1
yusijie
2024-05-06 62f346794d27086f41f7ce901bdd11eead5249c8
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
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
<!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">
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/Scripts/json2.js"></script>
    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
    <script src="../../../layuiadmin/PubCustom.js"></script>
    <script type="text/javascript" src="../../../layuiadmin/lib/extend/echarts.min.js"></script>
    <!--<style>
        .main-btn { /*头部主按钮*/
            padding: 0 2px; /*调整按钮左右空隙大小*/
            height: 30px;
            line-height: 30px;
        }
 
        .btn-title {
            font-size: 16px;
        }
        /* 防止下拉框的下拉列表被隐藏---必须设置--- */
        .layui-table-cell {
            overflow: visible !important;
        }
        /* 使得下拉框与单元格刚好合适 */
        td .layui-form-select {
            margin-top: -10px;
            margin-left: -15px;
            margin-right: -15px;
        }
 
        .layui-form-item .layui-inline {
            margin-top: 5px;
            margin-bottom: 5px;
            margin-right: 0px;
        }
 
        .layui-form-label {
            width: 25%;
        }
    </style>-->
 
</head>
<body>
    <div class="layui-fluid" style="padding: 0;">
        <div class="layui-card" style="padding: 2px;background-color: #efefef;">
            <div class="layui-card-body" style="padding: 1px;">
                <form class="layui-form" action="" lay-filter="formData" style="background-color:white;">
                    <div style="padding: 2px; ">
                        <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnAdd" id="btnSave">新增</button>
                        <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnCancel" id="btnEdit">退出</button>
                    </div>
                    <!--<div class="layui-tab" lay-filter="tab-POStockInBill">
                        <ul class="layui-tab-title" lay-filter="tab-all">
                            <li lay-id="1" style="padding:1px;" class="layui-this">采集信息</li>
                            <li lay-id="2" style="padding:1px;">当前工单</li>
                            <li lay-id="2" style="padding:1px;">不良率占比分析</li>
                            <li lay-id="2" style="padding:1px;">子表信息</li>
                        </ul>
                        <div class="layui-tab-content">-->
                    <!--采集信息-->
                    <!--<div class="layui-tab-item layui-show">
                        <div class="layui-form-item" style="padding-top: 10px;">-->
                    <div style="width: 750px;height:350px; border: 1px solid #000; display:inline-block;">
                        <div class="layui-row">
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;">条形码</label>
                                <div class="layui-input-block" style="margin-left: 120px; width: 501px;">
                                    <input type="text" class="layui-input" lay-verify="HBarCode" name="HBarCode" id="HBarCode">
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;">单据号</label>
                                <div class="layui-input-block" style="margin-left: 120px;">
                                    <input type="text" class="layui-input" name="HBillNo" lay-verify="HBillNo" id="HBillNo" style="background-color:#efefef4d;" readonly>
                                    <input type="hidden" name="HInterID" id="HInterID" lay-verify="HInterID">
                                    <input type="hidden" name="HEntryID" id="HEntryID" lay-verify="HEntryID" value="1">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">维修人</label>
                                <div class="layui-input-block" style="margin-left: 77px;">
                                    <input type="text" class="layui-input" lay-verify="HEmpName" name="HEmpName" id="HEmpName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                    <input type="hidden" name="HEmpID" id="HEmpID" lay-verify="HEmpID" value="0">
                                    <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchHEmp" id="btnSearchHEmp" style="padding: 0 10px;float: right;margin-right: 3px;">
                                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">不良原因</label>
                                <div class="layui-input-block" style="margin-left: 77px;">
                                    <input type="text" class="layui-input" lay-verify="HBadReasonName" name="HBadReasonName" id="HBadReasonName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                    <input type="hidden" name="HBadReasonID" id="HBadReasonID" lay-verify="HBadReasonID" value="0">
                                    <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchHBadReason" id="btnSearchHBadReason" style="padding: 0 10px;float: right;margin-right: 3px;">
                                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                    </button>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">不良类型</label>
                                <div class="layui-input-block" style="margin-left: 77px;">
                                    <input type="text" class="layui-input" lay-verify="HBadTypeName" name="HBadTypeName" id="HBadTypeName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                    <input type="hidden" name="HBadTypeID" id="HBadTypeID" lay-verify="HBadTypeID" value="0">
                                    <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchHBadType" id="btnSearchHBadType" style="padding: 0 10px;float: right;margin-right: 3px;">
                                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">不良后果</label>
                                <div class="layui-input-block" style="margin-left: 77px;">
                                    <input type="text" class="layui-input" lay-verify="HBadResultName" name="HBadResultName" id="HBadResultName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                    <input type="hidden" name="HBadResultID" id="HBadResultID" lay-verify="HBadResultID" value="0">
                                    <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchHBadResult" id="btnSearchHBadResult" style="padding: 0 10px;float: right;margin-right: 3px;">
                                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                    </button>
                                </div>
                            </div>
                            <div class="layui-inline" style="width:300px;">
                                <label class="layui-form-label" style="width: 85px;">维修结果</label>
                                <div class="layui-input-block" style="margin-left: 120px; width: 180px;">
                                    <select name="HRepairResult" id="HRepairResult" lay-filter="HRepairResult" style="width: 180px;">
                                        <option style="color:blue;" selected="selected" value="OK">OK</option>
                                        <option style="color:blue;" value="NG">NG</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;">产品MAC</label>
                                <div class="layui-input-block" style="margin-left: 120px;">
                                    <input type="text" class="layui-input" lay-verify="HProdMac" name="HProdMac" id="HProdMac" style="background-color:#efefef4d;" readonly>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;">产品SN</label>
                                <div class="layui-input-block" style="margin-left: 120px;">
                                    <input type="text" class="layui-input" lay-verify="HMaterSN" name="HMaterSN" id="HMaterSN" style="background-color:#efefef4d;" readonly>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;">备注</label>
                                <div class="layui-input-block" style="margin-left: 120px; width: 501px;">
                                    <input type="text" class="layui-input" lay-verify="HRemark" name="HRemark" id="HRemark">
                                </div>
                            </div>
                            <div class="layui-inline" style="display:none;">
                                <label class="layui-form-label" style="width: 85px;">不良工序</label>
                                <div class="layui-input-block" style="margin-left: 120px;">
                                    <input type="text" class="layui-input" lay-verify="HBadProcName" name="HBadProcName" id="HBadProcName" style="background-color:#efefef4d;" readonly>
                                    <input type="hidden" name="HBadProcID" id="HBadProcID" lay-verify="HBadProcID" value="0">
                                </div>
                            </div>
                            <div class="layui-inline" style="display:none;">
                                <label class="layui-form-label" style="width: 85px;">维修方法</label>
                                <div class="layui-input-block" style="margin-left: 120px; width: 501px;">
                                    <input type="text" class="layui-input" lay-verify="HRepairType" name="HRepairType" id="HRepairType">
                                </div>
                            </div>
                            <div class="layui-inline" style="display:none;">
                                <label class="layui-form-label" style="width: 85px;">数量</label>
                                <div class="layui-input-block" style="margin-left: 120px; width: 501px;">
                                    <input type="text" class="layui-input" lay-verify="HQty" name="HQty" id="HQty" value="0">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <div class="layui-input-block" style="margin-left: 120px; width: 501px;">
                                    <input type="hidden" name="HCreator" id="HCreator" lay-verify="HCreator">
                                    <input type="hidden" name="HCreateDate" id="HCreateDate" lay-verify="HCreateDate">
 
                                    <input type="hidden" name="HSourceInterID" id="HSourceInterID" lay-verify="HSourceInterID" value="0">
                                    <input type="hidden" name="HSourceEntryID" id="HSourceEntryID" lay-verify="HSourceEntryID" value="0">
                                    <input type="hidden" name="HSourceBillNo" id="HSourceBillNo" lay-verify="HSourceBillNo" value="">
                                    <input type="hidden" name="HSourceBillType" id="HSourceBillType" lay-verify="HSourceBillType" value="">
                                    <input type="hidden" name="HRelationQty" id="HRelationQty" lay-verify="HRelationQty" value="0">
                                    <input type="hidden" name="HRelationMoney" id="HRelationMoney" lay-verify="HRelationMoney" value="0">
 
                                    <input type="hidden" name="HMacAddr" id="HMacAddr" lay-verify="HMacAddr">
                                    <input type="hidden" name="HIPAddr" id="HIPAddr" lay-verify="HIPAddr">
 
                                    <!--记录子页面(更换配件)子表的临时数据-->
                                    <input type="hidden" name="subMaterList_Temp" id="subMaterList_Temp" lay-verify="subMaterList_Temp">
 
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;"></label>
                                <div class="layui-input-block" style="margin-left: 120px; width: 501px;">
                                    <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="NGSave" id="NGSave">NG保存</button>
                                    <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="OKSave" id="OKSave">OK保存</button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--</div>
                    </div>-->
                    <!--当前工单-->
                    <!--<div class="layui-tab-item">
                        <div class="layui-form-item">-->
                    <div style="width: 820px; height: 350px; border: 1px solid #000; display: inline-block; ">
                        <div class="layui-row">
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;">生产订单</label>
                                <div class="layui-input-block" style="margin-left: 120px;">
                                    <input type="text" class="layui-input" lay-verify="HICMOBillNo" name="HICMOBillNo" id="HICMOBillNo" style="background-color:#efefef4d;" readonly>
                                    <input type="hidden" name="HICMOInterID" id="HICMOInterID" lay-verify="HICMOInterID" value="0">
                                    <input type="hidden" name="HICMOEntryID" id="HICMOEntryID" lay-verify="HICMOEntryID" value="0">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;">日计划工单</label>
                                <div class="layui-input-block" style="margin-left: 120px;">
                                    <input type="text" class="layui-input" lay-verify="HSplitNO" name="HSplitNO" id="HSplitNO" style="background-color:#efefef4d;" readonly>
                                </div>
                            </div>
 
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;">产品代码</label>
                                <div class="layui-input-block" style="margin-left: 120px;">
                                    <input type="text" class="layui-input" lay-verify="HMaterNumber" name="HMaterNumber" id="HMaterNumber" style="background-color:#efefef4d;" readonly>
                                    <input type="hidden" name="HMaterID" id="HMaterID" lay-verify="HMaterID" value="0">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;">产品名称</label>
                                <div class="layui-input-block" style="margin-left: 120px;">
                                    <input type="text" class="layui-input" lay-verify="HMaterName" name="HMaterName" id="HMaterName" style="background-color:#efefef4d;" readonly>
                                </div>
                            </div>
 
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;">规格型号</label>
                                <div class="layui-input-block" style="margin-left: 120px;">
                                    <input type="text" class="layui-input" lay-verify="HMaterModel" name="HMaterModel" id="HMaterModel" style="background-color:#efefef4d;" readonly>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;">计量单位</label>
                                <div class="layui-input-block" style="margin-left: 120px;">
                                    <input type="text" class="layui-input" lay-verify="HUnitName" name="HUnitName" id="HUnitName" style="background-color:#efefef4d;" readonly>
                                    <input type="hidden" name="HUnitID" id="HUnitID" lay-verify="HUnitID" value="0">
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;">生产资源</label>
                                <div class="layui-input-block" style="margin-left: 120px;">
                                    <input type="text" class="layui-input" lay-verify="HSourceName" name="HSourceName" id="HSourceName" style="background-color:#efefef4d;" readonly>
                                    <input type="hidden" name="HSourceID" id="HSourceID" lay-verify="HSourceID" value="0">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;">日期</label>
                                <div class="layui-input-block" style="margin-left: 120px; width:180px;">
                                    <input type="date" class="layui-input" lay-verify="HDate" name="HDate" id="HDate" style="padding-left: 80px;">
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;">维修工位</label>
                                <div class="layui-input-block" style="margin-left: 120px;">
                                    <input type="text" class="layui-input" lay-verify="HWorkStationName" name="HWorkStationName" id="HWorkStationName" style="background-color:#efefef4d;" readonly>
                                    <input type="hidden" name="HWorkStationID" id="HWorkStationID" lay-verify="HWorkStationID" value="0">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;">维修工序</label>
                                <div class="layui-input-block" style="margin-left: 120px;">
                                    <input type="text" class="layui-input" lay-verify="HProcessName" name="HProcessName" id="HProcessName" style="background-color:#efefef4d;" readonly>
                                    <input type="hidden" name="HProcess" id="HProcess" lay-verify="HProcess" value="0">
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;">生产组织<label style="color:red"> * </label></label>
                                <div class="layui-input-block" style="margin-left: 120px; width: 501px;">
                                    <select name="HProdOrgID" id="HProdOrgID" lay-verify="HProdOrgID">
                                        <!--动态渲染生产组织-->
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;">维修部门</label>
                                <div class="layui-input-block" style="margin-left: 120px;width:501px;">
                                    <input type="text" class="layui-input" lay-verify="HDeptName" name="HDeptName" id="HDeptName" style="background-color:#efefef4d;" readonly>
                                    <input type="hidden" name="HDeptID" id="HDeptID" lay-verify="HDeptID" value="0">
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width: 85px;"></label>
                                <div class="layui-input-block" style="margin-left: 120px; width: 501px;">
                                    <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="ChangeBill" id="ChangeBill"> 换&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;单 </button>
                                    <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="ChangeMater" id="ChangeMater"> 换&nbsp;&nbsp;配&nbsp;&nbsp;件</button>
                                    <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="CurrentBill" id="CurrentBill">当前工单</button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--</div>
                    </div>-->
                    <!--不良率占比分析-->
                    <!--<div class="layui-tab-item">
                        <div class="layui-form-item">-->
                    <div style="width: 750px; height: 350px; display: inline-block; ">
                        <div class="layui-row">
                            <div id="HBadReasonECharts" style="width: 600px;height:350px;"></div>
                        </div>
                    </div>
                    <!--</div>
                    </div>-->
                    <!--子表信息-->
                    <!--<div class="layui-tab-item">
                        <div class="layui-form-item">-->
                    <div style="width: 820px; height: 350px; border: 1px solid #000; display: inline-block; ">
                        <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
                        <script type="text/html" id="toolbarDemo">
                            <div class="layui-btn-container">
                                <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-AddLine"><i class="layui-icon layui-icon-form"></i>增加一行</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-CopyLine"><i class="layui-icon layui-icon-form"></i>复制一行</button>-->
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn"><i class="layui-icon layui-icon-form"></i>列设置</button>
                            </div>
                        </script>
                    </div>
                    <!--</div>
                    </div>-->
                    <!--</div>
                    </div>-->
                </form>
            </div>
        </div>
    </div>
    <!--子表表:删除-->
    <script type="text/html" id="barDemo">
        <!--<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>-->
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    </script>
    <script>
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
            //#region 公共变量
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
                , table = layui.table
                , form = layui.form
                , element = layui.element;
 
            //模块名
            var HModName = "Sc_SourceLineRepairBill";
            //表格渲染参数
            var option = {};            //项目阶段表渲染参数
            var titleData = ["HInterID", "HEntryID", "HBadReasonID"];//子表不需要显示的字段 可扩展
 
            //获取参数
            var params = getUrlVars();
            var OperationType = params[params[0]]; //从参数中获取 数据类型  1添加 保存  2复制  3 编辑
            var linterid = params[params[1]]; //从参数中获取 单据内码
 
            //#endregion
 
            //#region 进入页面即加载
            //#region 判断是否登录 未登录则跳到登录页
            if (sessionStorage.login != "login") {
                layer.confirm("登录失效,请重新登录!", {
                    icon: 4, skin: 'layui-layer-lan', title: "温馨提示", closeBtn: 0, btn: ['重新登录']
                }, function () { window.location.href = "../../user/login.html"; });
            }
            //#endregion
 
            //#region 初始化生产组织
            Organ();
            //#endregion
 
            //#region 判断并设置操作类型、页面初始化
            if (OperationType == null || OperationType == 1) {                            //新增
                set_ClearBill();
            }
            //#endregion
 
            //#region 初始化表格
            DisPlay_HideColumn();
            //#endregion
 
            //#endregion
 
            //#region 触发事件:包括form.on(){}格式的所有点击事件、选择事件等
            //#region 弹窗选择触发事件
            //#region 选择维修人按钮
            form.on('submit(btnSearchHEmp)', function () {
                get_checkSearchHEmp();
            });
            //#endregion
 
            //#region 选择不良原因按钮
            form.on('submit(btnSearchHBadReason)', function () {
                get_checkSearchHBadReason();
            });
            //#endregion
 
            //#region 选择不良类型按钮
            form.on('submit(btnSearchHBadType)', function () {
                get_checkSearchHBadType();
            });
            //#endregion
 
            //#region 选择不良后果按钮
            form.on('submit(btnSearchHBadResult)', function () {
                get_checkSearchHBadResult();
            });
            //#endregion
            //#endregion
 
            //#region 操作按钮触发事件
            //#region 新增
            form.on('submit(btnAdd)', function (data) {
                //layer.msg("新增");
                set_ClearBill();
            });
            //#endregion
 
            //#region 退出
            form.on('submit(btnCancel)', function (data) {
                if (params[1] != null) {
                    Pub_Close(1);
                } else if (params[1] == null) {
                    Pub_Close(2);
                }
            });
            //#endregion
 
            //#region NG保存
            form.on('submit(NGSave)', function (data) {
                set_AddNew(data,1);
            });
            //#endregion
 
            //#region OK保存
            form.on('submit(OKSave)', function (data) {
                set_AddNew(data,2);
            });
            //#endregion
 
            //#region 换单
            form.on('submit(ChangeBill)', function (data) {
                //layer.msg("换单");
                get_checkSearchChangeBill();
            });
            //#endregion
 
            //#region 换配件
            form.on('submit(ChangeMater)', function (data) {
                //layer.msg("换配件");
                get_checkSearchChangeMater();
            });
            //#endregion
 
            //#region 当前工单
            form.on('submit(CurrentBill)', function (data) {
                layer.msg("当前工单");
            });
            //#endregion
            //#endregion
 
            //#region 文本框监听
            $(document).ready(function () {
                //#region 条形码回车事件监听
                $("#HBarCode").on('input keyup', function (data) {
                    if (data.keyCode == "13") {
                        //layer.msg(data.keyCode);
                        touchedByEnter_HBarCode();
                    }
                });
                //#endregion
            });
            //#endregion
 
            //#region 复选框 选中/取消 触发事件
            //#endregion
 
            //#region 子表:头工具栏事件
            table.on('toolbar(mainTable)', function (obj) {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
 
                //新增行表格数据
                var NewRow =
                {
                    "RowID": (table.cache["mainTable"].length + 1) * 10
                    , "HDate": Format(new Date(), "yyyy-MM-dd")
                    , "HMaterID": "0"
                    , "HMaterName": ""
                    , "HMaterSN": ""
                    , "HBadReasonID": "0"
                    , "HBadReasonName": ""
                    , "HResult": ""
                };
                switch (obj.event) {
                    case 'btn-AddLine':
                        table.cache["mainTable"].push(NewRow);
                        option.data = table.cache["mainTable"];
                        table.render(option);
                        break;
                    case 'btn-CopyLine':
                        var copydata = JSON.stringify(data);
                        if (data.length <= 0) {
                            layer.msg("请选择需要复制的一行!");
                        }
                        else if (data.length > 1) {
                            layer.msg("只能选择复制一行!");
                        }
                        else {
                            var copydata2 = copydata.substring(1, copydata.length);//去除首行字符'['
                            var copyrow = copydata2.substring(0, copydata2.length - 1);//去除末尾字符']'
                            table.cache["mainTable"].push(JSON.parse(copyrow));//将复制的行强转成json追加到表格上
                            option.data = table.cache["mainTable"];//将数据绑定到data上
                            table.render(option);//将数据渲染到表格上
                        }
                        break;
                    //列设置
                    case 'set_HideColumn':
                        get_HideColumn();
                        break;
                }
            });
            //#endregion
 
            //#region 子表:行内事件
            table.on('tool(mainTable)', function (obj) {
                set_GridDelete(obj);   //行内删除
                //set_GridCellCheck(obj); //行内快捷键筛选
 
            });
            //#endregion
 
            //#region 子表:行内鼠标离开事件:检查项目阶段是否重复
            table.on('edit(mainTable)', function (obj) {
 
            })
            //#endregion
 
            //#region 子表:单元格编辑监听
            table.on('edit(mainTable)', function (obj) {
                // 单元格编辑之前的值
                var oldText = $(this).prev().text();
                var value = obj.value //得到修改后的值
                    , data = obj.data //得到所在行所有键值
                    , field = obj.field; //得到字段
                //正则表达式-校验非负浮点数
                var ref = /^\d+(\.\d+)?$/;
 
                switch (field) {
                    case "HQty":                                            //数量
                        //if (!ref.test(value)) {                             //若输入值格式不正确,则变回原来的值
                        //    obj.update({
                        //        HQty: oldText
                        //    });
                        //    layer.msg("数量:数据错误,请输入非负小数")
                        //} else {
                        //    var HQty = value;                               //数量
                        //    var HPrice = data.HPrice;                       //工价
                        //    var HPriceRate = data.HPriceRate;               //定额浮动比率
 
                        //    var HSubsidyQty = data.HSubsidyQty;             //补贴数量
 
                        //    var HPackQty = data.HPackQty;                   //包装数量
                        //    var HPackPrice = data.HPackPrice;               //包装单价
 
                        //    var HDeuctTotal = data.HDeuctTotal * 1;               //扣款小计
                        //    var HSubsidyTotal = data.HSubsidyTotal * 1;           //补贴合计
 
                        //    obj.update({
                        //        HMoney: (HQty * HPrice * HPriceRate) + (HSubsidyQty * HPrice) + (HPackQty * HPackPrice) + HSubsidyTotal - HDeuctTotal       //金额= (数量*单价*定额浮动比率) + (补贴数量*工价) + (包装数量*包装单价) - 补贴合计 - 扣款小计
                        //    });
                        //}
                        break;
                    default:
                }
            });
            //#endregion
 
 
 
            //#region 监听提交
            form.verify({
                numberOrEmpty: function (value, item) {
 
                    // if (value != '') {
                    if (!/^\d+$/.test(value)) {
                        return '不能为空或数字或者0';
                    }
                    //}
                }
            });
            //#endregion
 
 
 
            //#endregion
 
            //#region 此页面所有的方法
            //#region 生产组织
            function Organ() {
                //获取登录页组织列
                var Organization = '';
                $.ajax({
                    type: "get",
                    url: GetWEBURL() + "/Web/GetOrganizations",
                    success: function (result) {
                        if (result.count == 1) { // 说明验证成功了,
                            var data = result.data;
                            for (var i = 0; i < data.length; i++) {
                                Organization += '<option  style="color:blue;" value="' + data[i].ID + '">' + data[i].Name + '</option>';
                            }
                            $("#HProdOrgID").empty();
                            $("#HProdOrgID").append(Organization);
                            if (OperationType == 1) {
                                HOrgIDBar = sessionStorage["OrganizationID"];
                            }
                            $("#HProdOrgID").val(HOrgIDBar);
                            form.render('select');
                        }
                        layer.closeAll("loading");
                    }
                })
            }
            //#endregion
 
            //#region 获取参数
            function getUrlVars() {
                var vars = [], hash;
                var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
                for (var i = 0; i < hashes.length; i++) {
                    hash = hashes[i].split('=');
                    vars.push(hash[0]);
                    vars[hash[0]] = hash[1];
                }
                return vars;
            }
            //#endregion
 
            //#region 生成单据号
            function createBillNo() {
                $.ajax({
                    url: GetWEBURL() + "/Web/GetMAXNum",
                    async: false,
                    type: "GET",
                    data: { "HBillType": '3748' },
                    success: function (d) {
                        //console.log(d.data);
                        $("#HInterID").val(d.data[0].HInterID);
                        $("#HBillNo").val(d.data[0].HBillNo);
                        $("#HEntryID").val("1");
                        $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
                    }
                });
            }
            //#endregion
 
            //#region 获取表头初始信息
            function getMainInfo() {
                var Czybm = sessionStorage["Czybm"];
 
                $.ajax({
                    url: GetWEBURL() + "/Sc_SourceLineRepairBill/getMainInfo",
                    type: "GET",
                    async: false,
                    data: { "Czybm": Czybm, "user": sessionStorage["HUserName"] },
                    success: function (result) {
                        if (result.count == 1) {
                            var tableMain = result.data;
                            var subMaterList_Temp = [];
 
                            //主表 赋值
                            form.val("formData", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
 
                                "HCreator": tableMain[0]["HCheckManName"]
                                , "HCreateDate": Format(new Date(), "yyyy-MM-dd")
                                , "HBadProcID": tableMain[0]["HProcID"] == null ? 0 : tableMain[0]["HProcID"]
                                , "HBadProcName": tableMain[0]["HProcName"]
 
 
                                , "HICMOInterID": tableMain[0]["HICMOInterID"] == null ? 0 : tableMain[0]["HICMOInterID"]
                                , "HICMOEntryID": tableMain[0]["HICMOEntryID"] == null ? 0 : tableMain[0]["HICMOEntryID"]
                                , "HICMOBillNo": tableMain[0]["HICMOBillNo"]
                                , "HSplitNO": tableMain[0]["HSplitNO"]
 
                                , "HEmpID": tableMain[0]["HCheckManID"] == null ? 0 : tableMain[0]["HCheckManID"]
                                , "HEmpName": tableMain[0]["HCheckManName"]
                                , "HDeptID": tableMain[0]["HDeptID"] == null ? 0 : tableMain[0]["HDeptID"]
                                , "HDeptName": tableMain[0]["HDeptName"]
 
                                , "HSourceID": tableMain[0]["HSourceID"] == null ? 0 : tableMain[0]["HSourceID"]
                                , "HSourceName": tableMain[0]["HSourceName"]
 
                                , "HMaterID": tableMain[0]["HMaterID"] == null ? 0 : tableMain[0]["HMaterID"]
                                , "HMaterNumber": tableMain[0]["HMaterNumber"]
                                , "HMaterName": tableMain[0]["HMaterName"]
                                , "HMaterModel": tableMain[0]["HMaterModel"]
                                , "HUnitID": tableMain[0]["HUnitID"] == null ? 0 : tableMain[0]["HUnitID"]
                                , "HUnitName": tableMain[0]["HUnitName"]
 
                                , "HProcess": tableMain[0]["HProcID"] == null ? 0 : tableMain[0]["HProcID"]
                                , "HProcessName": tableMain[0]["HProcName"]
 
                                , "HSourceInterID": tableMain[0]["HICMOInterID"] == null ? 0 : tableMain[0]["HICMOInterID"]
                                , "HSourceEntryID": tableMain[0]["HICMOEntryID"] == null ? 0 : tableMain[0]["HICMOEntryID"]
                                , "HSourceBillNo": tableMain[0]["HICMOBillNo"]
                                , "HSourceBillType": tableMain[0]["HICMOBillType"]
 
                                , "subMaterList_Temp": JSON.stringify(subMaterList_Temp)
 
                            });
                        } else {
                            //layer.alert(result.code + result.Message, { icon: 5 });
                            layer.msg(result.Message);
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
            }
            //#endregion
 
            //#region 子表初始化
            function get_InitGrid() {
                option = {
                    elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , async: true
                    , page: false
                    , totalRow: true
                    , cellMinWidth: 120
                    , height: 400
                }
 
                var HSourceInterID = $("#HSourceInterID").val();
                var HSourceEntryID = $("#HSourceEntryID").val();
                var HDate = $("#HDate").val();
                var ajaxLoad = layer.load();
                $.ajax({
                    url: GetWEBURL() + "/Sc_SourceLineRepairBill/getSubInfo",
                    type: "GET",
                    async: false,
                    data: { "HSourceInterID": HSourceInterID, "HSourceEntryID": HSourceEntryID, "HDate": HDate, "user": sessionStorage["HUserName"] },
                    success: function (data1) {
                        if (data1.count == 1) {
                            var data = [];
                            var col = [];
                            //给空的数组赋值
                            for (var key in data1.list) {
                                data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
                            }
                            //在列表左边添加勾选框
                            col.push({ type: 'checkbox', fixed: 'left' });
                            col.push({ type: 'numbers', title: '序号', style: 'background-color: #f9f9f9;' });
                            for (var i = 0; i < data.length; i++) {
                                // if (data[i].name == 'HInterID' || data[i].name == 'HBillType' || data[i].name == 'hmainid') {
                                if ($.inArray(data[i].name, titleData) > -1) {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
                                }
                                else {
                                    switch (data[i].Type) {
                                        //int
                                        case 'DateTime':
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 120 });
                                            break;
                                        default:
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 120 });
                                    }
                                }
                            }
                            col.push({ fixed: 'right', title: '操作', toolbar: '#barDemo' });
 
                            option.cols = [col];
                            option.data = data1.data;
                            table.render(option);
                            //刷新表格数据
                            DisPlay_HideColumn();
                            layer.close(ajaxLoad);
                        } else {
                            layer.close(ajaxLoad);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(ajaxLoad);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
            }
            //#endregion
 
            //#region 不良率占比分析图渲染
            function set_InitECharts(result) {
                var chartDom = document.getElementById('HBadReasonECharts');            //获取需要渲染的节点
                var myChart = echarts.init(chartDom, null, {
                    renderer: 'canvas',
                    useDirtyRect: false
                });                                   //获取组件渲染对象
                var option1;                                                            //渲染参数
                var totalQty = 0;                                                       //当前生产订单的不良原因总数
                var data1 = [];                                                         //不良原因列表,作为不良率占比分析图的x轴坐标
                var data2 = [];                                                         //对应不良原因的占比列表,作为y轴数据
 
                //计算当前生产订单的不良原因总数
                for (var i = 0; i < result.length; i++) {
                    totalQty += result[i]["HBadReasonQty"];
                }
                //获取不良原因数量最多的8个不良原因
                for (var i = 0; i < result.length; i++) {
                    if (data1.length == 8) {
                        break;
                    } else {
                        data1.push(result[i]["HBadReasonName"]);
                    }
                }
                //获取不良原因对应的占比
                for (var i = 0; i < data1.length; i++) {
                    var rate = ((result[i]["HBadReasonQty"] / totalQty) * 100).toFixed(2);
                    data2.push(rate);
                }
 
                option1 = {
                    xAxis: {
                        type: 'category',
                        data: data1
                    },
                    yAxis: {
                        type: 'value'
                    },
                    series: [
                        {
                            data: data2,
                            type: 'bar',
                            showBackground: true,
                            backgroundStyle: {
                                color: 'rgba(180, 180, 180, 0.2)'
                            },
                            label: {
                                show: true, //开启显示
                                position: 'top', //在上方显示
                                formatter: '{c}%',//显示百分号
                                textStyle: { //数值样式
                                    color: 'black',//字体颜色
                                    fontSize: 10//字体大小
                                }
                            }
                        }
                    ]
                };
 
                if (option1 && typeof option1 === 'object') {
                    myChart.setOption(option1);
                }
            }
            //#endregion
 
            //#region 不良率占比分析图数据获取
            function getBadReasonRateInfo() {
                var HSourceInterID = $("#HSourceInterID").val();
                var HSourceEntryID = $("#HSourceEntryID").val();
 
                $.ajax({
                    url: GetWEBURL() + "/Sc_SourceLineRepairBill/getBadReasonRateInfo",
                    type: "GET",
                    async: false,
                    data: { "HSourceInterID": HSourceInterID, "HSourceEntryID": HSourceEntryID },
                    success: function (result) {
                        if (result.count == 1) {
                            //渲染不良率占比分析图
                            set_InitECharts(result.data);
                        } else {
                            layer.alert(result.code + result.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
            }
            //#endregion
 
            //#region 页面初始化
            function set_ClearBill() {
                OperationType = 1;
                //生成并设置主表的内码和单据号、日期
                createBillNo();
                //设置表头初始信息
                getMainInfo();
                //初始化项目阶段表
                get_InitGrid();
                //不良率占比分析图渲染
                getBadReasonRateInfo();
            }
            //#endregion
 
            //#region 维修人选择页面
            function get_checkSearchHEmp() {
                //打开员工小窗体
                layer.open({
                    type: 2
                    , skin: "layui-layer-rim"                           //加上边框
                    , title: "员工列表"                             //标题
                    , closeBtn: 1                                       //窗体右上角关闭 的 样式
                    , shift: 2                                          //弹出动画
                    , area: ["90%", "90%"]                              //窗体大小
                    , maxmin: true                                      //设置最大最小按钮是否显示
                    , content: ['../../../views/基础资料/公用基础资料/Gy_EmployeeList.html?type=HEmp', 'yes']
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //按钮一  的回调
                        var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
                        var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
 
                        if (checkStatus.data.length != 1) {
                            return layer.msg("请选择一条数据");
                        }
 
                        $("#HEmpID").val(checkStatus.data[0].HItemID);//内码
                        $("#HEmpName").val(checkStatus.data[0].职员名称);//名称
                        layer.close(index);//关闭弹窗
                    }
                    , btn2: function (index, layero) { }
                })
            }
            //#endregion
 
            //#region 不良原因选择页面
            function get_checkSearchHBadReason() {
                layer.open({
                    type: 2
                    , skin: "layui-layer-rim"                           //加上边框
                    , title: "不良原因列表"                             //标题
                    , closeBtn: 1                                       //窗体右上角关闭 的 样式
                    , shift: 2                                          //弹出动画
                    , area: ["90%", "90%"]                              //窗体大小
                    , maxmin: true                                      //设置最大最小按钮是否显示
                    , content: ["../../../views/基础资料/生产基础资料/Gy_BadReason.html", "yes"]
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //按钮一  的回调
                        var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
                        var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
 
                        if (checkStatus.data.length != 1) {
                            return layer.msg("请选择一条数据");
                        }
 
                        $("#HBadReasonID").val(checkStatus.data[0].HItemID);//内码
                        $("#HBadReasonName").val(checkStatus.data[0].不良原因名称);//名称
                        layer.close(index);//关闭弹窗
                    }
                    , btn2: function (index, layero) { }
                })
            }
            //#endregion
 
            //#region 不良类型选择页面
            function get_checkSearchHBadType() {
                layer.open({
                    type: 2
                    , skin: "layui-layer-rim"                           //加上边框
                    , title: "不良类型列表"                             //标题
                    , closeBtn: 1                                       //窗体右上角关闭 的 样式
                    , shift: 2                                          //弹出动画
                    , area: ["90%", "90%"]                              //窗体大小
                    , maxmin: true                                      //设置最大最小按钮是否显示
                    , content: ["../../../views/基础资料/生产基础资料/Gy_BadType.html", "yes"]
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //按钮一  的回调
                        var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
                        var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
 
                        if (checkStatus.data.length != 1) {
                            return layer.msg("请选择一条数据");
                        }
 
                        layer.msg("不良类型");
                        $("#HBadTypeID").val(checkStatus.data[0].HItemID);//内码
                        $("#HBadTypeName").val(checkStatus.data[0].不良类型名称);//名称
                        layer.close(index);//关闭弹窗
                    }
                    , btn2: function (index, layero) { }
                })
            }
            //#endregion
 
            //#region 不良后果选择页面
            function get_checkSearchHBadResult() {
                layer.open({
                    type: 2
                    , skin: "layui-layer-rim"                           //加上边框
                    , title: "不良后果列表"                             //标题
                    , closeBtn: 1                                       //窗体右上角关闭 的 样式
                    , shift: 2                                          //弹出动画
                    , area: ["90%", "90%"]                              //窗体大小
                    , maxmin: true                                      //设置最大最小按钮是否显示
                    , content: ["../../../views/基础资料/生产基础资料/Gy_BadResult.html", "yes"]
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //按钮一  的回调
                        var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
                        var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
 
                        if (checkStatus.data.length != 1) {
                            return layer.msg("请选择一条数据");
                        }
 
                        layer.msg("不良后果");
                        $("#HBadResultID").val(checkStatus.data[0].HItemID);//内码
                        $("#HBadResultName").val(checkStatus.data[0].不良后果名称);//名称
                        layer.close(index);//关闭弹窗
                    }
                    , btn2: function (index, layero) { }
                })
            }
            //#endregion
 
            //#region 条形码回车事件
            function touchedByEnter_HBarCode() {
                var HBarCode = $("#HBarCode").val();
 
                $.ajax({
                    url: GetWEBURL() + "/Sc_SourceLineRepairBill/getBarCodeInfo",
                    type: "GET",
                    async: false,
                    data: { "HBarCode": HBarCode},
                    success: function (result) {
                        if (result.count == 1) {
 
                        } else {
                            layer.alert(result.code + result.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
            }
            //#endregion
 
            //#region 生产日计划工单选择页面
            function get_checkSearchChangeBill() {
                var HSourceID = $("#HSourceID").val();
                var HDate = $("#HDate").val();
 
                layer.open({
                    type: 2
                    , skin: "layui-layer-rim"                           //加上边框
                    , title: "生产日计划工单列表"                             //标题
                    , closeBtn: 1                                       //窗体右上角关闭 的 样式
                    , shift: 2                                          //弹出动画
                    , area: ["90%", "90%"]                              //窗体大小
                    , maxmin: true                                      //设置最大最小按钮是否显示
                    , content: ["../../生产管理/生产日计划工单/JIT_DayPlanBillList.html?OperationType=2&HSourceID=" + HSourceID + "&HDate=" + HDate, "yes"]
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //按钮一  的回调
                        var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
                        var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
 
                        if (checkStatus.data.length != 1) {
                            return layer.msg("请选择一条数据");
                        }
 
                        $("HCreateDate").val(Format(new Date(), "yyyy-MM-dd"));
                        $("#HBadProcID").val(checkStatus.data[0].HProcID);
                        $("#HBadProcName").val(checkStatus.data[0].工序);
 
                        $("#HSplitNO").val(checkStatus.data[0].单据号);
                        $("#HICMOInterID").val(checkStatus.data[0].生产订单内码);
                        $("#HICMOEntryID").val(checkStatus.data[0].生产订单明细内码);
                        $("#HICMOBillNo").val(checkStatus.data[0].生产订单号);
 
                        $("#HDeptID").val(checkStatus.data[0].HDeptID);
                        $("#HDeptName").val(checkStatus.data[0].部门);
 
                        $("#HSourceID").val(checkStatus.data[0].HSourceID);
                        $("#HSourceName").val(checkStatus.data[0].生产资源);
 
                        $("#HMaterID").val(checkStatus.data[0].HMaterID);
                        $("#HMaterNumber").val(checkStatus.data[0].物料代码);
                        $("#HMaterName").val(checkStatus.data[0].物料名称);
                        $("#HMaterModel").val(checkStatus.data[0].规格型号);
                        $("#HUnitID").val(checkStatus.data[0].HUnitID);
                        $("#HUnitName").val(checkStatus.data[0].计量单位);
 
                        $("#HProcess").val(checkStatus.data[0].HProcID);
                        $("#HProcessName").val(checkStatus.data[0].工序);
 
                        $("#HSourceInterID").val(checkStatus.data[0].生产订单内码);
                        $("#HSourceEntryID").val(checkStatus.data[0].生产订单明细内码);
                        $("#HSourceBillNo").val(checkStatus.data[0].生产订单号);
                        $("#HSourceBillType").val(checkStatus.data[0].生产订单类型);
 
                        //layer.msg("换单");
                        layer.close(index);//关闭弹窗
                    }
                    , btn2: function (index, layero) { }
                })
            }
            //#endregion
 
            //#region 换配件页面
            function get_checkSearchChangeMater() {
                var HInterID = $("#HInterID").val();
                var HBillNo = $("#HBillNo").val();
                var HEmpName = $("#HEmpName").val();
                var HProdMac = $("#HProdMac").val();
                var HSourceInterID = $("#HSourceInterID").val();
                var HSourceEntryID = $("#HSourceEntryID").val();
                var HSourceBillNo = $("#HSourceBillNo").val();
                var HSourceBillType = $("#HSourceBillType").val();
                var HBarCode = $("#HBarCode").val();
 
 
                //var url = "../../计划管理/产线返修平台/Sc_SourceLineRepairBill_ChangeMater.html?OperationType=2&HInterID=" + HInterID + "&HSourceInterID=" + HSourceInterID + "&HSourceEntryID=" + HSourceEntryID + "&HSourceBillNo=" + HSourceBillNo + "&HSourceBillType=" + HSourceBillType + "&HBarCode=" + HBarCode + "&subMaterListLength=" + subMaterListLength + "&HBillNo=" + HBillNo + "&HEmpName=" + HEmpName + "&HProdMac=" + HProdMac;
 
                var dataParams = {
                    'OperationType': 2
                    , 'HInterID': HInterID
                    , 'HBillNo': HBillNo
                    , 'HEmpName': HEmpName
                    , 'HProdMac': HProdMac
                    , 'HSourceInterID': HSourceInterID
                    , 'HSourceEntryID': HSourceEntryID
                    , 'HSourceBillNo': HSourceBillNo
                    , 'HSourceBillType': HSourceBillType
                    , 'HBarCode': HBarCode
                    , 'subMaterList_Temp': $("#subMaterList_Temp").val()
                }
                var datajson = JSON.stringify(dataParams);
                url = encodeURI('../../计划管理/产线返修平台/Sc_SourceLineRepairBill_ChangeMater.html?datajson=' + datajson);
 
                layer.open({
                    type: 2
                    , skin: "layui-layer-rim"                           //加上边框
                    , title: "产线返修平台(更换配件)"                             //标题
                    , closeBtn: 1                                       //窗体右上角关闭 的 样式
                    , shift: 2                                          //弹出动画
                    , area: ["90%", "90%"]                              //窗体大小
                    , maxmin: true                                      //设置最大最小按钮是否显示
                    , content: [url, "yes"]
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
 
 
                        layer.close(index);//关闭弹窗
                    }
                    , btn2: function (index, layero) { }
                })
            }
            //#endregion
 
            //#region 保存HMaker
            function set_AddNew(data,HSaveType) {
                data.field.HReportType = "3";
                //获取表头数据
                var tableMain = {
                    "HInterID": $("#HInterID").val()
                    , "HBillNo": $("#HBillNo").val()
                    , "HDate": $("#HDate").val()
                    , "HEmpID": $("#HEmpID").val()
                    , "HDeptID": $("#HDeptID").val()
                    , "HSourceID": $("#HSourceID").val()
                    , "HProdOrgID": $("#HProdOrgID").val()
                    , "HMaterID": $("#HMaterID").val()
                    , "HWorkStationID": $("#HWorkStationID").val()
                    , "HProcess": $("#HProcess").val()
                    , "HIPAddr": $("#HIPAddr").val()
                    , "HMacAddr": $("#HMacAddr").val()
                    , "HProdMac": $("#HProdMac").val()
                    , "HBarCode": $("#HBarCode").val()
                }
                //获取子表1数据
                var tableSub = {
                    "HInterID": $("#HInterID").val()
                    , "HEntryID": $("#HEntryID").val()
                    , "HBillNo_bak": $("#HBillNo").val()
                    , "HRemark": $("#HRemark").val()
                    , "HSourceInterID": $("#HSourceInterID").val()
                    , "HSourceEntryID": $("#HSourceEntryID").val()
                    , "HSourceBillNo": $("#HSourceBillNo").val()
                    , "HSourceBillType": $("#HSourceBillType").val()
                    , "HBadReasonID": $("#HBadReasonID").val()
                    , "HBadTypeID": $("#HBadTypeID").val()
                    , "HBadResultID": $("#HBadResultID").val()
                    , "HBadProcID": $("#HBadProcID").val()
                    , "HRepairResult": $("#HRepairResult").val()
                    , "HCreator": $("#HCreator").val()
                    , "HCreateDate": $("#HCreateDate").val()
                }
 
                //获取表头数据并序列化
                var sMainStr = JSON.stringify(tableMain);
                //序列化子表1数据
                var sSubStr = JSON.stringify(tableSub);
                //获取子表2数据序列化
                var sSubMaterStr = $("#subMaterList_Temp").val();
 
 
                //拼接序列化的数据
                var sMainSub = sMainStr + ';' + sSubStr + ";" + sSubMaterStr + ";" + sessionStorage["HUserName"];
 
                var index = layer.load();
                $.ajax({
                    type: "POST",
                    url: GetWEBURL() + "Sc_SourceLineRepairBillSub/AddSourceLineRepairBill",
                    async: true,
                    data: { "sMainSub": sMainSub },
                    dataType: "json",
                    success: function (data) {
                        if (data.count == 1) {
                            //生成并设置主表的内码和单据号、日期
                            createBillNo();
                            //更新表头
                            getMainInfo();
                            //更新子表
                            get_InitGrid();
                            //更新不良率占比分析图
                            getBadReasonRateInfo();
 
                            layer.close(index);
                            layer.msg("提交成功");
                        }
                        else {
                            layer.close(index);
                            layer.msg(data.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                        }
                    },
                    error: function (err) {
                        layer.close(index);
                        layer.msg("错误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                    }
                });
            }
            //#endregion
 
            //#region 编辑 页面赋值
            function RoadBillMain(linterid)//加载表头
            {
                //$.ajax({
                //    url: GetWEBURL() + "/Pay_SingleBalBill/editInit",
                //    type: "GET",
                //    async: false,
                //    data: { "HInterID": linterid, "user": sessionStorage["HUserName"] },
                //    success: function (result) {
                //        var tableMain = result.data[0];
                //        var tableSub = result.data[1];
 
                //        //主表 赋值
                //        form.val("formData", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
                //            "HInterID": tableMain[0]["HInterID"]
                //        });
 
                //        //子表  赋值
                //        option.data = tableSub;
                //        table.render(option);
                //    }
                //})
            }
            //#endregion
 
            //#region 数据校验
            function AllowLoadData(data) {
                //#region 表头数据检验
                if ($("#HBillNo").val() == "") {
                    layer.msg("单据号不能为空!");
                    return false;
                }
                //#endregion
                return true;
            }
            //#endregion
 
            //#region 子表:删除指定行
            function set_GridDelete(obj) {
                var data = obj.data;
                var rowIndex = $(obj.tr).attr("data-index");
                if (obj.event === 'del') {
                    layer.confirm('真的删除行吗?', function (index) {
                        var HInterID = obj.data.HInterID;
                        var HEntryID = obj.data.HEntryID;
 
                        var ajaxLoad = layer.load();
                        $.ajax({
                            url: GetWEBURL() + "/Sc_SourceLineRepairBill/deleteSubInfo",
                            type: "GET",
                            async: false,
                            data: { "HInterID": HInterID, "HEntryID": HEntryID, "user": sessionStorage["HUserName"] },
                            success: function (result) {
                                if (result.count == 1) {
                                    layer.msg("删除成功!");
                                    get_InitGrid();
                                    getBadReasonRateInfo();
                                    layer.close(ajaxLoad);
                                } else {
                                    layer.alert(result.code + result.Message, { icon: 5 });
                                    layer.close(ajaxLoad);
                                }
                            }, error: function () {
                                layer.alert("接口请求失败!", { icon: 5 });
                                layer.close(ajaxLoad);
                            }
                        })
                    });
                }
            }
            //#endregion
 
            //#region 隐藏列设置
            function get_HideColumn() {
                var colName = "";
                var contentUrl = "";
                for (var i = 1; i < option.cols[0].length - 1; i++) {
                    colName += option.cols[0][i]["title"] + ",";
                }
                var urlStr = window.document.location.pathname;//获取文件路径
                var urlLen = urlStr.split('/');
                for (var i = 0; i < urlLen.length - 4; i++) {
                    contentUrl += "../";
                }
                colName = encodeURI(colName.substring(0, colName.length - 1));//对 URI 进行编码
 
                contentUrl += '基础资料/隐藏列设置/Gy_GridView_Hide.html?HModName=' + HModName + '&colName=' + colName;
 
                layer.open({
                    type: 2
                    , skin: "layui-layer-rim" //加上边框
                    , title: "隐藏列设置"  //标题
                    , closeBtn: 1  //窗体右上角关闭 的 样式
                    , shift: 2 //弹出动画
                    , area: ["50%", "90%"] //窗体大小
                    , maxmin: true //设置最大最小按钮是否显示
                    , content: [contentUrl, "yes"]
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //刷新表格数据
                        DisPlay_HideColumn();
                        //更新表格缓存的数据
                        layer.close(index);//关闭弹窗
                    }
                })
            }
            //#endregion
            //#region 显示列数据
            function DisPlay_HideColumn() {
                $.ajax({
                    url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
                    type: "GET",
                    data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
                    async: false,
                    success: function (data1) {
                        if (data1.data.length != 0) {
                            var dataCol = [];//数据库查询出的列数据
 
                            dataCol = data1.data[0].HGridString.split(',');
 
                            for (var i = 0; i < option.cols[0].length - 2; i++) {
                                var dataCols = dataCol[i].split('|');
                                //隐藏列
                                if (dataCols[1] == 1) {
                                    option.cols[0][i + 1]["hide"] = true;
                                }
                                //设置列宽
                                if (dataCols[3] > 0) {
                                    option.cols[0][i + 1]["width"] = dataCols[3];
                                }
                                //设置内容字体大小
                                if (data1.data[0].HFontSize != 0) {
                                    option.cols[0][i + 1]["style"] += "font-size:" + data1.data[0].HFontSize + "px;";
                                } else {
                                    option.cols[0][i + 1]["style"] += "font-size:100%";
                                }
                                //设置列宽
                                //if (data1.data[0].HColumnWidth != 0) {
                                //    option.cols[0][i + 1]["width"] = data1.data[0].HColumnWidth + "px;";
                                //} else {
                                //    option.cols[0][i + 1]["width"] = "";
                                //}
                                //显示列
                                if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
                                    option.cols[0][i + 1]["hide"] = false;
                                }
                                //字体所在位置(左 居中 右)
                                switch (dataCols[2]) {
                                    case "L":
                                        option.cols[0][i + 1]["align"] = "left";
                                        break;
                                    case "M":
                                        option.cols[0][i + 1]["align"] = "center";
                                        break;
                                    case "R":
                                        option.cols[0][i + 1]["align"] = "right";
                                        break;
                                }
                            }
 
                            //取消冻结列
                            for (var i = 1; i < option.cols[0].length - 1; i++) {
                                if (option.cols[0][i]["fixed"] != null) {
                                    option.cols[0][i]["fixed"] = null;
                                }
                                else {
                                    break;
                                }
                            }
                            //冻结列
                            if (data1.data[0].HFixCols != 0) {
                                for (var i = 0; i < data1.data[0].HFixCols; i++) {
                                    if ($.inArray(option.cols[0][i + 1]["title"], titleData) != -1) {
                                        data1.data[0].HFixCols += 1;
                                    }
                                    option.cols[0][i + 1]["fixed"] = "left";
                                }
                            }
                            table.render(option);
                        } else {
                            table.render(option);
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
            }
            //#endregion
            //#endregion
 
 
 
 
        });
 
        //维修人
        function GetHEmpValue(obj) {
            $("#HEmpID").val(obj[0].HItemID);//内码
            $("#HEmpName").val(obj[0].职员名称);//名称
        }
        //不良原因
        function GetBadReasonValue(obj) {
            $("#HBadReasonID").val(obj[0].HItemID);//内码
            $("#HBadReasonName").val(obj[0].不良原因名称);//名称
        }
        //不良类型
        function GetBadTypeValue(obj) {
            $("#HBadTypeID").val(obj[0].HItemID);//内码
            $("#HBadTypeName").val(obj[0].不良类型名称);//名称
        }
        //不良后果
        function GetBadResultValue(obj) {
            $("#HBadResultID").val(obj[0].HItemID);//内码
            $("#HBadResultName").val(obj[0].不良后果名称);//名称
        }
 
    </script>
</body>
</html>