wtt
2025-03-17 980207d432914dce2d63a4358db2a5fcdcc7434f
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
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <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>-->
    <script src="../../CreateControl.js"></script>
</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>
                        <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" autocomplete="off" 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;padding: 9px 18px;">维修人</label>
                                            <div class="layui-input-block" style="margin-left: 77px;">
                                                <input type="text" class="layui-input" name="HEmpName" lay-verify="HEmpName" id="HEmpName" style="background-color: #efefef4d; width: 60%; display: inline-block;" readonly>
                                                <input type="hidden" name="HProcID" id="HProcID" lay-verify="HProcID" value="0">
                                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHEmp" id="btnHEmp" style="padding: 0 10px;float: right;margin-right: 3px;">
                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                                </button>
                                            </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="HProcName" lay-verify="HProcName" id="HProcName" style="background-color: #efefef4d;" readonly>
                                                <input type="hidden" name="HProcID" id="HProcID" lay-verify="HProcID" 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" name="HProdMac" lay-verify="HProdMac" id="HProdMac">
                                            </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="HMaterSN" lay-verify="HMaterSN" id="HMaterSN" style="background-color: #efefef4d; display: inline-block;" readonly>
                                            </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="HRemark" id="HRemark" lay-verify="HRemark" placeholder="请输入内容" onmouseover="this.title=this.value" style=" width: 500px;">
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <div class="layui-input-block" style="margin-left: 120px; width: 501px;">
                                                <input type="hidden" name="HSourceInterID" id="HSourceInterID" lay-verify="HSourceInterID" value="0">
                                                <input type="hidden" name="HSourceEntryID" id="HSourceEntryID" lay-verify="HSourceEntryID" value="0">
                                                <input type="hidden" name="HSourceBillNo" id="HSourceBillNo" lay-verify="HSourceBillNo" value="">
                                                <input type="hidden" name="HSourceBillType" id="HSourceBillType" lay-verify="HSourceBillType" value="">
                                                <input type="hidden" name="HRelationQty" id="HRelationQty" lay-verify="HRelationQty" value="0">
                                                <input type="hidden" name="HRelationMoney" id="HRelationMoney" lay-verify="HRelationMoney" value="0">
 
                                                <input type="hidden" name="HMaterID" id="HMaterID" lay-verify="HMaterID" value="0">
                                                <input type="hidden" name="HMaterNumber" id="HMaterNumber" lay-verify="HMaterNumber" value="">
                                                <input type="hidden" name="HMaterName" id="HMaterName" lay-verify="HMaterName" value="">
                                                <input type="hidden" name="HUnitID" id="HUnitID" lay-verify="HUnitID" value="0">
                                                <input type="hidden" name="HQty" id="HQty" lay-verify="HQty" value="0">
                                                <input type="hidden" name="HSupID" id="HSupID" lay-verify="HSupID" value="0">
                                                <input type="hidden" name="HBatchNo" id="HBatchNo" lay-verify="HBatchNo">
                                                <input type="hidden" name="HProcExchBillNo" id="HProcExchBillNo" lay-verify="HProcExchBillNo">
                                                <input type="hidden" name="HProcExchEntryID" id="HProcExchEntryID" lay-verify="HProcExchEntryID">
                                                <input type="hidden" name="HProcExchInterID" id="HProcExchInterID" lay-verify="HProcExchInterID">
                                                <input type="hidden" name="HProcess" id="HProcess" lay-verify="HProcess">
                                                <input type="hidden" name="HICMOInterID" id="HICMOInterID" lay-verify="HICMOInterID">
                                                <input type="hidden" name="HICMOBillNo" id="HICMOBillNo" lay-verify="HICMOBillNo">
                                                <input type="hidden" name="HICMOEntryID" id="HICMOEntryID" lay-verify="HICMOEntryID">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-tab layui-tab-card">
                        <ul class="layui-tab-title">
                            <li class="layui-this">配件更换记录</li>
                            <li>关键件清单</li>
                        </ul>
                        <div class="layui-tab-content">
                            <div class="layui-tab-item layui-show">
                                <!--配件更换记录-->
                                <table class="layui-hide" id="mainTable1" lay-filter="mainTable1"></table>
                            </div>
                            <div class="layui-tab-item">
                                <!--关键件清单-->
                                <table class="layui-hide" id="mainTable2" lay-filter="mainTable2"></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>
</body>
</html>
<script type="text/html" id="barDemo">
    <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-danger layui-btn-xs" lay-event="del2">删除</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 HModName = "Cj_CollectionOfSingleProductDefects";
        var option2 = [];
        //#endregion
 
        //#region 进入页面即加载
 
        var params = getUrlVars();
        var OperationType = params[params[0]]; //从参数中获取 数据类型  1添加 保存  2复制  3 编辑 4添加子工艺路线
        var datajson = params[params[1]]; //从参数中获取 单据内码
 
        //制单人
        $("#HMaker").val(sessionStorage["HUserName"]);
        $("#hmakedate").val(Format(new Date(), "yyyy-MM-dd"));
 
        //判断是否新增
        if (OperationType == 1) {
            datajson = decodeURI(datajson);
            datajson = $.parseJSON(datajson);
            OperationType = 1;
            $("#HMaterSN").val(datajson.HMaterSN);
            $("#HInterID").val(datajson.HInterID);
            $("#HBillNo").val(datajson.HBillNo);
            $("#HBillNo_bak").val(datajson.HBillNo);
            $("#HProcExchBillNo").val(datajson.HProcExchBillNo);
            $("#HProcExchInterID").val(datajson.HProcExchInterID);
            $("#HProcExchEntryID").val(datajson.HProcExchEntryID);
            $("#HICMOInterID").val(datajson.HICMOInterID);
            $("#HICMOBillNo").val(datajson.HICMOBillNo);
            $("#HICMOEntryID").val(datajson.HICMOEntryID);
            $("#HProcess").val(datajson.HProcess);
            //初始化界面
            set_ClearBill();
        }
 
 
 
        //#endregion
 
        //#region 触发事件:包括form.on(){}格式的所有点击事件、选择事件等
 
        //条形码回车方法
        $('#HBarCode').on('keydown', function (event) {
            var HBarCode = $('#HBarCode').val();
            if (event.keyCode == 13) {
                if (!HBarCode) {
                    layer.msg("条形码不能为空!")
                    return;
                }
                get_Accessory(HBarCode);
            }
        });
 
        //配件更换记录子表行内事件
        table.on('tool(mainTable1)', function (obj) {
            set_GridDelete1(obj);   //行内删除
        });
 
        //物料清单子表行内事件
        table.on('tool(mainTable2)', function (obj) {
            set_GridDelete2(obj);   //行内删除
        });
 
        //选择质检员
        form.on('submit(btnHEmp)', function () {
            btnHEmp();
        });
 
        //新增
        form.on('submit(set_AddNew)', function () {
            layer.confirm('新增后页面数据将消失?', { icon: 3, title: '提示' }, function (index) {
                location.replace('Cj_CollectionOfSingleProductDefects.html?OperationType=1&linterid=0');
            });
        });
 
 
        //退出
        form.on('submit(btnEdit)', function (data) {
            if (params[1] != null) {
                Pub_Close(1);
            } else if (params[1] == null) {
                Pub_Close(2);
            }
        });
 
 
        //#endregion
 
        //#region 此页面所有的方法
 
        //初始化界面
        function set_ClearBill() {
            //光标跳转到配件文本框上
            $("#HBarCode").focus();
            //查询绑定用户
            get_Display();
            //查询条码绑定的返修记录
            get_RepairRecord();
            //查询物料清单数据
            get_BomList();
        }
 
        //查询
        function get_Display() {
            var sWhere = " and 编码='" + sessionStorage["Czybm"] + "'";
            var ajaxLoad = layer.load();
            //进入页面显示的缓存列表
            $.ajax({
                url: GetWEBURL() + '/Cj_SingleStation/Cj_CollectionOfSingleProductDefectsUserList',
                type: "GET",
                async: false,
                data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                success: function (data1) {
                    if (data1.count == 1) {
 
                        $("#HEmpID").val(data1.data[0]["HEmpID"]);
                        $("#HEmpName").val(data1.data[0]["质检员"]);
                        layer.close(ajaxLoad);
 
                        //layer.alert("查询成功", { icon: 1 });
                    } else {
                        layer.close(ajaxLoad);
                        layer.alert(data1.code + data1.Message, { icon: 5 });
                    }
                }, error: function () {
                    layer.close(ajaxLoad);
                    layer.alert("接口请求失败!", { icon: 5 });
                }
 
            });
        }
 
        //条码回车查询更换配件
        var KNum = 0;
        function get_Accessory(HBarCode) {
            var index = layer.load();
            $.ajax({
                type: "GET",
                url: GetWEBURL() + "/Cj_SingleStation/HBardCodeAccessoryList",
                async: false,
                data: { "HBarCode": HBarCode, "user": sessionStorage["HUserName"] },
                dataType: "json",
                success: function (data1) {
                    if (data1.count == 1) {
                        layer.close(index);
 
                        for (var i = 0; i < option2.data.length; i++) {
                            if (data1.data[0]["HMaterNumber"] == option2.data[i]["配件代码"] && option2.data[i]["HBatchNo"] == data1.data[0]["HBatchNo"] && option2.data[i]["HBatchNo"] != "") {
                                return layer.msg("当前批次已扫入,请不要重复扫入!");
                            }
                            if (data1.data[0]["HMaterNumber"] == option2.data[i]["配件代码"] && option2.data[i]["HBatchNo"] != data1.data[0]["HBatchNo"] && option2.data[i]["HBatchNo"] != "") {
                                layer.confirm('是否要把当前批次:' + option2.data[i]["HBatchNo"] + '替换成批次:' + data1.data[0]["HBatchNo"], function (index) {
                                    layer.close(index);
                                    $('#HProcName').val(HBarCode);
                                    option2.data[i]["HBatchNo"] = data1.data[0]["HBatchNo"];
                                    option2.data[i]["HBarCode"] = HBarCode;
                                    table.render(option2);
                                    //保存配件更改记录
                                    set_AddNew();
                                });
                                break;
                            }
                            KNum += 1;
                        }
                      
                        $('#HBarCode').val("");
 
 
                    }
                    else {
                        layer.close(index);
                        layer.msg(data1.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    }
                },
                error: function (err) {
                    layer.close(index);
                    layer.msg("错误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                }
            });
        }
 
        //质检员选择页面
        function btnHEmp() {
            layer.open({
                type: 2//弹窗类型
                , skin: 'layui-layer-rim' //加上边框
                , area: ['90%', '90%']//大小
                , title: '维修员列表'//标题
                , shift: 2//弹出动画
                , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html', 'yes']
                , btn: ['确定', '取消']
                , btn1: function (index, layero) {//按钮【按钮一】的回调
                    var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                    var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                    if (checkStatus.data.length === 0) {
                        return layer.msg('请选择数据');
                    }
                    //获取数据
                    $("#HEmpID").val(checkStatus.data[0].HItemID);
                    $("#HEmpName").val(checkStatus.data[0].职员名称);
 
                    layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                }
            })
        }
 
        //查询条码绑定的返修记录
        function get_RepairRecord() {
            var sWhere = " and HBarCodeSN='" + $("#HMaterSN").val() + "' and HBarCode is not null";
            var index = layer.load();
            $.ajax({
                type: "GET",
                url: GetWEBURL() + "/Cj_SingleStation/Sc_SourceLineRepairBillSub_MaterList",
                async: false,
                data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                dataType: "json",
                success: function (data1) {
                    if (data1.count == 1) {
                        layer.close(index);
 
                        var option = {
                            elem: '#mainTable1'
                            //, toolbar: '#toolbarDemo'
                            , page: false
                            , totalRow: true
                            , data: data1.data
                            , cellMinWidth: 120
                            , height: 400
                            , cols: [[
                                { type: 'checkbox', fixed: 'left' }
                                , { type: 'numbers', title: '序号' }
                                , { field: 'HInterID', title: 'HInterID', hide: true }
                                , { field: 'HEntryID', title: 'HEntryID', hide: true }
                                , { field: 'HBillNo_bak', title: 'HBillNo_bak', hide: true }
                                , { field: 'HICMOInterID', title: 'HICMOInterID', hide: true }
                                , { field: 'HICMOEntryID', title: 'HICMOEntryID', hide: true }
                                , { field: 'HICMOBillType', title: 'HICMOBillType', hide: true }
                                , { field: 'HICMOBillNo', title: '生产订单' }
                                , { field: 'HDate', title: '日期' }
                                , { field: 'HMaterID', title: 'HMaterID', hide: true }
                                , { field: 'HMaterNumber', title: '配件物料编码' }
                                , { field: 'HMaterName', title: '配件物料名称' }
                                , { field: 'HUnitID', title: 'HUnitID', hide: true }
                                , { field: 'HQty', title: '配件数量', hide: true }
                                , { field: 'HSupID', title: 'HSupID', hide: true }
                                , { field: 'HBatchNo', title: '更换匹配批次', hide: true }
                                , { field: 'HBarCode', title: '配件SN码' }
                                , { field: 'HMaterSN', title: '产品SN码' }
                                , { field: 'HSourceInterID', title: '源单主内码', hide: true }
                                , { field: 'HSourceEntryID', title: '源单子内码', hide: true }
                                , { field: 'HSourceBillNo', title: '源单单号', hide: true }
                                , { field: 'HSourceBillType', title: '源单类型', hide: true }
                                , { fixed: 'right', title: '操作', toolbar: '#barDemo' }
                            ]]
                        }
 
                        table.render(option);
 
                    }
                    else {
                        layer.close(index);
                        layer.msg(data1.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    }
                    $("#HBarCodeSN").val("");
                },
                error: function (err) {
                    layer.close(index);
                    layer.msg("错误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                }
            });
        }
 
        //配件记录删除方法
        function set_GridDelete1(obj) {
            if (obj.event === 'del') {
                layer.confirm('真的删除行吗?', function (index) {
                    var HInterID = obj.data.HInterID;
                    var HEntryID = obj.data.HEntryID;
 
                    var ajaxLoad = layer.load();
                    $.ajax({
                        url: GetWEBURL() + "/Cj_SingleStation/ProcessItemRepairDel",
                        type: "GET",
                        async: false,
                        data: { "HInterID": HInterID, "HEntryID": HEntryID, "user": sessionStorage["HUserName"], "HBill": "PJ"},
                        success: function (result) {
                            if (result.count == 1) {
                                layer.msg("删除成功!");
                                layer.close(ajaxLoad);
                                //查询条码绑定的返修记录
                                get_RepairRecord();
                            } else {
                                layer.alert(result.code + result.Message, { icon: 5 });
                                layer.close(ajaxLoad);
                            }
                        }, error: function () {
                            layer.alert("接口请求失败!", { icon: 5 });
                            layer.close(ajaxLoad);
                        }
                    })
                });
            }
        }
 
        //物料清单删除方法
        function set_GridDelete2(obj) {
            if (obj.event === 'del2') {
                layer.confirm('真的删除行吗?', function (index) {
                    var HInterID = obj.data.BomHInterID;
                    var HEntryID = obj.data.BomHEntryID;
 
                    var ajaxLoad = layer.load();
                    $.ajax({
                        url: GetWEBURL() + "/Cj_SingleStation/DelBomTempList",
                        type: "GET",
                        async: false,
                        data: { "HInterID": HInterID, "HEntryID": HEntryID, "user": sessionStorage["HUserName"]},
                        success: function (result) {
                            if (result.count == 1) {
                                layer.msg("删除成功!");
                                layer.close(ajaxLoad);
                                //查询清单
                                get_BomList($("#HProcExchBillNo").val());
                            } else {
                                layer.alert(result.code + result.Message, { icon: 5 });
                                layer.close(ajaxLoad);
                            }
                        }, error: function () {
                            layer.alert("接口请求失败!", { icon: 5 });
                            layer.close(ajaxLoad);
                        }
                    })
                });
            }
        }
 
        //流转卡查询关键件清单
        function get_BomList() {
            var index = layer.load();
            $.ajax({
                type: "GET",
                url: GetWEBURL() + "/Cj_SingleStation/AssemHBardCodeBomList",
                async: false,
                data: { "HProcExchInterID": $("#HProcExchInterID").val(), "HProcExchEntryID": $("#HProcExchEntryID").val(), "HMaterSN": $("#HMaterSN").val(), "user": sessionStorage["HUserName"] },
                dataType: "json",
                success: function (data1) {
                    if (data1.count == 1) {
                        layer.close(index);
 
                        $("#HMaterNumber").val(data1.data[0]["HMainMaterNumber"]);
                        $("#HMaterID").val(data1.data[0]["HMainMaterID"]);
                        $("#HMaterName").val(data1.data[0]["HMainMaterName"]);
                        //$("#HProcExchInterID").val(data1.data[0]["HProcExchInterID"]);
                        //$("#HProcExchEntryID").val(data1.data[0]["HProcExchEntryID"]);
                        //$("#HProcExchBillNo").val(data1.data[0]["HProcExchBillNo"]);
                        //$("#HICMOBillNo").val(data1.data[0]["HICMOBillNo"]);
                        //$("#HICMOInterID").val(data1.data[0]["HICMOInterID"]);
                        //$("#HICMOEntryID").val(data1.data[0]["HICMOEntryID"]);
                        //$("#HProcNo").val(data1.data[0]["HProcNo"]);
                        //$("#HPieceQty").val(data1.data[0]["HPieceQty"]);
                        //$("#HICMOQty").val(data1.data[0]["HICMOQty"]);
 
                        option2 = {
                            elem: '#mainTable2'
                            //, toolbar: '#toolbarDemo'
                            , async: true
                            , page: false
                            //, totalRow: true
                            , cellMinWidth: 120
                            , data: data1.data
                            , height: 185
                            , cols: [[
                                { type: 'numbers', title: '序号' }
                                , { field: '日期', title: '日期' }
                                , { field: '配件代码', title: '配件代码' }
                                , { field: '配件名称', title: '配件名称' }
                                , { field: '配件规格', title: '配件规格' }
                                , { field: '配件数量', title: '配件数量' }
                                , { field: 'HBarCode', title: '当前配件码' }
                                , { field: 'HBatchNo', title: '当前批次' }
                                , { field: 'HICMOInterID', title: 'HICMOInterID', hide: true }
                                , { field: 'HICMOEntryID', title: 'HICMOEntryID', hide: true }
                                , { field: 'HICMOBillNo', title: 'HICMOBillNo', hide: true }
                                , { field: 'HProcExchInterID', title: 'HProcExchInterID', hide: true }
                                , { field: 'HProcExchEntryID', title: 'HProcExchEntryID', hide: true }
                                , { field: 'HProcExchBillNo', title: 'HProcExchBillNo', hide: true }
                                , { field: 'HMaterID', title: 'HMaterID', hide: true }
                                //, { field: 'HBarCode', title: 'HBarCode', hide: true }
                                , { fixed: 'right', title: '操作', toolbar: '#barDemo2' }
                            ]]
                        }
                        table.render(option2)
                    }
                    else {
                        layer.close(index);
                        layer.msg(data1.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    }
                    $("#HBarCodeSN").val("");
                },
                error: function (err) {
                    layer.close(index);
                    layer.msg("错误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                }
            });
        }
 
        //获取参数
        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;
        }
 
        //保存HMaker
        function set_AddNew() {
            var data1 = { "field": { "HInterID": $("#HInterID").val(), "HBillNo": $("#HBillNo").val(), "HProcExchBillNo": $("#HProcExchBillNo").val(), "HProcExchInterID": $("#HProcExchInterID").val(), "HProcExchEntryID": $("#HProcExchEntryID").val(), "HProcess": $("#HProcess").val(), "HICMOInterID": $("#HICMOInterID").val(), "HICMOEntryID": $("#HICMOEntryID").val(), "HICMOBillNo": $("#HICMOBillNo").val(), "HBarCode": $("#HMaterSN").val(), "HProdOrgID": sessionStorage["OrganizationID"] } };
 
            var HResult = "配件";
            var sMainStr = JSON.stringify(data1.field);
            var sSubStr = JSON.stringify(table.cache["mainTable2"][KNum]);
            var sMainSub = sMainStr + ';' + sSubStr  + ";" + sessionStorage["HUserName"] + ";" + HResult;
 
            var index = layer.load();
            $.ajax({
                type: "POST",
                url: GetWEBURL() + "/Cj_SingleStation/HFXAddRepairBill",
                async: false,
                data: { "sMainSub": sMainSub },
                dataType: "json",
                success: function (data) {
                    if (data.count == 1) {
                        //$('#btnSave').addClass("layui-btn-disabled").attr("disabled", true);
                        layer.close(index);
                        layer.msg("提交成功");
                        //查询更换记录
                        get_RepairRecord();
                    }
                    else {
                        layer.close(index);
                        layer.msg(data.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    }
                },
                error: function (err) {
                    layer.close(index);
                    layer.msg("错误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                }
            });
        }
 
        //非空验证
        function AllowLoadData(data) {
 
            var HBarCode = $("#HBarCode").val();
            if (HBarCode == "") {
                layer.msg("产品SN不能为空!")
                return false;
            }
 
            var HBadReasonID = $("#HBadReasonID").val();
            if (HBadReasonID == 0) {
                layer.msg("不良原因不能为空!")
                return false;
            }
            return true;
        }
 
        //#endregion
 
    });
</script>