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
<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="托盘号:" prop="plateCode" required class="itemWB">
                        <u-input v-model.trim="formData.plateCode" placeholder="请扫码录入"
                        @confirm="getMaterialDetails" @focus="formData.plateCode = ''"
                            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">
                                <text class="color_80">
                                    跟踪号:{{ item.extendField04 }}
                                </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.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,
        isPlate,
        getArea
    } from '@/src/api/artificial.js'
    import {
        getAttrValue
    } from '@/src/untils/tool.js'
    export default {
        data() {
            return {
                creator:"",
                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");
            
            let creator = uni.getStorageSync('creator') || ''
                        if(creator){
                            this.creator = JSON.parse(creator) || ''//修改人
                        }
        },
        methods: {
 
            //物料查询
            getMaterialDetails() {
                
                this.timerPrint = setTimeout(() => {
                    this.getProductInfo()
                    clearTimeout(this.timerPrint)
                    this.timerPrint = null
                }, 300);
            },
 
            // 获取物料信息
            getProductInfo() {
                var _this = this;
                var params = {
                    plateCode: this.formData.plateCode
                }
                isPlate(params).then((resWm) => {
                    //debugger    
                    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 {
                                    this.commonLoadPlateDataToTable(res.data);
                                }
                            }
                        } 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.rescode = 400
                        this.resmessage = '没有物料绑定'
                        this.$refs.resmodal.show = true
                        return
                    }
                })
            },
            // 公共 将托盘上的库存装载到列表中
                            commonLoadPlateDataToTable(listData){
                              this.tableData = listData
                              this.formData.plateCode = listData[0].plateCode
                              let i = 0
                              this.tableData = this.tableData.map(row => {
                                //debugger
                                row.finishedQuantity = listData[i].productStorage
                                i++
                                return row
                              })
                            },
            //客户要求 扫码后 清空数值 自动聚焦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();
            },
 
 
            // 确认入库
            saveCheck() {
                //    if (!window.confirm('当前扫描要确认码盘吗?')) return
                if (!this.formData.plateCode) {
                    this.$u.toast('请输入码盘的母托盘号!')
                    return
                }
                //这个验证去掉  【Editby shaocx,2024-03-23】
                 /*
                var emptyPositionName = this.tableData.filter(item => item.product_Id && item.finishedQuantity > 0 && !item
                    .positionName)
                if (emptyPositionName.length) {
                    this.$u.toast('条形码[' + 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
                    }
                });
                //debugger
                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
                        }
                    })
                )
                dataList = this.tableData;
                if (dataList.length === 0) {
                    this.$u.toast('至少录入一条数据')
                    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.$u.toast('检测到列表中有重复的标签条码' + dataList[j].extendField06 + ',请重新刷新界面重新扫码!')
                //             return
                //         }
                //     }
                // }
                 //增加对重复条形码的验证 【Editby shaocx,2022-08-27】
                      for (var i=0; i<dataList.length; i++) {
                        for (var j=i+1; j<dataList.length; j++) {
                          //拼盘上架 单独过滤掉为NULL的,因为从db中获取的竟然不带extendField06 【Editby shaocx,2022-08-30】
                            if (dataList[i].extendField06!=null && dataList[j].extendField06!=null &&dataList[i].extendField06 == dataList[j].extendField06) {
                                this.$message.error('检测到列表中有重复的标签条码'+dataList[j].extendField06+',请重新刷新界面重新扫码!')
                                return
                            }
                        }
                      }
 
                var msg = '当前拼盘上架共' + dataList.length + '条物料明细,请确认数量是否跟现场实物一致?,如果不一致请点取消按钮!';
                var params = {
                    creator:this.creator,
                    datalist: dataList,
                    plateCode: this.formData.plateCode,
                    percentAge: this.formData.percentAge,
                    productPosition_Id: this.productPosition_Id,
                    detailList: detailList,
                    shelveType: '拼盘上架'
                }
                //debugger
                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>