1
duhe
2025-02-11 917f616d7841dde25a1dd79ab696097e87bf33e8
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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" style="background-color:white;">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>产线组托单</title>
    <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">
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <!--<script src="../CreateControl.js"></script>-->
    <style>
        .layui-form-label {
            font-size: 14px;
            width: 85px;
            text-align: inherit;
        }
    </style>
</head>
<body>
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-card-body" style="padding: 15px;">
                <form class="layui-form" action="" lay-filter="component-form-group">
                    <div class="layui-form-item" style="margin-bottom: 20px;">
                        <button type="button" lay-submit="" lay-filter="HAddBT" class="layui-btn layui-btn-radius">新增</button>
                        <button type="button" id="Saver-btn" lay-submit="" lay-filter="Saver" class="layui-btn layui-btn-radius">保存</button>
                        <button type="button" lay-submit="" lay-filter="Close" class="layui-btn layui-btn-radius layui-btn-danger">退出</button>
                        <div class="layui-inline">
                            <div class="layui-input-block">
                                <select name="dymb" id="dymb">
                                    <option value="ZTDPrint">组托单物料标识卡(网页版)</option>
                                </select>
                            </div>
                        </div>
                        <button type="button" lay-submit="" lay-filter="Print" id="Print" class="layui-btn layui-btn-radius">打印</button>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-row" style="padding:10px 0">
                            <div class="layui-col-xs3 layui-inline">
                                <fieldset class="layui-elem-field layui-field-title" style="text-align:center;">
                                    <legend>产线组托单</legend>
                                </fieldset>
                            </div>
                            <div class="layui-col-xs1 layui-inline">
                                <img src="222.jpg" style="width:70%;height:50%;" />
                            </div>
                            <div class="layui-col-xs4 layui-inline">
                                <div>
                                    <label class="layui-inline" style="width:70px;">装箱条码</label>
                                    <div class="layui-inline">
                                        <input type="text" style="border-radius: 50px;width: 140%;" name="HBarCode_Pack" id="HBarCode_Pack" placeholder="请输入装箱条码" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div>
                                    <label class="layui-inline" style="width:70px;"><span style="color:red">*</span>入库批次</label>
                                    <div class="layui-inline">
                                        <input type="text" style="border-radius: 50px;width: 140%;" name="HBatchNo" id="HBatchNo" placeholder="请输入入库批次" autocomplete="off" class="layui-input" lay-verify="required">
                                    </div>
                                </div>
                                <div>
                                    <label class="layui-inline" style="width:70px;">黑标号</label>
                                    <div class="layui-inline">
                                        <input type="text" style="border-radius: 50px;width: 140%;" name="HBarCode_Cus" id="HBarCode_Cus" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <div class="">
                                    <label class="layui-inline" style="width:60px;">装箱数量</label>
                                    <div class="layui-inline">
                                        <input type="text" style="border-radius: 50px;" name="" id="zxQty" placeholder="请输入装箱数量" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--待接收工单&今日进站-->
                    <div class="layui-card layui-form-item">
                        <div class="layui-card-body">
                            <div class="layui-tab">
                                <ul class="layui-tab-title" lay-filter="tab-all">
                                    <li data-status="" class="layui-this">扫码记录</li>
                                </ul>
                                <div class="layui-tab-content">
                                    <div class="layui-tab-item layui-show">
                                        <div class="layui-row">
                                            <div class="layui-col-xs12">
                                                <table class="layui-hide" id="ztd-table" lay-filter="ztd-table"></table>
                                                <script type="text/html" id="smjl-toolbar">
                                                    <div class="layui-btn-container">
                                                        <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-getCheckData"><i class="layui-icon layui-icon-tips"></i>预览</button>-->
                                                        <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-reload"><i class="layui-icon layui-icon-refresh"></i>刷新</button>-->
                                                        <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-confirm" id="btn_confirm"><i class="layui-icon layui-icon-ok-circle"></i>确认</button>-->
                                                        <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-back" id="btn_back"><i class="layui-icon layui-icon-close-fill"></i>删行</button>
                                                        <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-details"><i class="layui-icon layui-icon-form"></i>编辑</button>
                                                        <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-generate"><i class="layui-icon layui-icon-file"></i>生成送货单</button>-->
                                                        <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-exit"><i class="layui-icon layui-icon-return"></i>退出</button>-->
                                                    </div>
                                                </script>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--当前工单&其他信息-->
                    <div class="layui-form-item">
                        <div class="layui-col-md8 layui-card-body layui-inline">
                            <div class="layui-tab">
                                <ul class="layui-tab-title" lay-filter="tab-all">
                                    <li data-status="" class="layui-this">包装信息</li>
                                    <li data-status="2">其他信息</li>
                                </ul>
                                <div class="layui-tab-content">
                                    <div class="layui-tab-item layui-show" style="height:250px;">
                                        <table>
                                            <tbody>
                                                <tr>
                                                    <th style="width:80px;padding:10px">流转卡号</th>
                                                    <td>
                                                        <input type="text" name="流转卡号" id="" lay-verify="" autocomplete="off" placeholder="流转卡号" class="layui-input" style="background-color:#efefef4d" readonly>
                                                        <input type="hidden" name="流转卡ID" id="HFbarcodeID">
                                                    </td>
                                                    <th style="width:80px;padding:10px">组装时间</th>
                                                    <td>
                                                        <input type="text" name="组装时间" class="layui-input" id="HDateNow" placeholder="组装时间" style="background-color:#efefef4d;" readonly>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <th style="width:80px;padding:10px">生产订单号</th>
                                                    <td>
                                                        <input type="text" name="生产订单号" id="HSourceBillNo" lay-verify="" autocomplete="off" placeholder="生产订单号" class="layui-input" style="background-color:#efefef4d" readonly>
                                                    </td>
                                                    <th style="width:80px;padding:10px">产品代码</th>
                                                    <td>
                                                        <input type="text" name="产品代码" class="layui-input" id="HNumber" placeholder="产品代码" style="background-color:#efefef4d;" readonly>
                                                        <input type="hidden" name="物料内码" id="HMaterID">
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <th style="width:80px;padding:10px">产品名称</th>
                                                    <td>
                                                        <input type="text" name="产品名称" id="HMaterName" lay-verify="" autocomplete="off" placeholder="产品名称" class="layui-input" style="background-color:#efefef4d" readonly>
                                                    </td>
                                                    <th style="width:80px;padding:10px">规格型号</th>
                                                    <td>
                                                        <input type="text" name="规格型号" class="layui-input" id="HModel" placeholder="规格型号" style="background-color:#efefef4d;" readonly>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <th style="width:80px;padding:10px">计量单位</th>
                                                    <td>
                                                        <input type="text" name="计量单位" id="" lay-verify="" autocomplete="off" placeholder="计量单位" class="layui-input" style="background-color:#efefef4d" readonly>
                                                    </td>
                                                    <th style="width:80px;padding:10px">流转卡数量</th>
                                                    <td>
                                                        <input type="text" name="流转卡数量" class="layui-input" id="" placeholder="流转卡数量" style="background-color:#efefef4d;" readonly>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <th style="width:80px;padding:10px">生产订单数量</th>
                                                    <td>
                                                        <input type="text" name="生产订单数量" id="" lay-verify="" autocomplete="off" placeholder="生产订单数量" class="layui-input" style="background-color:#efefef4d" readonly>
                                                    </td>
                                                    <th style="width:80px;padding:10px">单据号</th>
                                                    <td>
                                                        <input type="text" name="HBillNo" class="layui-input" id="HBillNo" placeholder="单据号" style="background-color:#efefef4d;" readonly>
                                                        <input type="hidden" name="HInterID" id="HInterID">
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <th style="width:80px;padding:10px">订单跟踪号</th>
                                                    <td>
                                                        <input type="text" name="订单跟踪号" id="" lay-verify="" autocomplete="off" placeholder="订单跟踪号" class="layui-input" style="background-color:#efefef4d" readonly>
                                                    </td>
                                                    <th style="width:80px;padding:10px">托条码</th>
                                                    <td>
                                                        <input type="text" name="托条码" class="layui-input" id="HBarCode_wym" placeholder="托条码" style="background-color:#efefef4d;" readonly>
                                                        <!--隐藏字段-->
                                                        <input type="hidden" name="HUnitID" id="HUnitID">
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <th style="width:80px;padding:10px">项目号</th>
                                                    <td>
                                                        <input type="text" name="项目号" id="HProjectNum" lay-verify="" autocomplete="off" placeholder="项目号" class="layui-input" style="background-color:#efefef4d" readonly>
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class="layui-tab-item" style="height:250px;">
                                        <table>
                                            <tbody>
                                                <tr>
                                                    <th style="width:80px;padding:10px">制单人</th>
                                                    <td>
                                                        <input type="text" name="HMaker" id="HMaker" lay-verify="" autocomplete="off" placeholder="制单人" class="layui-input" style="background-color:#efefef4d" readonly>
                                                    </td>
                                                    <th style="width:80px;padding:10px">制单日期</th>
                                                    <td>
                                                        <input type="text" name="HMakeDate" class="layui-input" id="HMakeDate" placeholder="制单日期" style="background-color:#efefef4d;" readonly>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <th style="width:80px;padding:10px">修改人</th>
                                                    <td>
                                                        <input type="text" name="修改人" id="" lay-verify="" autocomplete="off" placeholder="修改人" class="layui-input" style="background-color:#efefef4d" readonly>
                                                    </td>
                                                    <th style="width:80px;padding:10px">修改日期</th>
                                                    <td>
                                                        <input type="text" name="修改日期" class="layui-input" id="" placeholder="修改日期" style="background-color:#efefef4d;" readonly>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <th style="width:80px;padding:10px">审核人</th>
                                                    <td>
                                                        <input type="text" name="审核人" id="" lay-verify="" autocomplete="off" placeholder="审核人" class="layui-input" style="background-color:#efefef4d" readonly>
                                                    </td>
                                                    <th style="width:80px;padding:10px">审核日期</th>
                                                    <td>
                                                        <input type="text" name="审核日期" class="layui-input" id="" placeholder="审核日期" style="background-color:#efefef4d;" readonly>
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
 
    <script type="text/html" id="toolBar">
        <a class="layui-btn layui-btn-xs" lay-event="del" style="background-color: red;">删除</a>
    </script>
 
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/Scripts/json2.js" type="text/javascript"></script>
    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="../../../layuiadmin/Scripts/webConfig2.js"></script>
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <script>
 
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
            var $ = layui.$
                , admin = layui.admin
                , element = layui.element
                , layer = layui.layer
                , laydate = layui.laydate
                , table = layui.table
                , form = layui.form
                , util = layui.util;
 
            var zxQty;//输入的装箱数量
            var zxQtyFlag = 0;
         
 
 
            //判断是否登录 未登录则跳到登录页
            if (sessionStorage.login != "login") {
                layer.confirm("登录失效,请重新登录!", {
                    icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
                }, function () { parent.location.href = "../user/login.html"; });
                return;
            }
            //单据类型
            var HBillTyp = '2601';
            $('#HMaker').val(sessionStorage["HMaker"]);
            $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
            //进入页面默认装箱码不能填
            $("#HBarCode_Pack").attr("readonly", "readonly");//数量只读
            $("#HBarCode_Pack").css("background-color", "#efefef4d");
            //进入页面默认光标在装箱数量上
            $("#zxQty").focus();
            $("#zxQty").css("box-shadow", "0 0 0 1px #00ff00");
 
            //页面初始化赋值
            //获取单据号
            layer.load(3);
            $.ajax({
                url: GetWEBURL() + "/Web/GetMAXNum",
                type: "GET",
                async: false,
                data: { "HBillType": '3783' }, 
                success: function (d) {
                    $("#HInterID").val(d.data[0].HInterID);
                    $("#HBillNo").val(d.data[0].HBillNo);
                    layer.closeAll("loading");
                }, error: function () {
                    layer.closeAll("loading");
                    layer.alert("获取单据号失败!", { icon: 5 });
                }
            });
 
            //主表列表
            var option = {
                elem: '#ztd-table'
                //, toolbar: '#toolbarDemo'
                //, page: true
                //, height: 256
                , cellMinWidth: 90
                , limit: 500
                , cols: [[
                    { type: 'numbers', title: '序号', hide: true }
                    , { field: 'HInterID', title: '单据ID', hide: true }
                    , {
                        field: 'HDate', title: '制单日期', width: 110, templet: function (d) {
                            if (d.HDate == null) {
                                return "";
                            }
                            return util.toDateString(d.HDate, "yyyy-MM-dd");
                        }
                    }
                    , { field: 'HBillNo', title: '包装单号' }
                    , { field: 'HRemark', title: '不满箱标识' }
                    , { field: 'HMaker', title: '制单人' }
                    , { field: 'HICMOBillNo', title: '流转卡号' }
                    , { field: 'HBarCode_Pack', title: '装箱码' }
                    , { toolbar: '#toolBar', width: 65, fixed: 'right' }
                    //, { field: 'HBillType', title: 'HBillType', hide: true }
                ]]
                , text: {
                    none: '暂无相关数据,请先扫描装箱条码!' //默认:无数据。注:该属性为 layui 2.2.5 开始新增
                }
            };
 
            //初始加载表格
            option.data = [];
            table.render(option);
 
 
            //填写装箱数量后光标跳走
            $('#zxQty').on('keydown', function (event) {
                zxQty = $("#zxQty").val();
                if (event.keyCode == 13) {
                    if (!(/(^[1-9]\d*$)/.test(zxQty))) {
                        layer.msg("请输入正确的整数!");
                        return;
                    }
                  
                    if (zxQty == "" || zxQty <= 0) {
                        layer.msg("请输入正确的数量!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        return;
                    } else {
                        $("#zxQty").val("" + zxQtyFlag + "/" + zxQty + "");
                        $("#zxQty").attr("readonly", "readonly");//数量只读
                        $("#zxQty").css("background-color", "#efefef4d");
                        $("#zxQty").css("box-shadow", "none");
                        //光标跳转到装箱码上
                        $("#HBarCode_Pack").removeAttr("readonly");//移除子件条码只读
                        $("#HBarCode_Pack").css("background-color", "white");
                        $("#HBarCode_Pack").focus();
                        $("#HBarCode_Pack").css("box-shadow", "0 0 0 1px #00ff00");
                    }
                }
            });
 
 
            //扫装箱码
            $('#HBarCode_Pack').on('keydown', function (event) {
                if (sessionStorage.login != "login") {
                    layer.confirm("登录失效,请重新登录!", {
                        icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
                    }, function () { parent.location.href = "../user/login.html"; });
                }
 
                if (event.keyCode == 13) {
                    if (zxQty == zxQtyFlag) {
                        layer.alert("装箱数量已扫完,请点击保存!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        return;
                    }
                }
 
                var HInterID = $('#HInterID').val();
                var HBillNo = $('#HBillNo').val();
                var HMaker = $('#HMaker').val();
                var HBarCode_Pack = $('#HBarCode_Pack').val();
                if (event.keyCode == 13) {
                    var index = layer.load();
                    $.ajax({
                        url: GetWEBURL() + "/GroupOrderBill/GetPackBarCode",
                        type: "GET",
                        data: {
                            "HInterID": HInterID
                            , "HBillNo": HBillNo
                            , "HBillTyp": HBillTyp
                            , "HMaker": HMaker
                            , "HBarCode_Pack": HBarCode_Pack
                        },
                        success: function (result) {
                            if (result.count == 1) { // 说明验证成功了,
                                var sSubStr = result.data;
                                //var tableStr = table.cache['ztd-table'];
                                //for (var i = 0; i < tableStr.length; i++) {
                                //    if (tableStr[i].HBarCode_Pack == sSubStr[0].HBarCode_Pack) {
                                //        layer.close(index);
                                //        $('#HBarCode_Pack').val("");
                                //        layer.msg("该装箱码已扫描,请勿重复扫码", { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                                //        return;
                                //    }
                                //}
                                zxQtyFlag++;
                                $("#zxQty").val("" + zxQtyFlag + "/" + zxQty + "");
                                var datas = table.cache["ztd-table"];
                                option.data = datas;
                                option.data.push(sSubStr[0]);
                                table.render(option);
                                layer.close(index);
                                $('#HBarCode_Pack').val("");
                                layer.msg("扫码成功!", { icon: 1, time: 1000 });
                            }
                            else {
                                layer.close(index);
                                layer.msg(result.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: "温馨提示" });
                        }
                    });
                }
            });
 
            //保存提交
            form.on('submit(Saver)', function (data) {//提交
 
                if (parseInt(zxQty) > zxQtyFlag) {
                    layer.alert("装箱数量未扫完,请扫完装箱数量!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                    return;
                }
 
                //var tableData = data.field;
                var oMain = data.field;
                var index = layer.load();
                $.ajax({
                    type: "POST",
                    url: GetWEBURL() + "/GroupOrderBill/AddBill",
                    //url:"http://localhost:12761/GroupOrderBill/AddBill",
                    async: true,
                    data: { "oMain": oMain },
                    dataType: "json",
                    success: function (data) {
                        if (data.count == 1) {
                            layer.close(index);
                            $('#Saver-btn').addClass("layui-btn-disabled").attr("disabled", true);
                            //$("#Print").click();
                            layer.confirm(
                                '保存成功!请继续选择操作!',
                                {
                                    skin: 'layui-layer-lan',
                                    closeBtn: 0,
                                    btn: ['新增', '关闭'],
                                    btn2: function () {//新增
                                        parent.layui.admin.events.closeThisTabs();
                                    }
                                }, function () {//关闭
                                    window.location.reload();
                                }
                            );
                        }
                        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: "温馨提示" });
                    }
                });    
                
            });
 
            //退出按钮
            form.on('submit(Close)', function (data) {//退出
                layer.confirm('您确定要关闭本页吗?', { icon: 3, title: '提示' }, function (index) {
                    parent.layui.admin.events.closeThisTabs();
                });
            });
 
            //新增按钮
            form.on('submit(HAddBT)', function (data) {//退出
                layer.confirm('您确定要新增吗?', { icon: 3, title: '提示' }, function (index) {
                    window.location.reload();
                });
            });
 
            //打印按钮
            form.on('submit(Print)', function (data) {//退出
                //打开打印模板
                var linterid = $("#HInterID").val();
                //var linterid = "28973";dymb
                var Type = $("#dymb").val();
                var OpenTmp = $("#dymb").text().trim();
                //var ReportViewer = document.getElementById("ReportViewer");
                window.open("../../views/BaseSet/HBarPlanPrint.html?linterid=" + linterid.toString() + "&Type=" + Type.toString() + "&OpenTmp=" + OpenTmp.toString());
            });
 
            //监听表格中行工具事件
            table.on('tool(ztd-table)', function (obj) { //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
                var data = obj.data //获得当前行数据
                    , layEvent = obj.event; //获得 lay-event 对应的值
                if (layEvent === 'detail') {
                    layer.msg('查看操作');
                } else if (layEvent === 'del') {
                    layer.confirm('真的删除行么', function (index) {
                        $.ajax({
                            url: GetWEBURL() + '/GroupOrderBill/DelCacheListByBarCode',
                            type: "GET",
                            data: { "BarCode": obj.data.HBarCode_Pack },
                            success: function (data) {
                                if (data.count == 1) {
                                    zxQtyFlag--;
                                    if (zxQtyFlag == 0) {
                                        $("#zxQty").val(zxQty);
                                        //移除只读属性
                                        $("#zxQty").removeAttr("readonly");//移除子件条码只读
                                        $("#zxQty").css("background-color", "white");
                                        $("#zxQty").css("box-shadow", "0 0 0 1px #00ff00");
                                        $("#HBarCode_Pack").css("box-shadow", "none");
                                        $("#zxQty").focus();
                                    } else {
                                        $("#zxQty").val("" + zxQtyFlag + "/" + zxQty + "");
                                    }
                                    layer.close(index);
                                    obj.del(); //删除对应行(tr)的DOM结构
                                    layer.msg('删除成功');
                                } else {
                                    layer.alert(data.code + data.msg, { icon: 5 });
                                }
                            }, error: function () {
                                layer.msg("接口请求失败!", {
                                    icon: 5, btn: ['确认'], time: 100000, offset: 't',
                                    skin: 'layui-layer-lan', title: "温馨提示"
                                });
                            }
                        });
                    });
                } else if (layEvent === 'edit') {
                    layer.msg('编辑操作');
                }
            });
 
            //setInterval(function () {
            //    if (sessionStorage.login != "login") {
            //        layer.confirm("登录失效,请重新登录!", {
            //            icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
            //        }, function () { parent.location.href = "../user/login.html"; });
            //    }
            //}, 3600000);
            //以上为layui模块
        });
 
                //function window_onload() {
                //    Report.LoadFromURL("../grf/包装单物料标识卡(网页版).grf");
 
                //}
                //function btnPrint_onclick() {
                //    var linterid = "28973";
                //    //Report.LoadDataFromURL("../../views/Baseset/xmlSRM_Web_BarCodeBillList.aspx?linterid=" + linterid, true, "");
 
                //    Report.Print(true);
                //}
 
    </script>
</body>
</html>