1
wtt
2025-04-07 e095dbc7cc27e15d8aef898eb78fbdcb386186f0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
<!DOCTYPE html>
<html>
<head>
    <meta 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.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <!--引用layui样式文件-->
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <!--引用layui js文件-->
    <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="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <!--自定义样式-->
    <style>
        .layui-form-label {
            font-size: 14px;
            width: 85px;
            text-align: inherit;
        }
        /*全局设置输入框高度*/
        .layui-input {
            height: 30px;
        }
        /*设置表头输入框*/
        .t1_input {
            padding: 1%;
        }
        /*本站信息td*/
        .bz_td {
            display: -webkit-box; /*设置按钮不换行*/
            padding: 1%; /*设置输入框边距*/
        }
        /*设置本站信息按钮高度*/
        .bz_btu {
            height: 30px;
            width: 60px;
            line-height: 30px;
        }
 
        th {
            width: 70px;
            text-align: center;
        }
    </style>
</head>
<body>
    <div class="layui-fluid" style="padding: 0;">
        <div class="layui-card">
            <div class="layui-card-body" style="padding: 1px;">
                <form class="layui-form" action="" lay-filter="formData" id="formData" style="background-color:white;">
                    <div style="background-color:#0085E8;">
                        <span style="color: white;" class="jzd"><i class="layui-icon layui-icon-form"></i>检验取样单</span>
                    </div>
                    <div class="layui-form-item" style="margin: 1% 2%;text-align: right;">
                        <button type="button" lay-submit="" lay-filter="Add" class="layui-btn layui-btn-radius">新增</button>
                        <button type="button" lay-submit="" lay-filter="Saver" id="Saver" class="layui-btn layui-btn-radius">保存</button>
                        <button type="button" lay-submit="" lay-filter="Cancel" class="layui-btn layui-btn-radius layui-btn-danger">退出</button>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-tab layui-tab-card" lay-filter="TabTest">
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">
                                    <table style="width:80%;">
                                        <tbody>
                                            <tr>
                                                <th>条形码:</th>
                                                <td class="t1_input">
                                                    <input type="text" name="HBarCode" class="layui-input" id="HBarCode" placeholder="请输入条形码" style="border-radius: 50px;">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>工序:</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HProcName" class="layui-input" id="HProcName" placeholder="选择工序或输入流水号回车" style="border-radius: 50px;">
                                                    <input type="hidden" name="HProcID" id="HProcID" value="0" autocomplete="off" class="layui-input">
                                                    <button type="button" lay-submit="" class="layui-btn layui-col-xs2 bz_btu" lay-filter="Gy_ProcessList-BT" id="Gy_ProcessList-BT" style="font-weight:bolder">...</button>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>取样数量:</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HQty" class="layui-input" id="HQty" value="" placeholder="取样数量" style="border-radius: 50px;">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>破坏性实验数量:</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HSampleDamageQty" class="layui-input" id="HSampleDamageQty" value="0" placeholder="破坏性实验数量" style="border-radius: 50px;">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>送测类型:</th>
                                                <td class="bz_td">
                                                    <div class="layui-input-inline">
                                                        <select name="TestType" lay-filter="TestType" id="TestType">
                                                            <option value="首检">首检</option>
                                                            <option value="巡检">巡检</option>
                                                            <option value="未检">未检</option>
                                                            <option value="实验">实验</option>
                                                        </select>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>送测内容:</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HBadNote" class="layui-input" id="HBadNote" value="" placeholder="请输入送测内容" style="border-radius: 50px;">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>部门:</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HDeptName" class="layui-input" id="HDeptName" placeholder="选择部门" style="border-radius: 50px;">
                                                    <input type="hidden" name="HDeptID" id="HDeptID" value="0" autocomplete="off" class="layui-input">
                                                    <input type="hidden" name="HCenterID" id="HCenterID" value="0" autocomplete="off" class="layui-input">
                                                    <button type="button" lay-submit="" class="layui-btn layui-col-xs2 bz_btu" lay-filter="btnHDept" id="btnHDept" style="font-weight:bolder">...</button>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>生产班次:</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HShiftsName" class="layui-input" id="HShiftsName" placeholder="选择班次" style="border-radius: 50px;">
                                                    <input type="hidden" name="HShiftsID" id="HShiftsID" value="0" autocomplete="off" class="layui-input">
                                                    <button type="button" lay-submit="" class="layui-btn layui-col-xs2 bz_btu" lay-filter="WorkShiftList-BT" id="WorkShiftList-BT" style="font-weight:bolder">...</button>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>生产班组:</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HGroupName" class="layui-input" id="HGroupName" placeholder="选择生产班组" style="border-radius: 50px;">
                                                    <input type="hidden" name="HGroupID" id="HGroupID" value="0" autocomplete="off" class="layui-input">
                                                    <button type="button" lay-submit="" class="layui-btn layui-col-xs2 bz_btu" lay-filter="Group-BT" id="Group-BT" style="font-weight:bolder">...</button>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>取样员:</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HCheckEmpName" class="layui-input" id="HCheckEmpName" placeholder="选择取样员" style="border-radius: 50px;">
                                                    <input type="hidden" name="HCheckEmp" id="HCheckEmp" value="0" autocomplete="off" class="layui-input">
                                                    <button type="button" lay-submit="" class="layui-btn layui-col-xs2 bz_btu" lay-filter="HEmployeeID-BT" id="HEmployeeID-BT" style="font-weight:bolder">...</button>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>生产资源:</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HSourceName" class="layui-input" id="HSourceName" placeholder="选择生产资源" style="border-radius: 50px;">
                                                    <input type="hidden" name="HSourceID" id="HSourceID" value="0" autocomplete="off" class="layui-input">
                                                    <button type="button" lay-submit="" class="layui-btn layui-col-xs2 bz_btu" lay-filter="ProductionResources-BT" id="ProductionResources-BT" style="font-weight:bolder">...</button>
                                                </td>
                                            </tr>
 
                                            <tr>
                                                <th>单据日期</th>
                                                <td class="t1_input">
                                                    <input type="text" name="HDate" class="layui-input" id="HDate" style="border-radius: 50px; background-color: #efefef4d;" placeholder="请选择日期" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>单据号</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HBillNo" class="layui-input" id="HBillNo" placeholder="单据号" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                    <input type="hidden" name="HInterID" id="HInterID" value="0" autocomplete="off" class="layui-input">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>生产订单:</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HICMOBillNo" class="layui-input" id="HICMOBillNo" value="" style="border-radius: 50px; background-color: #efefef4d;" readonly>
                                                    <input id="HICMOInterID" name="HICMOInterID" type="hidden" />
                                                    <input id="HICMOEntryID" name="HICMOEntryID" type="hidden" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>流转卡:</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HProcExchBillNo" class="layui-input" id="HProcExchBillNo" value="" style="border-radius: 50px; background-color: #efefef4d;" readonly>
                                                    <input type="hidden" name="HProcExchInterID" id="HProcExchInterID" class="layui-input" value="0" style="float:left;width:150px;" disabled>
                                                    <input type="hidden" name="HProcExchEntryID" id="HProcExchEntryID" class="layui-input" value="0" style="float:left;width:150px;" disabled>
                                                    <input type="hidden" name="HMainSourceBillNo" id="HMainSourceBillNo" class="layui-input" value="0">
                                                    <input type="hidden" name="HMainSourceInterID" id="HMainSourceInterID" class="layui-input" value="0">
                                                    <input type="hidden" name="HMainSourceBillType" id="HMainSourceBillType" class="layui-input" value="0">
                                                    <input type="hidden" name="HMainSourceEntryID" id="HMainSourceEntryID" class="layui-input" value="0" autocomplete="off" disabled>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>物料代码:</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HMaterCode" class="layui-input" id="HMaterCode" value="" style="border-radius: 50px; background-color: #efefef4d;" readonly>
                                                    <input type="hidden" name="HMaterID" id="HMaterID" class="layui-input" value="0" style="float:left;width:150px;">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>物料名称:</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HMaterName" class="layui-input" id="HMaterName" value="" style="border-radius: 50px; background-color: #efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>规格型号:</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HMaterSpec" class="layui-input" id="HMaterSpec" value="" style="border-radius: 50px; background-color: #efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>计量单位:</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HUnitName" class="layui-input" id="HUnitName" value="" style="border-radius: 50px; background-color: #efefef4d;" readonly>
                                                    <input id="HUnitID" name="HUnitID" type="hidden" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>流转卡批号:</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HBatchNo" class="layui-input" id="HBatchNo" value="" style="border-radius: 50px; background-color: #efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>流转卡数量:</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HProcExchQty" class="layui-input" id="HProcExchQty" value="" style="border-radius: 50px; background-color: #efefef4d;" readonly>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <div class="layui-tab-item">
                                    <table style="width:80%;">
                                        <tbody>
                                            <tr>
                                                <th>制单人</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HMaker" class="layui-input" id="HMaker" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>制单日期</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HMakeDate" class="layui-input" id="HMakeDate" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>修改人</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HUpDater" class="layui-input" id="HUpDater" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>修改日期</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HUpDateDate" class="layui-input" id="HUpDateDate" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>审核人</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HChecker" class="layui-input" id="HChecker" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>审核日期</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HCheckDate" class="layui-input" id="HCheckDate" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>作废人</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HDeleteMan" class="layui-input" id="HDeleteMan" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>作废日期</th>
                                                <td class="bz_td">
                                                    <input type="text" name="HDeleteDate" class="layui-input" id="HDeleteDate" style="border-radius: 50px;background-color:#efefef4d;" readonly>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
                            </div>
                            <ul class="layui-tab-title">
                                <li class="layui-this">单据信息</li>
                                <li>制单信息</li>
                            </ul>
                        </div>
                    </div>
                    <!--隐藏字段-->
                    <!--<input type="hidden" name="lngProcInterID" id="lngProcInterID">
                    <input type="hidden" name="lngBillKey" id="lngBillKey" value="0">
                    <input type="hidden" name="lngBillSubKey" id="lngBillSubKey" value="0">
                    <input type="hidden" name="HMaker" id="HMaker">-->
                    <!--制单人-->
                    <!--<input type="hidden" name="eventType" id="eventType" value="Add">
                    <input type="hidden" name="HeqSouID" id="HeqSouID" value="0">-->
                </form>
            </div>
        </div>
    </div>
 
    <script>
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element', 'upload'], function () {
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
                , table = layui.table
                , form = layui.form
                , laydate = layui.laydate
                , element = layui.element;
            var params = get_UrlVars();
            var option = [];
            var titleData = [];
 
 
            if (typeof (params[params[0]]) == "undefined") {
                var OperationType = 1;//操作类型
                var closeType = 2;  //关闭类型
            } else {
                var OperationType = params[params[0]];//操作类型
                var linterid = params[params[1]];//源单id
                var HSouceBillType = params[params[2]];//源单类型
                var HBillNo = params[params[3]];//单据号
                var closeType = params[params[4]];  //关闭类型
            }
 
            //判断是否新增
            if (OperationType == 1 || OperationType == 2) {
                //获取最大单据号
                var ajaxLoad = layer.load();
                $.ajax({
                    url: GetWEBURL() + "/Web/GetMAXNum",
                    type: "GET",
                    data: { "HBillType": '7521' },
                    success: function (d) {
                        $("#HInterID").val(0);
                        $("#HBillNo").val(d.data[0].HBillNo);
                        layer.close(ajaxLoad);
                    }
                    , error: function () {
                        layer.close(ajaxLoad);
                        layer.msg("获取单据号失败,请刷新重试!");
                    }
                });
 
                GetDefValByUser();
            }
 
            //初始基本信息赋值
            $("#HDate").val(Pub_Format(new Date(), "yyyy-MM-dd"));
            $("#HMaker").val(sessionStorage["HUserName"]);
            $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));
            $("#HBarCode").focus();
 
            //#region 触发事件:包括form.on(){}格式的所有点击事件、选择事件等
 
            //扫条形码方法
            $('#HBarCode').on('keydown', function (event) {   //扫条形码
                var HBarCode = $('#HBarCode').val();//条形码(流转卡号)(数据库中为单据号)
                if (event.keyCode == 13) {
                    //判断文本框是否有数据    new
                    if (HBarCode == "") {
                        layer.alert("条形码为空!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        return;
                    }
                    $.ajax({
                        url: GetWEBURL() + "api/newBill/getHbarCodeDetail",
                        type: "GET",
                        data: {
                            "sBillBarCode": HBarCode
                        },
                        success: function (result) {
                            if (result.code == 1) { // 说明验证成功了,
                                layer.msg(result.msg);
                                var LoadData = result.data.h_v_Sc_ProcessExchangeBillList;
                               
                                $("#HMaterID").val(LoadData[0].HMaterID); //产品ID
                                $("#HMaterCode").val(LoadData[0].产品代码); //产品代码
                                $("#HMaterName").val(LoadData[0].产品); //产品名称
                                $("#HMaterSpec").val(LoadData[0].规格型号); //产品规格
                                $("#HUnitID").val(LoadData[0].HUnitID); //计量单位id
                                $("#HUnitName").val(LoadData[0].单位); //计量单位
                                $("#HMainSourceBillNo").val(LoadData[0].单据号); //源单单号
                                $("#HMainSourceInterID").val(LoadData[0].hmainid); //源单主内码
                                $("#HMainSourceBillType").val(3772); //源单类型
                                $("#HProcExchBillNo").val(LoadData[0].单据号); //流转卡号
                                $("#HProcExchInterID").val(LoadData[0].hmainid); //流转卡主内码(取值HInterID)
                                $("#HBatchNo").val(LoadData[0].批号); //流转卡批次
                                $("#HICMOInterID").val(LoadData[0].hicmointerid); //生产订单ID
                                $("#HICMOEntryID").val(LoadData[0].HICMOEntryID); //生产订单子ID
                                $("#HICMOBillNo").val(LoadData[0].任务单号); //生产订单
                                $("#HDeptID").val(LoadData[0].HWorkShopID); //车间ID
                                $("#HDeptName").val(LoadData[0].生产车间); //车间
                                 //$("#HProcID").val(LoadData[0].HProcID); //当前工序ID
                                //$("#HProcName").val(LoadData[0].HProcName); //当前工序
                                   //$("#HSourceID").val(LoadData[0].HSourceID); //生产资源ID
                                //$("#HSourceName").val(LoadData[0].HSourceName); //生产资源
                                /*   $("#HMainSourceEntryID").val(LoadData[0].HSourceEntryID); //源单子内码*/
                                    //$("#HProcExchEntryID").val(LoadData[0].HSourceEntryID); //流转卡子内码(源单行号)
                                   //$("#HProcExchQty").val(LoadData[0].HProcExchQty); //流转卡数量
                                //$("#HDeptID").val(LoadData[0].HDeptID); //车间ID
                                //$("#HDeptName").val(LoadData[0].HDeptName); //车间
                                $("#HBarCode").val("");
                                $("#HBarCode").css("box-shadow", "none");
                            } else {
                                layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                            }
                        }, error: function () {
                            layer.alert("扫条形码方法发生错误!", { icon: 5 });
                        }
                    });
                }
            });
 
            //流水号回车
            $('#HProcName').on('keydown', function (event) {   //扫条形码
                var HProcNo = $('#HProcName').val();
                var HBarCode = $('#HProcExchBillNo').val();
                if (event.keyCode == 13) {
                    if (HProcNo == "" || HBarCode == "") {
                        layer.alert("流水号或流转卡号为空!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        return;
                    }
                    HProcList(HBarCode, HProcNo);
                }
            });
 
 
            function HProcList(HBarCode, HProcNo) {
                $.ajax({
                    url: GetWEBURL() + "/api/newBill/getProcDetail",
                    type: "GET",
                    data: {
                        "sBillNo": HBarCode
                        , "sProcNo": HProcNo
                    },
                    success: function (result) {
                        var LoadData = result.data.h_v_Sc_ProcessExchangeBillList;
                        if (result.code == 1) { // 说明验证成功了,
                            $("#HProcID").val(LoadData[0].HProcID); //当前工序ID
                            $("#HProcName").val(LoadData[0].工序); //当前工序
                            $("#HSourceID").val(LoadData[0].HSourceID); //生产资源ID
                            $("#HSourceName").val(LoadData[0].生产资源); //生产资源
                            $("#HMainSourceEntryID").val(LoadData[0].hsubid); //源单子内码
                            $("#HProcExchEntryID").val(LoadData[0].hsubid); //流转卡子内码(源单行号)
                            $("#HProcExchQty").val(LoadData[0].流转卡数量); //流转卡数量
                            //$("#HDeptID").val(LoadData[0].HDeptID); //车间ID
                            //$("#HDeptName").val(LoadData[0].加工车间); //车间
                            $("#HCenterID").val(LoadData[0].HCenterID == null ? sessionStorage["HWorkCenterID"] : LoadData[0].HCenterID); //工作中心
                            $("#HProcNo").css("box-shadow", "none");
                            //获取班次
                            get_HWorkShift()
                        } else {
                            layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        }
                    }, error: function () {
                        layer.alert("流水号方法发生错误!", { icon: 5 });
                    }
                });
            }
 
 
            function ProcessExchangeBillQuerySub(sWhere) {
                $.ajax({
                    url: GetWEBURL() + "/LEMS/MES_Sc_ProcessExchangeBillQuerySub_Json",
                    type: "GET",
                    data: {
                        "sWhere": sWhere
                    },
                    success: function (result) {
                        var LoadData = result.data;
                        if (result.code == 1) { // 说明验证成功了,
                            $("#HProcID").val(LoadData[0].HProcID); //当前工序ID
                            $("#HProcName").val(LoadData[0].工序名称); //当前工序
                            $("#HSourceID").val(LoadData[0].HSourceID); //生产资源ID
                            $("#HSourceName").val(LoadData[0].生产资源); //生产资源
                            $("#HMainSourceEntryID").val(LoadData[0].hsubid); //源单子内码
                            $("#HProcExchEntryID").val(LoadData[0].hsubid); //流转卡子内码(源单行号)
                            $("#HProcExchQty").val(LoadData[0].流转卡数量); //流转卡数量
                            //$("#HDeptID").val(LoadData[0].HDeptID); //车间ID
                            //$("#HDeptName").val(LoadData[0].加工车间); //车间
                            $("#HCenterID").val(LoadData[0].HCenterID == null ? sessionStorage["HWorkCenterID"] : LoadData[0].HCenterID); //工作中心
                            $("#HProcNo").css("box-shadow", "none");
                            //获取班次
                            get_HWorkShift()
                        } else {
                            layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        }
                    }, error: function () {
                        layer.alert("流水号方法发生错误!", { icon: 5 });
                    }
                });
            }
 
            //#region 新增按钮
            form.on('submit(Add)', function () {//提交
                layer.confirm('新增后页面数据将消失?', { icon: 3, title: '提示' }, function (index) {
                    location.replace('QC_Add_TakeSampleCheckBill_PDA.html?');
                });
            })
            //#endregion
 
            //#region 保存按钮
            form.on('submit(Saver)', function (data) {//提交
                var refSav = "";
                if (OperationType == 1) {
                    refSav = "Add";
                } else {
                    refSav = "Update";
                }
                if ($("#HProcID").val() == "0") {
                    layer.msg("工序没有选择!");
                    return;
                }
                if ($("#HQty").val() == "") {
                    layer.msg("取样数量为空!");
                    return;
                }
                if ($("#HDeptID").val() == "0") {
                    layer.msg("部门没有选择!");
                    return;
                }
                if ($("#HShiftsID").val() == "0") {
                    layer.msg("班次未选择");
                    return;
                }
                if ($("#HGroupID").val() == "0") {
                    layer.msg("生产班组未选择");
                    return;
                }
                if ($("#HCheckEmp").val() == "0") {
                    layer.msg("取样员未选择");
                    return;
                }
                if ($("#HSourceID").val() == "0") {
                    layer.msg("生产资源未选择");
                    return;
                } else {
                    //获取表头数据并序列化
                    var sMainStr = JSON.stringify(data.field);              //主表数据
 
                    //拼接序列化的数据
                    var sMainSub = sMainStr + ';' + refSav + ";" + sessionStorage["HUserName"];
 
                    var index = layer.load();
                    $.ajax({
                        type: "POST",
                        url: GetWEBURL() + "QC_TakeSampleCheckBill/SaveQC_TakeSampleCheckBillMain",
                        async: true,
                        data: { "msg": sMainSub },
                        dataType: "json",
                        success: function (result) {
                            if (result.count == 1) {
                                $('#Saver').addClass("layui-btn-disabled").attr("disabled", true);//禁用保存按钮
                                layer.close(index);
                                layer.msg("提交成功");
                            }
                            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: "温馨提示" });
                        }
                    });
                }
 
            });
            //#endregion
 
            //#endregion
 
            //#region 本页面所有被调用的方法
 
            //#region 通过登录用户获取默认值
            function GetDefValByUser() {
                var index = layer.load();
                $.ajax({
                    url: GetWEBURL() + "/Cj_StationInBill/GetDefValByUser",
                    type: "GET",
                    data: { "Czybm": sessionStorage["Czybm"], "Czymc": sessionStorage["HUserName"] },
                    success: function (result) {
                        var data = result.data[0];
 
                        form.val("formData", {
                            "HSourceID": data.HSourceID,
                            "HSourceName": data.生产资源名称,
                            "HGroupID": data.HGroupID,
                            "HGroupName": data.生产班组名称,
                            "HGroupLeaderID": data.HEmpID,
                            "HGroupLeaderName": data.操作员名称
                        });
                        layer.close(index);
                    }
                    , error: function () {
                        layer.close(index);
                        layer.msg("接口请求失败");
                    }
                })
            }
            //#endregion
 
            //获取班次
            function get_HWorkShift() {
                var HDeptID = $("#HDeptID").val();
                var HCenterID = $("#HCenterID").val();
                $.ajax({
                    type: "GET",
                    url: GetWEBURL() + "/Gy_ShiftsController/Get_HWorkShift", //方法所在页面和方法名
                    data: {
                        "HDeptID": HDeptID,
                        "HCenterID": HCenterID
                    },
                    success: function (data) {
                        if (data.count == 1)// 说明验证成功了,
                        {
                            var LoadData = data.data;
                            $("#HShiftsID").val(LoadData[0].HInterID); //当前工序ID
                            $("#HShiftsName").val(LoadData[0].班次); //当前工序
                        }
                        else {
                            layer.alert(data.Message, { icon: 5 });
                        }
                    },
                    error: function (err) {
                        layer.alert(err, { icon: 5 });
                    }
                });
            }
 
 
           
            //选择部门弹窗
            form.on('submit(btnHDept)', function () {//部门
                layer.open({
                    type: 2 //类型
                    , skin: 'layui-layer-rim'//加上边框
                    , area: ['90%', '90%']//大小
                    , title: '部门列表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../Baseset/基础资料/Gy_DepartmentList.html?type=HDept1', 'yes']
                    , resize: false
                    , cancel: function (index, layero) {
                    }
                })
            });
 
         
            //选择生产班次弹窗
            form.on('submit(WorkShiftList-BT)', function () {//选择生产班组
                layer.open({
                    type: 2//弹窗类型
                    , skin: 'layui-layer-rim' //加上边框
                    , area: ['90%', '90%']//大小
                    , title: '班次列表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../基础资料/生产基础资料/Gy_WorkShiftList.html?type=HWorkShifts&openType=2', '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('请选择数据');
                        }
                        //获取数据
                        $("#HShiftsName").val(checkStatus.data[0].班次名称);
                        $("#HShiftsID").val(checkStatus.data[0].HInterID);
 
                        layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) { }
                    , end: function () { }
                })
            });
 
            //选择生产资源弹窗
            form.on('submit(ProductionResources-BT)', function () {//生产资源
                console.log($('#HProcNo').val())
                layer.open({
                    type: 2
                    , area: ['80%', '80%']
                    , title: '生产资源'
                    , shade: 0.6 //遮罩透明度
                    //, maxmin: true //允许全屏最小化
                    , anim: 0 //0-6的动画形式,-1不开启
                    , content: ['../../Baseset/基础资料/Gy_GetProductionResourcesList.html', 'yes']
                    , resize: false
                    , cancel: function (index, layero) {
                    }
                })
            });
 
 
            //选择工序弹窗
            form.on('submit(Gy_ProcessList-BT)', function () {//生产资源
                console.log($('#HProcNo').val())
                layer.open({
                    type: 2
                    , area: ['80%', '80%']
                    , title: '工序列表'
                    , shade: 0.6 //遮罩透明度
                    //, maxmin: true //允许全屏最小化
                    , anim: 0 //0-6的动画形式,-1不开启
                    , content: ['../../Baseset/基础资料/Gy_ProcessList.html?HStockOrgID=' + sessionStorage["OrganizationID"], 'yes']
                    , resize: false
                    , cancel: function (index, layero) {
                    }
                    , end: function () {
                        var HProcID = $('#HProcID').val();
                        var HBarCode = $('#HProcExchInterID').val();
                        var sWhere =  HBarCode + "  and HProcID=" + HProcID;
                        ProcessExchangeBillQuerySub(sWhere);
                    }
                })
            });
 
          
            //选择生产班组弹窗
            form.on('submit(Group-BT)', function () {//选择生产班组
                layer.open({
                    type: 2
                    , area: ['80%', '80%']
                    , title: '生产班组'
                    , shade: 0.6 //遮罩透明度
                    , maxmin: true //允许全屏最小化
                    , anim: 0 //0-6的动画形式,-1不开启
                    , content: ['../../Baseset/基础资料/Gy_GroupList.html?HStockOrgID=' + sessionStorage["OrganizationID"], 'yes']
                    , resize: false
                    , cancel: function (index, layero) {
                    }
                })
            });
 
 
 
            //选择操作人
            form.on('submit(HEmployeeID-BT)', function () {
                layer.open({
                    type: 2
                    , area: ['80%', '80%']
                    , title: '职员列表'
                    , shade: 0.6 //遮罩透明度
                    , maxmin: true //允许全屏最小化
                    , anim: 0 //0-6的动画形式,-1不开启
                    , content: ['../../Baseset/基础资料/Gy_EmployeeList.html?Type=HWorker', 'yes']
                    , resize: false
                    , cancel: function (index, layero) {
                    }
                })
            });
 
 
            //退出--全屏版
            form.on('submit(Cancel)', function () {
                layer.confirm('您确定要退出吗?', { icon: 3, title: '提示' }, function (index) {
                    parent.location.href = "../../../views/index_Mobile.html";
                });
            })
 
            //以上为layui模块
        });
        //返回部门
        function GetHDeptNameValue(obj) {
            $("#HDeptName").val(obj[0].HName);
            $("#HDeptID").val(obj[0].HItemID);
        }
        //返回班次
        function GetHWorkShiftsValue(obj) {
            $("#HShiftsName").val(obj[0].班次名称);
            $("#HShiftsID").val(obj[0].HInterID);
        }
 
        //返回生产资源
        function GetProductionResourcesValue(obj) {
            $("#HSourceName").val(obj[0].生产资源);
            $("#HSourceID").val(obj[0].HItemID);
        }
 
 
        //返回生产班组
        function GetHGroupValue(obj) {
            $("#HGroupName").val(obj[0].HName);
            $("#HGroupID").val(obj[0].HItemID);
        }
 
        //返回操作员
        function GetHWorkerValue(obj) {
            $("#HCheckEmpName").val(obj[0].HName);
            $("#HCheckEmp").val(obj[0].HItemID);
        }
 
        //返回工序
        function GetHProcValue(obj) {
            $("#HProcName").val(obj[0].HName);
            $("#HProcID").val(obj[0].HItemID);
        }
        
 
    </script>
</body>
</html>