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
| <template>
| <div class="mod-config">
| <basic-container>
| <el-row>
| <el-col :span="13">
| <ttable
| :table="table"
| @currentChange="handleCurrentChange"
| :uploadInfo="uploadInfo"
| :prelang="prelang"
| :options="options"
| :ajaxFun="ajaxFun"
| ref="operationTaskTable"
| >
| <template #toolbar>
| <el-button
| v-if="permissions.operationtaskreserved_pick_scm"
| @click="pickScm()"
| type="primary"
| style="margin-left:10px;"
| >SCM领料
| </el-button>
| </template>
| </ttable>
| </el-col>
| <el-col :span="11" style="padding-left: 10px">
| <ttable
| :table="joinTable"
| @handleSelectionChange="joinHandleSelectionChange"
| :uploadInfo="joinUploadInfo"
| :prelang="joinPrelang"
| :options="joinOptions"
| :ajaxFun="joinAjaxFun"
| :paramObj="paramObj"
| ref="joinStockTable"
| >
| <template #toolbar></template>
| </ttable>
| </el-col>
| </el-row>
|
| <!-- 预留库存零件 -->
| <!--<stockDialog
| :currshowlist.sync="relateVisible"
| @handleSelectionChange="saveJoinData"
| :paramSelArr="paramSelArr"
| :paramSelCol="paramSelCol"
| :multiSelect="stockMultiSelect"
| :showIsUsed="false"
| :partNo="partNo"
| :paramArr="paramArr"
| />-->
| <!-- 修改预留库存数量 -->
| <joinStockOrderDialog v-if="addOrUpdateVisible" ref="addOrUpdate" />
| <!-- 预留 -->
| <reservedOperateForm
| :currshowlist.sync="relateVisible"
| :taskId="taskId"
| @handleReserved="handleReserved"
| />
| </basic-container>
| </div>
| </template>
|
| <script>
| import { mapGetters } from 'vuex'
| import ttable from '@/views/common/ztt-table.vue'
| import stockDialog from '@/views/plan/operationtaskreserved/stock'
| import joinStockOrderDialog from './join-stock-order'
| import reservedOperateForm from '@/views/plan/operationtaskreserved/reserved-operate-form'
| import { fetchList as fetchListOperation } from '@/api/plan/operationtask'
| import {
| addObj,
| changeState,
| delByIds,
| cancelReserve,
| fetchList
| } from '@/api/warehouse/joinstockorder'
| import { updateOperationTaskId } from '../../../api/warehouse/joinstockorder'
| import { matPick } from '@/api/scm/common'
|
| export default {
| data() {
| return {
| ajaxFun: fetchListOperation,
| currentCustomerOrder: null,
| currentOperationTask: null,
| taskId: null,
| uploadInfo: {
| // 是否展示上传EXCEL以及对应的url
| isShow: false,
| url: ''
| },
| prelang: 'operation',
| options: {
| height: 300, // 默认高度-为了表头固定
| stripe: true, // 是否为斑马纹 table
| highlightCurrentRow: false, // 是否要高亮当前行
| border: true, // 是否有纵向边框
| lazy: false, // 是否需要懒加载
| fit: true, // 列的宽度是否自撑开
| multiSelect: false, //
| seqNo: true,
| isRefresh: true, // 是否显示刷新按钮
| isShowHide: true, // 是否显示显影按钮H
| isSearch: true, // 高级查询按钮
| defaultOrderBy: { column: 'plannedStartDate', direction: 'desc' }
| },
| table: {
| total: 0,
| currentPage: 1,
| pageSize: 20,
| data: [],
| // 标题
| column: [
| {
| minWidth: '140',
| prop: 'optaskNo',
| label: '工单编号',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'text',
| propVal: this.$route.query.optaskNo
| },
| {
| minWidth: '140',
| prop: 'moNo',
| label: '制造订单编号',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'text'
| },
| {
| minWidth: '140',
| prop: 'partName',
| label: '零件',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'text'
| },
| {
| minWidth: '140',
| prop: 'partNo',
| label: '零件号',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'text'
| },
| {
| minWidth: '140',
| prop: 'operationName',
| label: '工序',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'text'
| },
| {
| minWidth: '120',
| prop: 'priority',
| label: '优先级',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'text'
| },
| {
| minWidth: '120',
| prop: 'state',
| label: '状态',
| sort: true,
| isTrue: true,
| isSearch: false,
| searchInfoType: 'text',
| formatter: (row, column, cellValue) => {
| var formatVal
| if (cellValue == '01pending') {
| formatVal = '等待'
| } else if (cellValue == '02inProgress') {
| formatVal = '进行中'
| } else if (cellValue == '03interrupted') {
| formatVal = '已暂停'
| } else if (cellValue == '04completed') {
| formatVal = '已完成'
| } else if (cellValue == '05canceled') {
| formatVal = '已取消'
| } else {
| formatVal = ''
| }
| return formatVal
| }
| },
| {
| minWidth: '120',
| prop: 'plannedQuantity',
| label: '计划数量',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'text'
| },
| {
| minWidth: '120',
| prop: 'completedQuantity',
| label: '完成数量',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'text'
| },
| {
| minWidth: '20',
| prop: 'unit',
| label: '单位',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'text'
| },
| {
| minWidth: '120',
| prop: 'createTime',
| label: '创建时间',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'text',
| formatter: this.formatDutyDate
| },
| {
| minWidth: '120',
| prop: 'plannedStartDate',
| label: '计划开始时间',
| sort: true,
| isTrue: true,
| isSearch: false,
| searchInfoType: 'text',
| formatter: this.formatDutyDate
| },
| {
| minWidth: '120',
| prop: 'plannedFinishDate',
| label: '计划完成时间',
| sort: true,
| isTrue: true,
| isSearch: false,
| searchInfoType: 'text',
| formatter: this.formatDutyDate
| },
| {
| minWidth: '120',
| prop: 'actualStartDate',
| label: '实际完成时间',
| sort: true,
| isTrue: true,
| isSearch: false,
| searchInfoType: 'text',
| formatter: this.formatDutyDate
| },
| {
| minWidth: '120',
| prop: 'actualFinishDate',
| label: '实际完成时间',
| sort: true,
| isTrue: true,
| isSearch: false,
| searchInfoType: 'text',
| formatter: this.formatDutyDate
| },
| {
| minWidth: '120',
| prop: 'remark',
| label: '备注',
| sort: false,
| isTrue: true,
| isSearch: false,
| searchInfoType: 'text'
| }
| ],
| toolbar: [],
| operator: null,
| operatorConfig: {
| fixed: 'right',
| label: '操作',
| width: 200,
| minWidth: 100
| }
| },
| coStateList: [
| {
| value: '01plan',
| label: '待计划'
| },
| {
| value: '03planed',
| label: '已计划'
| },
| {
| value: '02planing',
| label: '计划中'
| },
| {
| value: '04complete',
| label: '已完成'
| }
| ],
| partNo: '',
|
| paramObj: { operationTaskId: 0 },
| paramArr: [],
| joinAjaxFun: fetchList,
| joinMultipleSelection: [],
| joinUploadInfo: {
| // 是否展示上传EXCEL以及对应的url
| isShow: false,
| url: ''
| },
| joinPrelang: 'operation',
| joinOptions: {
| height: 300, // 默认高度-为了表头固定
| stripe: true, // 是否为斑马纹 table
| highlightCurrentRow: false, // 是否要高亮当前行
| border: true, // 是否有纵向边框
| lazy: false, // 是否需要懒加载
| fit: true, // 列的宽度是否自撑开
| multiSelect: true, //
| seqNo: true,
| isRefresh: true, // 是否显示刷新按钮
| isShowHide: true, // 是否显示显影按钮
| isSearch: false, // 高级查询按钮
| defaultOrderBy: { column: 'id', direction: 'asc' }
| },
| joinTable: {
| total: 0,
| currentPage: 1,
| pageSize: 20,
| data: [],
| // 标题
| column: [
| {
| minWidth: '100',
| prop: 'status',
| label: '状态',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'select',
| formatter: this.formatStatus,
| optList: () => {
| return this.statusOptions
| }
| },
| {
| minWidth: '110',
| prop: 'partNo',
| label: '零件编号',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'text'
| },
| {
| minWidth: '110',
| prop: 'partName',
| label: '零件名称',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'text'
| },
| {
| minWidth: '100',
| prop: 'warehouseName',
| label: '仓库',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'text'
| },
| {
| minWidth: '100',
| prop: 'locationNo',
| label: '库位号',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'text'
| },
| {
| minWidth: '100',
| prop: 'partBatchNo',
| label: 'SN号',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'text'
| },
| {
| minWidth: '100',
| prop: 'reelNumber',
| label: '载具编号',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'text'
| },
| {
| minWidth: '110',
| prop: 'reservedQuantity',
| label: '预留数量',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'number'
| },
| {
| minWidth: '110',
| prop: 'deliveryQuantity',
| label: '发货数量',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'number'
| },
| {
| minWidth: '100',
| prop: 'partUnit',
| label: '单位',
| sort: true,
| isTrue: true,
| isSearch: true,
| searchInfoType: 'text'
| }
| ],
| toolbar: [
| {
| text: '预留',
| type: 'primary',
| fun: this.reservedHandle,
| disabled: false
| },
| {
| text: '取消预留',
| type: 'primary',
| fun: this.cancelReservedHandle,
| disabled: false
| },
| {
| text: 'ERP取消预留',
| type: 'primary',
| fun: this.cancelReservedHandle1,
| disabled: false
| }
| ],
| operator: null,
| operatorConfig: {
| fixed: 'right',
| label: '操作',
| width: 60,
| minWidth: 60
| }
| },
| addOrUpdateVisible: false,
| statusOptions: [
| {
| value: '02confirmed',
| label: '已确认',
| colorLabel: '已确认'
| }
| ],
| paramSelArr: [],
| paramSelCol: 'id',
| stockMultiSelect: false,
| relateVisible: false
| }
| },
| components: {
| ttable,
| stockDialog,
| joinStockOrderDialog,
| reservedOperateForm
| },
| computed: {
| ...mapGetters(['permissions'])
| },
| watch: {},
| methods: {
| getData() {
| this.$refs.customerOrderTable.getDataList()
| },
| handleCurrentChange(row) {
| // this.joinTable.toolbar.forEach((item) => {
| // item.disabled = true
| // })
| if (!row) {
| this.currentOperationTask = null
| this.paramObj = { operationTaskId: 0 }
| this.partNo = ''
| } else if (
| !this.currentOperationTask ||
| this.currentOperationTask.id !== row.id
| ) {
| this.currentOperationTask = row
| this.paramObj = { operationTaskId: row.id }
| // if (row.coState === '03planed' || row.coState === '02planing') {
| // this.joinTable.toolbar.forEach((item) => {
| // item.disabled = false
| // })
| // }
| }
| this.$nextTick(() => {
| this.getJoinData()
| })
| },
|
| getJoinData() {
| this.$refs.joinStockTable.getDataList()
| },
| joinHandleSelectionChange(val) {
| this.joinMultipleSelection = val
| },
| formatStatus(row, column, cellValue) {
| this.statusOptions.forEach((obj) => {
| if (obj.value === cellValue) {
| cellValue = obj.colorLabel
| }
| })
| return cellValue
| },
| // 修改预留数量
| addOrUpdateHandle(row) {
| this.addOrUpdateVisible = true
| this.$nextTick(() => {
| this.$refs.addOrUpdate.init(row)
| })
| },
| // 打开预留库存选择页面
| reservedHandle() {
| if (this.currentOperationTask) {
| this.taskId = this.currentOperationTask.id
| this.relateVisible = true
| } else {
| this.$message.warning('请先选择一条工单')
| }
| },
| // 打开预留库存选择页面
| /* reservedHandle() {
| if (this.currentOperationTask) {
| // 筛选出当前已经预留的库存
| this.paramSelArr = []
| fetchAll(this.paramObj).then((response) => {
| if (response.data.data) {
| response.data.data.forEach((e) => {
| this.paramSelArr.push(e.stockId)
| })
| }
| this.paramArr = [this.currentOperationTask.id]
| this.relateVisible = true
| this.stockMultiSelect = true
| })
| } else {
| this.$message.warning('请先选择一条工单')
| }
| }, */
| // 保存预留库存
| saveJoinData(stockList, isUsed) {
| if (this.currentOperationTask && stockList && stockList.length > 0) {
| const joinStockOrderList = []
| stockList.forEach((item) => {
| // 可用库存大于0才能预留
| if (item.availableStockQuantity > 0) {
| joinStockOrderList.push(
| Object.assign({
| operationTaskId: this.currentOperationTask.id,
| stockId: item.id,
| reservedQuantity: item.availableStockQuantity,
| partNo: item.partNo,
| partName: item.partName,
| warehouseNo: item.warehouseNo,
| warehouseName: item.warehouseName,
| locationNo: item.locationNo,
| locationName: item.locationName,
| partUnit: item.unit,
| systemNo: item.systemNo,
| partBatchNo: item.partBatchNo,
| status: '01unconfirmed',
| type: '工单预留'
| })
| )
| }
| })
| if (joinStockOrderList && joinStockOrderList.length > 0) {
| addObj(joinStockOrderList).then((response) => {
| this.$refs.joinStockTable.getDataList()
| this.$message.success('预留成功')
| })
| }
| }
| },
| // 取消预留
| cancelReservedHandle() {
| if (this.joinMultipleSelection && this.joinMultipleSelection.length > 0) {
| const joinStockOrderList = []
| let joinMultiple
| for (let i = 0; i < this.joinMultipleSelection.length; i++) {
| joinMultiple = this.joinMultipleSelection[i]
| joinStockOrderList.push({
| id: joinMultiple.id,
| operationTaskId: joinMultiple.operationTaskId,
| stockId: joinMultiple.stockId,
| reservedQuantity: joinMultiple.reservedQuantity,
| partNo: joinMultiple.partNo,
| partName: joinMultiple.partName,
| warehouseNo: joinMultiple.warehouseNo,
| warehouseName: joinMultiple.warehouseName,
| locationNo: joinMultiple.locationNo,
| locationName: joinMultiple.locationName,
| partUnit: joinMultiple.partUnit,
| systemNo: joinMultiple.systemNo,
| partBatchNo: joinMultiple.partBatchNo,
| status: '02confirmed',
| type: '工单预留'
| })
| }
| cancelReserve(joinStockOrderList)
| .then((response) => {
| const resCode = response.data.code
| if (resCode === 0) {
| this.$refs.joinStockTable.getDataList()
| this.$message.success('取消预留成功')
| } else {
| this.$message.error('取消预留失败')
| }
| })
| .catch(() => {
| console.log('取消预留时,发生错误')
| })
| } else {
| this.$message.warning('请选择需要取消预留的库存')
| }
| },
| cancelReservedHandle1() {
| if (this.joinMultipleSelection && this.joinMultipleSelection.length > 0) {
| const joinStockOrderList = []
| let joinMultiple
| for (let i = 0; i < this.joinMultipleSelection.length; i++) {
| joinMultiple = this.joinMultipleSelection[i]
| joinStockOrderList.push({
| source: 'erp',
| id: joinMultiple.id,
| operationTaskId: joinMultiple.operationTaskId,
| stockId: joinMultiple.stockId,
| reservedQuantity: joinMultiple.reservedQuantity,
| partNo: joinMultiple.partNo,
| partName: joinMultiple.partName,
| warehouseNo: joinMultiple.warehouseNo,
| warehouseName: joinMultiple.warehouseName,
| locationNo: joinMultiple.locationNo,
| locationName: joinMultiple.locationName,
| partUnit: joinMultiple.partUnit,
| systemNo: joinMultiple.systemNo,
| partBatchNo: joinMultiple.partBatchNo,
| status: '02confirmed',
| type: '工单预留'
| })
| }
| cancelReserve(joinStockOrderList)
| .then((response) => {
| const resCode = response.data.code
| if (resCode === 0) {
| this.$refs.joinStockTable.getDataList()
| this.$message.success('取消预留成功')
| } else {
| this.$message.error('取消预留失败')
| }
| })
| .catch(() => {
| console.log('取消预留时,发生错误')
| })
| } else {
| this.$message.warning('请选择需要取消预留的库存')
| }
| },
| // 确认
| confirmHandle() {
| if (this.joinMultipleSelection && this.joinMultipleSelection.length > 0) {
| for (let i = 0; i < this.joinMultipleSelection.length; i++) {
| if (this.joinMultipleSelection[i].status === '02confirmed') {
| this.$message.warning('请选择待确认的预留库存')
| return
| }
| }
| changeState(this.joinMultipleSelection, 'CONFIRM').then((response) => {
| this.$refs.joinStockTable.getDataList()
| this.$message.success('确认成功')
| this.refreshCustomerOrder()
| })
| } else {
| this.$message.warning('请选择需要确认的库存')
| }
| },
| // 取消确认
| cancelConfirmHandle() {
| if (this.joinMultipleSelection && this.joinMultipleSelection.length > 0) {
| for (let i = 0; i < this.joinMultipleSelection.length; i++) {
| if (this.joinMultipleSelection[i].status === '01unconfirmed') {
| this.$message.warning('请选择已确认的预留库存')
| return
| }
| }
| changeState(this.joinMultipleSelection, 'CANCEL').then((response) => {
| this.$refs.joinStockTable.getDataList()
| this.$message.success('取消确认成功')
| this.refreshCustomerOrder()
| })
| } else {
| this.$message.warning('请选择需要取消确认的库存')
| }
| },
| // 刷新客户订单的已预留数量
| refreshCustomerOrder() {
| if (this.currentOperationTask && this.currentOperationTask.id) {
| updateOperationTaskId(this.currentOperationTask.id).then((response) => {
| this.$set(
| this.currentOperationTask,
| 'reservedQuantity',
| response.data.data
| )
| })
| }
| },
| handleReserved() {
| this.$refs.joinStockTable.getDataList()
| },
| pickScm() {
| if (this.currentOperationTask) {
| matPick(this.currentOperationTask.id).then((response) => {
| this.$message.success('SCM领料成功')
| })
| } else {
| this.$message.warning('请先选择一条工单')
| }
| }
| }
| }
| </script>
|
|