index.vue
25.8 KB
1
2
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
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
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
<template>
<div class="app-container">
<el-row :gutter="20">
<el-col :span="12">
<el-card class="box-card">
<el-form
:model="queryBillParams"
ref="queryBillForm"
:inline="true"
v-show="showBillSearch"
label-width="68px"
>
<el-form-item label="收货单号" prop="code">
<el-input
v-model="queryBillParams.code"
placeholder="请输入收货单号"
clearable
size="small"
@keyup.enter.native="billQuery"
/>
</el-form-item>
<el-form-item>
<el-button
type="cyan"
icon="el-icon-search"
size="mini"
@click="billQuery"
>搜索</el-button
>
</el-form-item>
<el-row class="fr">
<el-form-item> 物料总数:{{ billTotal }} </el-form-item>
<el-form-item> 总单据数量:{{ qty_show }} </el-form-item>
<el-form-item> 已收货数量:{{ qtyCompleted_show }} </el-form-item>
</el-row>
</el-form>
<el-row :gutter="10" class="mb8">
<right-toolbar
:showSearch.sync="showBillSearch"
@queryTable="getScanBillList"
:col-data="colData4"
@selectData="selectData4"
></right-toolbar>
</el-row>
<el-table
v-loading="billLoading"
:data="scanBillList"
@row-click="rowClick"
ref="table"
>
<el-table-column
label="明细id"
align="center"
prop="id"
v-if="colData4[0].istrue"
width="80"
/>
<el-table-column
label="物料编码"
align="center"
prop="materialCode"
width="150"
v-if="colData4[1].istrue"
/>
<el-table-column
label="名称"
align="center"
prop="materialName"
width="250"
:show-overflow-tooltip="true"
v-if="colData4[2].istrue"
/>
<el-table-column
label="单数据量"
align="center"
prop="totalQty"
width="100"
v-if="colData4[3].istrue"
/>
<el-table-column
label="已入数量"
align="center"
prop="openQty"
width="100"
v-if="colData4[4].istrue"
/>
<el-table-column
label="库存状态"
align="center"
prop="inventorySts"
width="150"
v-if="colData4[5].istrue"
>
<template slot-scope="scope">
<el-button
size="mini"
:type="scope.row.inventorySts | inventoryStsFilter"
round
>{{
inventoryStatusFormat(scope.row, scope.column)
}}</el-button
>
</template>
</el-table-column>
<el-table-column
label="项目号"
align="center"
prop="projectNo"
width="130"
v-if="colData4[6].istrue"
/>
<el-table-column
label="单位"
align="center"
prop="materialUnit"
min-width="80"
v-if="colData4[7].istrue"
/>
</el-table>
<pagination
v-show="billTotal > 0"
:total="billTotal"
:page.sync="queryBillParams.pageNum"
:limit.sync="queryBillParams.pageSize"
@pagination="getScanBillList"
/>
</el-card>
</el-col>
<el-col :span="12">
<el-card class="box-card">
<el-form
:model="queryReceiptParams"
ref="queryInfoForm"
:inline="true"
v-show="showInfoSearch"
label-width="68px"
>
<el-form-item label="收货数量" prop="qty" label-width="100px">
<el-input
v-model="queryReceiptParams.qty"
placeholder="请输入收货数量"
clearable
size="small"
@keyup.enter.native="receipt"
/>
</el-form-item>
<el-form-item
label="容器编号"
prop="containerCode"
label-width="100px"
>
<el-input
v-model="queryReceiptParams.containerCode"
placeholder="请输入容器编号"
clearable
size="small"
@keyup.enter.native="receipt"
/>
</el-form-item>
<el-form-item>
<el-button
type="cyan"
icon="el-icon-search"
size="mini"
@click="receipt"
v-if="loading == true"
>组盘</el-button
>
<el-button
icon="el-icon-loading"
size="mini"
:disabled="true"
v-if="loading == false"
>组盘中</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-place"
size="mini"
:disabled="multiple"
@click="positioning"
>定位</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
icon="el-icon-close"
size="mini"
:disabled="multiple"
@click="cancelPositioning"
v-hasPermi="['receipt:receiptContainer:canalPosition']"
>取消定位</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>取消收货</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-edit-outline"
size="mini"
:disabled="multiple"
@click="createTask"
>生成任务</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showInfoSearch"
@queryTable="getReceiptInfoList"
:col-data="colData"
@selectData="selectData"
></right-toolbar>
</el-row>
<el-table
v-loading="infoLoading"
:data="receiptInfoList"
@selection-change="handleSelectionChange"
ref="table"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column
label="组盘明细id"
align="center"
prop="id"
width="100"
v-if="colData[0].istrue"
/>
<el-table-column
label="组盘头id"
align="center"
prop="receiptContainerId"
width="80"
v-if="colData[1].istrue"
/>
<el-table-column
label="容器编号"
align="center"
prop="containerCode"
width="130"
v-if="colData[2].istrue"
/>
<el-table-column
label="库位编号"
align="center"
prop="locationCode"
width="130"
v-if="colData[3].istrue"
/>
<el-table-column
label="物料编码"
align="center"
prop="materialCode"
min-width="120"
:show-overflow-tooltip="true"
v-if="colData[4].istrue"
/>
<el-table-column
label="物料名称"
align="center"
prop="materialName"
width="250"
:show-overflow-tooltip="true"
v-if="colData[5].istrue"
/>
<el-table-column
label="物料规格"
align="center"
prop="materialSpec"
width="120"
v-if="colData[6].istrue"
/>
<el-table-column
label="数量"
align="center"
prop="qty"
width="80"
v-if="colData[7].istrue"
/>
<el-table-column
label="项目号"
align="center"
prop="project"
width="130"
v-if="colData[8].istrue"
/>
<el-table-column
label="组盘状态"
align="center"
prop="status"
width="150"
v-if="colData[6].istrue"
>
<template slot-scope="scope">
{{ containerStatusFormat(scope.row, scope.column) }}
</template>
</el-table-column>
<el-table-column
label="入库单明细id"
align="center"
prop="receiptDetailId"
width="100"
v-if="colData[10].istrue"
/>
<el-table-column
label="创建时间"
align="center"
prop="createTime"
width="160"
v-if="colData[11].istrue"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.created) }}</span>
</template>
</el-table-column>
<el-table-column
label="创建人"
align="center"
prop="createdBy"
width="130"
:show-overflow-tooltip="true"
v-if="colData[12].istrue"
/>
<el-table-column
fixed="right"
label="操作"
align="center"
class-name="small-padding fixed-width"
min-width="120"
v-if="colData[13].istrue"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>取消</el-button
>
</template>
</el-table-column>
</el-table>
<el-row :gutter="10" class="mb8" style="margin-top: 50px">
<span class="title">本物料库存</span>
<right-toolbar
:showSearch.sync="showInventorySearch"
@queryTable="getInventoryList"
:no-search="noSearch"
:col-data="colData2"
@selectData="selectData2"
></right-toolbar>
</el-row>
<el-table
v-loading="inventoryLoading"
:data="inventoryList"
@row-click="rowClick2"
ref="table"
>
<el-table-column
label="容器编号"
align="center"
prop="containerCode"
width="130"
v-if="colData2[0].istrue"
/>
<el-table-column
label="物料编码"
align="center"
prop="materialCode"
width="130"
v-if="colData2[1].istrue"
/>
<el-table-column
label="物料名称"
align="center"
prop="materialName"
width="250"
:show-overflow-tooltip="true"
v-if="colData2[2].istrue"
/>
<el-table-column
label="物料规格"
align="center"
prop="materialSpec"
width="120"
v-if="colData2[3].istrue"
/>
<el-table-column
label="数量"
align="center"
prop="qty"
width="80"
v-if="colData2[4].istrue"
/>
<el-table-column
label="货主"
align="center"
prop="companyCode"
width="180"
:show-overflow-tooltip="true"
v-if="colData2[5].istrue"
>
<template slot-scope="scope">
{{ companyCodeFormat(scope.row, scope.column) }}
</template>
</el-table-column>
<el-table-column
label="库位编号"
align="center"
prop="locationCode"
width="130"
v-if="colData2[6].istrue"
/>
<el-table-column
label="库存状态"
align="center"
prop="inventorySts"
min-width="130"
v-if="colData2[7].istrue"
>
<template slot-scope="scope">
<el-button
size="mini"
:type="scope.row.inventorySts | inventoryStsFilter"
round
>{{
inventoryStatusFormat(scope.row, scope.column)
}}</el-button
>
</template>
</el-table-column>
</el-table>
<el-row :gutter="10" class="mb8" style="margin-top: 50px">
<span class="title">空料盒</span>
<right-toolbar
:showSearch.sync="showContainerSearch"
@queryTable="getContainerList"
:no-search="noSearch"
:col-data="colData3"
@selectData="selectData3"
></right-toolbar>
</el-row>
<el-table
v-loading="containerLoading"
:data="containerList"
@row-click="rowClick3"
ref="table"
>
<el-table-column
label="容器编号"
align="center"
prop="code"
min-width="130"
v-if="colData3[0].istrue"
/>
<el-table-column
label="库位编号"
align="center"
prop="locationCode"
min-width="130"
v-if="colData3[1].istrue"
/>
</el-table>
<pagination
v-show="containerTotal > 0"
:total="containerTotal"
:page.sync="queryContainerParams.pageNum"
:limit.sync="queryContainerParams.pageSize"
@pagination="getContainerList"
/>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import {
listScanBill,
listReceiptInfo,
receiving,
position,
cancelPosition,
delReceipt,
createTask,
} from "@/api/receipt/receiving";
import { getInventoryByMaterialCode } from "@/api/inventory/inventoryHeader/detail";
import { getEmptyContainer } from "@/api/config/InventoryInfo/container";
import { getCompaniesByToken } from "@/api/system/company";
export default {
name: "Receiving",
data() {
return {
// 遮罩层
billLoading: true,
infoLoading: true,
inventoryLoading: false,
containerLoading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showBillSearch: true,
showInfoSearch: true,
showInventorySearch: true,
showContainerSearch: true,
// 订单明细总条数
billTotal: 0,
// 库存状态数据字典
inventoryStatusOptions: [],
// 空料盒总条数
containerTotal: 0,
// 订单明细表格数据
scanBillList: [],
// 收货信息表格数据
receiptInfoList: [],
// 物料库存表格数据
inventoryList: [],
// 组盘状态数据字典
containerStatus: [],
// 货主数据字典
companyOptions: [],
// 空料盒表格数据
containerList: [],
// 查询订单明细参数
queryBillParams: {
pageNum: 1,
pageSize: 10,
code: this.$route.query.code,
},
// 查询收货信息参数
queryInfoParams: {
code: undefined,
},
// 组盘参数
queryReceiptParams: {
receiptCode: this.$route.query.code,
qty: undefined,
receiptDetailId: undefined,
containerCode: undefined,
},
// 查询物料库存参数
queryInventoryParams: {
code: undefined,
count: 3,
},
// 查询空料盒参数
queryContainerParams: {
pageNum: 1,
pageSize: 10,
},
noSearch: false,
// 物料总数
materialTotal: null,
// 总单据数量
qty_show: null,
// 已收货数量
qtyCompleted_show: null,
colData: [
{ title: "组盘明细id", istrue: false },
{ title: "组盘头id", istrue: false },
{ title: "容器编号", istrue: true },
{ title: "库位编号", istrue: true },
{ title: "物料编码", istrue: true },
{ title: "物料名称", istrue: true },
{ title: "物料规格", istrue: true },
{ title: "数量", istrue: true },
{ title: "项目号", istrue: false },
{ title: "组盘状态", istrue: true },
{ title: "入库单明细id", istrue: true },
{ title: "创建时间", istrue: true },
{ title: "创建人", istrue: true },
{ title: "操作", istrue: true, disabled: true },
],
colData2: [
{ title: "容器编号", istrue: true },
{ title: "物料编码", istrue: true },
{ title: "物料名称", istrue: true },
{ title: "物料规格", istrue: true },
{ title: "数量", istrue: true },
{ title: "货主", istrue: true },
{ title: "库位编号", istrue: true },
{ title: "库存状态", istrue: true, disabled: true },
],
colData3: [
{ title: "容器编号", istrue: true },
{ title: "库位编号", istrue: true, disabled: true },
],
colData4: [
{ title: "明细id", istrue: false },
{ title: "物料编码", istrue: true },
{ title: "名称", istrue: true },
{ title: "单数据量", istrue: true },
{ title: "已入数量", istrue: true },
{ title: "库存状态", istrue: true },
{ title: "项目号", istrue: true },
{ title: "单位", istrue: true, disabled: true },
],
containerIds: [],
loading: true,
};
},
watch: {
"$route.query.code"(newValue, oldValue) {
if (newValue) {
this.queryBillParams.code = newValue;
this.queryReceiptParams.receiptCode = newValue;
this.getScanBillList();
this.getReceiptInfoList();
this.getContainerList();
} else {
this.queryBillParams.code = oldValue;
this.queryReceiptParams.receiptCode = oldValue;
}
},
},
created() {
this.getDicts("receiptContainerHeaderStatus").then(response => {
this.containerStatus = response.data;
});
this.getDicts("inventorySts").then((response) => {
this.inventoryStatusOptions = response.data;
});
getCompaniesByToken().then((response) => {
this.companyOptions = response;
});
this.getScanBillList();
this.getReceiptInfoList();
this.getContainerList();
},
beforeUpdate() {
this.$nextTick(() => {
this.$refs["table"].doLayout();
});
},
methods: {
/** 查询订单明细列表 */
getScanBillList() {
this.billLoading = true;
listScanBill(this.queryBillParams).then((response) => {
this.scanBillList = response.data;
this.billTotal = response.data.length;
this.billLoading = false;
let qty_show = null;
let qtyCompleted_show = null;
response.data.forEach((item) => {
qty_show += item.totalQty;
qtyCompleted_show += item.openQty;
});
this.qty_show = qty_show;
this.qtyCompleted_show = qtyCompleted_show;
});
},
// 库存状态字典翻译
inventoryStatusFormat(row, column) {
return this.selectDictLabel(
this.inventoryStatusOptions,
row.inventorySts
);
},
// 组盘状态字典翻译
containerStatusFormat(row, column) {
return this.selectDictLabel(this.containerStatus, row.status);
},
/** 订单明细搜索按钮操作 */
billQuery() {
this.queryBillParams.pageNum = 1;
this.getScanBillList();
},
/** 订单明细表格行点击 */
rowClick(row, column, event) {
this.queryReceiptParams.qty = row.totalQty;
this.queryReceiptParams.receiptDetailId = row.id;
this.queryInventoryParams.code = row.materialCode;
this.getInventoryList();
},
/** 获取收货信息 */
getReceiptInfoList() {
this.infoLoading = true;
this.queryInfoParams.code = this.$route.query.code;
listReceiptInfo(this.queryInfoParams).then((response) => {
this.receiptInfoList = response.data;
this.infoLoading = false;
});
},
/** 收货信息组盘按钮操作 */
receipt() {
this.loading = false;
receiving(this.queryReceiptParams)
.then((response) => {
if (response.code == 200) {
this.getReceiptInfoList();
this.msgSuccess(response.msg);
} else {
this.msgError(response.msg);
}
this.loading = true;
})
.catch((err) => {
this.loading = true;
});
},
// 收货信息多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.containerIds = selection.map((item) => item.receiptContainerId);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 定位按钮操作 */
positioning() {
position(this.containerIds).then((response) => {
if (response.code == 200) {
this.getReceiptInfoList();
this.msgSuccess(response.msg);
this;
} else {
this.msgError(response.msg);
}
});
},
/** 取消定位按钮操作 */
cancelPositioning() {
cancelPosition(this.containerIds).then((response) => {
if (response.code == 200) {
this.getReceiptInfoList();
this.msgSuccess(response.msg);
} else {
this.msgError(response.msg);
}
});
},
/** 取消按钮操作 */
handleDelete(row) {
const Ids = row.id || this.ids;
this.$confirm(
row.id
? "是否确认删除该条收货信息吗?"
: "是否确认删除选中的" + this.ids.length + "条数据项?",
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
)
.then(function () {
return delReceipt(Ids);
})
.then(() => {
this.getReceiptInfoList();
this.msgSuccess("取消成功");
});
},
/** 生成任务按钮操作 */
createTask() {
createTask(this.containerIds).then((response) => {
if (response.code == 200) {
this.getReceiptInfoList();
this.msgSuccess(response.msg);
} else {
this.msgError(response.msg);
}
});
},
/** 获取物料库存 */
getInventoryList() {
this.inventoryLoading = true;
getInventoryByMaterialCode(this.queryInventoryParams).then((response) => {
this.inventoryList = response.data;
this.inventoryLoading = false;
});
},
// 货主字典翻译
companyCodeFormat(row, column) {
return this.selectCommonLabel(this.companyOptions, row.companyCode);
},
/** 物料库存表格行点击 */
rowClick2(row) {
this.queryReceiptParams.containerCode = row.containerCode;
},
/** 查询空料盒列表 */
getContainerList() {
this.containerLoading = true;
getEmptyContainer(this.queryContainerParams).then((response) => {
this.containerList = response.rows;
this.containerTotal = response.total;
this.containerLoading = false;
});
},
/** 空料盒表格行点击 */
rowClick3(row) {
this.queryReceiptParams.containerCode = row.code;
},
/** 主表表格切换字段显示隐藏操作 */
selectData(val) {
if (val) {
this.colData.filter((i) => {
if (val.indexOf(i.title) !== -1) {
i.istrue = true;
} else {
i.istrue = false;
}
});
}
},
/** 表格切换字段显示操作 */
selectData2(val) {
if (val) {
this.colData2.filter((i) => {
if (val.indexOf(i.title) !== -1) {
i.istrue = true;
} else {
i.istrue = false;
}
});
}
},
selectData3(val) {
if (val) {
this.colData3.filter((i) => {
if (val.indexOf(i.title) !== -1) {
i.istrue = true;
} else {
i.istrue = false;
}
});
}
},
selectData4(val) {
if (val) {
this.colData4.filter((i) => {
if (val.indexOf(i.title) !== -1) {
i.istrue = true;
} else {
i.istrue = false;
}
});
}
},
},
};
</script>
<style lang="scss" scoped>
.title {
font-size: 15px;
}
</style>