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
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<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">
    <!--引用layui样式文件-->
    <link rel="stylesheet" href="../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../layuiadmin/style/admin.css" media="all">
    <link href="../layuiadmin/layui/css/global.css" rel="stylesheet" />
    <!--自定义样式-->
    <link href="../layuiadmin/layui/css/ReportPlatform.css" rel="stylesheet" />
    <!--引用layui js文件-->
    <script src="../layuiadmin/Scripts/jquery-1.4.1.js"></script>
    <script src="../layuiadmin/layui/layui.js"></script>
    <script src="../layuiadmin/echarts.min.js"></script>
    <script src="../layuiadmin/Scripts/json2.js"></script>
    <script src="../layuiadmin/Scripts/webConfig.js"></script>
    <script src="../layuiadmin/zgqCustom/zgqCustom.js"></script>
 
    <script>
        var wktag = 0;
        var workcode = "";          //工单号
        var HDeptID = "";          //车间ID
        var HDept = "";            //车间
        var HSourceID = "";        //生产资源ID
        var HSourceName = "";      //生产资源
        var HSourceID1 = "";        //生产资源ID1
        var HSourceName1 = "";      //生产资源1
        var HSourceInterID = "";   //源单主内码
        var HSourceEntryID = "";   //源单子内码
        var HSourceBillNo = "";    //源单单号
        var HSourceBillType = "";  //源单类型
        var HICMOInterID = "";     //生产订单主内码
        var HICMOEntryID = "";     //生产订单子内码
        var HICMOBillNo = "";      //任务单号
        var HMaterName = "";      //产品名称
        var HMaterID = 0;          //产品ID
        var HProQty = [];       //时间点产量
        var HBadQty = [];       //不良数量
        var HBadReason = [];       //不良原因
        var HEmpName = "";      //操作员
        var HManagerName = "";      //负责人
        var HGroupName = "";      //班组
        var HProcID = 0;      //工序
        var HSBName = "";   //设备名称
 
        //注意:选项卡 依赖 element 模块,否则无法进行功能性操作
        layui.config({
            base: '../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
                , table = layui.table
                , form = layui.form
                , laydate = layui.laydate
                , element = layui.element;
            //window 全局变量
            window.mychart1 = echarts.init(document.getElementById('mychart1'));
            window.mychart2 = echarts.init(document.getElementById('mychart2'));
 
            element.on('tab(TabTest)', function (data) {
                Mychart(mychart1, mychart2);
                mychart1.resize();
                mychart2.resize();
            })
 
            TSLoad();
        });
        function TSLoad() {
            $("#topleft").html("");
            var HUserName = sessionStorage["HUserName"];  //sessionStorage["HUserName"];     //默认当前登录人员
            $.ajax({
                url: GetWEBURL() + "/ReportPlatForm/SearchGetLineBindBillList",
                type: "GET",
                data: { "HUserName": HUserName },
                dataType: "json",//数据类型可以为 text xml json  script  jsonp
                success: function (data) {
                    var LoadData = data.data.h_p_JIT_GetSourceInfoByUser;
 
                    if (LoadData.length > 0)// 说明验证成功了,
                    {
                        HSBName = LoadData[0].HSourceName;
                        for (var i = 1; i <= LoadData.length + 1; i++) {
                            if (i <= LoadData.length) {
                                var html1 = '';
                                html1 += '<div class="layui-col-sm12 layui-col-md3">';
                                html1 += '<div class="cnt ctop" id="ts' + i + '" onclick="Check(this,' + i + ')">';
                                html1 += '<dl>';
                                html1 += '<dd>';
                                html1 += '<h1 style="display:none;"><span>资源ID:</span><span id="eqpid' + i + '">' + LoadData[i - 1].HSourceID + '</span></h1>';
                                html1 += '<h1><span>设备编号:</span><span id="eqp' + i + '">' + LoadData[i - 1].HSourceName + '</span></h1>';
                                html1 += '<h1><span>设备代码:</span><span id="eqp' + i + '">' + LoadData[i - 1].HSourceNumber + '</span></h1>';
                                html1 += '<h1><span>操作员:</span><span id="HEmpName' + i + '">' + LoadData[i - 1].HUserName + '</span></h1>';
                                html1 += '<h1><span>生产班组:</span><span id="HGroupName' + i + '">' + LoadData[i - 1].GroupName + '</span></h1>';
                                //html1 += '<h1><span>当前工单:</span><span id="po' + i + '">' + (LoadData[i - 1].HSourceBillNo == null ? '' : LoadData[i - 1].HSourceBillNo) + '</span></h1>';
                                //html1 += '<h1><span>产品名称:</span><span id="ptn' + i + '">' + (LoadData[i - 1].HName == null ? '' : LoadData[i - 1].HName) + '</span></h1>';
                                //html1 += '<h1><span>产品规格:</span><span id="pts' + i + '">' + (LoadData[i - 1].HModel == null ? '' : LoadData[i - 1].HModel) + '</span></h1>';
                                html1 += '<h1><span>负责人:</span><span id="us' + i + '">' + LoadData[i - 1].HEmpName + '</span></h1>';
                                html1 += '<h1 hidden> <span id="HGroupID' + i + '">' + LoadData[i - 1].HGroupID + '</span></h1>';
                                html1 += '<h1 hidden> <span id="HManagerID' + i + '">' + LoadData[i - 1].HManagerID + '</span></h1>';
                                html1 += '</dd>';
                                html1 += '</dl>';
                                html1 += '</div>';
                                html1 += '</div>';
                                $("#topleft").append(html1);
                                $("#ts" + i + "").append('<span class="layui-icon layui-icon-delete delete"  onclick="Delete(event,this,' + i + ')"></span>'); //在当前div后追加加一个span删除
 
                                //根据返回的 选中标志HNowFlag设置选中的资源
                                if (LoadData[i - 1].HNowFlag) {
                                    $('.ctop').removeClass('check');  //删除不同父级clss样式相同的所有元素
                                    $("#ts" + i + "").addClass('check'); // 添加当前元素的样式
                                    Check(this, i);
                                }
                            }
                            else {
                                var html1 = '';
                                html1 += '<div class="layui-col-sm12 layui-col-md3">';
                                html1 += '<div class="cnt ctop" id="ts' + i + '" onclick="Check(this,' + i + ')">';
                                html1 += '<span class="layui-icon layui-icon-addition imgicon0" onclick="Add(event,this,' + i + ')"></span>';
                                html1 += '</div>';
                                html1 += '</div>';
                                $("#topleft").append(html1);
 
                            }
                        }
                    }
                    else {
                        var html1 = '';
                        html1 += '<div class="layui-col-sm12 layui-col-md3">';
                        html1 += '<div class="cnt ctop" id="ts1" onclick="Check(this,1)">';
                        html1 += '<span class="layui-icon layui-icon-addition imgicon0" onclick="Add(event,this,1)"></span>';
                        html1 += '</div>';
                        html1 += '</div>';
                        $("#topleft").append(html1);
                    }
                },
                error: function (err) {
                    layer.alert(err.Message, { time: 1 * 2000, icon: 5 });
                    return false;
                }
            });
        }
        var HManagerID = 0;
        var HGroupID = 0;
        //选中资源
        function Check(obj, i) {
            wktag = 0;
            $("#btomleft").html("");
            $("#topright").html("");
            HProQty = [];       //时间点产量
            HBadQty = [];       //不良数量
            HBadReason = [];       //不良原因
            var partid = $(obj).parent().attr("id");   //获取父级id
            var eqpid = "eqpid" + i;                   //获取指定资源样式ID
            var HSourceID = $("#" + eqpid + "").html(); //通过样式ID获取html内容(资源ID)
            HSourceID1 = $("#" + eqpid + "").html(); //通过样式ID获取html内容(资源ID)
            var eqp = "eqp" + i;                       //获取指定资源样式ID
            var HSourceName = $("#" + eqp + "").html(); //通过样式ID获取html内容(资源)
            HSourceName1 = $("#" + eqp + "").html(); //通过样式ID获取html内容(资源)
            var emp = "HEmpName" + i;                   //获取指定资源样式ID
            var us = "us" + i;                   //获取指定资源样式ID
            var gro = "HGroupName" + i;                   //获取指定资源样式ID
            HEmpName = $("#" + emp + "").html(); //通过样式ID获取html内容(资源ID)
            HManagerName = $("#" + us + "").html(); //通过样式ID获取html内容(资源ID)
            HGroupName = $("#" + gro + "").html(); //通过样式ID获取html内容(资源ID)
            HManagerID = "HManagerID" + i;
            HGroupID = "HGroupID" + i;
            HManagerID = $("#" + HManagerID + "").html();
            HGroupID = $("#" + HGroupID + "").html();
 
            if (HSourceID != "" && HSourceID != null) {
                $('.ctop').removeClass('check');  //删除不同父级clss样式相同的所有元素
                $("#ts" + i + "").addClass('check'); // 添加当前元素的样式
                //执行联动事件
                $.ajax({
                    url: GetWEBURL() + "/ReportPlatForm/SearchGetWorkBillList",
                    type: "GET",
                    data: { "HSourceID": HSourceID },
                    dataType: "json",//数据类型可以为 text xml json  script  jsonp
                    success: function (data) {
 
                        var LoadData1 = data.data.h_p_JIT_GetWorkBillListInfoBySource;
                        var LoadData2 = data.data.h_p_JIT_GetWorkBillListInfoBySource1;
                        var LoadData3 = data.data.h_p_JIT_GetWorkBillListInfoBySource2; //时间点产量
                        var LoadData4 = data.data.h_p_JIT_GetWorkBillListInfoBySource3; //不良分析                       
                        if (LoadData1.length > 0)  //工单列表数据
                        {
 
                            for (var i = 0; i < LoadData1.length; i++) {
                                var html1 = '';
                                //汇报总数大于计划数量,调整背景色提示
                                if (LoadData1[i].HDateFinishQty > LoadData1[i].HDatePlanQty) {
                                    html1 += '<div class="layui-col-sm12 layui-col-md3" style="background-color:#F595A0;border-radius: 3%;">';
                                } else {
                                    html1 += '<div class="layui-col-sm12 layui-col-md3">';
                                }
                                html1 += '<div class="cns" id="bs' + (i + 1) + '" onclick="CheckBtom(this,' + (i + 1) + ')">';
                                html1 += '<dl>';
                                html1 += '<dd class="tcenter">';
                                html1 += '<h1 style="display:none;"><span>单据类型:</span><span id="ty' + (i + 1) + '">' + LoadData1[i].HBillType + '</span></h1>';
                                //HSourceInterID实际取值:Sc_ICMOBillStatus_Tmp  HInterID(单据主ID)
                                html1 += '<h1 style="display:none;"><span>源单主内码:</span><span id="sm' + (i + 1) + '">' + LoadData1[i].HSourceInterID + '</span></h1>';
                                html1 += '<h1 style="display:none;"><span>源单子内码:</span><span id="sb' + (i + 1) + '">' + LoadData1[i].HSourceEntryID + '</span></h1>';
                                html1 += '<h1 style="display:none;"><span>源单单号:</span><span id="sw' + (i + 1) + '">' + LoadData1[i].HSourceBillNo + '</span></h1>';
                                html1 += '<h1 style="display:none;"><span>源单类型:</span><span id="st' + (i + 1) + '">' + LoadData1[i].HSourceBillType + '</span></h1>';
                                html1 += '<h1 style="display:none;"><span>生产订单号主ID:</span><span id="df' + (i + 1) + '">' + LoadData1[i].HICMOInterID + '</span></h1>';
                                html1 += '<h1 style="display:none;"><span>生产订单子ID:</span><span id="ds' + (i + 1) + '">' + LoadData1[i].HICMOEntryID + '</span></h1>';
 
 
                                html1 += '<h1><span>工单号:</span><span id="wk' + (i + 1) + '">' + LoadData1[i].HICMOBillNo + '</span><span style="margin-left:25px;">日期:</span><span>' + LoadData1[i].计划日期 + '</span></h1>';
                                html1 += '<h1 style="display:none;"><span>产品ID:</span><span id="materid' + (i + 1) + '">' + LoadData1[i].HMaterID + '</span></h1>';
                                html1 += '<h1 style="display:none;"><span>工序ID:</span><span id="procid' + (i + 1) + '">' + LoadData1[i].HProcID + '</span></h1>';
                                html1 += '<h1><span>产品名称:</span><span id="ptn' + (i + 1) + '">[' + LoadData1[i].HMaterNumber + ']-[' + LoadData1[i].HMaterName + ']</span></h1>';
                                html1 += '<h1><span>产品型号:</span><span id="pts' + (i + 1) + '">' + LoadData1[i].HModel + '</span></h1>';
                                html1 += '<h1><span>计划数量:</span><span>' + LoadData1[i].HDatePlanQty + '</span><span style="margin-left:20px;">汇报总数:</span><span>' + LoadData1[i].HDateFinishQty + '</span></h1>';
                                switch (LoadData1[i].HICMOStatus) {
                                    case "待生产":
                                        html1 += '<h1><span>当前状态:</span><span class="gj_icon color_border3"></span><span>' + LoadData1[i].HICMOStatus + '</span><span style="margin-left:5px;">领料状态:</span><span>' + LoadData1[i].领料状态 + '</span></h1>';
                                        break;
                                    case "生产中":
                                        html1 += '<h1><span>当前状态:</span><span class="gj_icon color_border2"></span><span>' + LoadData1[i].HICMOStatus + '</span><span style="margin-left:5px;">领料状态:</span><span>' + LoadData1[i].领料状态 + '</span></h1>';
                                        break;
                                    case "挂起":
                                        html1 += '<h1><span>当前状态:</span><span class="gj_icon color_border1"></span><span>' + LoadData1[i].HICMOStatus + '</span><span style="margin-left:5px;">领料状态:</span><span>' + LoadData1[i].领料状态 + '</span></h1>';
                                        break;
                                    case "完工":
                                        html1 += '<h1><span>当前状态:</span><span class="gj_icon color_border4"></span><span>' + LoadData1[i].HICMOStatus + '</span><span style="margin-left:5px;">领料状态:</span><span>' + LoadData1[i].领料状态 + '</span></h1>';
                                        break;
                                    default:
                                }
                                html1 += '<span class="prs">生产进度:</span>';
                                html1 += '<div class="layui-progress layui-progress-big" lay-showPercent="yes">';
                                html1 += '<div class="layui-progress-bar" lay-percent="' + ((LoadData1[i].HDateFinishQty / LoadData1[i].HDatePlanQty) * 100).toFixed(2) + '%" style="width:' + ((LoadData1[i].HDateFinishQty / LoadData1[i].HDatePlanQty) * 100).toFixed(2) + '%;">';
                                html1 += '<span class="layui-progress-text">' + ((LoadData1[i].HDateFinishQty / LoadData1[i].HDatePlanQty) * 100).toFixed(2) + '%</span>';
                                html1 += '</div > ';
                                html1 += '</div>';
                                html1 += '</dd>';
                                html1 += '</dl>';
                                html1 += '</div>';
                                html1 += '</div>';
                                $("#btomleft").append(html1);
                            }
                        }
                        if (LoadData2.length > 0)  //当前状态数据
                        {
                            HSBName = LoadData2[0].HSourceName;
                            for (var i = 0; i < LoadData2.length; i++) {
                                var html1 = '';
                                html1 += '<div class="layui-col-sm12 layui-col-md12">';
                                html1 += '<dl class="topright">'
                                html1 += '<dt>';
                                html1 += '<img src="../layuiadmin/layui/images/device.png" onError="this.src="../layuiadmin/layui/images/erro.png";">'
                                html1 += '</dt>';
                                html1 += '<dd>';
                                html1 += '<h1 style="display:none;"><span>设备编号:</span><span id="HEquipCode' + (i + 1) + '">' + LoadData2[i].HSourceCode + '</span></h1>';
                                html1 += '<h1><span>当前设备:</span><span id="HEquipName' + (i + 1) + '">' + LoadData2[i].HSourceName + '</span><div style="margin-left:25px;float:right"><span >首检次数:</span><span>' + LoadData2[i].首检次数 + '</span></div></h1>';
                                html1 += '<h1><span>当前订单:</span><span>' + LoadData2[i].HSourceBillNo + '</span><div style="margin-left:25px;float:right"><span >巡检次数:</span><span>' + LoadData2[i].巡检次数 + '</span></div></h1>';
                                html1 += '<h1><span>物料名称:</span><span>' + LoadData2[i].HMaterName + '</span><div style="margin-left:25px;float:right"><span >过程检次数:</span><span>' + LoadData2[i].过程检次数 + '</span></div></h1>';
                                html1 += '<h1><span>计划数量:</span><span>' + LoadData2[i].HPlanQty + '</span><div style="margin-left:25px;float:right"><span >当日点检时间:</span><span>' + LoadData2[i].当日点检时间 + '</span></div></h1>';
                                html1 += '<h1><span>已汇报数量:</span><span>' + LoadData2[i].HRelationQty + '</span><div style="margin-left:25px;float:right"><span >最后保养时间:</span><span>' + LoadData2[i].最后保养时间 + '</span></div></h1>';
                                if (LoadData2[i].HRelationQty == 0 || LoadData2[i].HRelationQty == null) {
                                    html1 += '<h1><span>进度:</span><span>0%</span><div style="margin-left:25px;float:right"><span >点检完成情况:</span><span>' + LoadData2[i].当日点检完成情况 + '</span></div></h1>';
                                }
                                else {
                                    html1 += '<h1><span>进度:</span><span>' + ((LoadData2[i].HRelationQty / LoadData2[i].HPlanQty) * 100).toFixed(2) + '%</span><div style="margin-left:25px;float:right"><span >点检完成情况:</span><span>' + LoadData2[i].当日点检完成情况 + '</span></div></h1>';
                                }
                                html1 += '<h1><span>本单运行时间:</span><span>' + getSeconds(LoadData2[i].HSumTimes) + '</span></h1>';
                                html1 += '<h1><span>本资源运行时间:</span><span>' + getSeconds(LoadData2[i].HSourceWorkTime) + '</span></h1>';
                                html1 += '</dd>';
                                html1 += '</dl>';
                                html1 += '</div>';
                                $("#topright").append(html1);
                            }
                        }
                        if (LoadData3.length > 0)  //当前状态数据
                        {
                            let k = 0; //LoadData3 数据数组的下标
                            for (let i = 8; i < 21; i++) {
                                let IsAdd = false; //是否要累加 LoadData3 数据数组的下标值
                                for (let j = 0; j < LoadData3.length; k) {
                                    if (i == LoadData3[k].时间点) { //如果 i(8--20) 时间点有产量,则把产量写入数组 HProQty,否则写入 0
                                        HProQty.push(LoadData3[k].产量)
                                        IsAdd = true;
                                        break;
                                    } else {
                                        HProQty.push(0)
                                        break;
                                    }
                                }
                                if (k < LoadData3.length - 1 && IsAdd == true) {
                                    k++;
                                }
                            }
                        }
                        if (LoadData4.length > 0) {
                            for (let i = 0; i < LoadData4.length; i++) {
                                HBadReason.push(LoadData4[i].不良原因);
                                HBadQty.push(LoadData4[i].不良数量);
                            }
                        }
                        //刷新图表数据
                        Mychart(mychart1, mychart2);
                    },
                    error: function (err) {
                        layer.alert(err.Message, { time: 1 * 2000, icon: 5 });
                        return false;
                    }
                });
            }
        }
 
        //添加资源
        function Add(event, obj, i) {
            event.stopPropagation();  //阻止冒泡
            //页面层-自定义
            layer.open({
                type: 2 //此处以iframe举例
                , title: '产线绑定'
                , area: ['90%', '90%']
                , shadeClose: false //开启遮罩关闭
                , shade: 0.5
                , maxmin: true
                , content: ['生产管理/报工平台功能页/LineBind.html', 'yes']
                , btn: ['确定', '取消']
                , btn1: function (index, layero, e) {
 
                    //按钮【按钮一】的回调
                    var body = layer.getChildFrame('body', index); //得到iframe页的body内容
                    //var from = layer.getChildFrame('#from0', index); //得到iframe页的from内容
                    if (!AllowLoadData(body))//数据验证
                    {
                        return false;
                    }
                    var HUserName = sessionStorage["HUserName"];
                    var HSourceID = body.find("#HSourceID").val();
                    var HSourceCode = body.find("#HSourceCode").val();
                    var HSourceName = body.find("#HSourceName").val();
                    var HManagerID = body.find("#HManagerID").val();
                    var HManagerName = body.find("#HManagerName").val();
                    var HGroupID = body.find("#HGroupID").val();
                    var HGroupName = body.find("#HGroupName").val();
                    var HCreateDate = body.find("#HCreateDate").val();
                    var HRemark = body.find("#HRemark").val();
                    $.ajax(
                        {
                            url: GetWEBURL() + "/ReportPlatForm/SaveGetLineBindBillList", //方法所在页面和方法名
                            dataType: "json",
                            type: "Get",
                            async: false,
                            data: {
                                "HUserName": HUserName,
                                "HSourceID": HSourceID,
                                "HSourceName": HSourceName,
                                "HManagerID": HManagerID,
                                "HManagerName": HManagerName,
                                "HGroupID": HGroupID,
                                "HGroupName": HGroupName,
                                "HCreateDate": HCreateDate,
                                "HRemark": HRemark
                            },
                            success: function (data) {
                                if (data.count == 1) { // 说明验证成功了,
                                    TSLoad(); //执行查询过程
                                    layer.close(index);
                                    layer.msg(data.Message, { time: 1 * 2000, icon: 1 });
                                    return false;
                                }
                                else {
                                    layer.alert(data.Message, { icon: 5 });
                                    return false;
 
                                }
                            },
                            error: function (err) {
                                layer.alert(err.Message, { time: 1 * 2000, icon: 5 });
                                return false;
                            }
                        });
                }
                , btn2: function (index, layero) {
                    //按钮【按钮二】的回调
                    //return false 开启该代码可禁止点击该按钮关闭
                }
 
                , zIndex: layer.zIndex //重点1
                , success: function (layero, index) {
 
                }
                , end: function () {
 
                }
            });
 
        }
 
        //删除资源
        function Delete(event, obj, i) {
            event.stopPropagation();  //阻止冒泡
            //获取父级id
            var partid = $(obj).parent().attr("id");
            var eqpid = "eqpid" + i;                   //获取指定资源样式ID
            HSourceID = $("#" + eqpid + "").html(); //通过样式ID获取html内容(资源ID)
            //逻辑删除方法
            layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
                $.ajax({
                    url: GetWEBURL() + "/ReportPlatForm/DeleteGetLineBindBillList",
                    type: "GET",
                    data: { "HSourceID": HSourceID, "user": sessionStorage["HUserName"] },
                    dataType: "json",//数据类型可以为 text xml json  script  jsonp
                    success: function (data) {
                        if (data.count > 0) {
                            TSLoad(); //执行查询过程
                            layer.close(index);
                            layer.msg(data.Message, { time: 1 * 2000, icon: 1 });
                            return false;
                        }
                        else {
                            layer.alert(data.Message, { time: 1 * 2000, icon: 5 });
                            return false;
                        }
                    },
                    error: function (err) {
                        layer.alert(err.Message, { time: 1 * 2000, icon: 5 });
                        return false;
                    }
                });
            })
        }
 
        //工单列表选中
        function CheckBtom(obj, i) {
            var partid = $(obj).parent().attr("id");   //获取父级id
            workcode = $("#wk" + i + "").html(); //通过样式ID获取html内容(工单号)
            HBillType = $("#ty" + i + "").html(); //通过样式ID获取html内容(单据类型)
            HSourceInterID = $("#sm" + i + "").html(); //通过样式ID获取html内容(源单主内码)
            HSourceEntryID = $("#sb" + i + "").html(); //通过样式ID获取html内容(源单子内吗)
            HSourceBillNo = $("#sw" + i + "").html(); //通过样式ID获取html内容(源单单号)
            HSourceBillType = $("#st" + i + "").html(); //通过样式ID获取html内容(源单类型)
            HICMOInterID = $("#df" + i + "").html();     //生产订单主内码
            HICMOEntryID = $("#ds" + i + "").html();     //生产订单子内码
            HICMOBillNo = $("#wk" + i + "").html();     //生产订单号
            HMaterName = $("#ptn" + i + "").html();     //产品名称
            HMaterID = $("#materid" + i + "").html();     //产品ID
            HProcID = $("#procid" + i + "").html();     //工序ID
 
            if (workcode != "" && workcode != null) {
                $('.cns').removeClass('check1');  //删除不同父级clss样式相同的所有元素
                $("#bs" + i + "").addClass('check1'); // 添加当前元素的样式
                wktag = 1;
            }
        }
 
 
        function Mychart(mychart1, mychart2) {
            //生产效率
            option1 = {
                title: {
                    text: '当前设备日生产效率'
                },
                tooltip: {
                    trigger: 'axis'
                },
                legend: {
                    data: ['当前设备日生产效率']
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                toolbox: {
                    feature: {
                        saveAsImage: {}
                    }
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    data: ['08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00']
                },
                yAxis: {
                    type: 'value'
                },
                series: [
                    {
                        name: '当前设备日生产效率',
                        type: 'line',
                        stack: '总量',
                        data: HProQty
                    }
                ]
            };
            //不良分析
            option2 = {
                title: {
                    text: '当前设备本周不良原因对比'
                },
                legend: {
                    data: ['不良原因']
                },
                grid: {
                    left: '3%',
                    right: '3%',
                    bottom: '15%',
                    containLabel: true
                },
                xAxis: {
                    data: HBadReason
                },
                yAxis: {},
                series: [{
                    type: 'bar',
                    name: '不良原因',
                    itemStyle: {
                        normal: {
                            color: function (params) {
                                var colorList = ['#2eddc1', '#FCCE10', '#E87C25', '#27727B', '#9efdc6', '#F00DC6', '#8317E5', '#29086A', '#D8E848', '#17ADE5', '#FF1F86', '#A27E90', '#71BCCE', '#11715012', '#DBF7B2',];
                                return colorList[params.dataIndex]
                            },
                            label: {
                                show: true,
                                position: 'top',
                                formatter: '{c}'
                            }
                        }
                    },
                    data: HBadQty
                }]
            };
 
 
            mychart1.setOption(option1);
            mychart2.setOption(option2);
            window.onresize = function () {
                mychart1.resize();
                mychart2.resize();
            }
        }
 
        //非空验证
        function AllowLoadData(body) {  //非空验证
            var Result = true;
            //if (body.find("#HUserName").val() == '' || body.find("#HUserName").val() == null) {
            //    layer.msg("用户名不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
            //    return Result = false;
            //}
            if (body.find("#HSourceID").val() == '' || body.find("#HSourceID").val() == null) {
                layer.msg("生产资源不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                return Result = false;
            }
            if (body.find("#HManagerID").val() == '' || body.find("#HManagerID").val() == null) {
                layer.msg("负责人不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                return Result = false;
            }
            if (body.find("#HGroupID").val() == '' || body.find("#HGroupID").val() == null) {
                layer.msg("班组不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                return Result = false;
            }
            if (body.find("#HCreateDate").val() == '' || body.find("#HCreateDate").val() == null) {
                layer.msg("创建日期不能为空!", { icon: 5, btn: ['确认'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
                return Result = false;
            }
            return Result;
        }
 
        //将s转化为时分秒格式 h:m:s
        function getSeconds(s) {
            var sTime = parseInt(s);// 秒
            var mTime = 0;// 分
            var hTime = 0;// 时
            if (sTime > 60) {//如果秒数大于60,将秒数转换成整数
                //获取分钟,除以60取整数,得到整数分钟
                mTime = parseInt(sTime / 60);
                //获取秒数,秒数取佘,得到整数秒数
                sTime = parseInt(sTime % 60);
                //如果分钟大于60,将分钟转换成小时
                if (mTime > 60) {
                    //获取小时,获取分钟除以60,得到整数小时
                    hTime = parseInt(mTime / 60);
                    //获取小时后取佘的分,获取分钟除以60取佘的分
                    mTime = parseInt(mTime % 60);
                }
            }
            var result = '';
            if (sTime >= 0 && sTime < 10) {
                result = "0" + parseInt(sTime) + "";
            } else {
                result = "" + parseInt(sTime) + "";
            }
            if (mTime >= 0 && mTime < 10) {
                result = "0" + parseInt(mTime) + ":" + result;
            } else {
                result = "" + parseInt(mTime) + ":" + result;
            }
            if (hTime >= 0 && hTime < 10) {
                result = "0" + parseInt(hTime) + ":" + result;
            } else {
                result = "" + parseInt(hTime) + ":" + result;
            }
            return result;
        }
 
        //开工按钮点击事件
        function OpenWork(event, obj) {
            if (wktag == 0) {
                layer.alert("请选择工单列表", { icon: 5 });
                return false;
            }
            if (WorkStaus(HSourceID1, workcode, HSourceInterID, "开工")) {
                layer.alert("单据状态不满足开工条件!", { icon: 5 });
                return false;
            }
            layer.open({
                type: 2,
                skin: 'layui-layer-rim', //加上边框
                title: '新增开工单',
                closeBtn: 1,
                shift: 2,
                area: ['100%', '100%'],
                maxmin: true,
                content: '生产管理/生产开工单/Sc_Add_MESBeginWorkBillList.html?OperationType=2&linterid=&HSouceBillType=',
                end: function () {
 
                },
                success: function (dom, index) {
                    var data = [];
                    data.push({
                        "HBillType": HBillType,
                        "HSourceInterID": HSourceInterID,
                        "HSourceEntryID": HSourceEntryID,
                        "HSourceBillNo": HSourceBillNo,
                        "HSourceBillType": HSourceBillType
                    });
 
                    //通过索引获取到当前iframe弹出层
                    var iframe = window['layui-layer-iframe' + index];
                    //调用iframe弹出层内的方法
                    iframe.edit(data);
                },
            });
        }
 
        //快速开工
        function KSOpenWork(event, obj) {
            if (wktag == 0) {
                layer.alert("请选择工单列表", { icon: 5 });
                return false;
            }
            if (WorkStaus(HSourceID1, workcode, HSourceInterID, "开工")) {
                layer.alert("单据状态不满足开工条件!", { icon: 5 });
                return false;
            }
            var indexOpen = layer.open({
                type: 1
                , title: "确认开工吗?"
                , closeBtn: false
                , area: '300px;'
                , shade: 0.8
                , id: 'LAY_layuipro' //设定一个id,防止重复弹出
                , btn: ['确定', '取消']
                , btnAlign: 'c'
                , moveType: 1 //拖拽模式,0或者1
                , content: '<div style="padding: 50px; line-height: 22px; font-weight: 300;text-align:center;">设备编号:' + HSourceName1 + '<br>工单号:' + workcode + '<br>产品名称:' + HMaterName + '<br></div>'
                , btn1: function (index, layero, e) {
 
                    //新增开工单
                    $.ajax({
                        type: "GET",
                        url: GetWEBURL() + "/Sc_MESBeginWorkBill/SaveGetMESBeginWorkFrom_KS", //方法所在页面和方法名
                        data: { "HBillType": HBillType, "HSourceInterID": HSourceInterID, "HSourceEntryID": HSourceEntryID, "HSourceBillNo": HSourceBillNo, "user": sessionStorage["HUserName"], "HSourceBillType": HSourceBillType },
                        success: function (result) {
                            if (result.count == 1) {
                                layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
                                    // 得到frame索引
                                    var index = layer.getFrameIndex(window.name);
                                    //关闭当前frame
                                    layer.close(index);
                                    //修改为功后刷新界面
                                    //window.location.reload();
                                });
                                layer.close(indexOpen);
                            } else {
                                layer.alert(result.code + result.Message, { icon: 5 });
                            }
                        }, error: function () {
                            layer.alert("接口请求失败!", { icon: 5 });
                        }
                    });
                }
            });
        }
 
        //SOP 作业指导书
        function SOP(event, obj) {
            if (wktag == 0) {
                layer.alert("请选择工单列表", { icon: 5 });
                return false;
            }
 
            layer.open({
                type: 2,
                skin: 'layui-layer-rim', //加上边框
                title: '作业指导书',
                closeBtn: 1,
                shift: 2,
                area: ['95%', '95%'],
                maxmin: true,
                content: '生产管理/作业指导书/Gy_SOPBill_Video.html?OperationType=5&HMaterID=' + HMaterID + '&HSourceNo=' + workcode + '&HSourceEntryID=' + HSourceEntryID + '&HProcID=' + HProcID,
                end: function () {
 
                },
            });
 
            /* window.open("../../../views/生产管理/作业指导书/Gy_SOPBill_Video.html?OperationType=5&HMaterID=" + HMaterID + "&HSourceNo=" + workcode + "&HSourceEntryID=" + HSourceEntryID);*/
        }
 
        //汇报按钮点击事件
        function OpenReport(event, obj) {
            if (wktag == 0) {
                layer.alert("请选择工单列表", { icon: 5 });
                return false;
            }
            if (WorkStaus(HSourceID1, workcode, HSourceInterID, "汇报")) {
                layer.alert("单据状态不满足汇报条件!", { icon: 5 });
                return false;
            }
            layer.open({
                type: 2,
                skin: 'layui-layer-rim', //加上边框
                title: '新增产量汇报单',
                closeBtn: 1,
                shift: 2,
                area: ['100%', '100%'],
                maxmin: true,
                content: '生产管理/产量汇报单/Sc_Add_ProductReportBillList.html?OperationType=2&linterid=&HSouceBillType=',
                end: function () {
 
                },
                success: function (dom, index) {
                    var data = [];
                    data.push({
                        "HBillType": HBillType,
                        "HSourceInterID": HSourceInterID,
                        "HSourceEntryID": HSourceEntryID,
                        "HSourceBillNo": HSourceBillNo,
                        "HSourceBillType": HSourceBillType
                    });
 
                    //通过索引获取到当前iframe弹出层
                    var iframe = window['layui-layer-iframe' + index];
                    //调用iframe弹出层内的方法
                    iframe.edit(data);
                },
            });
        }
        //完工单按钮点击事件
        function OpenEnd(event, obj) {
            if (wktag == 0) {
                layer.alert("请选择工单列表", { icon: 5 });
                return false;
            }
            if (WorkStaus(HSourceID1, workcode, HSourceInterID, "完工")) {
                layer.alert("单据状态不满足完工条件!", { icon: 5 });
                return false;
            }
            layer.open({
                type: 2,
                skin: 'layui-layer-rim', //加上边框
                title: '新增完工单',
                closeBtn: 1,
                shift: 2,
                area: ['100%', '100%'],
                maxmin: true,
                content: '生产管理/生产完工单/Sc_Add_MESEndWorkBillList.html?OperationType=2&linterid=&HSouceBillType=',
                end: function () {
 
                },
                success: function (dom, index) {
                    var data = [];
                    data.push({
                        "HBillType": HBillType,
                        "HSourceInterID": HSourceInterID,
                        "HSourceEntryID": HSourceEntryID,
                        "HSourceBillNo": HSourceBillNo,
                        "HSourceBillType": HSourceBillType
                    });
 
                    //通过索引获取到当前iframe弹出层
                    var iframe = window['layui-layer-iframe' + index];
                    //调用iframe弹出层内的方法
                    iframe.edit(data);
                },
            });
        }
        //停工单按钮点击事件
        function OpenStop(event, obj) {
            if (wktag == 0) {
                layer.alert("请选择工单列表", { icon: 5 });
                return false;
            }
            if (WorkStaus(HSourceID1, workcode, HSourceInterID, "停工")) {
                layer.alert("单据状态不满足停工条件!", { icon: 5 });
                return false;
            }
            layer.open({
                type: 2,
                skin: 'layui-layer-rim', //加上边框
                title: '新增停工单',
                closeBtn: 1,
                shift: 2,
                area: ['100%', '100%'],
                maxmin: true,
                content: '生产管理/生产停工单/Sc_Add_MESStopWorkBillList.html?OperationType=2&linterid=&HSouceBillType=',
                end: function () {
 
                },
                success: function (dom, index) {
                    var data = [];
                    data.push({
                        "HBillType": HBillType,
                        "HSourceInterID": HSourceInterID,
                        "HSourceEntryID": HSourceEntryID,
                        "HSourceBillNo": HSourceBillNo,
                        "HSourceBillType": HSourceBillType
                    });
 
                    //通过索引获取到当前iframe弹出层
                    var iframe = window['layui-layer-iframe' + index];
                    //调用iframe弹出层内的方法
                    iframe.edit(data);
                },
            });
        }
 
        //报检申请按钮点击事件
        function OpenInSpection(event, obj) {
            if (wktag == 0) {
                layer.alert("请选择工单列表", { icon: 5 });
                return false;
            }
 
            var IsCheck = false;
 
            //根据系统参数控制,判断生产订单是否做了首件检验单和工序检验单,如果有其中一种检验单没做,则不让做生产汇报单
            $.ajax({
                url: GetWEBURL() + "/ReportPlatForm/IsCheck",
                type: "GET",
                data: { "HICMOInterID": HICMOInterID, "HICMOEntryID": HICMOEntryID, "HICMOBillNo": HICMOBillNo },
                async: false,
                success: function (data) {
                    if (data.code == 0) {
                        layer.alert(data.Message);
                        return false;
                    } else {
                        IsCheck = true;
                    }
                },
                error: function (err) {
                    layer.alert(data.Message);
                    return false;
                }
            });
 
            if (IsCheck == true) {
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: '产量汇报列表',
                    closeBtn: 1,
                    shift: 2,
                    area: ['100%', '100%'],
                    maxmin: true,
                    content: '生产管理/产量汇报单/Sc_ProductReportBillList.html?OperationType=2&linterid=&HSouceBillType=',
                    end: function () {
 
                    },
                    success: function (dom, index) {
                        var data = [];
                        data.push({
                            "workcode": workcode,
                            "HSourceID": HSourceID1,
                            "HSourceName": HSourceName1,
                            "HICMOInterID": HICMOInterID,
                            "HICMOEntryID": HICMOEntryID,
                            "HMaker": sessionStorage["HUserName"],    //sessionStorage["HUserName"]
                            "Czybm": sessionStorage["Czybm"],
                            //"HEmpID": "0",    //sessionStorage["HEmpID"]
                            "HSourceBillType": HSourceBillType
                        });
 
                        //通过索引获取到当前iframe弹出层
                        var iframe = window['layui-layer-iframe' + index];
                        //调用iframe弹出层内的方法
                        iframe.edit(data);
                    },
                });
            }
 
 
        }
 
        //上料防错单
        function OpenMaterToSource() {
            if (wktag == 0) {
                layer.alert("请选择工单列表", { icon: 5 });
                return false;
            }
            layer.open({
                type: 2,
                skin: 'layui-layer-rim', //加上边框
                title: '新增上料防错单',
                closeBtn: 1,
                shift: 2,
                area: ['100%', '100%'],
                maxmin: true,
                content: '生产管理/上料防错单/Sc_Add_MaterToSourceBillList.html?OperationType=2&linterid=&HSouceBillType=',
                end: function () {
 
                },
                success: function (dom, index) {
                    var data = [];
                    data.push({
                        "HBillType": HBillType,
                        "HSourceInterID": HSourceInterID,
                        "HSourceEntryID": HSourceEntryID,
                        "HSourceBillNo": HSourceBillNo,
                        "HSourceBillType": HSourceBillType
                    });
 
                    //通过索引获取到当前iframe弹出层
                    var iframe = window['layui-layer-iframe' + index];
                    //调用iframe弹出层内的方法
                    iframe.edit(data);
                },
            });
        }
 
        //首检检验
        function OpenFistCheck(event, obj) {
            if (wktag == 0) {
                layer.alert("请选择工单列表", { icon: 5 });
                return false;
            }
            layer.open({
                type: 2
                , area: ['100%', '100%']
                , title: '首件检验单-编辑'
                , shade: 0.6
                , maxmin: false
                , anim: 0
                , content: ['质量管理/首件检验单/QC_Add_Edit_FirstPieceCheckBill.html?OperationType=2&linterid=' + HSourceInterID + '&HSouceBillType=' + HBillType + '&HICMOEntryID=' + HICMOEntryID, 'yes']
                , resize: false
                , cancel: function () {
                }
                , end: function () {
 
                }
            })
        }
 
        //过程检验
        function OpenProcess(event, obj) {
            if (wktag == 0) {
                layer.alert("请选择工单列表", { icon: 5 });
                return false;
            }
            layer.open({
                type: 2
                , area: ['100%', '100%']
                , title: '工序检验单-编辑'
                , shade: 0.6
                , maxmin: false
                , anim: 0
                , content: ['质量管理/工序检验单/QC_ProcessCheckBill.html?OperationType=2&linterid=' + HSourceInterID + '&HSouceBillType=' + HBillType + '&HICMOEntryID=' + HICMOEntryID, 'yes']
                , resize: false
                , cancel: function () {
 
                }
                , end: function () {
 
                }
            })
        }
 
        //不良采集
        function BadGather() {
            if (wktag == 0) {
                layer.alert("请选择工单列表", { icon: 5 });
                return false;
            }
            if (WorkStaus(HSourceID1, workcode, HSourceInterID, "不良采集")) {
                layer.alert("单据状态不满足不良采集条件!", { icon: 5 });
                return false;
            }
            layer.open({
                type: 2
                , area: ['100%', '100%']
                , title: '质量汇报单-编辑'
                , shade: 0.6
                , maxmin: false
                , anim: 0
                , content: ['生产管理/质量汇报单/Sc_QualityReportBill.html?OperationType=2&linterid=' + HSourceInterID + '&HSouceBillType=' + HBillType + '&HICMOEntryID=' + HSourceEntryID, 'yes']
                , resize: false
                , cancel: function () {
 
                }
                , end: function () {
 
                }
            })
        }
 
        //当前工单按钮点击事件
        function CurrentStatus(event, obj) {
            if (wktag == 0) {
                layer.alert("请选择工单列表", { icon: 5 });
                return false;
            }
            layer.open({
                type: 2,
                skin: 'layui-layer-rim', //加上边框
                title: '当前工单',
                closeBtn: 1,
                shift: 2,
                area: ['100%', '100%'],
                maxmin: true,
                content: '生产管理/工单/Sc_CurrentTicket.html?OperationType=2&linterid=&HSouceBillType=',
                end: function () {
 
                },
                success: function (dom, index) {
                    var data = [];
                    data.push({
                        "HEquipName": $("#HEquipName1").text(),
                        "HEquipCode": $("#HEquipCode1").text(),
                        "HICMOBillNo": workcode,
                        "HICMOInterID": HICMOInterID,
                        "HICMOEntryID": HICMOEntryID,
                        "HSourceID": HSourceID1,
                        "HEmpName": HEmpName,
                        "HManagerName": HManagerName,
                        "HGroupName": HGroupName,
                        "HBillType": HBillType,
                        "HSourceInterID": HSourceInterID,
                        "HSourceEntryID": HSourceEntryID,
                        "HSourceBillNo": HSourceBillNo,
                        "HSourceBillType": HSourceBillType
                    });
 
                    //通过索引获取到当前iframe弹出层
                    var iframe = window['layui-layer-iframe' + index];
                    //调用iframe弹出层内的方法
                    iframe.edit(data);
                },
 
 
            });
        }
 
 
        //当前工单(汇报)按钮点击事件
        function CodingReport(event, obj) {
            if (wktag == 0) {
                layer.alert("请选择工单列表", { icon: 5 });
                return false;
            }
            if (WorkStaus(HSourceID1, workcode, HSourceInterID, "汇报")) {
                layer.alert("单据状态不满足汇报条件!", { icon: 5 });
                return false;
            }
            layer.open({
                type: 2,
                skin: 'layui-layer-rim', //加上边框
                title: '当前工单',
                closeBtn: 1,
                shift: 2,
                area: ['100%', '100%'],
                maxmin: true,
                content: '车间管理/工序出站汇报单/Cj_StationOutBill_CurrentWork.html?OperationType=2&linterid=&HSouceBillType=',
                end: function () {
 
                },
                success: function (dom, index) {
                    var data = [];
                    data.push({
                        "HEquipName": $("#HEquipName1").text(),
                        "HEquipCode": $("#HEquipCode1").text(),
                        "HICMOBillNo": workcode,
                        "HICMOInterID": HICMOInterID,
                        "HICMOEntryID": HICMOEntryID,
                        "HSourceID": HSourceID1,
                        "HSourceName": HSourceName1,
                        "HEmpName": HEmpName,
                        "HManagerID": HManagerID,
                        "HManagerName": HManagerName,
                        "HGroupName": HGroupName,
                        "HGroupID": HGroupID,
                        "HBillType": HBillType,
                        "HSourceInterID": HSourceInterID,
                        "HSourceEntryID": HSourceEntryID,
                        "HSourceBillNo": HSourceBillNo,
                        "HSourceBillType": HSourceBillType
                    });
 
                    //通过索引获取到当前iframe弹出层
                    var iframe = window['layui-layer-iframe' + index];
                    //调用iframe弹出层内的方法
                    iframe.edit(data);
                },
 
 
            });
        }
 
        //设备启动点检按钮点击事件
        function BeginDotCheck(event, obj) {          
            layer.open({
                type: 2,
                skin: 'layui-layer-rim', //加上边框
                title: '新增设备启动点检单',
                closeBtn: 1,
                shift: 2,
                area: ['100%', '100%'],
                maxmin: true,
                content: '车间管理/启动点检单/Sc_WorkBeginDotCheckBill.html?OperationType=4&linterid=&HSouceBillType=',
                end: function () {
 
                },
                success: function (dom, index) {
                    var data = [];
                    data.push({
                        "HMaterID": HMaterID,
                        "HProcID": HProcID,
                        "HSourceID": HSourceID1,
                        "SCOrder": HSourceBillNo
                    });
 
                    //通过索引获取到当前iframe弹出层
                    var iframe = window['layui-layer-iframe' + index];
                    //调用iframe弹出层内的方法
                    iframe.edit(data);
                },
            });
        }
 
        //异常按钮点击事件
        function Abnormal (event, obj) {
            layer.open({
                type: 2,
                skin: 'layui-layer-rim', //加上边框
                title: '异常反馈类型',
                closeBtn: 1,
                shift: 2,
                area: ['100%', '100%'],
                maxmin: true,
                content: '生产管理/异常反馈单/Sc_MESExecptFeedBackBillType.html',
                end: function () {
 
                },
                success: function (dom, index) {
                    var data = [];
                    data.push({
                        "HICMOBillNo": HICMOBillNo,//工单号
                        "HSourceName": HSBName, //设备
                        "HSourceBillNo": HSourceBillNo //工序流转卡
                    });
 
                    //通过索引获取到当前iframe弹出层
                    var iframe = window['layui-layer-iframe' + index];
                    //调用iframe弹出层内的方法
                    iframe.edit(data);
                },
            });
        }
 
        //防错验证清单按钮点击事件
        function PreventErrMouldCheck(event, obj) {
            layer.open({
                type: 2,
                skin: 'layui-layer-rim', //加上边框
                title: '新增防错验证',
                closeBtn: 1,
                shift: 2,
                area: ['100%', '100%'],
                maxmin: true,
                content: '车间管理/防错验证/Qc_PreventErrMouldCheckBill.html?OperationType=4&linterid=&HSouceBillType=',
                end: function () {
 
                },
                success: function (dom, index) {
                    var data = [];
                    data.push({
                        "HMaterID": HMaterID,
                        "HProcID": HProcID,                     
                        "SCOrder": HSourceBillNo
                    });
 
                    //通过索引获取到当前iframe弹出层
                    var iframe = window['layui-layer-iframe' + index];
                    //调用iframe弹出层内的方法
                    iframe.edit(data);
                },
            });
        }
 
        //检验取样按钮点击事件
        function TakeSample(event, obj) {
            if (wktag == 0) {
                layer.alert("请选择工单列表", { icon: 5 });
                return false;
            }           
            layer.open({
                type: 2,
                skin: 'layui-layer-rim', //加上边框
                title: '新增开工单',
                closeBtn: 1,
                shift: 2,
                area: ['100%', '100%'],
                maxmin: true,
                content: '质量管理/检验取样还样单/QC_Add_TakeSampleCheckBill.html?OperationType=2&linterid=&HSouceBillType=',
                end: function () {
 
                },
                success: function (dom, index) {
                    var data = [];
                    data.push({
                        "HBillType": HBillType,
                        "HSourceInterID": HSourceInterID,
                        "HSourceEntryID": HSourceEntryID,
                        "HSourceBillNo": HSourceBillNo,
                        "HSourceBillType": HSourceBillType
                    });
 
                    //通过索引获取到当前iframe弹出层
                    var iframe = window['layui-layer-iframe' + index];
                    //调用iframe弹出层内的方法
                    iframe.edit(data);
                },
            });
        }
 
        //工艺参数点检点击事件
        function TechParam(event, obj) {
            if (wktag == 0) {
                layer.alert("请选择工单列表", { icon: 5 });
                return false;
            }
            if (WorkStaus(HSourceID1, workcode, HSourceInterID, "工艺参数点检")) {
                layer.alert("单据状态不满足工艺参数点检条件!", { icon: 5 });
                return false;
            }
            layer.open({
                type: 2,
                skin: 'layui-layer-rim', //加上边框
                title: '新增工艺参数点检单',
                closeBtn: 1,
                shift: 2,
                area: ['100%', '100%'],
                maxmin: true,
                content: '设备管理/设备工艺参数订单点检表/SB_EquipICMOTechParamBillEdit.html?OperationType=4&linterid=&HEntryID=',
                end: function () {
 
                },
                success: function (dom, index) {
                    var data = [];
                    data.push({
                        "HBillType": HBillType,
                        "HSourceInterID": HSourceInterID,
                        "HSourceEntryID": HSourceEntryID,
                        "HSourceBillNo": HSourceBillNo,
                        "HSourceBillType": HSourceBillType
                    });
 
                    //通过索引获取到当前iframe弹出层
                    var iframe = window['layui-layer-iframe' + index];
                    //调用iframe弹出层内的方法
                    iframe.edit(data);
                },
            });
        }
 
        //退出
        function Esc(event, obj) {
            parent.location.href = "index.html"
 
        }
 
        //单据状态验证
        function WorkStaus(HSourceID1, workcode, HSourceInterID, btn) {
            var flag = false;
            var sWhere = "";
            sWhere = {
                HSourceID: HSourceID1
                , HICMOBillNo: workcode
                , HInterID: HSourceInterID
                , type: btn
            }
            //switch (btn) {
            //    case "开工":
            //        sWhere = " where HSourceID='" + HSourceID1 + "' and HICMOBillNo='" + workcode + "' and HInterID='" + HSourceInterID + "' and hicmostatus not in('0','2')";   //是否有不为开工开工状态、停工状态
            //        break;
            //    case "完工":
            //        sWhere = " where HSourceID='" + HSourceID1 + "' and HICMOBillNo='" + workcode + "' and HInterID='" + HSourceInterID + "' and hicmostatus not in('1','2')";   //是否有不为开工、完工状态
            //        break;
            //    case "停工":
            //        sWhere = " where HSourceID='" + HSourceID1 + "' and HICMOBillNo='" + workcode + "' and HInterID='" + HSourceInterID + "' and hicmostatus not in('1')";   //是否有不为停工挂起状态
            //        break;
            //    case "汇报":
            //        sWhere = " where HSourceID='" + HSourceID1 + "' and HICMOBillNo='" + workcode + "' and HInterID='" + HSourceInterID + "' and hicmostatus not in('1','2')";   //是否有不为开工、停工挂起状态
            //        break;
            //    case "报检申请":
 
            //        break;
            //    default:
            //}
 
            $.ajax({
                url: GetWEBURL() + "/Sc_MESBeginWorkBill/GetMESBeginWorkBillStaus",
                type: "GET",
                data: { "sWhere": JSON.stringify(sWhere) },
                dataType: "json",//数据类型可以为 text xml json  script  jsonp
                async: false,
                success: function (data) {
 
                    if (data.count > 0) {
                        flag = true;
 
                    }
                    else {
                        flag = false;
                    }
                },
                error: function (err) {
                    flag = false;
                }
            });
 
            return flag;
        }
    </script>
</head>
 
<body>
    <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
 
    <div style="margin: 20px 20px;">
        <!--<blockquote class="layui-elem-quote">注意:下述演示中的颜色只是做一个区分作用,并非栅格内置。</blockquote>-->
        <div class="layui-row layui-col-space10">
            <div class="layui-col-sm12 layui-col-md8">
                <fieldset style="border: 1px solid #eee;box-shadow: 0 2px 5px 0 rgb(0 0 0 / 10%);">
                    <legend style="color: #5FB878">生产资源</legend>
                    <div class="layui-content">
                        <div class="layui-row layui-col-space10" id="topleft">
 
                        </div>
                    </div>
                </fieldset>
            </div>
            <div class="layui-col-sm12 layui-col-md4">
                <fieldset style="border: 1px solid #eee;box-shadow: 0 2px 5px 0 rgb(0 0 0 / 10%);">
                    <legend style="color: #5FB878">当前状态</legend>
                    <div class="layui-content">
                        <div class="layui-row layui-col-space10" id="topright">
 
                        </div>
                    </div>
                </fieldset>
            </div>
        </div>
        <div class="layui-row layui-col-space10">
            <div class="layui-col-sm12 layui-col-md8">
                <div class="layui-tab layui-tab-card" lay-filter="TabTest">
                    <ul class="layui-tab-title">
                        <li class="layui-this">工单列表</li>
                        <li>效率/不良分析</li><!--style="pointer-events: none; background-color:rgb(0 0 0 / 10%);"-->
                    </ul>
                    <div class="layui-tab-content content3">
                        <div class="layui-tab-item layui-show">
                            <div class="layui-row layui-col-space10" id="btomleft" style="height:600px;display:block;overflow-y:auto;">
 
                            </div>
                        </div>
                        <div class="layui-tab-item">
                            <div class="layui-row">
                                <div class="layui-row layui-col-space10">
                                    <div class="layui-col-sm12 layui-col-md12">
                                        <div id="mychart1"></div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row layui-col-space10">
                                <div class="layui-col-sm12 layui-col-md12">
                                    <div id="mychart2"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-col-sm12 layui-col-md4">
                <fieldset style="border: 1px solid #eee;box-shadow: 0 2px 5px 0 rgb(0 0 0 / 10%);">
                    <legend style="color: #5FB878">操作台</legend>
                    <div class="content4">
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-sm12 layui-col-md4" onclick="OpenWork(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-play imgicon"></span>
                                    <span class="imgtitle">开工</span>
                                </div>
                            </div>
                            <div class="layui-col-sm12 layui-col-md4" onclick="OpenReport(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-list imgicon"></span>
                                    <span class="imgtitle">汇报</span>
                                </div>
                            </div>
                            <div class="layui-col-sm12 layui-col-md4" onclick="OpenEnd(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-logout imgicon"></span>
                                    <span class="imgtitle">完工</span>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row layui-col-space10" style="display:none;">
                            <div class="layui-col-sm12 layui-col-md4" onclick="KSOpenWork(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-pause imgicon"></span>
                                    <span class="imgtitle">快速开工</span>
                                </div>
                            </div>
 
                        </div>
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-sm12 layui-col-md4" onclick="SOP(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-read imgicon"></span>
                                    <span class="imgtitle">作业指导书</span>
                                </div>
                            </div>
                            <div class="layui-col-sm12 layui-col-md4" onclick="OpenFistCheck(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-search imgicon"></span>
                                    <span class="imgtitle">首检</span>
                                </div>
                            </div>
                            <div class="layui-col-sm12 layui-col-md4">
                                <div class="cnt bottomright" style="pointer-events:none; background-color:rgb(0 0 0 / 10%);display:none;">
                                    <span class="layui-icon layui-icon-search imgicon"></span>
                                    <span class="imgtitle">巡检</span>
                                </div>
                            </div>
                            <div class="layui-col-sm12 layui-col-md4" onclick="OpenProcess(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-search imgicon"></span>
                                    <span class="imgtitle">过程检验</span>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-sm12 layui-col-md4" onclick="OpenInSpection(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-release imgicon"></span>
                                    <span class="imgtitle">报检申请</span>
                                </div>
                            </div>
                            <div class="layui-col-sm12 layui-col-md4" onclick="OpenMaterToSource(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-engine imgicon"></span>
                                    <span class="imgtitle">上料防错</span>
                                </div>
                            </div>
                            <div class="layui-col-sm12 layui-col-md4" onclick="BadGather(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-chart imgicon"></span>
                                    <span class="imgtitle">不良采集</span>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-sm12 layui-col-md4" onclick="OpenStop(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-pause imgicon"></span>
                                    <span class="imgtitle">停工</span>
                                </div>
                            </div>
                            <div class="layui-col-sm12 layui-col-md4" onclick="Abnormal(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-unlink imgicon"></span>
                                    <span class="imgtitle">异常</span>
                                </div>
                            </div>
                            <div class="layui-col-sm12 layui-col-md4" onclick="Esc(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-close imgicon"></span>
                                    <span class="imgtitle">退出</span>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-sm12 layui-col-md4" onclick="CurrentStatus(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-console imgicon"></span>
                                    <span class="imgtitle">当前状态</span>
                                </div>
                            </div>
                            <div class="layui-col-sm12 layui-col-md4" onclick="CodingReport(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-console imgicon"></span>
                                    <span class="imgtitle">当前工单(汇报)</span>
                                </div>
                            </div>
                            <div class="layui-col-sm12 layui-col-md4" onclick="BeginDotCheck(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-search imgicon"></span>
                                    <span class="imgtitle">设备启动点检</span>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-sm12 layui-col-md4" onclick="PreventErrMouldCheck(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-engine imgicon"></span>
                                    <span class="imgtitle">防错验证</span>
                                </div>
                            </div>
                            <div class="layui-col-sm12 layui-col-md4" onclick="TakeSample(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-form imgicon"></span>
                                    <span class="imgtitle">检验取样</span>
                                </div>
                            </div>
                            <div class="layui-col-sm12 layui-col-md4" onclick="TechParam(event,this)">
                                <div class="cnt bottomright">
                                    <span class="layui-icon layui-icon-tabs imgicon"></span>
                                    <span class="imgtitle">工艺参数点检</span>
                                </div>
                            </div>
                        </div>
                                              
                    </div>
                </fieldset>
            </div>
        </div>
    </div>
 
</body>
</html>