333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
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
<template>
    <!-- 组盘 -->
    <view style="padding-bottom:100px">
        <u-form labelPosition="left" label-width="150rpx" :model="formData" ref="warehouseRef">
            <u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
                <u-col span="12">
                    <u-form-item label="标签条码:" class="itemWB">
                        
                        <u-input id="materialRef"  :focus="curFoucus2" v-model="formData.extendField06" ref="materialRef" placeholder="请扫码录入"
                            @focus="formData.extendField06 = ''" @confirm="getMaterialDetails"
                            style="font-weight: bolder;margin-left: 15rpx;" class="width padding_left25rpx">
                        </u-input>
                        
                    </u-form-item>
                </u-col>
            </u-row>
            <u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
                <u-col span="12">
                    <u-form-item label="托盘号:" prop="plateCode" required class="itemWB">
                        <u-input v-model.trim="formData.plateCode" placeholder="请扫码录入"
                            style="font-weight: bolder;margin-left: 15rpx;" class="width padding_left25rpx">
                        </u-input>
                    </u-form-item>
                </u-col>
            </u-row>
            
            <u-row class="border_bottom margin_top10rpx padding10" style="background-color: #fff;">
                <u-col span="12">
                    <u-form-item label-width="200rpx" label="占用空间(%):" class="itemWB">
                        <u-input v-model="formData.percentAge" type="number" ref="percentAge" :min="1" :max="100"
                            placeholder="请输入占用空间" style="font-weight: bolder;margin-left: 15rpx;"
                            class="width padding_left25rpx">
                        </u-input>
                    </u-form-item>
                </u-col>
            </u-row>
        </u-form>
        <modal-code :rescode='rescode' :resmessage='resmessage' ref="resmodal" />
        <view style="margin-bottom: 200rpx;" class="margin_top10rpx">
            <view v-for="(item, eindex) in tableData" :key="eindex" class="margin_bottom10rpx">
                <u-swipe-action :show="item.show" :index="eindex" @click="longpress" @open="open" @close='close'
                    :options="options" style="width: 100vw;">
                    <view class="title-wrap fontSize32rpx background_fff padding10"
                        :class="item.enAbled==0? 'bg_item' : '' ">
                        <u-row>
                            <u-col span="12" class="flex">
                                <text class="flex justify-center align-center circkle06">{{ eindex + 1 }}</text>
                                <text class="color_f18202 padding_left10rpx">
                                    {{item.productCode}}
                                </text>
                                <!-- <u-icon name="plus-circle" v-if="item.enAbled!=1"></u-icon> -->
                            </u-col>
                        </u-row>
                        <u-row>
                            <u-col span="12">
                                <text class="color_80">
                                    物料名称:{{ item.productName }}
                                </text>
                            </u-col>
                        </u-row>
                        <u-row>
                            <u-col span="12">
                                <view class="color_80 flex" style="vertical-align: middle;align-items: center;">
                                    是否需要助力臂:
                                    <!-- @change="change" -->
                                    <!-- <view style="margin-top: 2rpx;"> -->
                                    <u-switch size="40" v-model="item.isBoosterArm"></u-switch>
                                    <!-- </view> -->
                                </view>
                            </u-col>
                        </u-row>
                        <u-row>
                            <u-col span="12">
                                <text class="color_80">
                                    标签条码:{{ item.extendField06 }}
                                </text>
                            </u-col>
                        </u-row>
                        
                        <u-row>
                            <u-col span="6">
                                <text class="color_80">
                                    库存单位:{{item.smallUnit}}
                                </text>
                            </u-col>
                            <u-col span="6" class="flex color_f18202">
                                <view class="color_80">
                                    数量:
                                </view>
                                {{ item.finishedQuantity }}
                                <!-- <input :class="item.enAbled?'':'border_bottom_f18202 inputGray'"
                                    class="text-left color_f18202 fontSize32rpx inputGray2" v-model="item.quantity"
                                    type="number" :disabled="item.enAbled==1" @blur="changeNum(item)"
                                    @click="clicki(item)" placeholder="0" /> -->
                            </u-col>
                        </u-row>
                
                    </view>
                </u-swipe-action>
            </view>
        </view>
        <!--         <button-modal :BottomModal="true" :issueShow='true' issueTitle="重置" subTitle='组盘' restTiltle='入库' @reset='goWarhouse'
            @submit='submit' @issue="reset" /> -->
 
        <u-popup v-model="detailshow" border-radius="14" @close="detailshow = false" mode="bottom">
            <h2 class="text_align_center padding_bottom18 padding15">物料信息</h2>
            <scroll-view scroll-y="true" style="height: 550rpx;">
 
                <view class="line flex justify-between">
                    <text class="text-gray">采购单号</text>
                    <text>{{ materlist.poCode }}</text>
                </view>
                <view class="line flex justify-between">
                    <text class="text-gray">采购项号</text>
                    <text>{{ materlist.itemNumber }}</text>
                </view>
                <view class="line flex justify-between">
                    <text class="text-gray">跟踪号</text>
                    <text>{{ materlist.extendField04 }}</text>
                </view>
                <view class="line flex justify-between">
                    <text class="text-gray">销售单号</text>
                    <text>{{ materlist.saleCode }}</text>
                </view>
                <view class="line flex justify-between">
                    <text class="text-gray">销售项号</text>
                    <text>{{ materlist.extendField08 }}</text>
                </view>
                <view class="line flex justify-between">
                    <text class="text-gray">到期日期</text>
                    <text>{{ materlist.limitDate }}</text>
                </view>
        <!--         <view class="line flex justify-between">
                    <text class="text-gray">重量</text>
                    <text>{{ materlist.totalWeight }}</text>
                </view> -->
            </scroll-view>
        </u-popup>
 
        <button-modal :empTytowerShow='true' cleaningTitle="重置" garmenTitle='确认码盘' @submit='saveCheck' @reset='rest' />
 
    </view>
</template>
<script>
    import ButtonModal from '@/components/BottomModal.vue'
    import ModalCode from '@/components/ModalCode.vue'
    import {
        addGroupDisk,
        getContainDetail,
        getBhbMaterialList,
        getArea
    } from '@/src/api/artificial.js'
    import {
        getAttrValue
    } from '@/src/untils/tool.js'
    export default {
        data() {
            return {
                curFoucus: true,
                curFoucus2: true,
                rescode: 0,
                resmessage: "",
                putCode: '', //容器二维码
                detailshow: false,
                operator: '',
                focu: false, //清空按钮隐显
                focuM: false, //物料隐显按钮
                // Datetime: getDate(),
                tableData: [], //物料详情
                options: [{
                        text: '详情',
                        style: {
                            backgroundColor: '#fc9f35'
                        }
                    },
                    {
                        text: '删除',
                        style: {
                            backgroundColor: '#fc4b4b'
                        }
                    }
                ],
                materlist: {},
                formData: {
                    plateCode: '',
                    extendField06: '',
                    percentAge: 100,
                },
                gridable: true,
                gridFocus: false,
                detailable: false,
                detailableZb: false,
                batchNo: '', //扫码到的当前物料的批次
                warehouseRules: {
                    plateCode: [{
                        required: true,
                        message: '托盘号不能为空',
                        trigger: 'blur'
                    }]
                },
                orderType: 1,
                warhouseTph: '',
                timerPrint: null,
                kwbhAllowed: false, //是否禁用库位编号
                arrD: [],
                disabled_extendField06: false,
                // 当前正在扫描的数据  {}
                currentRow: null,
                // SKU列表
                findProductList: [],
                productPosition_Id:"",
                    existRows: [],//
            };
        },
        components: {
            ButtonModal,
            ModalCode
        },
        onLoad(option) {},
        onReady() {
            this.$refs.warehouseRef.setRules(this.warehouseRules)
        },
        mounted() {
            let tokenInfouser = uni.getStorageSync('$tokenInfouser');
            if(!tokenInfouser){
                uni.navigateTo({
                    url: '../Login/login?id=1'
                })
            }
            // formatTime("2024-01-16")
            // this.formatTime("2024-1-16")
            
            this.addDate("2024-1-16 16:28:01");
        },
        methods: {
 
            //物料查询
            getMaterialDetails() {
                
                this.timerPrint = setTimeout(() => {
                    this.getProductInfo()
                    clearTimeout(this.timerPrint)
                    this.timerPrint = null
                }, 300);
            },
            //物料查询
            // _getMaterialDetails() {
            //     //console.log('我是:'+this.warehouse.materialCode);
            //     // if (!this.warehouse.plateCode) {
            //     //     return
            //     // }
 
            //     // if (this.warehouse.materialCode.length > 50) {
            //     // 错误码提示
            //     // let str = this.warehouse.materialCode.replace(/\s/g, '')
            //     // if (str.indexOf('LOTNO') == -1 || str.indexOf('PARTSNUMBER') == -1) {
            //     //     uni.showToast({
            //     //         title: '二维码格式错误,格式为:' + str,
            //     //         icon: 'none',
            //     //         duration: 2000
            //     //     })
            //     //     return
            //     // }
 
            //     // this.batchNo = getAttrValue(this.warehouse.materialCode, 'LOTNO')
            //     // let quantity = getAttrValue(this.warehouse.materialCode, 'QUANTITY')
            //     // // let boxNum = getAttrValue(this.warehouse.materialCode,'BOXNUM')
            //     // // let sap_location = getAttrValue(this.warehouse.materialCode,'SAP')
            //     // if (quantity == '' || Number(quantity) <= 0) {
            //     //     this.rescode = 400
            //     //     this.resmessage = '标贴中没有数量'
            //     //     this.$refs.resmodal.show = true
            //     //     return
            //     // }
            //     // //扫描的物料是否有批次
            //     // if (!this.batchNo) {
            //     //     this.rescode = 400
            //     //     this.resmessage = '无批次'
            //     //     this.$refs.resmodal.show = true
            //     //     return
            //     // }
            //     // this.warehouse.materialCode = getAttrValue(this.warehouse.materialCode, 'PARTSNUMBER')
            //     let param1 = this.warehouse.extendField06;
            //     var qty = "";
            //     if (param1.length > 12) {
            //         param1 = getAttrValue(this.warehouse.extendField06, 6);
            //         qty = getAttrValue(this.warehouse.extendField06, 4) || "";
            //     }
            //     if (!param1) {
            //         uni.showToast({
            //             title: '标签条码获取失败!',
            //             icon: 'none'
            //         })
            //         return
            //     }
            //     getBhbMaterialList({
            //         'extendField06': param1,
            //     }).then((resWm) => {
            //         if (resWm.data.result) { //200
            //             let res = resWm.data;
            //             if (res.result) {
            //                 if (res.data == null) {
            //                     this.rescode = 400
            //                     this.resmessage = '无此物料'
            //                     this.$refs.resmodal.show = true
            //                     return
            //                 } else {
            //                     if (res.data.length == 0) {
            //                         this.rescode = 400
            //                         this.resmessage = '无此物料'
            //                         this.$refs.resmodal.show = true
            //                         return
            //                     } else {
            //                         // 根据id 判断物料是否存在
            //                         res.data.forEach(item => {
            //                             //根据标签码extendField06
            //                             let index = this.tableData.findIndex(v => v.extendField06 == item
            //                                 .extendField06);
            //                             console.log(index)
            //                             if (index == -1) {
            //                                 this.tableData.unshift({
            //                                     ...item,
            //                                     finishedQuantity: qty || item.quantity
            //                                     // show: false,
            //                                     // enAbled: 0 //控制数量是否可以输入
            //                                 })
            //                             } else {
            //                                 //有的 置顶
            //                                 this.tableData.unshift(...this.tableData.splice(index, 1))
            //                                 // this.tableData[index].quantity = Number(Number(this.tableData[
            //                                 //     index].quantity) + Number(quantity)).toFixed(3);
            //                                 // this.tableData.unshift(...this.tableData.splice(index, 1))
            //                             }
            //                         });
            //                     }
            //                 }
            //             } else {
            //                 this.resmessage = res.message
            //                 this.rescode = res.code
            //                 this.$refs.resmodal.show = true
            //             }
            //         } else {
            //             this.resmessage = resWm.data.msg;
            //             this.rescode = 400
            //             this.$refs.resmodal.show = true
            //         }
 
            //     })
            //     // }
            // },
 
            // 获取物料信息
            getProductInfo() {
                var _this = this;
                // this.disabled_extendField06 = true //禁用控件 【EditBy shaocx,2022-08-29】
                // // 标签条码
                // var extendField06 = this.formData.extendField06
                // var extendField06Arr = Object.values(extendField06)
                // var extendField06Length = extendField06Arr.length
                // // 字符长度如果为5就获取器具的焦点
                // if (extendField06Length === 5) {
                //     // 器具框获得焦点
                //     this.formData.plateCode = extendField06
                //     this.disabled_extendField06 = false //启用控件 【EditBy shaocx,2022-08-29】
                //     return
                // }
                // extendField06 = extendField06.trim()
                // this.formData.extendField06 = extendField06
                // if (!extendField06) {
                //     this.$message({
                //         message: '条码值不能为空!',
                //         type: 'warning'
                //     })
                //     this.disabled_extendField06 = false //启用控件 
                //     return
                // }
                // this.findProductList = []
 
                let extendField06 = this.formData.extendField06;
                if(extendField06.length == 5){
                    this.formData.plateCode = extendField06;
                    this.formData.extendField06 = ''
                    this.autoFocusPdaInput(); //客户要求 扫码后 清空数值 自动聚焦focus
                    return
                }
                var qty = "";
                if (extendField06.length > 12) {
                    extendField06 = getAttrValue(this.formData.extendField06, 6);
                    qty = getAttrValue(this.formData.extendField06, 4) || "";
                }
                if (!extendField06) {
                    uni.showToast({
                        title: '标签条码获取失败!',
                        icon: 'none'
                    })
                    return
                }
                var params = {
                    extendField06: extendField06
                }
                getBhbMaterialList(params).then((resWm) => {
                    if (resWm.data.result) { //200
                        let res = resWm.data;
                        if (res.result) {
                            if (res.data == null) {
                                this.rescode = 400
                                this.resmessage = '无此物料'
                                this.$refs.resmodal.show = true
                                return
                            } else {
                                if (res.data.length == 0) {
                                    this.rescode = 400
                                    this.resmessage = '无此物料'
                                    this.$refs.resmodal.show = true
                                    return
                                } else {
                                    // --------------pc端
                                    this.findProductList = res.data.map(row => {
                                        // row.finishedQuantity = qty || row.quantity;
                                        row.finishedQuantity = row.quantity;
                                        if (row.limitDate) {
                                        //    row.limitDate = moment(row.limitDate).format('YYYY-MM-DD')
                                            row.limitDate = row.limitDate.split('T')[0];
                                        }
                                        row.extendField06 = extendField06;
                                        //this.formData.scanQty = row.finishedQuantity
                                        return row;
                                    })
                                    for (var index in this.findProductList) {
                                        this.currentRow = this.findProductList[index]
                                    }
                                    
                                    // -------------第一个
                                    // this.$set(this.tableData, this.tableData.length, this.currentRow)
                                    // this.existRows.push(this.currentRow)
                                    // this.sortRow()
                                    
                                    // -----------------pc端
 
                                    // 根据id 判断物料是否存在
                                    res.data.forEach(item => {
                                        //根据标签码extendField06
                                        let index = this.tableData.findIndex(v => v.extendField06 == item
                                            .extendField06);
                                        console.log(index)
                                        if (index == -1) {
                                            this.tableData.unshift({
                                                ...item,
                                                // finishedQuantity: qty || item.quantity,
                                                finishedQuantity: item.quantity
                                            })
                                        } else {
                                            //有的 置顶
                                            this.tableData.unshift(...this.tableData.splice(index, 1))
                                        }
                                    });
                                }
                            }
                        } else {
                            this.resmessage = res.message
                            this.rescode = res.code
                            this.$refs.resmodal.show = true
                        }
                    } else {
                        this.resmessage = resWm.data.msg;
                        this.rescode = 400
                        this.$refs.resmodal.show = true
                    }
                    this.formData.extendField06 = ''
                    this.autoFocusPdaInput(); //客户要求 扫码后 清空数值 自动聚焦focus
                })
                // }
 
            //     this.common.ajax(
            //         url,
            //         params,
            //         res => {
            //             this.common.showMsg(res)
            //             if (res.result) {
            //                 this.findProductList = res.data.map(row => {
            //                     row.finishedQuantity = row.quantity
            //                     if (row.limitDate) {
            //                         row.limitDate = moment(row.limitDate).format('YYYY-MM-DD')
            //                     }
            //                     row.extendField06 = this.formData.extendField06
 
            //                     this.formData.scanQty = row.finishedQuantity
            //                     return row
            //                 })
            //                 for (var index in this.findProductList) {
            //                     this.currentRow = this.findProductList[index]
            //                 }
            //                 this.$set(this.tableData, this.tableData.length, this.currentRow)
            //                 //    this.existRows.push(this.currentRow)
            //                 this.sortRow()
            //             }
            //             this.disabled_extendField06 = false //启用控件 【EditBy shaocx,2022-08-29】
            //         },
            //         true
            //     )
            },
        
            //客户要求 扫码后 清空数值 自动聚焦focus
            autoFocusPdaInput(){
                //客户要求 扫码后 清空数值在聚焦
                // #ifdef H5
                try {
                    document.getElementById('materialRef').querySelector('input').focus()
                } catch (e) {}
                // #endif
                
                // #ifdef APP
                try{
                    this.curFoucus2 = false
                    this.timerPrint = setTimeout(()=>{
                        this.curFoucus2 = true
                        clearTimeout(this.timerPrint)
                        this.timerPrint = null
                    }, 2000)
                }catch(e){
                    //TODO handle the exception
                }
                // #endif
                //客户要求 扫码后 清空数值在聚焦
            },
            //删除详情
            longpress(index, eindex) {
                this.tableData[index].cardNum = true
                if (eindex == 1) {
                    uni.showModal({
                        title: '提示',
                        content: '是否确认删除?',
                        showCancel: true,
                        cancelColor: '#333333',
                        success: (res => {
                            if (res.confirm) {
                                this.tableData[index].cardNum = true
                                if (eindex == 0) { //删除
                                    this.tableData.splice(index, 1)
                                } else {
                                    this.materlist = this.tableData[index]
                                    this.detailshow = true
                                }
                            } else if (res.cancel) {
 
                            }
                        })
                    });
 
                } else {
                    this.materlist = this.tableData[index]
                    this.detailshow = true
                }
            },
 
 
            //编辑状态样式
            dc(e) {
                e.cardNum = true
                this.$forceUpdate()
            },
            //卡片选中
            clicki(e) {
                e.cardNum = true
                this.$forceUpdate()
            },
            // 如果打开一个的时候,不需要关闭其他,则无需实现本方法
            open(index) {
                // 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
                // 原本为'false',再次设置为'false'会无效
                this.tableData[index].cardNum = true;
                this.$forceUpdate()
                this.tableData[index].show = true;
                this.tableData.map((val, idx) => {
                    if (index != idx) this.tableData[idx].show = false;
                })
            },
            close(index) {
                this.tableData[index].show = false;
                this.tableData[index].cardNum = false;
                this.$forceUpdate()
            },
            //改变组盘数量
            changeNum(val) {
                val.cardNum = false
                if (!val.quantity) {
                    uni.showModal({
                        title: '提示',
                        content: '组盘数量不能为空',
                        showCancel: false
                    })
                }
                if (val.quantity < 0) {
                    uni.showModal({
                        title: '提示',
                        content: '组盘数量必须大于0',
                        showCancel: false
                    })
                }
 
            },
 
            //重置页面信息
            rest() {
                this.formData.extendField06 = ''
                this.formData.plateCode = ''
                this.formData.percentAge = 100
                this.tableData = [];
                this.$refs.warehouseRef.resetFields();
            },
            //确认
            // submit() {
            //     this.$refs.warehouseRef.setRules(this.warehouseRules)
            //     this.$refs.warehouseRef.validate(valid => {
            //         if (valid) {
            //             if (this.tableData.length <= 0) {
            //                 uni.showToast({
            //                     title: '物料明细不能为空',
            //                     icon: 'none',
            //                     duration: 2000
            //                 });
            //                 return
            //             }
 
            //             //请求参数
            //             let params = {
            //                 datalist: this.tableData,
            //                 percentAge: this.formData.percentAge, //空间占比 
            //                 plateCode: this.formData.plateCode,
            //                 productPosition_Id: null,
            //                 shelveType: "码盘上架"
            //             }
            //             uni.showModal({
            //                 title: '提示',
            //                 content: '是否确认码盘上架?',
            //                 showCancel: true,
            //                 cancelColor: '#333333',
            //                 success: (res => {
            //                     if (res.confirm) {
            //                         addGroupDisk(params).then(res => {
            //                             if (res.data.result) { //200
            //                                 this.rescode = 200
            //                                 this.resmessage = "码盘上架成功!"
            //                                 this.$refs.resmodal.show = true
            //                                 this.rest()
            //                             } else {
            //                                 this.resmessage = res.data.msg || "";
            //                                 this.rescode = 400
            //                                 this.$refs.resmodal.show = true
            //                             }
 
 
            //                         })
            //                     } else if (res.cancel) {
 
            //                     }
            //                 })
            //             });
            //         }
            //     })
            // },
 
 
            // 确认入库
            saveCheck() {
                //    if (!window.confirm('当前扫描要确认码盘吗?')) return
                if (!this.formData.plateCode) {
                    this.$message.error('请输入码盘的母托盘号!')
                    return
                }
                var emptyPositionName = this.tableData.filter(item => item.product_Id && item.finishedQuantity > 0 && !item
                    .positionName)
                if (emptyPositionName.length) {
                    this.$message.error('条形码[' + emptyPositionName.join(',') + ']货位不能为空!')
                    return
                }
                var dataList = this.tableData.filter(item => item.position_Id && item.finishedQuantity > 0).map(item => {
                    return {
                        storage_Id: 87,
                        storageName: '立体库',
                        product_Id: item.product_Id,
                        productCode: item.productCode,
                        productName: item.productName,
                        finishedQuantity: item.finishedQuantity,
                        positionName: item.positionName,
                        produceDate: item.produceDate,
                        purchasePrice: item.purchasePrice,
                        batchNumber: null,
                        productSpec: item.productSpec,
                        plateCode: item.plateCode,
                        enterMode: '',
                        isBoosterArm: item.isBoosterArm || 0,
                        quantity: item.quantity,
                        poCode: item.poCode,
                        extendField04: item.extendField04,
                        saleCode: item.saleCode,
                        itemNumber: item.itemNumber,
                        extendField08: item.extendField08,
                        limitDate: item.limitDate,
                        totalWeight: item.totalWeight,
                        extendField06: item.extendField06
                    }
                });
 
                var dataListss = this.tableData.filter(item => item.finishedQuantity > item.quantity)
                const detailList = JSON.stringify(
                    dataListss.map(m => {
                        return {
                            poCode: m.poCode,
                            productCode: m.productCode,
                            number: m.finishedQuantity - m.quantity,
                            saleCode: m.saleCode,
                            trackting: m.extendField04
                        }
                    })
                )
 
                if (dataList.length === 0) {
                    this.$message.error('至少录入一条数据')
                    return
                }
                //增加对重复条形码的验证 
                for (var i = 0; i < dataList.length; i++) {
                    for (var j = i + 1; j < dataList.length; j++) {
                        if (dataList[i].extendField06 == dataList[j].extendField06) {
                            this.$message.error('检测到列表中有重复的标签条码' + dataList[j].extendField06 + ',请重新刷新界面重新扫码!')
                            return
                        }
                    }
                }
 
                var msg = '当前码盘上架共' + dataList.length + '条物料明细,请确认数量是否跟现场实物一致?,如果不一致请点取消按钮!';
                var params = {
                    datalist: dataList,
                    plateCode: this.formData.plateCode,
                    percentAge: this.formData.percentAge,
                    productPosition_Id: this.productPosition_Id,
                    detailList: detailList,
                    shelveType: '码盘上架'
                }
                uni.showModal({
                    title: '提示',
                    //content: '是否确认码盘上架?',
                    content: msg,
                    showCancel: true,
                    cancelColor: '#333333',
                    success: (res => {
                        if (res.confirm) {
                            addGroupDisk(params).then(res => {
                                if (res.data.result) { //200
                                    this.rescode = 200
                                    this.resmessage = "码盘上架成功!"
                                    this.$refs.resmodal.show = true
                                    this.rest()
                                } else {
                                    this.resmessage = res.data.msg || "";
                                    this.rescode = 400
                                    this.$refs.resmodal.show = true
                                }
                            })
                        } else if (res.cancel) {}
                    })
                });
            },
 
            // 排序高亮行靠前
            sortRow() {
                this.tableData.forEach(element => {
                    element.sortIndex = 0
                })
                this.currentRow.sortIndex = 1
                this.tableData = this.tableData.sort(function(a, b) {
                    return b.sortIndex - a.sortIndex
                })
                this.tableData.forEach(element => {
                    element.sortIndex = 0
                })
            },
        
             // formatTime (strDate){
                // let dateFormat = new Date(strDate);
                //     dateFormat = dateFormat.setDate(dateFormat.getDate() + 1);
                //     dateFormat = new Date(dateFormat);
                //   let y = dateFormat.getFullYear();
                //     let m = (dateFormat.getMonth() + 1).tostring().padstart(2, '0');
                //     let d = dateFormat.getDate().tostring().padstart(2, '0');
                //     return  `${y} - ${m} - ${d}`
             //    },
                
                
                 addDate(dateC, days) {
                      if (days == undefined || days == '') {
                          days = 1;
                      }
                      const date = new Date(dateC);
                      date.setDate(date.getDate() + days);
                      const month = date.getMonth() + 1;
                      const day = date.getDate();
                      return date.getFullYear() + '-' + getFormatDate(month) + '-' + getFormatDate(day);
                    
                      function getFormatDate(arg) {
                        if (arg == undefined || arg == '') {
                            return '';
                        }
                        let re = arg + '';
                        if (re.length < 2) {
                            re = '0' + re;
                        }
                        return re;
                      }
                  
                }
 
        }
    }
</script>
 
    
<style lang="scss" scoped>
    page {
            width: 100%;
            min-height: 100vh;
            background-color: #F2F2F2;
            box-sizing: border-box;
        }
    .bg_item {
        background: #FFEBCD !important;
    }
 
    .inputGray2 {
        line-height: 30px;
        border-top: 10rpx solid transparent;
    }
 
    .inputGray {
        border-top: 0rpx solid transparent;
 
    }
</style>