qq_41295110
2026-01-13 4e5527d8bf8d89b7b8a3ca2a00ba95e9ca37b5aa
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
<template>
    <div style="margin: 10px;">
        <div style=" margin-bottom: 10px; border-bottom: 1px solid #f6f6f6;">
            <el-button type="primary" @click="onClickMethod_BarCodeProduce" :disabled="disabledFlag_BarCodeProduce">生成</el-button>
            <el-button type="primary" @click="get_PrintReport">打印</el-button>
            <!-- <el-button type="primary" @click="close">退 出</el-button> -->
        </div>
        <div style="margin: 10px; font-size: 28px; font-weight: bold; text-align: center;">条码生成</div>
        <el-form :model="initMainData" label-width="80px">
            <el-row>
                <el-col :span="6">
                    <el-form-item label="日期">
                        <el-date-picker v-model="initMainData.HDate" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100%"> </el-date-picker>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="源单单号">
                        <el-input v-model="initMainData.HMainSourceBillNo" disabled></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="采购订单号">
                        <el-input v-model="initMainData.HPOOrderBillNo" disabled></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="6">
                    <el-form-item label="物料代码">
                        <el-input v-model="initMainData.HMaterNumber" disabled></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="物料名称">
                        <el-input v-model="initMainData.HMaterName" disabled></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="规格型号">
                        <el-input v-model="initMainData.HMaterModel" disabled></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="6">
                    <el-form-item label="计量单位">
                        <el-input v-model="initMainData.HUnitName" disabled></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="辅助属性代码">
                        <el-input v-model="initMainData.HAuxPropNumber" disabled></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="辅助属性名称">
                        <el-input v-model="initMainData.HAuxPropName" disabled></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="6">
                    <el-form-item label="供应商代码">
                        <el-input v-model="initMainData.HSupNumber" disabled></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="供应商名称">
                        <el-input v-model="initMainData.HSupName" disabled></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="批号">
                        <el-input v-model="initMainData.HBatchNo"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="6">
                    <el-form-item label="源单数量">
                        <el-input-number v-model="initMainData.HQty_SourceBill" @change="onChangeForHQty_SourceBill" />
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="标准包装数">
                        <el-input-number v-model="initMainData.HMinQty" @change="onChangeForHMinQty" />
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="包数">
                        <el-input-number v-model="initMainData.HBQty" disabled />
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="6">
                    <el-form-item label="尾包数量">
                        <el-input-number v-model="initMainData.HEndQty" disabled />
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="采购跟踪号">
                        <el-input v-model="initMainData.HPOOrderBillMTO" disabled></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="复检启用">
                        <el-checkbox v-model="initMainData.HReInspectionFlag" disabled>复检启用</el-checkbox>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="6">
                    <el-form-item label="生产日期">
                        <el-date-picker v-model="initMainData.HInspectionDate" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100%"> </el-date-picker>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="复检周期">
                        <el-input-number v-model="initMainData.HInspectionCycle" disabled/>天
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="复检日期">
                        <el-date-picker v-model="initMainData.HReInspectionDate" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100%" disabled> </el-date-picker>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="6">
                    <el-form-item label="客户订单号">
                        <el-input v-model="initMainData.HSeOrderBillNo" disabled></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="产品型号">
                        <el-input v-model="initMainData.HCusModel" disabled></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="组织" @change="onChangeMethod_HOrganization">
                        <el-select v-model="initMainData.HOrganizationID" placeholder="请选择组织" style="width: 100%">
                            <el-option v-for="(item, index) in HOrganizationList" :key="index" :value="item.ID" :label="item.Name"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
 
            <el-tabs type="border-card" v-model="SelectedTabName" style="height:400px;">
                <!-- 条码列表 -->
                <el-tab-pane label="条码列表" name="BarCode">
                    <el-table :data="tableData_BarCode" @selection-change="onSelectionChange_BarCode" :row-class-name="RowIndex_BarCode" style="width: 100%" height="900" width="100%" border v-if="tableData_BarCode.length > 0">
                        <el-table-column type="selection" width="55" align="center" />
                        <el-table-column align="center" label="序号" type="index" width="80" fixed />
                        <template v-for="(item, index) in tableColumns_BarCode">
                            <el-table-column :prop="item.field" :label="item.title" :key="index" show-overflow-tooltip :width="item.width" align="center"  v-if="!item.hide">
                                <template slot-scope="{row,  column }">
                                    <div :style="item.style"><span>{{ row[column.label] }}</span> </div>
                                </template>
                            </el-table-column>
                        </template>
                    </el-table>
                </el-tab-pane>
            </el-tabs>
        </el-form>
 
        <!-- 打印弹窗 -->
        <el-dialog title="打印模板选择" :visible.sync="openPrintList" width="800px" append-to-body>
            <PrintList :linterid="rowSel.toString()" :MyMsg="rowSel.toString()" Type="HGy_BarCodeBill"
                HModName="HGy_BarCodeBill" @rowEditClose="rowSetClose" v-if="printListShow" />
        </el-dialog>
    </div>
</template>
<script>
import axios from 'axios'                                                   //axios请求方法库
import moment from 'moment';                                                //moment.js库
import PrintList from "@/views/component/printList";                        //打印
 
import HSourceReportHtml from '@/views/component/HSourceReportHtml'
import GyProperty from "@/views/basic/gyProperty/gyPropertyList.vue";
import Material from '@/views/gyMaterial/GyMaterial.vue'
 
export default {
    name: 'Gy_BarCodeBill_JinLong',
    components: { HSourceReportHtml, PrintList, GyProperty, Material },
    data() {
        return {
            baseURL: process.env.VUE_APP_BASE_API,                      //后端接口访问前缀
            HModName: "Gy_BarCodeBill_JinLong",                         //模块名称
            disabledFlag_BarCodeProduce:false,                           //禁用标记-生成 按钮
            rules:{                                                     //表头form 校验
 
            },
            HOrganizationList:[],                                       //组织下拉列表数据
            initMainData:{                                              //表头数据初始化
                HDate: moment().format('YYYY-MM-DD')                    //日期
                ,HMainSourceInterID:0                                   //源单主ID
                ,HMainSourceEntryID:0                                   //源单子ID
                ,HMainSourceBillNo:""                                   //源单单号
                ,HMainSourceBillType:""                                 //源单类型
                ,HPOOrderBillNo:""                                      //采购订单号
                ,HMaterID:0                                             //物料ID
                ,HMaterNumber:""                                        //物料代码
                ,HMaterName:""                                          //物料名称
                ,HMaterModel:""                                         //规格型号
                ,HUnitID:""                                             //计量单位ID
                ,HUnitName:""                                           //计量单位名称
                ,HAuxPropID:0                                           //辅助属性ID
                ,HAuxPropNumber:""                                      //辅助属性代码
                ,HAuxPropName:""                                        //辅助属性
                ,HBatchNo:""                                            //批号
                ,HSupID:0                                               //供应商ID
                ,HSupNumber:""                                          //供应商代码
                ,HSupName:""                                            //供应商
                ,HQty_SourceBill:0                                      //源单数量
                ,HMinQty:0                                              //标准包装数
                ,HBQty:0                                                //包数
                ,HEndQty:0                                              //尾包数量
                ,HReInspectionFlag:false                                //复检启用
                ,HInspectionDate:null                                   //生产日期
                ,HInspectionCycle:0                                     //复检周期(天)
                ,HReInspectionDate:null                                 //复检日期
                ,HPOOrderBillMTO:""                                     //采购跟踪号
                ,HSeOrderBillNo:""                                      //客户订单号
                ,HCusModel:""                                           //产品型号
                
                ,HOrganizationID:0                                      //组织ID
                ,HOrganization:""                                       //组织名称
            },
 
            SelectedTabName:"BarCode",                                  //表格页签-当前选择页面name
            tableColumns_BarCode: [                                     //条码列表table 列数据
                { field: 'HItemID', title: 'HItemID', width: 100, hide: true }
                , { field: 'hmainid', title: 'hmainid', width: 100, hide: true }
                , { field: 'hsubid', title: 'hsubid', width: 100, hide: true }
                , { field: 'HinterID', title: 'HinterID', width: 100, hide: true }
                , { field: '条码类型', title: '条码类型', width: 100 }
                , { field: '条码编号', title: '条码编号', width: 120 }
                , { field: 'HMaterID', title: '物料ID', width: 100, hide: true }
                , { field: '物料代码', title: '物料代码', width: 120 }
                , { field: '物料名称', title: '物料名称', width: 120 }
                , { field: '规格型号', title: '规格型号', width: 120 }
                , { field: 'HUnitID', title: '计量单位ID', width: 100, hide: true }
                , { field: '计量单位代码', title: '计量单位代码', width: 120 }
                , { field: '计量单位', title: '计量单位', width: 120 }
                , { field: 'HAuxPropID', title: '辅助属性ID', width: 100, hide: true }
                , { field: '辅助属性代码', title: '辅助属性代码', width: 120 }
                , { field: '辅助属性', title: '辅助属性', width: 120 }
                , { field: '批号', title: '批号', width: 120 }
                , { field: '数量', title: '数量', width: 100 }
                , { field: '源单单号', title: '源单单号', width: 120 }
                , { field: '计划跟踪号', title: '计划跟踪号', width: 120 }
                , { field: '是否赠品', title: '是否赠品', width: 100 }
                , { field: 'DeptID', title: '车间ID', width: 100, hide: true }
                , { field: '车间', title: '车间', width: 120 }
                , { field: 'HSupID', title: '供应商ID', width: 100, hide: true }
                , { field: '供应商代码', title: '供应商代码', width: 120 }
                , { field: '供应商', title: '供应商', width: 120 }
                , { field: '客户条码编号', title: '客户条码编号', width: 120 }
                , { field: '客户型号', title: '客户型号', width: 120 }
                , { field: '往来单位', title: '往来单位', width: 120 }
                , { field: '销售订单号', title: '销售订单号', width: 120 }
                , { field: '销售订单行号', title: '销售订单行号', width: 120 }
                , { field: '托号', title: '托号', width: 120 }
                , { field: '总托数', title: '总托数', width: 100 }
                , { field: '条码日期', title: '条码日期', width: 120 }
                , { field: '生产入库日期', title: '生产入库日期', width: 120 }
                , { field: '生产入库单号', title: '生产入库单号', width: 120 }
                , { field: '生产入库次数', title: '生产入库次数', width: 100 }
                , { field: '销售出库日期', title: '销售出库日期', width: 120 }
                , { field: '销售出库单号', title: '销售出库单号', width: 120 }
                , { field: '销售出库次数', title: '销售出库次数', width: 100 }
                , { field: '作废标记', title: '作废标记', width: 100 }
                , { field: '作废人', title: '作废人', width: 100 }
                , { field: '备注', title: '备注', width: 120 }
                , { field: '制作人', title: '制作人', width: 100 }
                , { field: '日期', title: '日期', width: 120 }
                , { field: '计划完工日期', title: '计划完工日期', width: 120 }
                , { field: '打印次数', title: '打印次数', width: 100 }
                , { field: 'HSTOCKORGID', title: 'HSTOCKORGID', width: 100, hide: true }
                , { field: '生成组织', title: '生成组织', width: 120 }
            ],
            tableData_BarCode:[],                                       //条码列表table 数据
            RowIndex_BarCode:0,                                         //条码列表table 行索引
 
            openPrintList:false,                                         //打印弹窗显示标记
            printListShow:false,                                        //打印模板数据显示标记
            selectedData_BarCode:0,                                     //条码列表table 选中数据集合
        };
    },
    async created() {
        this.judgeIsLoging();                                           //判断是否登录,未登录则跳转回登录页面
        await this.get_OrganizationList();                              //页面初始化 获取组织下拉列表数据
        await this.initPageData();                                      //页面初始化
    },
    methods: {
        //#region 判断是否登录,未登录则跳转回登录页面
        judgeIsLoging(){
            if (sessionStorage["login"] != "login") {
                this.$modal.msgError("登录失效,请重新登录!!");
                this.$router.push({ path: "/" }).catch(() => { })
            }
        },
        //#endregion
 
        //#region 页面初始化
        initPageData(){
            var params = this.get_UrlVars();
            var OperationType = params[params[0]];      //操作类型
 
            if (OperationType == "1" || typeof(OperationType)=="undefined") {                                             //
 
            }
            else if (OperationType == "4") {                                        //下推
                this.setInit_PushBill();
            }
            else {
                layer.alert("未知操作类型!", { icon: 5 });
            }
        },
        //#endregion
 
        //#region 获取组织下拉列表数据
        async get_OrganizationList() {
            axios.get(this.baseURL + '/Web/GetOrganizations',{async:false}).then(response => {
                let result = response.data
                if (result.count == 1) {
                    var data = result.data;
                    for (var i = 0; i < data.length; i++) {
                        this.HOrganizationList.push(
                            {
                                ID:data[i].ID,
                                Name:data[i].Name,
                            }
                        )
                    }
 
                    this.initMainData.HOrganizationID = sessionStorage["OrganizationID"] * 1;
                }else{
                    this.$modal.msgError(result.message);
                }
            }).catch(error => {
                this.$modal.msgError("接口请求失败!" + error);
            });
        },
        //#endregion
 
        //#region 组织下拉列表变更事件
        onChangeMethod_HOrganization(){
 
        },
        //#endregion
 
        //#region 源单数量数据变更事件
        onChangeForHQty_SourceBill(){
            if(this.initMainData.HMinQty>0){
                this.initMainData.HBQty = Math.floor((this.initMainData.HQty_SourceBill / this.initMainData.HMinQty) + (this.initMainData.HQty_SourceBill%this.initMainData.HMinQty == 0?0:1));
            }else{
                this.initMainData.HBQty = 0;
            }
            if(this.initMainData.HMinQty>0){
                this.initMainData.HEndQty = this.initMainData.HQty_SourceBill%this.initMainData.HMinQty;
            }
        },
        //#endregion
 
        //#region 标准包装数数据变更事件
        onChangeForHMinQty(){
            if(this.initMainData.HMinQty>0){
                this.initMainData.HBQty = Math.floor((this.initMainData.HQty_SourceBill / this.initMainData.HMinQty) + (this.initMainData.HQty_SourceBill%this.initMainData.HMinQty == 0?0:1));
            }else{
                this.initMainData.HBQty = 0;
            }
            if(this.initMainData.HMinQty>0){
                this.initMainData.HEndQty = this.initMainData.HQty_SourceBill%this.initMainData.HMinQty;
            }
        },
        //#endregion
 
        //#region 生产按钮点击事件数据校验
        AllowLoadData(sSubStr) {
            var Result = true;
            //数值格式校验工具
            var ref = /^\d+(\.\d+)?$/;          //非负数正则表达式
            var ref1 = /^[1-9]\d*$/;            //正整数正则表达式
            var temp = "";
            sSubStr = JSON.parse(sSubStr);
 
            if (sSubStr[0].HDate == "") {
                this.$modal.msgError("日期未设置!!");
                return Result = false;
            }
            if (sSubStr[0].HSourceInterID == "0" || sSubStr[0].HSourceEntryID == "0" || sSubStr[0].HSourceBillNo == "") {
                this.$modal.msgError("源单信息有误!!【主内码:" + sSubStr[0].HSourceInterID + ";子内码:" + sSubStr[0].HSourceEntryID + ";源单号:" + sSubStr[0].HSourceBillNo + ";】");
                return Result = false;
            }
            if (sSubStr[0].HMaterID == "0") {
                this.$modal.msgError("物料信息有误!!【物料ID:" + sSubStr[0].HMaterID + ";物料代码:" + sSubStr[0].HMaterNumber + ";物料名称:" + sSubStr[0].HMaterName + ";规格型号:" + sSubStr[0].HMaterModel + ";】");
                return Result = false;
            }
            if (sSubStr[0].HSupID == "0") {
                this.$modal.msgError("供应商信息有误!!【供应商ID:" + sSubStr[0].HMaterID + ";供应商代码:" + sSubStr[0].HMaterNumber + ";供应商名称:" + sSubStr[0].HMaterName + ";】");
                return Result = false;
            }
 
            temp = sSubStr[0].HQty + "";
            if (temp == "0" || temp == "") {
                this.$modal.msgError("源单数量不能为0或空!!");
                return Result = false;
            } else if (!ref.test(temp)) {
                this.$modal.msgError("源单数量请输入大于0的数字!!");
                return Result = false;
            }
 
            temp = sSubStr[0].HMinQty + "";
            if (temp == "0" || temp == "") {
                this.$modal.msgError("标准包装数不能为0或空!!");
                return Result = false;
            } else if (!ref.test(temp)) {
                this.$modal.msgError("标准包装数请输入大于0的数字!!");
                return Result = false;
            }
 
            temp = sSubStr[0].HBQty + "";
            if (!ref1.test(temp)) {
                this.$modal.msgError("包数请输入大于0的整数数字!!");
                return Result = false;
            }
 
            // var HEndQty = this.initMainData.HEndQty;
            // if (HEndQty == "") {
            //     this.$modal.msgError("尾包数量不能为空!!");
            //     return Result = false;
            // } else if (!ref.test(HEndQty)) {
            //     this.$modal.msgError("尾包数量请输入不小于0的数字!!");
            //     return Result = false;
            // }
            
            return Result;
        },
        //#endregion
 
        //#region 生成按钮点击事件
        async onClickMethod_BarCodeProduce(){
            this.disabledFlag_BarCodeProduce = true;                                //禁用生成按钮
 
            if (this.initMainData.HMaterName != null && (this.initMainData.HMaterName.indexOf("\"") != -1 || this.initMainData.HMaterName.indexOf(";") != -1)) {
                this.initMainData.HMaterName = this.initMainData.HMaterName.replaceAll("\"", "”").replaceAll(";", ";")
            }
            if (this.initMainData.HMaterModel != null && (this.initMainData.HMaterModel.indexOf("\"") != -1 || this.initMainData.HMaterModel.indexOf(";") != -1)) {
                this.initMainData.HMaterModel = this.initMainData.HMaterModel.replaceAll("\"", "”").replaceAll(";", ";")
            }
 
             //判断生成条码数量是否超过可生成条码数量
            var temp = await this.getPushSource_POInStockBillInit(this.initMainData.HMainSourceInterID, this.initMainData.HMainSourceEntryID);
            var dataArray = [];
            dataArray.push(temp);
            var HQty_SourceBill = this.initMainData.HQty_SourceBill * 1;
            if (HQty_SourceBill > ((dataArray[0].数量 * 1) - (dataArray[0].已生成条码数量 * 1))) {
                this.$modal.msgError("条码生成数量大于最大可生成数量【" + ((dataArray[0].数量 * 1) - (dataArray[0].已生成条码数量 * 1)) + "】!!");
                return false;
            }
 
            var sMainData_temp = [
                {
                    "HMainID": this.initMainData.HMainSourceInterID
                    , "HSubID": this.initMainData.HMainSourceEntryID
                    , "HBillNo": this.initMainData.HMainSourceBillNo
                    , "HBillType": this.initMainData.HMainSourceBillType
                    , "HMaterID": this.initMainData.HMaterID
                    , "HMaterNumber": this.initMainData.HMaterNumber
                    , "HMaterName": this.initMainData.HMaterName
                    , "HMaterModel": this.initMainData.HMaterModel
                    , "HCusModel": this.initMainData.HCusModel
                    , "HCusMaterName": ""
                    , "HEmpID": 0
                    , "HEmpNumber": ""
                    , "HEmpName": ""
                    , "HGroupID": 0
                    , "HGroupNumber": ""
                    , "HGroupName": ""
                    , "HCheckEmpName": ""
                    , "HBatchNo": this.initMainData.HBatchNo
                    , "HQty": this.initMainData.HQty_SourceBill
                    , "HMinQty": this.initMainData.HMinQty
                    , "HBQty": this.initMainData.HBQty
                    , "HPackQty": 0
                    , "HCoilNO": ""
                    , "HFurnaceNO": ""
                    , "HFactory": ""
                    , "HCusID": 0
                    , "HCusNumber": ""
                    , "HCusName": ""
                    , "HSeOrderBillNo": ""
                    , "HRemark": ""
                    , "HProduceDate": this.initMainData.HDate
                    , "HExpiryDate": this.initMainData.HDate
                    , "HheatNO": ""
                    , "HAuxPropID": this.initMainData.HAuxPropID
                    , "HAuxPropNumber": this.initMainData.HAuxPropNumber
                    , "HAuxPropName": this.initMainData.HAuxPropName
                    , "HUnitID": this.initMainData.HUnitID
                    , "HUnitNumber": ""
                    , "HUnitName": this.initMainData.HUnitName
                    , "HAuxQty": 0
                    , "HExpirationDateFlag": 0
                    , "HGiveAwayFlag": 0
                    , "HDate": this.initMainData.HDate
                    , "HMTONo": ""
                    , "HBarCodeType": "唯一条码"
                    , "HSupID": this.initMainData.HSupID
                    , "HSupNumber": this.initMainData.HSupNumber
                    , "HSupName": this.initMainData.HSupName
                    , "HInnerBillNo": this.initMainData.HPOOrderBillNo
                    , "HReInspectionFlag": this.initMainData.HReInspectionFlag
                    , "HInspectionDate": this.initMainData.HInspectionDate
                    , "HInspectionCycle": this.initMainData.HInspectionCycle
                    , "HReInspectionDate": this.initMainData.HReInspectionDate
                    , "HPOOrderBillMTO": this.initMainData.HPOOrderBillMTO
                    , "HSeOrderBillNo": this.initMainData.HSeOrderBillNo
                }
            ]
 
            var sSubStr = JSON.stringify(sMainData_temp);
            //物料明细信息不为空判断
            if (!this.AllowLoadData(sSubStr))//数据验证
            {
                this.disabledFlag_BarCodeProduce = false;                           //生成按钮启用
                return;
            }
            var HOrgType = sessionStorage["Organization"];                         //获取选择的组织
            var HSourceBillType = this.initMainData.HMainSourceBillType;            //获取选择的源单类型
            var CampanyName = "xxx";                                                //获取选择的工厂代码
            var UserName = sessionStorage["HUserName"];                             //获取当前登录人员
            var sMainSub = sSubStr + ';' + HOrgType + ';' + HSourceBillType + ';' + CampanyName + ';' + UserName;
            this.SaveBarCodeCreate(sMainSub);                                       //条码生成
        },
        //#endregion
 
        //#region 打印按钮点击事件
        get_PrintReport() {
            if (this.selectedData_BarCode.length == 0) {
                this.$modal.msgError("请选择数据");
            } else {
                this.rowSel = [];
                for (var i = 0; i < this.selectedData_BarCode.length; i++) {
                    this.rowSel.push(this.selectedData_BarCode[i].HItemID.toString());
                }
                this.printListShow = true;
                this.openPrintList = true;
            }
        },
        //#endregion
 
        //#region 条码列表复选框选择状态变更监听事件
        onSelectionChange_BarCode(selection){
            this.selectedData_BarCode = selection;
        },
        //#endregion
    
        //#region 获取参数
        get_UrlVars() {
            var vars = [], hash;
            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
            for (var i = 0; i < hashes.length; i++) {
                hash = hashes[i].split('=');
                vars.push(hash[0]);
                vars[hash[0]] = hash[1];
            }
            return vars;
        },
        //#endregion
        
        //#region 根据主内码与子内码获取源单收料通知单数据
        async getPushSource_POInStockBillInit(HSourceInterID, HSourceEntryID) {
            var res = "none";
            var sql = "select * from h_v_IF_POInStockBillList_Source where 1=1 and HMainID = " + HSourceInterID + " and HSubID = " + HSourceEntryID;
            var ModRightNameCheck = "";
            return axios.get(this.baseURL + '/CommonModel/searchMethod', {
                async:false,
                params: {
                    "sql": sql
                    , "user": sessionStorage["HUserName"]
                    , "ModRightNameCheck": ModRightNameCheck
                },
            })
        },
        //#endregion
    
        //#region 下推页面初始化
        async setInit_PushBill(HSourceInterID,HSourceEntryID) {
            //获取参数
            var params = this.get_UrlVars();
            var OperationType = params[params[0]];      //操作类型
            var HSourceInterID = params[params[1]];     //源单主id
            var HSourceEntryID = params[params[2]];     //源单子id
            var HSourceBillType = params[params[3]];    //源单类型
            var HSourceBillNo = params[params[4]];      //源单单号
            
            //获取源单信息
            var temp = null;
            var res = "none"
            try{
                res = await this.getPushSource_POInStockBillInit(HSourceInterID, HSourceEntryID);
                if(res.data.code=="1"){
                    if(res.data.data.length>0){
                        res = await this.getPushSource_POInStockBillInit(HSourceInterID, HSourceEntryID);
                    }else{
                        res = "none";
                        this.$modal.msgError("未查询到当前单据!!!");
                    }
                }
                else{
                    res = "none";
                    this.$modal.msgError(res.data.Message);
                }
            }catch(error){
                res = "none";
                this.$modal.msgError("接口请求失败!" + error);
            }
            if(res != "none"){
                temp = res.data.data[0];
            }else{
                return;
            }
 
            var dataArray = [];
            dataArray.push(temp);
 
            this.initMainData.HDate = moment().format('YYYY-MM-DD');
            this.initMainData.HMainSourceInterID = HSourceInterID;
            this.initMainData.HMainSourceEntryID = HSourceEntryID;
            this.initMainData.HMainSourceBillNo = HSourceBillNo;
            this.initMainData.HMainSourceBillType = HSourceBillType;
            this.initMainData.HPOOrderBillNo = dataArray[0].源单单号==null?"":dataArray[0].源单单号;
            this.initMainData.HMaterID = dataArray[0].HMaterID==null?0:dataArray[0].HMaterID;
            this.initMainData.HMaterNumber = dataArray[0].物料代码==null?"":dataArray[0].物料代码;
            this.initMainData.HMaterName = dataArray[0].物料名称==null?"":dataArray[0].物料名称;
            this.initMainData.HMaterModel = dataArray[0].规格型号==null?"":dataArray[0].规格型号;
            this.initMainData.HUnitID = dataArray[0].HUnitID==null?0:dataArray[0].HUnitID;
            this.initMainData.HUnitName = dataArray[0].计量单位==null?"":dataArray[0].计量单位;
            this.initMainData.HAuxPropID = dataArray[0].HAuxPropID==null?0:dataArray[0].HAuxPropID;
            this.initMainData.HAuxPropNumber = dataArray[0].辅助属性代码==null?"":dataArray[0].辅助属性代码;
            this.initMainData.HAuxPropName = dataArray[0].辅助属性==null?"":dataArray[0].辅助属性;
            this.initMainData.HSupID = dataArray[0].HSupID==null?0:dataArray[0].HSupID;
            this.initMainData.HSupNumber = dataArray[0].供应商代码==null?"":dataArray[0].供应商代码;
            this.initMainData.HSupName = dataArray[0].供应商==null?"":dataArray[0].供应商;
            this.initMainData.HBatchNo = dataArray[0].批号==null?"":dataArray[0].批号;
            this.initMainData.HQty_SourceBill = ((dataArray[0].数量 * 1) - (dataArray[0].已生成条码数量 * 1))<0?0:((dataArray[0].数量 * 1) - (dataArray[0].已生成条码数量 * 1));
            this.initMainData.HReInspectionFlag = dataArray[0].复检标记==1?true:false;
            this.initMainData.HInspectionCycle = dataArray[0].复检标记==1?dataArray[0].复检周期:0;
            this.initMainData.HInspectionDate = dataArray[0].复检标记==1?moment(dataArray[0].检验日期).format('YYYY-MM-DD'):null;
            this.initMainData.HReInspectionDate = dataArray[0].复检标记==1?moment(dataArray[0].检验日期).add(dataArray[0].复检周期,"days").format('YYYY-MM-DD') :null;
            this.initMainData.HPOOrderBillMTO = dataArray[0].采购跟踪号;
            this.initMainData.HSeOrderBillNo = dataArray[0].客户订单号;
            this.initMainData.HCusModel = dataArray[0].产品型号;
            this.initMainData.HMinQty = 0;
            if(this.initMainData.HMinQty>0){
                this.initMainData.HBQty = (this.initMainData.HQty_SourceBill / this.initMainData.HMinQty) + (this.initMainData.HQty_SourceBill%this.initMainData.HMinQty == 0?0:1);
            }else{
                this.initMainData.HBQty = 0;
            }
            if(this.initMainData.HMinQty>0){
                this.initMainData.HEndQty = this.initMainData.HQty_SourceBill%this.initMainData.HMinQty;
            }
        },
        //#endregion
        
        //#region 条码生成
        SaveBarCodeCreate(sMainSub, CampanyName) {
            axios({
                method: 'post',
                url: this.baseURL + "/Sc_BarCode/Sub_SaveBill_JinLong",
                data: {
                    "msg": sMainSub, "CampanyName": CampanyName
                },
            }).then(response => {
                let result = response.data
                if (result.count == 1) { // 说明验证成功了,
                    this.tableData_BarCode = result.data;
                    console.log(this.tableData_BarCode);
                }
                else {
                    this.disabledFlag_BarCodeProduce = false                            //生成按钮启用
                    this.$modal.msgError(result.Message);
                }
            }).catch(error => {
                this.disabledFlag_BarCodeProduce = false                            //生成按钮启用
                this.$modal.msgError("接口请求失败!");
            });     
        }
        //#endregion
    }
};
</script>
<style>
.input-search-btn {
    background-color: rgb(24, 144, 255) !important;
    color: #fff !important;
}
</style>