yangle
2023-08-16 fadf38051ddbc40d998356d357028465627c1899
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
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>产线组装追溯单</title>
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/Scripts/json2.js"></script>
    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
    <script src="../../../layuiadmin/PubCustom.js"></script>
 
    <style>
        .main-btn { /*头部主按钮*/
            padding: 0 2px; /*调整按钮左右空隙大小*/
            height: 30px;
            line-height: 30px;
        }
 
        .btn-title {
            font-size: 16px;
        }
    </style>
</head>
<body>
    <div class="layui-fluid" style="padding: 0;">
        <div class="layui-card" style="padding: 2px;background-color: #efefef;">
            <div class="layui-card-body" style="padding: 1px;">
                <form class="layui-form" action="" lay-filter="formData" style="background-color:white;">
                    <div style="padding: 10px;">
                        <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnSave" id="btnSave">保存</button>
                        <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnSave" id="btnSave">退出</button>
                    </div>
                    <div class="layui-tab" lay-filter="tab-POStockInBill">
                        <ul class="layui-tab-title" lay-filter="tab-all">
                            <li lay-id="1" style="padding:1px;" class="layui-this">采集信息</li>
                        </ul>
                        <div class="layui-tab-content">
                            <!--基本信息-->
                            <div class="layui-tab-item layui-show">
                                <div class="layui-form-item" style="padding-top: 10px;">
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">条形码:</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" name="HBarCode" lay-verify="HBarCode" placeholder="请键入后回车" id="HBarCode" style="width: 500px;">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">单据号</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" name="HBillNo" lay-verify="HBillNo" id="HBillNo" style="background-color:#efefef4d;" readonly>
                                                <input type="hidden" name="HInterID" id="HInterID" lay-verify="HInterID">
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">创建人</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" name="HMaker" lay-verify="HMaker" id="HMaker" style="background-color:#efefef4d;" readonly>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 68px;">生产订单</label>
                                            <div class="layui-input-block" style="margin-left: 100px;">
                                                <input type="text" class="layui-input" name="HICMOBillNo" lay-verify="HICMOBillNo" id="HICMOBillNo" value="" style="background-color: #efefef4d; display: inline-block;" readonly>
                                                <input type="hidden" id="HICMOInterID" name="HICMOInterID" value="0" />
                                                <input type="hidden" id="HICMOEntryID" name="HICMOEntryID" value="0" />
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">产品MAC</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" lay-verify="HMateMAC" name="HMateMAC" id="HMateMAC" style="background-color:#efefef4d;" readonly>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">产品SN</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" name="HBarCode_P" lay-verify="HBarCode_P" id="HBarCode_P" style="background-color:#efefef4d;display: inline-block;" readonly>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 65px;">产品编码</label>
                                            <div class="layui-input-block" style="margin-left: 100px;">
                                                <input type="text" class="layui-input" lay-verify="HMaterNumber" name="HMaterNumber" id="HMaterNumber" style="background-color:#efefef4d;" readonly>
                                                <input type="hidden" id="HMaterID" name="HMaterID" value="0" />
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">产品名称</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" lay-verify="HMaterName" name="HMaterName" id="HMaterName" style="background-color:#efefef4d;" readonly>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 85px;">规格型号</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" lay-verify="HMaterModel" name="HMaterModel" id="HMaterModel" style="background-color:#efefef4d;" readonly>
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label" style="width: 70px;">状态</label>
                                            <div class="layui-input-block" style="margin-left: 100px; width: 184px;">
                                                <select name="HAssemblyStatus" id="HAssemblyStatus" lay-verify="HAssemblyStatus">
                                                    <option value="生产中" selected>生产中</option>
                                                    <option value="汇报">汇报</option>
                                                    <option value="检验">检验</option>
                                                    <option value="包装">包装</option>
                                                    <option value="入库">入库</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline" style="width: 56%;">
                                            <label class="layui-form-label" style="width: 85px;">备注</label>
                                            <div class="layui-input-block" style="margin-left: 120px;">
                                                <input type="text" class="layui-input" name="HRemark" id="HRemark" lay-verify="HRemark" placeholder="请输入内容" onmouseover="this.title=this.value" style="width: 50%;">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-tab layui-tab-card" style="width: 49%; float: left;">
                        <ul class="layui-tab-title">
                            <li class="layui-this">关键件清单</li>
                        </ul>
                        <div class="layui-tab-content">
                            <div class="layui-tab-item layui-show">
                                <!--关键件清单-->
                                <table class="layui-hide" id="mainTable2" lay-filter="mainTable2"></table>
                            </div>
                        </div>
                    </div>
                    <div class="layui-tab layui-tab-card" style="width: 49%; float: left; margin-left: 1%; ">
                        <ul class="layui-tab-title">
                            <li class="layui-this">采集记录</li>
                        </ul>
                        <div class="layui-tab-content">
                            <div class="layui-tab-item layui-show">
                                <!--采集记录-->
                                <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
                            </div>
                        </div>
                    </div>
                    <script type="text/html" id="toolbarDemo">
                        <div class="layui-btn-container">
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-AddLine"><i class="layui-icon layui-icon-form"></i>增加一行</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-CopyLine"><i class="layui-icon layui-icon-form"></i>复制一行</button>
                        </div>
                    </script>
                    <script type="text/html" id="toolbarDemo2">
                        <div class="layui-btn-container">
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-AddLine2"><i class="layui-icon layui-icon-form"></i>增加一行</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-CopyLine2"><i class="layui-icon layui-icon-form"></i>复制一行</button>
                        </div>
                    </script>
                    <input type="hidden" id="HProdOrgID" name="HProdOrgID" value="0" />
                </form>
            </div>
        </div>
    </div>
 
    <script type="text/html" id="barDemo">
        <!--<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>-->
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    </script>
    <script type="text/html" id="barDemo2">
        <!--<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>-->
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    </script>
 
    <script>
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
 
            //#region 公共变量
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
                , table = layui.table
                , form = layui.form
                , element = layui.element;
            var option = [];
            var option2 = [];
            //#endregion
 
            //#region 进入页面即加载
 
            var params = getUrlVars();
            var OperationType = params[params[0]]; //从参数中获取 数据类型  添加 保存
            var linterid = params[params[1]]; //从参数中获取 单据内码
 
            //判断是否新增
            if (linterid == null || linterid == 0) {
                OperationType = 1;
                $.ajax({
                    url: GetWEBURL() + "/Web/GetMAXNum",
                    type: "GET",
                    data: { "HBillType": '3727' },
                    success: function (d) {
                        //赋值
                        $("#HInterID").val(d.data[0].HInterID);
                        $("#HBillNo").val(d.data[0].HBillNo);
                    }
                });
            }
 
            //判断是否登录 未登录则跳到登录页
            if (sessionStorage.login != "login") {
                layer.confirm("登录失效,请重新登录!", {
                    icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
                }, function () { window.location.href = "../../user/login.html"; });
            }
 
            //初始化界面
            set_ClearBill();
 
 
            //#endregion
 
            //#region  触发事件:包括form.on(){}格式的所有点击事件、选择事件等
 
            //条形码回车方法
            $('#HBarCode').on('keydown', function (event) {
                var HBarCode = $('#HBarCode').val();
                if (event.keyCode == 13) {
                    if (!HBarCode) {
                        layer.msg("条形码不能为空!")
                        return;
                    }
                    txtHBarCode_KeyDown(HBarCode);
                }
            });
          
 
 
            ////行内事件
            //table.on('tool(mainTable)', function (obj) {
            //    set_GridDelete(obj);   //行内删除
            //});
 
            ////行内事件
            //table.on('tool(mainTable2)', function (obj) {
            //    set_GridDelete2(obj);   //行内删除
            //});
 
 
            //保存提交
            form.on('submit(btnSave)', function (data) {//提交
                //为空验证
                if (AllowLoadData(data)) {
                    set_AddNew(data,3);
                }
            });
 
            //#endregion
 
            //#region 此页面所有的方法
 
            // 初始化界面
            function set_ClearBill() {
                $("#HBarCode").focus(); //进入页面默认光标在条形码上
                set_InitGrid();
                set_InitGrid2();
                //制单人
                $("#HMaker").val(sessionStorage["HUserName"]);
                $("#HProdOrgID").val(sessionStorage["OrganizationID"]);//组织
                //初始化日期
                $("#HPlanBeginDate").val(Format(new Date(), "yyyy-MM-dd"));
                $("#HPlanEndDate").val(Format(new Date(), "yyyy-MM-dd"));
                $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
                get_Display();
            }
 
            function set_InitGrid() {
                //子表  初始化表格数据
                option = {
                    elem: '#mainTable'
                    //, toolbar: '#toolbarDemo'
                    , limit: 500 //每页默认显示的数量
                    , cellMinWidth: 120
                    , height: 400
                    , cols: [[ //表头
                        { type: 'checkbox', totalRowText: '合计行' }
                        , { type: 'numbers', title: '序号', totalRow: true }
                        , { field: '日期', title: '日期' }
                        , { field: '产品名称', title: '产品名称' }//f7
                        , { field: 'HMaterID', title: 'HMaterID ', hide: true }//f7
                        , { field: '产品条码', title: 'SN码' }
                        , { field: '配件条码', title: '配件SN码' }
                        , { field: '任务单号', title: '订单号' }
                        , { field: 'HPRDORGID', title: 'HPRDORGID', hide: true }
                        //, { fixed: 'right', title: '操作', toolbar: '#barDemo' }
                    ]]
                };
                //var rowdata = [{
                //    "HDate": "", "HMaterName": "", "HMaterID": 0, "HBarCode": "", "HBarCode_P": "",
                //    "HICMOBillNo": ""
                //}];
                option.data = [];
                table.render(option);
 
            }
 
            function set_InitGrid2() {
                //子表  初始化表格数据
                option2 = {
                    elem: '#mainTable2'
                    //, toolbar: '#toolbarDemo2'
                    , limit: 500 //每页默认显示的数量
                    , cellMinWidth: 120
                    , height: 400
                    , cols: [[ //表头
                        { type: 'checkbox', totalRowText: '合计行' }
                        , { type: 'numbers', title: '序号', totalRow: true }
                        , { field: 'HDate', title: '日期', edit: 'text' }
                        , { field: 'HMaterName', title: '配件名称' }//f7
                        , { field: 'HMaterID', title: 'HMaterID ', hide: true }//f7
                        , { field: 'HMaterModel', title: '配件规格' }
                        , { field: 'HQty', title: '配件数量' }
                        , { field: 'HBardQty', title: '已扫数量' }
                        , { field: 'HPRDORGID', title: 'HPRDORGID', hide: true }
                        , { field: 'HBarCode', title: 'HBarCode', hide: true }
                        , { field: 'HEQty', title: 'HEQty', hide: true }
                        //, { fixed: 'right', title: '操作', toolbar: '#barDemo2' }
                    ]]
                };
                var rowdata = [{
                    "HDate": "", "HMaterName": "", "HMaterID": 0, "HMaterModel": "", "HQty": 0,
                    "HBardQty": 0, "HPRDORGID": $("#HProdOrgID").val(), "HBarCode": "","HEQty":0
                }];
                option2.data = rowdata;
                table.render(option2);
 
            }
 
            //初始化查询
            function get_Display() {
                var sWhere = " and HProdOrgID=" + sessionStorage["OrganizationID"] + " and 制单人='" + $("#HMaker").val() +"' and DATEDIFF(DAY,GETDATE(),日期)=0";
                var ajaxLoad = layer.load();
                $.ajax({
                    url: GetWEBURL() + '/Sc_AssemblyBill/Sc_AssemblyBillAddList',
                    type: "GET",
                    data: { "sWhere": sWhere  },
                    success: function (data1) {
                        if (data1.count == 1) {
                            option.data = data1.data;
                            ins = table.render(option);
                            layer.close(ajaxLoad);
 
                        } else {
                            layer.close(ajaxLoad);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(ajaxLoad);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
 
            }
 
            //条码回车查询
            function txtHBarCode_KeyDown(HBarCode) {
 
                var index = layer.load();
                $.ajax({
                    type: "GET",
                    url: GetWEBURL() + "/Sc_AssemblyBill/HBardCodeList",
                    async: true,
                    data: { "HBarCode": HBarCode, "user": sessionStorage["HUserName"], "HICMOBillNo": $("#HICMOBillNo").val()},
                    dataType: "json",
                    success: function (data) {
                        if (data.count == 1) {
                            var data_1 = null;
                            var option_s = [];
                            if ($("#HICMOBillNo").val() == "") {
                                $("#HICMOBillNo").val(data.data[0]["FMOBILLNO"]);
                                $("#HICMOInterID").val(data.data[0]["HSourceInterID"]);
                                $("#HICMOEntryID").val(data.data[0]["HSourceEntryID"]);
                                $("#HBarCode_P").val($("#HBarCode").val());
                                $("#HMaterID").val(data.data[0]["HItemID"]);
                                $("#HMaterNumber").val(data.data[0]["HMaterNumber"]);
                                $("#HMaterName").val(data.data[0]["HMaterName"]);
                                $("#HMaterModel").val(data.data[0]["HMaterModel"]);
                                var num = [];
                                for (var i = 0; i < data.data.length; i++) {
                                    num.push({
                                        "HDate": Format(new Date().getTime(), 'yyyy-MM-dd hh:mm:ss'), "HMaterName": data.data[i]["HMaterName_z"], "HMaterID": data.data[i]["HMaterID"], "HMaterModel": data.data[i]["HMaterModel_z"], "HQty": data.data[i]["FMUSTQTY"],
                                        "HBardQty": 0, "HPRDORGID": $("#HProdOrgID").val(), "HBarCode": "","HEQty":0
                                    });
                                }
                                option2.data = num;
                                data_1 = set_AddNew({ "field": { "HInterID": $("#HInterID").val(), "HBillNo": $("#HBillNo").val(), "HICMOBillNo": $("#HICMOBillNo").val() } }, 1);
 
                            } else {
                                option_s = JSON.stringify(option2.data);
                                for (var i = 0; i < option2.data.length; i++) {
                                    if (option2.data[i]["HMaterID"] == data.data[0]["HMaterID"]) {
                                        option2.data[i]["HBardQty"] += data.data[0]["HQty"];
                                        option2.data[i]["HBarCode"] = $("#HBarCode").val();
                                        option2.data[i]["HEQty"] = data.data[0]["HQty"];
                                    } else {
                                        option2.data[i]["HBarCode"] = "";
                                    }
                                }
                                data_1 = set_AddNew({ "field": { "HInterID": $("#HInterID").val(), "HBillNo": $("#HBillNo").val(), "HICMOBillNo": $("#HICMOBillNo").val() } }, 2);
 
                            }
                            if (data_1.count == 1) {
                                layer.msg("提交成功");
                                layer.close(index);
                                table.render(option2);
                            }
                            else {
                                option2.data = JSON.parse(option_s);
                                layer.msg(data_1.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                                layer.close(index);
                            }
                        }
                        else {
                            layer.close(index);
                            layer.msg(data.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        }
                        $("#HBarCode").val("");
                    },
                    error: function (err) {
                        layer.close(index);
                        layer.msg("错误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    }
                });
            }
 
            ////行内删除
            //function set_GridDelete(obj) {
            //    var data = obj.data;
            //    var rowIndex = $(obj.tr).attr("data-index");
            //    if (obj.event === 'del') {
            //        layer.confirm('真的删除行吗?', function (index) {
            //            if (rowIndex === '0') {
            //                layer.msg('首行无法删除!!!');
            //            } else {
            //                var oldData = table.cache["mainTable"];
            //                oldData.splice(obj.tr.data('index'), 1)
            //                option.data = oldData;//将数据绑定到data上
            //                table.render(option);
            //                layer.close(index);
            //            }
            //        });
            //    }
            //}
 
            ////行内删除
            //function set_GridDelete2(obj) {
            //    var data = obj.data;
            //    var rowIndex = $(obj.tr).attr("data-index");
            //    if (obj.event === 'del') {
            //        layer.confirm('真的删除行吗?', function (index) {
            //            if (rowIndex === '0') {
            //                layer.msg('首行无法删除!!!');
            //            } else {
            //                var oldData = table.cache["mainTable2"];
            //                oldData.splice(obj.tr.data('index'), 1)
            //                option2.data = oldData;//将数据绑定到data上
            //                table.render(option2);
            //                layer.close(index);
            //            }
            //        });
            //    }
            //}
 
            //保存数据
            function set_AddNew(data, num) {
                var data_1 = [];
                //过滤子表删除之后留下的空数据
                var num2 = [];
                for (var i = 0; i < option2.data.length; i++) {
                    //给不能为空的数据 赋值(子)
                    if (option2.data[i] != "") {
                        num2.push(option2.data[i]);
                    }
                }
 
                var sMainStr = JSON.stringify(data.field);
                var sSubStr = JSON.stringify(num2);
                var sMainSub = sMainStr + ';' + sSubStr + ';' + num + ";" + sessionStorage["HUserName"];
                var index = layer.load();
                
                $.ajax({
                    type: "POST",
                    url: GetWEBURL() + "/Sc_AssemblyBill/AddBill",
                    async: false,
                    data: { "sMainSub": sMainSub },
                    dataType: "json",
                    success: function (res) {
                        layer.close(index);
                        if (num != 3) {
                            data_1 = res;
                        } else {
                            if (res.count == 1) {
                                layer.msg("提交成功", { time: 1 * 1000, icon: 1 }, function () {
                                    location.replace('Cj_AssemblyTraceability.html');
                                });
                            }
                            else {
                                layer.msg(res.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                                layer.close(index);
                            }
                        }
                    },
                    error: function (err) {
                        layer.close(index);
                        layer.msg("错误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    }
                });
                return data_1;
            }
 
            //数据验证
            function AllowLoadData(data) {
                var HICMOBillNo = $("#HICMOBillNo").val();//生产订单
                if (HICMOBillNo == "") {
                    layer.msg("请扫产品码!");
                    return false;
                }
                var count = 0;
                for (var i = 0; i < option2.data.length; i++) {
                    if (option2.data[i]["HBardQty"] != 0) {
                        count += 1;
                    }
                }
                if (count == 0) {
                    layer.msg("请扫配件码!");
                    return false;
                }
                return true;
            }
 
            //获取参数
            function getUrlVars() {
                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
 
        });
    </script>
</body>
</html>