1
<template>
xcq
authored
about a year ago
2
<a-card :bordered="false">
谭毅彬
authored
11 months ago
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<form id="container-form">
<div class="select-list">
<ul id="select_info">
<li>
<a-select
show-search
placeholder="请选择库区"
option-filter-prop="children"
v-model="zoneCode"
@change="refresh"
style="width: 200px">
<a-select-option selected="0" id="zoneCode" v-for="item in zoneList" :key="item.name" :value="item.code">{{ item.name }}
</a-select-option>
</a-select>
</li>
<li>第
<a-select
show-search
option-filter-prop="children"
v-model="num"
style="width: 70px">
<a-select-option id="num" v-for="num in nums" :key="num" :value="num">{{ num }}
</a-select-option>
</a-select>
</li>
<li>
<a-select
show-search
option-filter-prop="children"
v-model="col"
@change="refresh"
style="width: 70px">
<a-select-option id="col" v-for="item in colList" :key="item.name" :value="item.code">{{ item.name }}
</a-select-option>
</a-select>
</li>
<li>
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="search()" icon="search" style="margin-left: 8px;">查询</a-button>
<a-button @click='expressDelivery()' v-if="expressDeliveryVisible" type='primary' style="margin-left: 8px;">快速出库</a-button>
<a-button @click="expressStorage()" type="primary" v-if="expressStorageVisible" style="margin-left: 8px;">快速入库</a-button>
</span>
</li>
</ul>
谭毅彬
authored
11 months ago
47
</div>
谭毅彬
authored
11 months ago
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
</form>
<div class="col-sm-12 select-info">
<form id="receiptHeader-form">
<div class="select-list">
<ul id="img_list">
<li style="font-size: 12px">空柜空闲:<img src="~@/assets/icon/grid_rest.png"></li>
<li style="font-size: 12px">空盘空闲:<img src="~@/assets/icon/grid_empty.png" alt=""></li>
<li style="font-size: 12px">整盘空闲:<img src="~@/assets/icon/grid_all.png"></li>
<li style="font-size: 12px">空柜锁定:<img src="~@/assets/icon/grid_emp_lock.png"></li>
<li style="font-size: 12px">空盘锁定:<img src="~@/assets/icon/grid_empty_lock.png"></li>
<li style="font-size: 12px">整盘锁定:<img src="~@/assets/icon/grid_all_lock.png"></li>
</ul>
<ul id="info_list">
<li>
<span style="font-size: 12px">库位统计情况:</span>
<input style="width: 600px; font-size: 12px; border: none;" type="text" id="zone" disabled/>
</li><br><br>
<li><span>库位:</span><input type="text" style="width: 100px; font-size: 12px; border: none;" id="code" disabled/></li><br><br>
<li><span>容器:</span><input type="text" style="width: 200px; font-size: 12px; border: none;" id="containerCode" disabled/></li><br><br>
<li style="width: 100%;">
谭毅彬
authored
11 months ago
68
69
<span style="height: 32px; line-height:26px;">物料:</span>
<a-textarea v-model="materialInfo" auto-size style="padding: 4px 5px; width: 80%; font-size: 12px; resize: none; vertical-align:top; border: none; box-shadow: none; outline:none;" readonly />
谭毅彬
authored
11 months ago
70
71
</li>
</ul>
72
</div>
谭毅彬
authored
11 months ago
73
74
75
76
77
</form>
</div>
<div class="col-sm-12 select-info">
<div id="borderCol" style="overflow-y: auto;white-space:nowrap" v-show="showPrise">
<div class="location" id="location"></div>
78
</div>
谭毅彬
authored
11 months ago
79
80
81
<a-spin tip="库位视图生成中..." :spinning="spinning">
<a-skeleton active :loading="loading" :paragraph="{ rows: 5 }"/>
</a-spin>
82
</div>
谭毅彬
authored
11 months ago
83
84
<ExpressStorageModal ref="ExpressStorageModal" @ok="search"></ExpressStorageModal>
<ExpressDeliveryModal ref="ExpressDeliveryModal" @ok="search"></ExpressDeliveryModal>
xcq
authored
about a year ago
85
</a-card>
86
</template>
87
88
<script>
89
谭毅彬
authored
11 months ago
90
import huahengUI from '@/assets/css/huahengUI.css'
91
import $ from '../../../assets/js/jquery-1.11.1.min'
92
93
94
95
96
97
98
99
100
101
102
103
104
import grid_rest from '@/assets/icon/grid_rest.png'
import grid_empty from '@/assets/icon/grid_empty.png'
import grid_half from '@/assets/icon/grid_half.png'
import grid_all from '@/assets/icon/grid_all.png'
import grid_emp_waing from '@/assets/icon/grid_emp_waing.png'
import grid_empty_waring from '@/assets/icon/grid_empty_waring.png'
import grid_half_waring from '@/assets/icon/grid_half_waring.png'
import grid_all_waring from '@/assets/icon/ContainerDisabled.png'
import grid_emp_lock from '@/assets/icon/grid_emp_lock.png'
import grid_empty_lock from '@/assets/icon/grid_empty_lock.png'
import grid_half_lock from '@/assets/icon/grid_half_lock.png'
import grid_all_lock from '@/assets/icon/grid_all_lock.png'
import rel_empty from '@/assets/icon/rel_empty.png'
xcq
authored
about a year ago
105
106
import {getInventoryDetailByLocationCode, getZoneList} from '@/api/api'
import ExpressDeliveryModal from "@views/system/monitor/modules/ExpressDeliveryModal";
xcq
authored
about a year ago
107
import ExpressStorageModal from "@views/system/monitor/modules/ExpressStorageModal";
xcq
authored
about a year ago
108
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
谭毅彬
authored
11 months ago
109
import {getAction, postAction} from "@api/manage";
xcq
authored
about a year ago
110
111
112
113
export default {
name: "locationStatus",
xcq
authored
about a year ago
114
115
mixins: [JeecgListMixin],
components: {
xcq
authored
about a year ago
116
ExpressStorageModal,
xcq
authored
about a year ago
117
118
ExpressDeliveryModal
},
119
120
121
122
123
data() {
return {
spinning: true,
loading: true,
showPrise: false,
xcq
authored
about a year ago
124
expressDeliveryVisible: false,
谭毅彬
authored
11 months ago
125
126
expressStorageVisible: false,
col: "row",
谭毅彬
authored
11 months ago
127
materialInfo: "",
谭毅彬
authored
11 months ago
128
129
130
131
132
colList: [
{code: "row", name: "行"},
{code: "line", name: "列"},
{code: "layer", name: "层"}
],
133
zoneCode: '',
134
zoneList: [],
谭毅彬
authored
11 months ago
135
136
num: 1,
nums: [],
137
model: {},
谭毅彬
authored
11 months ago
138
139
140
141
142
143
144
145
146
147
url: {
getStatus: "/location/locationMonitor/getStatus",
getLocationInfo: "/location/locationMonitor/getLocationInfo",
getAllLocation: "/location/locationMonitor/getAllLocation"
},
grid_row: null,
grid_line: null,
grid_layer: null,
list_info: null,
currentLocationCode: 0,
148
149
150
}
},
created() {
谭毅彬
authored
11 months ago
151
152
153
154
this.loadFrom()
window.gridMsg = this.gridMsg
window.mClose = this.mClose
window.lays = this.lays
155
156
},
mounted() {
谭毅彬
authored
11 months ago
157
158
159
160
161
162
163
164
165
166
167
168
169
// 方法一:确保 .location 元素存在且已渲染
const locationElement = document.querySelector('.location');
if (locationElement) {
const resizeObserver = new ResizeObserver(entries => {
for (let entry of entries) {
this.changeMargin();
}
});
resizeObserver.observe(locationElement);
setTimeout(() => {
this.refresh(); // 使用箭头函数,this 指向 Vue 组件实例
}, 1000);
}
170
171
},
methods: {
谭毅彬
authored
11 months ago
172
173
174
loadData() {
// 空方法,为了覆盖混入文件中的方法,解决报错
},
175
loadFrom() {
176
getZoneList().then((res) => {
177
if (res.success) {
178
179
180
this.zoneList = res.result;
if (this.zoneList.length > 0) {
this.zoneCode = this.zoneList[0].code;
181
182
183
}
}
})
184
},
谭毅彬
authored
11 months ago
185
186
187
188
189
190
191
192
193
194
handleNumsSelect() {
let col = this.col;
if (col === "row") {
this.nums = this.grid_row;
} else if (col === "line") {
this.nums = this.grid_line;
} else if (col === "layer") {
this.nums = this.grid_layer;
} else {
this.$message.warning("错误");
195
}
196
},
谭毅彬
authored
11 months ago
197
198
199
200
201
202
203
204
205
refresh() {
let url = this.url.getAllLocation
getAction(url, {zoneCode: this.zoneCode}).then(res => {
if (res.success) {
this.grid_row = res.result.maxRow;
this.grid_line = res.result.maxLine;
this.grid_layer = res.result.maxLayer;
} else {
this.$message.warning(res.message)
206
}
谭毅彬
authored
11 months ago
207
208
209
210
211
}).finally(() => {
this.handleNumsSelect();
this.search();
})
this.locationStatistics();
212
213
214
},
//格子宽度
changeMargin() {
215
216
217
218
let box_width = 0;
if (document.getElementById("location") != null) {
box_width = document.getElementById("location").offsetWidth;
}
219
box_width = box_width - 80;
谭毅彬
authored
11 months ago
220
let num = this.col;
221
222
let grid_width;
if (num === "layer" || num === "row") {
谭毅彬
authored
11 months ago
223
grid_width = box_width / this.grid_line;
224
} else if (num === "line") {
谭毅彬
authored
11 months ago
225
grid_width = box_width / this.grid_row;
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
}
if (grid_width >= 50) {
$(".grid").css({"width": "50px", "height": "50px"});
} else if (grid_width <= 20) {
$(".grid").css({"width": "20px", "height": "20px"});
} else {
$(".grid").css({"width": grid_width, "height": grid_width});
}
},
//tips信息
lays(x) {
let $j = $(x);
let row = $j.attr("data-i");
let line = $j.attr("data-j");
let layers = $j.attr("data-k");
row = parseInt(row);
line = parseInt(line);
layers = parseInt(layers);
谭毅彬
authored
11 months ago
244
245
246
if (this.list_info) {
for (const element of this.list_info) {
if (element.row === row && element.icolumn === line && element.layer === layers) {
247
248
let str_info = '';
let container_code = '';
谭毅彬
authored
11 months ago
249
250
251
252
253
254
255
if (element.containerCode) {
container_code = "\n容器编码:" + element.containerCode + "";
if (element.materialName) {
for (let j = 0; j < element.materialName.length; j++) {
let list_batch = element.batch[j].length == 0 ? "无" : element.batch[j];
let list_qty = element.qty[j];
str_info += "\n物料信息:批次->" + list_batch + ",物料名称->" + element.materialName[j] + ",物料编码->" + element.materialCode[j] + ",数量->" + list_qty + ""
256
257
258
}
}
}
谭毅彬
authored
11 months ago
259
let code = element.code === null ? "无" : element.code;
260
$("[data-i='" + row + "']" + "[data-j='" + line + "']" + "[data-k='" + layers + "']").attr({"title": "第" + row + "行,第" + line + "列,第" + layers + "层\n库位:" + code + container_code + str_info});
261
}
262
263
264
265
266
}
} else {
return ""
}
},
xcq
authored
about a year ago
267
// 快速入库
谭毅彬
authored
11 months ago
268
expressStorage() {
xcq
authored
about a year ago
269
let json = {
谭毅彬
authored
11 months ago
270
271
"containerCode": this.currentContainerCode,
"locationCode": this.currentLocationCode
xcq
authored
about a year ago
272
273
}
this.$refs.ExpressStorageModal.edit(json);
xcq
authored
about a year ago
274
275
},
// 获取库存信息
谭毅彬
authored
11 months ago
276
getInventory(locationCode) {
xcq
authored
about a year ago
277
278
279
280
281
282
283
let params = {
locationCode: locationCode
}
getInventoryDetailByLocationCode(params).then((res) => {
if (res.success) {
let parameter = [];
let newArr = res.result.records;
谭毅彬
authored
11 months ago
284
285
for (let i of newArr) {
let param = {
xcq
authored
about a year ago
286
287
288
materialCode: i.materialCode,
shipQty: i.qty,
inventoryDetailId: i.id,
xcq
authored
about a year ago
289
containerCode: i.containerCode
xcq
authored
about a year ago
290
291
292
293
294
295
296
297
298
299
}
parameter.push(param);
}
this.$refs.ExpressDeliveryModal.edit(parameter);
} else {
this.$message.error(res.message);
}
});
},
//快速出库
谭毅彬
authored
11 months ago
300
301
expressDelivery() {
this.getInventory(this.currentLocationCode);
xcq
authored
about a year ago
302
},
xcq
authored
about a year ago
303
// 显示快速出库
谭毅彬
authored
11 months ago
304
305
revealExpressDelivery(code, materialCode) {
this.expressDeliveryVisible = !!materialCode;
xcq
authored
about a year ago
306
307
},
// 显示快速入库
谭毅彬
authored
11 months ago
308
309
revealExpressStorage(code) {
this.expressStorageVisible = !!code;
xcq
authored
about a year ago
310
},
311
//关闭tips
谭毅彬
authored
11 months ago
312
mClose(x) {
313
314
315
316
317
318
//关闭
// Vue.prototype.$Jnotification.error({message: '系统提示', description: "鼠标拿走了", duration: 4})
},
//库位信息请求和状态显示
ajaxGrid(x, info) {
let _this = this
谭毅彬
authored
11 months ago
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
let url = this.url.getLocationInfo;
postAction(url, info).then(res => {
if (res.success) {
if (x === "row") {
for (let i = 0; i < res.result.length; i++) {
let index = res.result[i].icolumn + ((res.result[i].layer - 1) * this.grid_line);
index = index - 1;
_this.resShow(res, index, i);
}
_this.clearLocation(this.grid_line, this.grid_layer);
} else if (x === "line") {
for (let i = 0; i < res.result.length; i++) {
let index = res.result[i].row + ((res.result[i].layer - 1) * this.grid_row);
index = index - 1;
_this.resShow(res, index, i);
334
}
谭毅彬
authored
11 months ago
335
336
337
338
339
340
341
342
_this.clearLocation(this.grid_row, this.grid_layer);
} else if (x === "layer") {
for (let i = 0; i < res.result.length; i++) {
let index = res.result[i].icolumn + ((res.result[i].row - 1) * this.grid_line);
index = index - 1;
_this.resShow(res, index, i);
}
_this.clearLocation(this.grid_line, this.grid_row);
343
}
谭毅彬
authored
11 months ago
344
345
} else {
this.$message.error(res.message);
346
}
谭毅彬
authored
11 months ago
347
348
349
this.list_info = res.result;
}).finally(() => {
350
351
352
353
})
},
//库位请求的结果显示
resShow(res, index, i) {
谭毅彬
authored
11 months ago
354
355
356
let row = res.result[i].row;
let jColumn = res.result[i].icolumn;
let kLayer = res.result[i].layer;
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
if (res.result[i].locationAttribute === "1") {
$("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
"src": grid_rest,
"isTrue": 1
});
} else if (res.result[i].locationAttribute === "2") {
$("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
"src": grid_empty,
"isTrue": 1
});
} else if (res.result[i].locationAttribute === "3") {
$("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
"src": grid_half,
"isTrue": 1
});
} else if (res.result[i].locationAttribute === "4") {
$("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
"src": grid_all,
"isTrue": 1
});
} else if (res.result[i].locationAttribute === "5") {
$("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
"src": grid_emp_lock,
"isTrue": 1
});
} else if (res.result[i].locationAttribute === "6") {
$("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
"src": grid_empty_lock,
"isTrue": 1
});
} else if (res.result[i].locationAttribute === "7") {
$("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
"src": grid_half_lock,
"isTrue": 1
});
} else if (res.result[i].locationAttribute === "8") {
$("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
"src": grid_all_lock,
"isTrue": 1
});
} else if (res.result[i].locationAttribute === "9") {
$("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
"src": grid_emp_waing,
"isTrue": 1
});
} else if (res.result[i].locationAttribute === "10") {
$("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
"src": grid_empty_waring,
"isTrue": 1
});
} else if (res.result[i].locationAttribute === "11") {
$("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
"src": grid_half_waring,
"isTrue": 1
});
} else if (res.result[i].locationAttribute === "12") {
$("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
"src": grid_all_waring,
"isTrue": 1
});
}
},
//清除将数据库中没有的库位
clearLocation(x, y) {
for (let j = 0; j < x * y; j++) {
谭毅彬
authored
11 months ago
422
423
let $grid = $(".grid");
let sta = $grid.eq(j).attr("isTrue");
424
if (sta !== "1") {
谭毅彬
authored
11 months ago
425
$grid.eq(j).attr({"src": rel_empty, "onmouseover": "", "onclick": ""});
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
}
}
this.spinning = false;
this.showPrise = true;
this.loading = false;
},
//点击显示当前库位信息
gridMsg(msg) {
let $j = $(msg);
let row = $j.attr("data-i");
let line = $j.attr("data-j");
let layers = $j.attr("data-k");
row = parseInt(row);
line = parseInt(line);
layers = parseInt(layers);
谭毅彬
authored
11 months ago
441
442
443
if (this.list_info) {
for (const element of this.list_info) {
if (element.row === row && element.icolumn === line && element.layer === layers) {
xcq
authored
about a year ago
444
let materialCode = '';
谭毅彬
authored
11 months ago
445
//let $material = $("#material");
谭毅彬
authored
11 months ago
446
if (element.materialName) {
谭毅彬
authored
11 months ago
447
//$material.children().remove();
谭毅彬
authored
11 months ago
448
449
450
451
let str_info = '';
for (let j = 0; j < element.materialName.length; j++) {
let list_batch = element.batch[j].length === 0 ? "无" : element.batch[j];
let list_qty = element.qty[j];
谭毅彬
authored
11 months ago
452
str_info += "批次->" + list_batch + ",物料名称->" + element.materialName[j] + ",物料编码->" + element.materialCode[j] + ",数量->" + list_qty;
谭毅彬
authored
11 months ago
453
materialCode = element.materialCode[j];
谭毅彬
authored
11 months ago
454
455
456
if (j !== element.materialName.length -1) {
str_info += "\r\n"
}
457
}
谭毅彬
authored
11 months ago
458
this.materialInfo = str_info
459
} else {
谭毅彬
authored
11 months ago
460
this.materialInfo = "无"
461
}
谭毅彬
authored
11 months ago
462
463
464
465
466
467
468
let $code = $("#code");
$code.val(element.code);
$("#containerCode").val(element.containerCode === "" ? "无" : element.containerCode);
this.currentContainerCode = element.containerCode;
this.currentLocationCode = $code.val()
this.revealExpressDelivery(element.code, materialCode);
this.revealExpressStorage(element.code);
xcq
authored
about a year ago
469
break;
470
}
471
472
473
474
475
476
}
} else {
return ""
}
},
//搜索平面库位
谭毅彬
authored
11 months ago
477
search() {
478
479
480
this.spinning = true;
this.showPrise = false;
this.loading = true;
谭毅彬
authored
11 months ago
481
482
let col = this.col;
let num = this.num;
483
let data;
谭毅彬
authored
11 months ago
484
485
486
487
$("#location").children().remove();
let $location = $(".location");
if (col === "row") {
488
data = {zoneCode: this.zoneCode, row: num};
谭毅彬
authored
11 months ago
489
for (let i = this.grid_layer; i > 0; i--) {
谭毅彬
authored
11 months ago
490
491
492
493
if (i != this.grid_layer) {
$location.append("<br>")
}
$location.append("<span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第" + i + "层</span>");
谭毅彬
authored
11 months ago
494
495
for (let j = 1; j <= this.grid_line; j++) {
$location.append("<img data-i=" + num + " data-j=" + j + " data-k=" + i + " class='grid' onmouseover='lays(this)' onmouseout='mClose(this)' onclick='gridMsg(this)'>");
496
497
}
}
谭毅彬
authored
11 months ago
498
} else if (col === "line") {
499
data = {zoneCode: this.zoneCode, line: num};
谭毅彬
authored
11 months ago
500
for (let k = this.grid_layer; k > 0; k--) {
谭毅彬
authored
11 months ago
501
502
503
504
if (k != this.grid_layer) {
$location.append("<br>")
}
$location.append("<span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第" + k + "层</span>");
谭毅彬
authored
11 months ago
505
506
for (let l = 1; l <= this.grid_row; l++) {
$location.append("<img data-i=" + l + " data-j=" + num + " data-k=" + k + " class='grid' onmouseover='lays(this)' onmouseout='mClose(this)' onclick='gridMsg(this)'>");
507
508
}
}
谭毅彬
authored
11 months ago
509
} else if (col === "layer") {
510
data = {zoneCode: this.zoneCode, layer: num};
谭毅彬
authored
11 months ago
511
for (let m = 1; m <= this.grid_row; m++) {
谭毅彬
authored
11 months ago
512
513
514
515
if (m != 1) {
$location.append("<br>")
}
$location.append("<span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第" + m + "行</span>");
谭毅彬
authored
11 months ago
516
517
for (let n = 1; n <= this.grid_line; n++) {
$location.append("<img data-i=" + m + " data-j=" + n + " data-k=" + num + " class='grid' onmouseover='lays(this)' onmouseout='mClose(this)' onclick='gridMsg(this)'>");
518
519
}
}
520
}
谭毅彬
authored
11 months ago
521
this.ajaxGrid(col, data);
522
},
谭毅彬
authored
11 months ago
523
524
525
526
527
528
529
530
locationStatistics() {
let url = this.url.getStatus;
getAction(url, {zoneCode: this.zoneCode}).then(res => {
if (res.success) {
$("#zone").val("库位总数:" + res.result.location + ",空库位:" + res.result.emptyLocation +
",空托盘库位:" + res.result.haveContainLocation + ",有货库位:" + res.result.haveInventoryLocation)
} else {
this.$message.warning(res.message)
531
}
谭毅彬
authored
11 months ago
532
533
}).finally()
}
534
}
535
}
谭毅彬
authored
11 months ago
536
</script>