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
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
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
<!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="../../../layuiadmin/grwebapp.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-header"></div>-->
            <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" lay-submit="" lay-filter="" class="layui-btn layui-btn-radius">清空</button>-->
                        <button type="button" 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="city" lay-verify="required" id="dymb">
                                    <!--<option value="未选择">请选择打印模板</option>-->
                                    <option value="HBarCodePrint">物料条码模板</option>
                                    <!--<option value="HPOInStockBill">送货单</option>-->
                                    <!--<option value="HPOInStockBill">送货单(标签纸)</option>-->
                                </select>
                            </div>
                        </div>
                        <button type="button" lay-submit="" lay-filter="Print" id="Print" class="layui-btn layui-btn-radius">打印</button>
                        <button type="button" lay-submit="" lay-filter="Print2" id="Print2" hidden="hidden" ></button>
                        <div class="layui-inline" style="width: 200px;">
                            <div class="layui-input-block">
                                <select name="PrintName" lay-verify="required" id="PrintName">
                                    <option value="斯莫尔" selected>斯莫尔</option>
                                    <option value="普菲特">普菲特</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <div class="layui-input-block">
                                <select name="LDM" lay-verify="required" id="LDM">
                                    <option value="DU3" selected>DU3</option>
                                    <option value="QDR">QDR</option>
                                    <option value="AAA">15车间</option>
                                    <option value="其他">其他</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <div class="layui-input-block">
                                <select name="BBM" lay-verify="required" id="BBM">
                                    <option value="1099081-00-E">1099081-00-E</option>
                                    <option value="1786947-00-B">1786947-00-B</option>
                                    <option value="1607222-00-B">1607222-00-B</option>
                                    <option value="1943600-00-B">1943600-00-B</option>
                                    <option value="1941600-00-B">1941600-00-B</option>
                                    <option value="1941600-00-C">1941600-00-C</option>
                                    <option value="1943600-00-C">1943600-00-C</option>
                                    <option value="其他" selected>其他</option>
                                </select>
                            </div>
                        </div>
                    </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 class="" hidden="hidden">
                                    <label class="layui-inline" style="width:60px;">流转卡号</label>
                                    <div class="layui-inline">
                                        <input type="text" style="border-radius: 50px;width: 140%;" name="流转卡号" id="HFbarcode" placeholder="请输入流转卡号" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="">
                                    <label class="layui-inline" style="width:60px;">子件条码数量</label>
                                    <div class="layui-inline">
                                        <input type="text" lay-verify="verifyPcmQty" style="border-radius: 50px;width: 140%;" name="子件条码数量" id="pcmQty" autocomplete="off" placeholder="请输入子件条码数量" class="layui-input">
                                    </div>
                                </div>
                                <div class="">
                                    <label class="layui-inline" style="width:60px;">子件条码</label>
                                    <div class="layui-inline">
                                        <input type="text" style="border-radius: 50px;width: 140%;" name="子件条码" id="SubBarcode" autocomplete="off" placeholder="请输入子件条码" class="layui-input">
                                    </div>
                                </div>
                                <div class="" hidden="hidden">
                                    <label class="layui-inline" style="width:60px;">是否混箱</label>
                                    <div class="layui-inline">
                                        <input type="checkbox" id="HMixedBox" name="HMixedBox" lay-skin="primary" value="" lay-filter="HMixedBox">
                                    </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 class="" hidden="hidden">
                                    <label class="layui-inline" style="width:60px;">不满箱标识</label>
                                    <div class="layui-inline">
                                        <input type="text" style="border-radius: 50px;" name="" id="HRemark" autocomplete="off" placeholder="请输入不满箱标识" class="layui-input">
                                    </div>
                                </div>
                                <div class="">
                                    <label class="layui-inline" style="width:60px;">白标号</label>
                                    <div class="layui-inline">
                                        <input type="text" style="border-radius: 50px;" name="" id="HBarCode_White" autocomplete="off" placeholder="白标号" 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="smjl-table" lay-filter="smjl-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" hidden="hidden">流转卡号</th>
                                                    <td hidden="hidden">
                                                        <input type="text" name="流转卡号" id="HProcExchBillNo" 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" hidden="hidden">生产订单号</th>
                                                    <td hidden="hidden">
                                                        <input type="text" name="生产订单号" id="HSourceBillNo" lay-verify="" autocomplete="off" placeholder="生产订单号" class="layui-input" style="background-color:#efefef4d" readonly>
                                                    </td>
                                                    <th hidden="hidden" style="width:80px;padding:10px">产品代码</th>
                                                    <td hidden="hidden">
                                                        <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 hidden="hidden" style="width:80px;padding:10px">产品名称</th>
                                                    <td hidden="hidden">
                                                        <input type="text" name="产品名称" id="HMaterName" lay-verify="" autocomplete="off" placeholder="产品名称" class="layui-input" style="background-color:#efefef4d" readonly>
                                                    </td>
                                                    <th hidden="hidden" style="width:80px;padding:10px">规格型号</th>
                                                    <td hidden="hidden">
                                                        <input type="text" name="规格型号" class="layui-input" id="HModel" placeholder="规格型号" style="background-color:#efefef4d;" readonly>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <th hidden="hidden" style="width:80px;padding:10px">计量单位</th>
                                                    <td hidden="hidden">
                                                        <input type="text" name="计量单位" id="" lay-verify="" autocomplete="off" placeholder="计量单位" class="layui-input" style="background-color:#efefef4d" readonly>
                                                    </td>
                                                    <th hidden="hidden" style="width:80px;padding:10px">流转卡数量</th>
                                                    <td hidden="hidden">
                                                        <input type="text" name="流转卡数量" class="layui-input" id="" placeholder="流转卡数量" style="background-color:#efefef4d;" readonly>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <th hidden="hidden" style="width:80px;padding:10px">生产订单数量</th>
                                                    <td hidden="hidden">
                                                        <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="HBillNo2" placeholder="单据号" style="background-color:#efefef4d;" readonly>
                                                        <input type="hidden" name="单据号ID" id="HInterID">
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <th hidden="hidden" style="width:80px;padding:10px">订单跟踪号</th>
                                                    <td hidden="hidden">
                                                        <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 hidden="hidden" style="width:80px;padding:10px">项目号</th>
                                                    <td hidden="hidden">
                                                        <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="制单人" 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>
                                                <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 id="" style="display:none;">
                            <audio id="cs" hidden controls>
                                <source src="../../video/jingbao.wav" type="audio/ogg">
                            </audio>
                        </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="../../CreateControl.js"></script>
    <script>
        //CreateReport("Report");
        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;
        }
        var params = getUrlVars();
        var BillStatusjson = params[params[0]];
        var InterID = params[params[1]];
 
        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;
 
            //判断是否登录 未登录则跳到登录页
            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 option = [];
            set_InitGrid();
 
            //初始化明细表格
            function set_InitGrid() {
                columns = [
                    { type: 'numbers', title: '序号' }
                    , {
                        field: time, title: '扫码日期', width: 110, templet: function (d) {
                            return util.toDateString(time, "yyyy-MM-dd");
                        }
                    }
                    //, { field: 'HBarCode_Pack', title: '条形码', width: 145 }
                    , { field: 'HSourceBillNo', title: '条形码', width: 145 }
                    , { field: 'HBillNo', title: '源单单号', width: 125 }
                    , { field: 'HBarCode', title: '唯一码', width: 125 }
                    , { field: 'HNumber', title: '物料编码', width: 105 }
                    , { field: 'HName', title: '物料名称', width: 105 }
                    , { field: 'HModel', title: '规格型号', width: 105 }
                    , { field: 'HQty', title: '数量', width: 80 }
                    //, { field: 'HWhID', title: '仓库', width: 80 }
                    , { field: 'HMaker', title: '制单人', width: 80 }
                    , { field: 'HMakeDate', title: '制单日期', width: 195 }
                    , { toolbar: '#toolBar', width: 65, fixed: 'right' }
                ];
                option = {
                    id: 'smjl-table'
                    , elem: '#smjl-table'
                    //, toolbar: '#toolbarDemo'
                    , page: false
                    //, cellMinWidth: 120
                    //, height: 500
                    , cols: [columns]
                    //, limit: 500 //每页默认显示的数量
                    , done: function (res, curr, count) {
                    }
                };
            }
            //全局变量
            var ZJTMFlag = false;//子件条码输入标记
            //获取当前时间处理
            var data = new Date();
            var year = data.getFullYear();  //获取年
            var month = data.getMonth() + 1;    //获取月
            var day = data.getDate(); //获取日
            var time = year + "-" + month + "-" + day;
 
            var sMaker = sessionStorage["HMaker"];
            var zxQty;//输入的装箱数量
            var zxQtyFlag = 0;
            var pcmQty;//输入的批次码数量
            var pcmQtyFlag = 0;
            var icmoQty = 0;//流转卡数量
            var icmoQtyNow = 0;//流转卡剩余数量
            //console.log(sessionStorage);
 
            //页面初始化赋值
            layer.load(3);
            //获取单据号
            getBillno();
         
            $("#HDateNow").val(time);//加载当前时间
            $("#zxQty").focus();
            //$("#HFbarcode").css("box-shadow", "0 0 0 1px #00ff00");
            $("#SubBarcode").attr("readonly", "readonly");//子件条码只读
            $("#SubBarcode").css("background-color", "#efefef4d");
            //$("#zxQty").attr("readonly", "readonly");//数量只读
            //$("#zxQty").css("background-color", "#efefef4d");
            $("#HFbarcode").attr("readonly", "readonly");
            $("#HFbarcode").css("background-color", "#efefef4d");
            $("#pcmQty").attr("readonly", "readonly");//数量只读
            $("#pcmQty").css("background-color", "#efefef4d");
 
 
            //填写装箱数量后光标跳走
            $('#zxQty').on('keydown', function (event) {
                zxQty = $("#zxQty").val();
                if (event.keyCode == 13) {
                    if (!(/(^[1-9]\d*$)/.test(zxQty))) {
                        playSound();
                        layer.msg("请输入正确的整数!");
                        return;
                    }
              
                    if (zxQty == "" || zxQty <= 0) {
                        playSound();
                        layer.msg("请输入正确的数量!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        return;
                    } else {
                        $("#zxQty").attr("readonly", "readonly");//数量只读
                        $("#zxQty").css("background-color", "#efefef4d");
                        $("#zxQty").css("box-shadow", "none");
                      
                        pcmQty = zxQty;
                        $("#pcmQty").val(zxQty);//子件条码数量 默认为 = 装箱数量
                        $("#SubBarcode").removeAttr("readonly");//移除子件条码只读
                        $("#SubBarcode").css("background-color", "white");
                        $("#SubBarcode").focus();
                        $("#SubBarcode").css("box-shadow", "0 0 0 1px #00ff00");
                        HFbarcodeKeydown();
                    }
                }
            });
 
            //填写子件条码数量后光标跳走
            $('#pcmQty').on('keydown', function (event) {
                pcmQty = $("#pcmQty").val();
                if (event.keyCode == 13) {
                    if (!(/(^[1-9]\d*$)/.test(pcmQty))) {
                        playSound();
                        layer.msg("请输入正确的整数!");
                        return;
                    }
                    //判断文本框是否有数据    new
                    if (pcmQty > icmoQty) {
                        playSound();
                        layer.msg("子件条码数量不允许大于流转卡数量!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        return;
                    }
                    if (pcmQty == "" || pcmQty <= 0) {
                        playSound();
                        layer.msg("请输入正确的数量!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        return;
                    } else {
                        $("#pcmQty").attr("readonly", "readonly");//数量只读
                        $("#pcmQty").css("background-color", "#efefef4d");
                        $("#pcmQty").css("box-shadow", "none");
                        $("#SubBarcode").removeAttr("readonly");//移除子件条码只读
                        $("#SubBarcode").css("background-color", "white");
                        $("#SubBarcode").focus();
                        $("#SubBarcode").css("box-shadow", "0 0 0 1px #00ff00");
                    }
                }
            });
 
 
            form.on('checkbox(HMixedBox)', function (obj) {
                if (icmoQtyNow == 0) {
                    playSound();
                    layer.msg("剩余数量为" + icmoQtyNow + ",不允许混箱!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                    $("input[name='HMixedBox']").prop("checked", false);
                    form.render('checkbox');
                    return;
                }
                if (obj.value == "") {
                    $("#HMixedBox").val("1");
                } else {
                    $("#HMixedBox").val("");
                }
 
            });
           
 
            //子件条码回车方法
            $('#SubBarcode').on('keydown', function (event) {   //扫条形码
 
                var SubBarcode = $('#SubBarcode').val();
                var HBillNo = $('#HFbarcode').val();
                var HInterID = $("#HInterID").val();
                var HBillNo2 = $("#HBillNo2").val();
                var HBillType = "3783";
                var LDM = $("#LDM").val();//条码车间类型 DU3/QDR/其它
                var BBM = $("#BBM").val();//
                var reg = /[a-z]/;
 
                if (event.keyCode == 13) {
                    if (LDM != "其他" && BBM != "其他" && SubBarcode.length != 29) {
                        playSound();
                        layer.alert("子件条码长度不为29位!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        return;
                    }
 
                    if (LDM == "AAA" && SubBarcode.length != 50) {
                        playSound();
                        layer.alert("子件条码长度不为50位!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        return;
                    }
 
                    if (SubBarcode.match(/[^\x00-\xff]/g) != null) {
                        playSound();
                        layer.alert("必须是半角字符!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        return;
                    }
 
                    if (SubBarcode.length == 50) {
                        if (LDM != "其他" && reg.test(SubBarcode)) {
                            playSound();
                            layer.alert("请查看子件条码大写是否正确!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                            return;
                        }
                    } else {
                        if (LDM != "其他" && BBM != "其他" && reg.test(SubBarcode)) {
                            playSound();
                            layer.alert("请查看子件条码大写是否正确!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                            return;
                        }
                    }
 
                    if (LDM != "其他" && BBM != "其他" && SubBarcode.indexOf(BBM) == -1) {
                        playSound();
                        layer.alert("请扫描正确的子件条码!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        return;
                    }
 
                    if (LDM != "其他") {
                        if (SubBarcode.indexOf(LDM) == -1) {
                            playSound();
                            layer.alert("当前条码不属于" + LDM + "车间", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                            return;
                        }
                    }
                    if (SubBarcode == "") {
                        playSound();
                        layer.alert("子件条码为空!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        return;
                    }
                    if (zxQty == zxQtyFlag) {
                        playSound();
                        layer.alert("装箱数量已扫完,请点击保存!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        $("#HRemark").attr("readonly", "readonly");//不满箱标识只读
                        $("#HRemark").css("background-color", "#efefef4d");
                        return;
                    }
                    if (pcmQty == pcmQtyFlag) {
                        playSound();
                        layer.alert("子件条码数量已扫完,请点击保存!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        return;
                    }
                    //var a = 0;
 
                    //$.ajax({//判断条码的状态
                    //    url: GetWEBURL() + "/LEMS/HbadStaus",
                    //    type: "GET",
                    //    async: false,
                    //    data: { "SubBarcode": SubBarcode },
                    //    success: function (result) {
                    //        if (result.count == 0) {
                    //            a = 1;
                    //            playSound();
                    //            layer.alert(result.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't' });
                    //            return false;
                    //        }
                    //    }
                    //})
                    //if (a == 1) {
                    //    a = 0;
                    //    return false;
                    //}
                    //var HProcExchBillNo = $("#HProcExchBillNo").val();
                    ////判断条码之前的工序是否出站
                    //$.ajax({
                    //    url: GetWEBURL() + "/LEMS/SNBarcodeProcCtrl",
                    //    type: "GET",
                    //    async: false,
                    //    data: { "SubBarcode": SubBarcode, "HProcExchBillNo": HProcExchBillNo, "HMixedBox": $("#HMixedBox").val(), "HBillNo": HBillNo2 },
                    //    success: function (result) {
                    //        if (result.count == 0) {
                    //            a = 1;
                    //            playSound();
                    //            layer.alert(result.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't' });
                    //            return false;
                    //        }
                    //    }
                    //})
 
                    //if (a == 1) {
                    //    a = 0;
                    //    return false;
                    //}
 
                    $.ajax({//查询子件条码的合计数量
                        url: GetWEBURL() + "/LEMS/Select_Gy_BarCodeBill_HQty",
                        type: "GET",
                        async: false,
                        data: {
                            "HBarCode": $("#HBarCode_wym").val()
                        },
                        success: function (result) {
                            var AllHqty = result.data[0].HQty;
                            if (AllHqty >= icmoQty) {
                                playSound();
                                layer.alert("包装数量已等于流转卡数量!不允许扫码!", { icon: 1 });
                                return;
                            } else {
                                //判断装箱数量不能大于剩余数量
                                if (AllHqty > icmoQtyNow && $("#HMixedBox").val() == "") {
                                    playSound();
                                    layer.msg("装箱数量不允许大于流转卡剩余数量!剩余数量为" + icmoQtyNow, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                                    return;
                                } else {
                                    $.ajax({//表体存temp表
                                        url: GetWEBURL() + "/LEMS/SaveSubBarcode_Json_MXG",
                                        type: "GET",
                                        async: false,
                                        data: {
                                            "HBillNo": HBillNo
                                            , "SubBarcode": SubBarcode
                                            , "HInterID": HInterID
                                            , "HBillNo2": HBillNo2
                                            , "HBillType": HBillType
                                            , "sMaker": sMaker
                                            , "HBarCode": $("#HBarCode_wym").val()
                                            , "HNumber": $("#HNumber").val()
                                            , "HName": $("#HMaterName").val()
                                            , "HModel": $("#HModel").val()
                                        },
                                        success: function (result) {
                                            var data = result.data;
                                            if (result.Message == "该子件条码已存在") {
                                                playSound();
                                                layer.alert("该子件条码已存在", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                                            } else {
                                                if (data[0].Column1 == 1) { // 说明验证成功了,
                                                    $('#SubBarcode').val("");
                                                    $("#SubBarcode").focus();
                                                    table.reload('smjl-table', {
                                                        url: GetWEBURL1() + '/LEMS/Update_HBillNo_SubBarcodeList_Json'
                                                        , where: {
                                                            HBillNo: HBillNo2
                                                            , HBarCode: HBillNo
                                                        }
                                                    });
                                                    zxQtyFlag++;
                                                    pcmQtyFlag++
                                                    $("#zxQty").val("" + zxQtyFlag + "/" + zxQty + "");
                                                    $("#pcmQty").val("" + pcmQtyFlag + "/" + pcmQty + "");
                                                    layer.msg("扫描成功", { time: 5000, icon: 6 });
                                                    $.ajax({//查询条码档案表里的镭雕条码的合计数量方法
                                                        url: GetWEBURL() + "/LEMS/Select_Gy_BarCodeBill_HQty",
                                                        type: "GET",
                                                        async: false,
                                                        data: {
                                                            "HBarCode": $("#HBarCode_wym").val()
                                                        },
                                                        success: function (result) {
                                                            var HQty = result.data[0].HQty;
                                                            HQty++;
                                                            $.ajax({//更新条码档案表里的镭雕条码的合计数量方法
                                                                url: GetWEBURL() + "/LEMS/Update_Gy_BarCodeBill_HQty",
                                                                type: "GET",
                                                                async: false,
                                                                data: {
                                                                    "HBarCode": $("#HBarCode_wym").val(),
                                                                    "HQty": HQty
                                                                },
                                                                success: function (result) {
                                                                    var HQty = result.data;
                                                                    ZJTMFlag = true;
                                                                }, error: function () {
                                                                    playSound();
                                                                    layer.alert("更新条码档案表里的镭雕条码的合计数量方法发生错误!", { icon: 5 });
                                                                }
                                                            });
                                                        }, error: function () {
                                                            playSound();
                                                            layer.alert("查询条码档案表里的镭雕条码的合计数量方法发生错误!", { icon: 5 });
                                                        }
                                                    });
                                                } else {
                                                    playSound();
                                                    // $("#verifycode").click();
                                                    //layer.msg(result.Message, { icon: 5 });
                                                    layer.alert("插入缓存表失败", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                                                }
                                            }
                                        }, error: function () {
                                            playSound();
                                            layer.alert("子件条码方法发生错误!", { icon: 5 });
                                        }
                                    });
                                }
                            }
                        }, error: function () {
                            playSound();
                            layer.alert("查询条码档案表里的镭雕条码的合计数量方法发生错误!", { icon: 5 });
                        }
                    });
                }
            });
            //保存按钮
            form.on('submit(Saver)', function (data) {//提交
                //debugger;
                if (parseInt(zxQty) > zxQtyFlag) {
                    var HRemark = $('#HRemark').val();
                    if (!HRemark) {
                        playSound();
                        layer.alert("装箱数量未扫完,请扫完装箱数量或填写不满箱标识!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        return;
                    }
                }
                if (!ZJTMFlag) {
                    playSound();
                    layer.alert("子件条码未扫描!", { icon: 5, btn: ['确认'], time: 100000, offset: 't' });
                    return;
                }
                //增加校验白标号
                var LDM = $("#LDM").val();//
                var BBM = $("#BBM").val();//
                var HBarCode_White = $("#HBarCode_White").val();//白标号
 
                if (HBarCode_White == "") {
                    playSound();
                    layer.alert("白标号不能为空!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                    return;
                }
 
                //var BBMs = BBM.replace(/-/g, "");
                //if (LDM != "其他" && BBM != "其他" && HBarCode_White.indexOf(BBMs) == -1) {
                //    playSound();
                //    layer.alert("请扫描正确白标号", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                //    return;
                //}
                if ($('#dymb').val() == "未选择") {
                    playSound();
                    layer.alert("请选择打印模板", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                    return;
                }
                var sMainStr = JSON.stringify(data.field);
                var datas = table.cache["smjl-table"];
                var HBillNo = $('#HBillNo2').val();
                var lenth = datas.length;
                var HRemark = $("#HRemark").val();
                if (!HRemark) {
                    HRemark = "无";
                }
                //var HProjectNum = $("#HProjectNum").val();
                var HProjectNum = "测试";
                if (!HProjectNum) {
                    playSound();
                    layer.alert("项目号为空!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                    return;
                }
                $.ajax({//插入主表
                    url: GetWEBURL() + "/LEMS/SaveToSc_PackUnionBillMain_MXG",
                    type: "GET",
                    async: false,
                    data: {
                        "HBillNo": HBillNo
                        , "HRemark": HRemark
                        , "HProjectNum": HProjectNum
                        , "HBarCode_White": HBarCode_White
                        , "zxQty": zxQty
                        , "BBM": BBM
                        , "LDM": LDM
                        , "HMaterNumber": $("#HNumber").val()
                    },
                    success: function (result) {
                        var data = result.data;
                        if (result.count == 1) {
                            playSound();
                            layer.msg("扫描成功", { time: 5000, icon: 6 });
                        } else {
                            playSound();
                            // $("#verifycode").click();
                            //layer.msg(result.Message, { icon: 5 });
                            layer.alert("插入主表失败", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                            return;
                        }
                    }, error: function () {
                        playSound();
                        layer.alert("流水号方法发生错误!", { icon: 5 });
                        return;
                    }
                });
                for (var i = 0; i < datas.length; i++) {
                    var HitemID = datas[i].HitemID;
                    var HBillType = datas[i].HBillType;
                    if (HBillType != 3772) {
                        var HRemark = $("#HRemark").val();
                        if (!HRemark) {
                            HRemark = "无";
                        }
                        $.ajax({//插入子表
                            url: GetWEBURL() + "/LEMS/SaveToSc_PackUnionBillSub",
                            type: "GET",
                            async: false,
                            data: {
                                "HitemID": HitemID
                                , "HRemark": HRemark
                            },
                            success: function (result) {
                                var data = result.data;
                                if (result.count == 1) {
                                    //layer.msg("扫描成功", { time: 5000, icon: 6 });
                                } else {
                                    playSound();
                                    // $("#verifycode").click();
                                    //layer.msg(result.Message, { icon: 5 });
                                    layer.alert("插入子表失败", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                                    return;
                                }
                            }, error: function () {
                                playSound();
                                layer.alert("插入子表方法发生错误!", { icon: 5 });
                            }
                        });
                    }
                }
                for (var i = 0; i < datas.length; i++) {
                    var HitemID = datas[i].HitemID
                    $.ajax({//更新temp表标记字段
                        url: GetWEBURL() + "/LEMS/Update_Flag_HRelationInterID",
                        type: "GET",
                        async: false,
                        data: {
                            "HitemID": HitemID
                        },
                        success: function (result) {
                            var data = result.data;
                            if (result.count == 1) {
                                //layer.msg("扫描成功", { time: 5000, icon: 6 });
                            } else {
                                playSound();
                                layer.alert("插入主表失败", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                            }
                        }, error: function () {
                            playSound();
                            layer.alert("更新标记方法发生错误!", { icon: 5 });
                        }
                    });
                }
                $("#Print2").click();
                $("#HBarCode_White").val("");
                //子件条码数量已扫完 条码扫完后
                if (pcmQty == pcmQtyFlag) {
                    $.ajax({//查询子件条码的合计数量
                        url: GetWEBURL() + "/LEMS/Select_Gy_BarCodeBill_HQty",
                        type: "GET",
                        async: false,
                        data: {
                            "HBarCode": $("#HBarCode_wym").val()
                        },
                        success: function (result) {
                            var AllHqty = result.data[0].HQty;
                            if (AllHqty == icmoQty) {
                                location.reload();
                                return;
                            }
                        }
                    })
                    //清空扫描记录的装箱数量
                    zxQtyFlag = 0;
                    pcmQtyFlag = 0;
                    $("#HMixedBox").val("");
                    $("input[name='HMixedBox']").prop("checked", false);
                    form.render('checkbox');
                 
                    //取消流转卡号只读(取消后会数据重复)
                    //$("#HFbarcode").removeAttr("readonly", "readonly");//流转卡号只读
                    //$("#HFbarcode").css("background-color", "white");
                    //$("#HFbarcode").css("box-shadow", "0 0 0 1px #00ff00");
                    //装箱数量 单元格 在流转卡号回车时候 已被取消只读以及添加样式
                    //重新赋值装箱数量和子件条码数量 值为原来的值
                    $("#zxQty").val(pcmQty);
                    //子件条码数量 默认为 = 装箱数量 然后光标移动到 "子件条码" 单元格
                    $("#pcmQty").val(pcmQty);//子件条码数量 默认为 = 装箱数量
                    //移除子件条码只读
                    $("#SubBarcode").removeAttr("readonly");
                    $("#SubBarcode").css("background-color", "white");
                    $("#SubBarcode").focus();
                    $("#SubBarcode").css("box-shadow", "0 0 0 1px #00ff00");
                }
                layer.confirm(
                    '保存成功!请继续选择操作!',
                    {
                        skin: 'layui-layer-lan',
                        closeBtn: 0,
                        btn: ['新增', '关闭'],
                        btn2: function () {//新增
                            parent.layui.admin.events.closeThisTabs();
                        }
                    }, function () {//关闭
                        window.location.reload();
                    }
                );
            });
 
            //失败提示音
            function playSound() {
                console.log("playSound");
                var audio = document.getElementById("cs");
                audio.play();
            }
 
            //退出按钮
            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(Print2)', function (data) {//退出
                //打开打印模板
                var linterid = $("#HInterID").val();
                //var linterid = "28973";
                //var Type = "HBarCodePrint";
                //var OpenTmp = "包装单物料标识卡(网页版)";
                //var ReportViewer = document.getElementById("ReportViewer");
                //window.open("../../views/BaseSet/HBarPlanPrint.html?linterid=" + linterid.toString() + "&Type=" + Type.toString() + "&OpenTmp=" + OpenTmp.toString());
 
                var sWhere = "select * from h_v_SRM_BarCodeBillList where HItemID in(" + linterid + ") order by 物料代码";
                $.ajax({
                    type: "GET",
                    url: GetWEBURL() + "/Gy_SOPBillList/WindowPrintList", //方法所在页面和方法名
                    async: false,
                    data: { "sWhere": sWhere },
                    success: function (data) {
                        if (data.count == 1) { // 说明验证成功了,
 
                            if (data.data.length != 0) {
                                var dataPrint = [];
                                dataPrint.push({ "产品名称": data.data[0]["产品名称"], "条码编号": data.data[0]["条码编号"], "数量": data.data[0]["数量"], "日期": data.data[0]["日期"], "生产任务单": data.data[0]["生产任务单"], "流转卡编号": data.data[0]["流转卡编号"], "自定义字段": data.data[0]["自定义字段"], "项目编号": data.data[0]["项目编号"] }
                                );
 
                                var Customer = {
                                    "Table": dataPrint
                                }
                                var LDM = $("#LDM").val();
                                var report1 = "";
                                var parintName = $("#PrintName").val();
                                if (parintName == "斯莫尔" && LDM != "AAA") {
                                    report1 = urlAddRandomNo("../../grf/包装单物料标识卡(网页版).grf");
                                } else if (LDM == "AAA") {
                                    report1 = urlAddRandomNo("../../grf/包装单物料标识卡(网页版)_MXG.grf");
                                } else {
                                    report1 = urlAddRandomNo("../../grf/包装单物料标识卡(网页版)2.grf");
                                }
 
                                var args = {
                                    type: "print",
                                    showOptionDlg: false, //如果不显示打印对话框而直接打印,将此行注释去掉即可
                                    report: report1,
                                    data: Customer
                                };
                                //var args = {
                                //    report: urlAddRandomNo("../../views/grf/包装单物料标识卡(网页版).grf"),
                                //    data: Customer
                                //};
                                webapp_ws_ajax_run(args);
                            } else {
                                layer.msg("查无数据!");
                            }
                        }
                        else {
                            layer.msg(data.Message, { icon: 5 });
                        }
                        layer.closeAll("loading");
                    },
                    error: function (err) {
                        layer.msg("错误:" + err, { icon: 5 });
                    }
                })
            });
 
            //打印按钮
            form.on('submit(Print)', function (data) {//退出
                //打开打印模板
                var linterid = $("#HInterID").val();
                var Type = "HBarCodePrint";
                var OpenTmp = "白标打印1";
                //var ReportViewer = document.getElementById("ReportViewer");
                window.open("../../基础资料/公用基础资料/HBarPlanPrint.html?linterid=" + linterid.toString() + "&Type=" + Type.toString() + "&OpenTmp=" + OpenTmp.toString());
                $("#Print2").click();
            });
 
            //监听表格中行工具事件
            table.on('tool(smjl-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') {
                    if (data.HBillType == "3772") {
                        layer.msg("流转卡号不允许删除!");
                        return;
                    }
                    layer.confirm('真的删除行么', function (index) {
                        $.ajax({
                            url: GetWEBURL() + '/LEMS/DelProductionLinePackagingTable',
                            type: "GET",
                            data: { "sHInterID": data.HInterID, "HSourceBillNo": data.HSourceBillNo },
                            success: function (data) {
                                if (data.count == 1) {
                                    zxQtyFlag--;
                                    pcmQtyFlag--
                                    $("#zxQty").val("" + zxQtyFlag + "/" + zxQty + "");
                                    $("#pcmQty").val("" + pcmQtyFlag + "/" + pcmQty + "");
                                    layer.close(index);
                                    obj.del(); //删除对应行(tr)的DOM结构
                                    $.ajax({//查询条码档案表里的镭雕条码的合计数量方法
                                        url: GetWEBURL() + "/LEMS/Select_Gy_BarCodeBill_HQty",
                                        type: "GET",
                                        async: false,
                                        data: {
                                            "HBarCode": $("#HBarCode_wym").val()
                                        },
                                        success: function (result) {
                                            var HQty = result.data[0].HQty;
                                            HQty--;
                                            $.ajax({//更新条码档案表里的镭雕条码的合计数量方法
                                                url: GetWEBURL() + "/LEMS/Update_Gy_BarCodeBill_HQty",
                                                type: "GET",
                                                async: false,
                                                data: {
                                                    "HBarCode": $("#HBarCode_wym").val(),
                                                    "HQty": HQty
                                                },
                                                success: function (result) {
                                                    var HQty = result.data;
                                                }, error: function () {
                                                    playSound();
                                                    layer.alert("更新条码档案表里的镭雕条码的合计数量方法发生错误!", { icon: 5 });
                                                }
                                            });
                                        }, error: function () {
                                            playSound();
                                            layer.alert("查询条码档案表里的镭雕条码的合计数量方法发生错误!", { icon: 5 });
                                        }
                                    });
                                } else {
                                    playSound();
                                    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('编辑操作');
                }
            });
 
            //流转卡号 回车事件
            function HFbarcodeKeydown() {
                var HFbarcode = $('#HFbarcode').val();
                var HInterID = $("#HInterID").val();
                var HBillNo2 = $("#HBillNo2").val();//单据号
              
                icmoQty = 20;
                icmoQtyNow = 20;
                //
                $.ajax({//生成唯一码
                    url: GetWEBURL() + "/LEMS/SaveBarCode_json",
                    type: "GET",
                    async: false,
                    data: {
                        "sHBarcodeNo": $("#HSourceBillNo").val(),
                        "sHMaterID": $("#HMaterID").val(),
                        "sHUnitID": $("#HUnitID").val(),
                        "sHMaterName": $("#HMaterName").val()
                    },
                    success: function (result) {
                        var data = result.data;
                        if (data[0].HBarCode) {
                            $("#HBarCode_wym").val(data[0].HBarCode);
                        } else {
                            playSound();
                            // $("#verifycode").click();
                            //layer.msg(result.Message, { icon: 5 });
                            layer.alert("插入主表失败", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        }
                    }, error: function () {
                        playSound();
                        layer.alert("更新标记方法发生错误!", { icon: 5 });
                    }
                });
                //
                $.ajax({//表头存temp表
                    url: GetWEBURL() + "/LEMS/SaveCirculationCard_Json_MXG",
                    type: "GET",
                    async: false,
                    data: {
                        "HBillNo": HFbarcode
                        , "HInterID": HInterID
                        , "HBillNo2": HBillNo2
                        , "HBarCode": $("#HBarCode_wym").val()
                        , "HNumber": $("#HNumber").val()
                        , "HName": $("#HMaterName").val()
                        , "HModel": $("#HModel").val()
                    },
                    success: function (result) {
                        var data = result.data;
                        if (data[0].Column1 == 1) { // 说明验证成功了,
                            $("#HFbarcode").attr("readonly", "readonly");//流转卡号只读
                            $("#HFbarcode").css("background-color", "#efefef4d");
                            $("#HFbarcode").css("box-shadow", "none");
                            $.ajax({
                                url: GetWEBURL() + '/LEMS/Update_HBillNo_SubBarcodeList_Json',
                                type: "GET",
                                data: { "HBillNo": HBillNo2 },
                                async: false,
                                success: function (result) {
                                    if (result.count == 1) {
                                        option.data = result.data;
                                        table.render(option);
                                    }
                                    else {
                                        playSound();
                                        layer.alert(result.code + result.Message, { icon: 5 });
                                    }
                                }
                                , error: function () {
                                    playSound();
                                    layer.close(index0);
                                    layer.alert("接口请求失败!", { icon: 5 });
                                }
                            })
                        } else {
                            playSound();
                            // $("#verifycode").click();
                            //layer.msg(result.Message, { icon: 5 });
                            layer.alert("无此流转卡号!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        }
                    }, error: function () {
                        playSound();
                        layer.alert("扫流转卡号方法发生错误!", { icon: 5 });
                    }
                });
            }
            //获取单据号
            function getBillno() {
                $.ajax({
                    url: GetWEBURL() + "/Web/GetMAXNum",
                    type: "GET",
                    async: false,
                    data: { "HBillType": '3783' },
                    success: function (d) {
                        $("#HInterID").val(d.data[0].HInterID);
                        $("#HBillNo2").val(d.data[0].HBillNo);
                        layer.closeAll("loading");
                    }, error: function () {
                        playSound();
                        layer.closeAll("loading");
                        layer.alert("获取单据号失败!", { icon: 5 });
                    }
                });
            }
            //以上为layui模块
        });
 
        function GetHWorkerValue(obj) {  //返回接收人
            $("#Operator").val(obj[0].HName);
            $("#OperatorID").val(obj[0].HNumber);
            $("#Operator").css("box-shadow", "none");
            if ($("#ProductionTeam").val()) {
                $("#ProductionTeam").css("box-shadow", "none");
            } else {
                $("#ProductionTeam").css("box-shadow", "0 0 1px 2px #00ff00");
            }
        }
 
        function GetProductionTeamValue(obj) {  //返回生产班组
            $("#ProductionTeam").val(obj[0].班组);
            $("#ProductionTeamID").val(obj[0].班组代码);
            $("#ProductionTeam").css("box-shadow", "none");
            if ($("#ProductionResources").val()) {
                $("#ProductionResources").css("box-shadow", "none");
            } else {
                $("#ProductionResources").css("box-shadow", "0 0 1px 2px #00ff00");
            }
        }
 
        function GetProductionResourcesValue(obj) {  //返回生产资源
            if ($("#ProductionResources").val()) {
                $("#ProductionResources").css("box-shadow", "none");
            }
            $("#ProductionResources").val(obj[0].生产资源);
            $("#ProductionResourcesID").val(obj[0].生产资源代码);
            $("#ProductionResources").css("box-shadow", "none");
        }
 
 
        function GetOrgValue(obj)  //返回生产组织
        {
            $("#HOrganization").val(obj[0].HName);
            $("#HOrganizationID").val(obj[0].HNumber);
        }
 
 
    </script>
</body>
</html>