chenhaozhe
2025-11-25 6f17e42e2463aee9804f50bfd0d5a8bcb1f7d7c2
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
<template>
    <view>
        <view class="form">
            <view class="form-item">
                <view class="title"><text>*</text>条形码:</view>
                <view class="right" style="width: 380rpx;">
                    <input v-model="hform.HBarCode"  placeholder="请扫描条码" @confirm="toInCode(e)"/>
                </view>
                <uni-icons type="scan" style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;" size="20" @click="toScanCode"></uni-icons>
            </view>
            <view class="form-item">
                <view class="title">序列号:</view>
                <view class="right">
                    <uni-combox :candidates="arrayHSEQName" placeholder="请选择序列" v-model="hform.HSEQName"
                        @input="HSEQNameChange"></uni-combox>
                </view>
            </view>
            <view class="form-item">
                <view class="title"><text>*</text>流水号:</view>
                <view class="right" style="width: 380rpx;">
                    <input v-model="hform.HProcNo" placeholder="请输入(或扫描)流水号" @blur="getHProcNoData2(hform.HBarCode,hform.HProcNo,hform.HSEQNumber)"/>
                </view>
                <uni-icons type="scan" style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;" size="20" @click="toScanProcNo"></uni-icons>
            </view>
            <view class="form-item">
                <view class="title">工序编码:</view>
                <view class="righton">
                    <input disabled v-model="hform.HProcNumber" placeholder="请输入工序编码" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">未发出数量:</view>
                <view class="righton">
                    <input disabled v-model="hform.HNotReportQty" placeholder="请输入合格数量" />
                </view>
            </view>
            <view class="form-item">
                <view class="title"><text>*</text>发出数量:</view>
                <view class="right">
                    <input v-model="hform.HQty" placeholder="请输入发出数量" />
                </view>
            </view>
            <view class="form-item">
                <view class="title"><text>*</text>供应商:</view>
                <view class="right">
                    <uni-combox :candidates="arrayHSupName" placeholder="请选择供应商" v-model="hform.HSupName" @input="HSupNameChange"></uni-combox>
                </view>
            </view>
            <view class="form-item">
                <view class="title"><text>*</text>操作员:</view>
                <view class="right">
                    <uni-combox :candidates="arrayHEmpName" placeholder="请选择操作员" v-model="hform.HEmpName" @input="HEmpNameChange"></uni-combox>
                </view>
            </view>
            <view class="form-item">
                <view class="title">送货单号:</view>
                <view class="right">
                    <input v-model="hform.HInnerBillNo" placeholder="请输入送货单号" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">委外工单号:</view>
                <view class="right">
                    <input v-model="hform.HWWWorkOrderBillNo" placeholder="请输入委外工单号" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">备注:</view>
                <view class="right">
                    <textarea name="HRemark" v-model="hform.HRemark" auto-height placeholder="请输入备注"></textarea>
                </view>
            </view>
            <view class="form-item">
                <view class="title">单据日期:</view>
                <view class="right">
                    <picker mode="date" v-model="hform.HDate" @change="HDateChange">
                        <input disabled v-model="hform.HDate" placeholder="请选择日期" />
                        <view class="picker-overlay"></view>
                    </picker>
                </view>
            </view>
            
            <view class="tab_area"></view>
            
            <view class="form-item">
                <view class="title">单据号:</view>
                <view class="righton">
                    <input name="HBillNo" disabled v-model="hform.HBillNo" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">生产订单:</view>
                <view class="righton">
                    <input name="HICMOBillNo" disabled v-model="hform.HICMOBillNo" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">流转卡:</view>
                <view class="righton">
                    <input disabled v-model="hform.HProcExchBillNo" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">物料代码:</view>
                <view class="righton">
                    <input disabled v-model="hform.HMaterNumber" />
                    <!-- <uni-combox :candidates="arrayHMaterNumber" placeholder="请选择产品代码" v-model="hform.HMaterNumber" @input="HMaterNumberChange"></uni-combox> -->
                </view>
            </view>
            <view class="form-item">
                <view class="title">物料名称:</view>
                <view class="righton">
                    <input v-model="hform.HMaterName" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="title">规格型号:</view>
                <view class="righton">
                    <input v-model="hform.HMaterModel" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="title">计量单位:</view>
                <view class="righton">
                    <input v-model="hform.单位" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="title">工序:</view>
<!--                 <view class="right">
                    <uni-combox :candidates="arrayHProcName" placeholder="请选择当前工序" v-model="hform.HProcName" @input="HProcNameChange"></uni-combox>
                </view> -->
                <view class="righton">
                    <input v-model="hform.HProcName" disabled />
                </view>
            </view>
            <view class="form-item">
                <view class="title">生产组织:</view>
                <view class="righton">
                    <input v-model="hform.HPRDOrg" disabled />
                </view>
            </view>
            
<!--             <view class="form-item">
                <view class="title">订单数量:</view>
                <view class="right">
                    <input name="HICMOQty" v-model="hform.HICMOQty" placeholder="请输入订单数量" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">流转卡数量:</view>
                <view class="right">
                    <input v-model="hform.HPlanQty" placeholder="请输入流转卡数量" />
                </view>
            </view>
            <view class="form-item">
                <view class="title"><text>*</text>发出人:</view>
                <view class="right">
                    <input v-model="hform.HEmpName" placeholder="请输入发出人" />
                </view>
            </view>
            <view class="form-item">
                <view class="title"><text>*</text>发出件数:</view>
                <view class="right">
                    <input v-model="hform.HPieceQty" placeholder="请输入发出件数" />
                </view>
            </view>
            <view class="form-item">
                <view class="title"><text>*</text>税率:</view>
                <view class="right">
                    <input v-model="hform.HTaxRate" placeholder="请输入税率" />
                </view>
            </view>
            <view class="form-item">
                <view class="title"><text>*</text>单价:</view>
                <view class="right">
                    <input v-model="hform.HPeriod" placeholder="请输入单价" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">金额:</view>
                <view class="right">
                    <input v-model="hform.HMoney" placeholder="请输入金额" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">发出时间:</view>
                <view class="right">
                     <uni-datetime-picker v-model="hform.HStationInTime">
                         <input disabled v-model="hform.HStationInTime" placeholder="请选择发出时间" />
                     </uni-datetime-picker>
                </view>
            </view>
            <view class="form-item">
                <view class="title">生产资源:</view>
                <view class="right">
                    <input v-model="hform.HSource" placeholder="请输入生产资源" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">班组:</view>
                <view class="right">
                    <input v-model="hform.HGroup" placeholder="请输入班组" />
                </view>
            </view>
            <view class="form-item">
                <view class="title">部门:</view>
                <view class="right">
                    <input v-model="hform.HDept" placeholder="请输入部门" />
                </view>
            </view> -->
            
            <!-- <view class="tab_area"></view> -->
            
<!--             <view class="form-item">
                <view class="title">选择文件:</view>
                <view class="right">
                    1111
                </view>
            </view> -->
            
            <view class="tab_area"></view>
            
            <view v-if="showmore">
                <view class="form-item">
                    <view class="title">订单跟踪号:</view>
                    <view class="righton">
                        <input v-model="hform.HOrderProcNO" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">制单人:</view>
                    <view class="righton">
                        <input v-model="hform.HMaker" disabled/>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">制单日期:</view>
                    <view class="righton">
                        <input v-if="hform.HMakeDate" v-model="hform.HMakeDate.substr(0,10)" disabled/>
                        <input v-else v-model="hform.HMakeDate" disabled/>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">修改人:</view>
                    <view class="righton">
                        <input v-model="hform.HUpDater" disabled/>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">修改日期:</view>
                    <view class="righton">
                        <input v-if="hform.HUpDateDate" v-model="hform.HUpDateDate.substr(0,10)" disabled/>
                        <input v-else v-model="hform.HUpDateDate" disabled/>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">审核人:</view>
                    <view class="righton">
                        <input v-model="hform.HChecker" disabled/>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">审核日期:</view>
                    <view class="righton">
                        <input v-if="hform.HCheckDate" v-model="hform.HCheckDate.substr(0,10)" disabled/>
                        <input v-else v-model="hform.HCheckDate" disabled/>
                    </view>
                </view>
<!--                 <view class="form-item">
                    <view class="title">关闭人:</view>
                    <view class="righton">
                        <input v-model="hform.HCloseMan" disabled/>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">关闭日期:</view>
                    <view class="righton">
                        <input v-if="hform.HCloseDate" v-model="hform.HCloseDate.substr(0,10)" disabled/>
                        <input v-else v-model="hform.HCloseDate" disabled/>
                    </view>
                </view> -->
                <view class="form-item">
                    <view class="title">作废人:</view>
                    <view class="righton">
                        <input v-model="hform.HDeleteMan" disabled/>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">作废日期:</view>
                    <view class="righton">
                        <input v-if="hform.HDeleteDate" v-model="hform.HDeleteDate.substr(0,10)" disabled/>
                        <input v-else v-model="hform.HDeleteDate" disabled/>
                    </view>
                </view>
            </view>
            
            <view class="other">
                <view v-if="!showmore" @tap="showmore = true">
                    展开其他信息<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="bottom"></uni-icons>
                </view>
                <view v-if="showmore" @tap="showmore = false">
                    折叠其他信息<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="top"></uni-icons>
                </view>
            </view>
 
            <view class="bottom-btn">
                <button v-if="btnType == 0 && !isEdit" class="btn-a" size="mini" @tap="submit">提交</button>
                <button v-if="btnType != 0 && !isEdit" class="btn-a" size="mini" @tap="ifEdit">修改</button>
                <button v-if="btnType != 0 && isEdit" class="btn-a" size="mini" @tap="submit">提交</button>
                <button v-if="btnType != 0 && btnType == 2" class="btn-b" style="margin-left: 20rpx;" size="mini" @tap="check">审核</button>
                <button v-if="btnType != 0 && btnType == 3" class="btn-d" style="margin-left: 20rpx;" size="mini" @tap="abandonCheck">反审核</button>
                <!-- <button class="btn-b" size="mini" @tap="showMask = true">新增</button> -->
                <button class="btn-b" size="mini" @tap="addNew">新增</button>
                <button class="btn-c" size="mini" @tap="goBack">退出</button>
            </view>
        </view>
    </view>
</template>
<script>
    import getDateTime from '@/utils/getdateTime.js';
    import { getUserInfo } from "@/utils/auth.js";
    export default {
        data() {
            return {
                userInfo:getUserInfo(),
                serverUrl: uni.getStorageSync('serverUrl')||'http://47.96.97.237/API',
                linterid:'',
                HBillNo:'',
                btnType:0,//0新增,1修改,2审核,3反审核
                showmore: false,
                
                arrayHMaterNumber:[],//产品
                HMaterNumberList:[],
                arrayHProcName:[],//工序
                HProcNameList:[],
                arrayHSupName:[],//供应商
                HSupNameList:[],
                arrayHEmpName:[],//操作员
                HEmpNameList:[],
                arrayHSEQName:[],//序列
                HSEQNameList:[],
                isEdit: false,
                hform:{
                    HInterID:'',
                    HBillNo:'',
                    HBarCode:'',
                    HProcNo:'',
                    HProcNumber: '',
                    HNotReportQty: 0,
                    HQty:'',
                    HEmpName:'',
                    HEmpID:'',
                    HInnerBillNo:'',
                    HWWWorkOrderBillNo:'',
                    HRemark:'',
                    HDate:getDateTime.dateTimeStr('y-m-d'),
                    
                    HICMOBillNo:'',
                    HProcExchBillNo:'',
                    HMaterNumber:'',
                    HMaterName:'',
                    HMaterID:'',
                    HMaterModel:'',
                    HSupName:'',
                    HSupID:'',
                    单位:'',
                    HProcName:'',
                    HProcID:'',
                    HPRDOrg:'',
                    HOrderProcNO:'',
                    HSEQName:'',
                    HSEQNumber:0,
                    // HICMOInterID:'',
                    // HICMOQty:'',
                    // HProcExchHinteID:'',
                    // HPlanQty:'',
                    // HPieceQty:'',
                    // HTaxRate:'',
                    // HPeriod:'',
                    // HMoney:'',
                    // HStationInTime:'',
                    // HEmp:'',
                    // HEmpID:'',
                    // HSource:'',
                    // HSourceID:'',        
                    // HGroup:'',
                    // HGroupID:'',
                    // HDept:'',
                    // HDeptID:'',        
                        
                    HMaker:'',
                    HMakeDate:'',
                    HUpDater:'',
                    HUpDateDate:'',        
                    HChecker:'',
                    HCheckDate:'',
                    HCloseMan:'',
                    HCloseDate:'',        
                    HDeleteMan:'',
                    HDeleteDate:'',
                    
                    eventType:'Add',
                }
            }
        },
        onLoad(e) {
            // this.getEditData('983','WWFC000000000318')
            // this.hform.HEmpID = this.userInfo.Czybm
            // this.hform.HEmpName = uni.getStorageSync('HUserName')
            this.hform.HMaker = uni.getStorageSync('HUserName')
            
            console.log(e,this.userInfo)
            if(e.linterid){
                this.btnType = 1
                this.linterid = e.linterid
                this.HBillNo = e.HBillNo
                this.getEditData(e.linterid,e.HBillNo)
            }else{
                this.getNewData()
            }
            // this.getHMaterList()
            this.getHProcList()
            this.getHSupList()
            this.getHEmpList()
            
            this.getDefValByUser()
        },
        methods: {
            //通过登录用户获取默认值
            getDefValByUser(){
                uni.request({
                    url: this.serverUrl + '/Cj_StationInBill/GetDefValByUser', 
                    type: "GET",
                    async: false,
                    data: { "Czybm": this.userInfo.Czybm, "Czymc":  this.userInfo.Czymc },
                    success: (res) => {
                        console.log(res.data)
                        if(res.data.count == 1){
                            var data = res.data.data[0]
                            this.hform.HGroupID = data.HGroupID
                            this.hform.HGroupName = data.生产班组名称
                            this.hform.HEmpID = data.HEmpID
                            this.hform.HEmpName = data.操作员名称
                            this.hform.HEmpNumber = data.操作员代码
                            this.hform.HSourceID = data.HSourceID
                            this.hform.HSourceName = data.生产资源名称
                            this.hform.HCenterID = data.HWorkCenterID
                            this.hform.HCenterName = data.工作中心名称
                            this.hform.HEmpName_second = data.操作员名称
                        }else{
                            uni.showToast({
                                title:'获取生产班组信息失败',
                                icon:'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'获取生产班组信息失败',
                            icon:'none'
                        })
                    },
                });
            },
            //扫码
            toScanCode(){
                var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
                mpaasScanModule.mpaasScan({
                    'hideAlbum': true,
                    'timeoutInterval':'10', //超时时间
                    'timeoutText':'未识别到二维码' //超时提醒            
                },(ret) => {
                    console.log(ret.resp_result)
                    var str = ret.resp_result
                    if(str.includes('@')) {
                      const parts = str.split('@');
                      if(parts.length==3){
                          this.hform.HBarCode = parts[0]
                          this.hform.HProcNo = parts[1]
                          this.hform.HSEQNumber = parts[2]
                          this.getHBarCodeData(parts[0], 2)
                      }else{
                          this.hform.HBarCode = parts[0]
                          this.hform.HProcNo = parts[1]
                          this.getHBarCodeData(parts[0], 1)
                      }
                      // this.getHProcNoData(parts[0],parts[1])
                    }else{
                        this.hform.HBarCode = ret.resp_result
                        this.getHBarCodeData(ret.resp_result)
                    }
                })
            },
            toInCode(e) {
                var str = this.hform.HBarCode
                if (str.includes('@')) {
                    const parts = str.split('@');
                    if(parts.length==3){
                        this.hform.HBarCode = parts[0]
                        this.hform.HProcNo = parts[1]
                        this.hform.HSEQNumber = parts[2]
                        this.getHBarCodeData(parts[0], 2)
                    }else{
                        this.hform.HBarCode = parts[0]
                        this.hform.HProcNo = parts[1]
                        this.getHBarCodeData(parts[0], 1)
                    }
                    // this.getHProcNoData(parts[0],parts[1])
                } else {
                    this.getHBarCodeData(this.hform.HBarCode)
                }
            },
            //扫流水号
            toScanProcNo(){
                var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
                mpaasScanModule.mpaasScan({
                    'hideAlbum': true,
                    'timeoutInterval':'10', //超时时间
                    'timeoutText':'未识别到二维码' //超时提醒            
                },(ret) => {
                    console.log(ret.resp_result)
                    this.hform.HProcNo = ret.resp_result
                    this.getHProcNoData2(this.hform.HBarCode,ret.resp_result,this.hform.HSEQNumber)
                })
            },
            //日期
            HDateChange(e){
                console.log(e.detail.value)
                this.hform.HDate = e.detail.value
            },
            
            // //获取产品数据
            // getHMaterList(){
            //     var Value = " Where HStopFlag=0  and HEndFlag=1 and HUSEORGID = " + uni.getStorageSync('OrganizationID')
            //     uni.request({
            //         url: this.serverUrl + '/Web/GetMaterialList_Json', 
            //         data: { sWhere: Value },
            //         success: (res) => {
            //             if(res.data.count == 1){
            //                 this.HMaterNumberList = res.data.data
            //                 for(var i=0;i<res.data.data.length;i++){
            //                     this.arrayHMaterNumber[i] = res.data.data[i].HNumber
            //                 }
            //                 this.$forceUpdate();
            //             }else{
            //                 uni.showToast({
            //                     title:res.data.Message,
            //                     icon:'none'
            //                 })
            //             }
            //         },
            //         fail: (res) => {
            //             console.log(res);
            //             uni.showToast({
            //                 title:'接口请求失败',
            //                 icon:'none'
            //             })
            //         },
            //     });
            // },
            // //选择产品数据
            // HMaterNumberChange(e){
            //     for(var i=0;i<this.HMaterNumberList.length;i++){
            //         if(this.HMaterNumberList[i].HNumber == e){
            //             this.hform.HMaterName = this.HMaterNumberList[i].HName
            //             this.hform.HMaterID = this.HMaterNumberList[i].HItemID
            //         }
            //     }
            // },
            //工序
            getHProcList(){
                uni.request({
                    url: this.serverUrl + '/Web/GetProcList_Json', 
                    data: { sWhere: '' },
                    success: (res) => {
                        if(res.data.count == 1){
                            this.HProcNameList = res.data.data
                            for(var i=0;i<res.data.data.length;i++){
                                this.arrayHProcName[i] = res.data.data[i].工序
                            }
                            this.$forceUpdate();
                        }else{
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                        })
                    },
                });
            },
            //选择工序
            HProcNameChange(e){
                for(var i=0;i<this.HProcNameList.length;i++){
                    if(this.HProcNameList[i].工序 == e){
                        this.hform.HProcID = this.HProcNameList[i].HItemID
                    }
                }
            },
            //获取供应商数据
            getHSupList(){
                if (!uni.getStorageSync('OrganizationID')) {
                   var HOtherOrgID = 0;
                }else{
                    var HOtherOrgID = uni.getStorageSync('OrganizationID')
                }
                uni.request({
                    url: this.serverUrl + '/Web/GetSupplierList_Json', 
                    data: { Supplier: '', HOrgID: HOtherOrgID },
                    success: (res) => {
                        if(res.data.count == 1){
                            this.HSupNameList = res.data.data
                            for(var i=0;i<res.data.data.length;i++){
                                this.arrayHSupName[i] = res.data.data[i].HName
                            }
                            this.$forceUpdate();
                        }else{
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                        })
                    },
                });
            },
            //选择供应商
            HSupNameChange(e){
                for(var i=0;i<this.HSupNameList.length;i++){
                    if(this.HSupNameList[i].HName == e){
                        this.hform.HSupID = this.HSupNameList[i].HItemID
                    }
                }
            },
            //操作员
            getHEmpList(){
                uni.request({
                    url: this.serverUrl + '/Web/GetEmployeeList_Json', 
                    data: { Employee: '',HGroupID:0 },
                    success: (res) => {
                        if(res.data.count == 1){
                            this.HEmpNameList = res.data.data
                            for(var i=0;i<res.data.data.length;i++){
                                this.arrayHEmpName[i] = res.data.data[i].HName
                            }
                            this.$forceUpdate();
                        }else{
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                        })
                    },
                });
            },
            //选择接收人
            HEmpNameChange(e){
                for(var i=0;i<this.HEmpNameList.length;i++){
                    if(this.HEmpNameList[i].HName == e){
                        this.hform.HEmpID = this.HEmpNameList[i].HItemID
                    }
                }
            },
            //序列获取
            getHSEQList(e){
                uni.request({
                    url: this.serverUrl + 'Cj_StationOutBill/getAllHSEQ',
                    data: {
                        HInterID:this.hform.HProcExchHinteID
                    },
                    success: (res) => {
                        if (res.data.code == 1) {
                            this.HSEQNameList = res.data.data
                            for (var i = 0; i < res.data.data.length; i++) {
                                this.arrayHSEQName[i] = res.data.data[i].HSEQName
                            }
                            this.$forceUpdate();
                            //没有序列号默认主序列
                            if(e==1){
                                //设置主序列
                                this.setMainHSEQ();
                                this.getHProcNoData2(this.hform.HBarCode,this.hform.HProcNo,this.hform.HSEQNumber)
                            }else if(e==2){
                                this.getHProcNoData2(this.hform.HBarCode,this.hform.HProcNo,this.hform.HSEQNumber)
                            }else{
                                //设置主序列
                                this.setMainHSEQ();
                            }
                        } else {
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title: '接口请求失败',
                            icon: 'none'
                        })
                    },
                });
            },
            //选择序列
            HSEQNameChange(e) {
                for (var i = 0; i < this.HSEQNameList.length; i++) {
                    if (this.HSEQNameList[i].HSEQName == e) {
                        this.hform.HSEQNumber = this.HSEQNameList[i].HSEQNumber
                    }
                }
            },
            //设置主序列
            setMainHSEQ(){
                for (var i = 0; i < this.HSEQNameList.length; i++) {
                    if (this.HSEQNameList[i].HSEQType == 'M') {
                        this.hform.HSEQNumber = this.HSEQNameList[i].HSEQNumber
                        this.hform.HSEQName = this.HSEQNameList[i].HSEQName
                        break;
                    }
                }
            },
            //编辑
            ifEdit(){
                //是否编辑
                uni.request({
                    url: this.serverUrl + '/Cj_StationEntrustInBill/set_ShowBillJudge', 
                    data: { 
                        HBillNo: this.HBillNo,
                        CurUserName: uni.getStorageSync('HUserName'),
                        HInterID: this.linterid,
                    },
                    success: (res) => {
                        console.log(res)
                        if(res.data.count == 1){
                            this.isEdit = true
                            this.hform.eventType = 'Modify'
                        }else{
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                        })
                    },
                });
            },
            getEditData(linterid,HBillNo){
                //主表
                uni.request({
                    url: this.serverUrl + '/Cj_StationEntrustInBill/GetStationEntrustInBill', 
                    data: { HInterID: linterid },
                    success: (res) => {
                        console.log(1,res.data.data[0]);
                        if(res.data.code == 1){
                            var data = res.data.data[0]
                            this.getHBarCodeData(data.HBarCode)
                            this.getHProcNoData(data.HBarCode,data.HProcNo)
                            
                            this.hform.HInterID= data.HInterID
                            this.hform.HBillNo= data.HBillNo
                            this.hform.HBarCode= data.HBarCode
                            this.hform.HProcNo= data.HProcNo
                            this.hform.HQty= data.HQty
                            this.hform.HSupName= data.HSupName
                            this.hform.HSupID= data.HSupID
                            this.hform.HEmpID= data.HEmpID
                            this.hform.HEmpName= data.HEmpName
                            this.hform.HInnerBillNo= data.HInnerBillNo
                            this.hform.HWWWorkOrderBillNo= data.HWWWorkOrderBillNo
                            this.hform.HRemark= data.HRemark
                            this.hform.HDate = data.HDate.substr(0,10)
                            
                            // this.hform.HProcID= data.HProcID
                            // this.hform.HProcName= data.HProcName
                            // this.hform.HMaterNumber= data.HMaterNumber
                            // this.hform.HMaterName= data.HMaterName
                            // this.hform.HMaterID= data.HMaterID
                            // this.hform.HPrice= data.HPrice
                            // this.hform.HMoney= data.HMoney
                            // this.hform.HWasterQty= data.HWasterQty
                            // this.hform.HPieceQty= data.HPieceQty
                            // this.hform.HBadPNL= data.HBadPNL
                            // this.hform.HSourceID= data.HSourceID
                            // this.hform.HSourceName= data.HSourceName
                            if (data.是否审核 == "true") {
                                this.btnType = 3
                            } else {
                                this.btnType = 2
                            }
                            
                            this.hform.HMaker= data.HMaker
                            this.hform.HMakeDate= data.HMakeDate
                            this.hform.HUpDater= data.HUpDater
                            this.hform.HUpDateDate= data.HUpDateDate
                            this.hform.HChecker= data.HChecker
                            this.hform.HCheckDate= data.HCheckDate
                            // this.hform.HCloseMan= data.HCloseMan
                            // this.hform.HCloseDate= data.HCloseDate
                            this.hform.HDeleteMan= data.HDeleteMan
                            this.hform.HDeleteDate= data.HDeleteDate
                            
                            this.getHProcNoData(this.hform.HBarCode,this.hform.HProcNo)
                        }else{
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                        })
                    },
                });
            },
            getHBarCodeData(HBarCode,e){
                uni.request({
                    url: this.serverUrl + '/Cj_StationEntrustInBill/txtHBarCode_KeyDown', 
                    data: {HBarCode: HBarCode},
                    success: (res) => {
                        console.log(2,res.data);
                        if(res.data.code == 1){
                            var data = res.data.data[0]
                            this.hform.HICMOBillNo= data.任务单号
                            this.hform.HProcExchBillNo= data.单据号
                            this.hform.HICMOInterID= data.hicmointerid
                            this.hform.HMaterID= data.HMaterID
                            this.hform.HMaterName= data.产品
                            this.hform.HMaterNumber= data.产品代码
                            this.hform.HMaterModel= data.规格型号
                            this.hform.单位= data.单位
                            // this.hform.HQty= 0,
                            this.hform.HPieceQty= data.生产数量
                            this.hform.HPlanQty= data.生产数量
                            this.hform.lngBillSubKey= data.hsubid
                            this.hform.lngBillKey= data.hmainid
                            this.hform.HICMOQty= data.任务单数量
                            this.hform.HOrderProcNO= data.订单跟踪号
                            this.hform.HStationInTime= getDateTime.dateTimeStr('y-m-d h:i:s')
                            // this.hform.HMoney= 0
                            // this.hform.HSupID= data.HSupID
                            // this.hform.HSup= data.供应商
                            this.hform.HSourceID= data.HSourceID
                            this.hform.HSource= data.生产资源
                            this.hform.HGroupID= data.HGroupID
                            this.hform.HGroup= data.班组
                            this.hform.HDeptID= this.userInfo.HDeptID
                            this.hform.HDept= this.userInfo.HDept
                            this.hform.HProcExchHinteID= data.hmainid
                            this.hform.HPRDOrg= data.组织
                            this.getHSEQList(e);
                            
                        }else{
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                        })
                    },
                });
            },
            getHProcNoData(HBarCode,HProcNo){
                uni.request({
                    url: this.serverUrl + '/Cj_StationEntrustInBill/txtHProcNo_KeyDown', 
                    data: {sBillNo: HBarCode,sProcNo: HProcNo},
                    success: (res) => {
                        console.log(3,res);
                        if(res.data.code == 1){
                            var data = res.data.data[0]
                            this.showHProcNoData = true
                            this.hform.lngBillSubKey= data.hsubid
                            this.hform.HProcName= data.工序
                            this.hform.HProcID= data.HProcID
                            this.hform.HCenterName= data.工作中心
                            this.hform.HCenterID= data.HCenterID
                            this.hform.HNotReportQty = data['未发出数量']
                            this.hform.HProcNumber = data['工序代码']
                            if(!this.hform.HSupName){
                                this.hform.HSupName= data.供应商
                                this.hform.HSupID= data.HSupID
                            }
                        }else{
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                        })
                    },
                });
            },
            getHProcNoData2(HBarCode,HProcNo,HSEQNumber){
                uni.request({
                    url: this.serverUrl + '/Cj_StationEntrustInBill/txtHProcNo_KeyDown_Sec', 
                    data: {
                        sBillNo: HBarCode,
                        sProcNo: HProcNo,
                        HSEQNumber:HSEQNumber},
                    success: (res) => {
                        console.log(3,res);
                        if(res.data.code == 1){
                            var data = res.data.data[0]
                            this.showHProcNoData = true
                            this.hform.lngBillSubKey= data.hsubid
                            this.hform.HProcName= data.工序
                            this.hform.HProcID= data.HProcID
                            this.hform.HCenterName= data.工作中心
                            this.hform.HCenterID= data.HCenterID
                            this.hform.HNotReportQty = data['未发出数量']
                            this.hform.HProcNumber = data['工序代码']
                            this.hform.HSEQName = data.序列名称
                            if(!this.hform.HSupName){
                                this.hform.HSupName= data.供应商
                                this.hform.HSupID= data.HSupID
                            }
                        }else{
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                        })
                    },
                });
            },
            //新增
            getNewData(){
                uni.request({
                    url: this.serverUrl + '/Web/GetMAXNum', 
                    data: { HBillType: '3792' },
                    success: (res) => {
                        console.log(res.data)
                        if(res.data.count == 1){
                            this.hform.HInterID = res.data.data[0].HInterID
                            this.hform.HBillNo = res.data.data[0].HBillNo
                        }else{
                            uni.showToast({
                                title:res.data.Message,
                                icon:'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                        })
                    },
                });
            },
            addNew() {
                uni.redirectTo({
                    url: '/pages/weiwaigxIn/Cj_StationEntrustInBill?OperationType=1'
                })
            },
            submit() {
                //去除分号以免后端分解报错
                this.hform.HMaterName= this.hform.HMaterName.replace(/;/g, '');
                this.hform.HMaterModel = this.hform.HMaterModel.replace(/;/g, '');
                if(!this.hform.HBarCode){
                    uni.showToast({
                        title:'请扫描设备条形码',
                        icon:'none'
                    })
                }else if(!this.hform.HProcNo){
                    uni.showToast({
                        title:'请输入/扫描流水号',
                        icon:'none'
                    })
                }else if(!this.hform.HQty){
                    uni.showToast({
                        title:'请输入发出数量',
                        icon:'none'
                    })
                }else if(!this.hform.HSupName){
                    uni.showToast({
                        title:'请选择供应商',
                        icon:'none'
                    })
                }else if(!this.hform.HEmpName){
                    uni.showToast({
                        title:'请选择操作员',
                        icon:'none'
                    })
                }else{
                    uni.showLoading({
                        title:'请稍候'
                    })
                    var sMainStr = JSON.stringify(this.hform);
                    var sMainSub = sMainStr + ";" + uni.getStorageSync('HUserName');
                    console.log(sMainSub);
                    uni.request({
                        url: this.serverUrl + '/Cj_StationEntrustInBill/AddBill',
                        method:'POST',
                        dataType:"json",
                        data:{ oMain: sMainSub },
                        success: (res) => {
                            console.log(1,res);
                            uni.hideLoading()
                            if(res.data.count == 1){
                                // let pages = getCurrentPages();
                                // let prePage = pages[pages.length - 2]; 
                                // prePage.$vm.getList()
                                if(this.isEdit){
                                    setTimeout(()=>{
                                        uni.redirectTo({
                                            url:'/pages/weiwaigxIn/Cj_StationEntrustInBill?linterid=' + this.linterid + '&HBillNo=' + this.linterid
                                        })
                                    },1000)
                                }else{
                                    uni.showModal({
                                        title: '提示',
                                        content: res.data.Message + '。是否继续新增?(点击取消返回上级页面)',
                                        success: (res) => {
                                            if (res.confirm) {
                                                console.log('用户点击确定');
                                                uni.redirectTo({
                                                    url:'/pages/weiwaigxIn/Cj_StationEntrustInBill?OperationType=1'
                                                })
                                            } else if (res.cancel) {
                                                console.log('用户点击取消');
                                                setTimeout(()=>{
                                                    uni.navigateBack();
                                                },50)
                                            }
                                        }
                                    });
                                }
                            }else{
                                uni.showToast({
                                    title:res.data.Message,
                                    icon:'none'
                                })
                            }
                        },
                        fail: (res) => {
                            console.log(res);
                            uni.showToast({
                                title:'接口请求失败',
                                icon:'none'
                            })
                        },
                    });
                }
            },
            //审核
            check(){
                uni.request({
                    url: this.serverUrl + '/Cj_StationEntrustInBill/set_CheckBill',
                    method:'GET',
                    dataType:"json",
                    data:{ 
                        CurUserName: uni.getStorageSync('HUserName'),
                        HInterID: this.linterid,
                    },
                    success: (res) => {
                        console.log(1,res);
                        uni.hideLoading()
                        if(res.data.count == 1){
                            this.btnType = 3
                            let pages = getCurrentPages();
                            let prePage = pages[pages.length - 2];
                            prePage.$vm.getList()
                            uni.showModal({
                                title: '操作成功',
                                content: '是否继续停留在当前页面?‘是’可进行反审核,‘否’则回到上一级列表',
                                confirmText:'是',
                                cancelText:'否',
                                success: (res) => {
                                    if (res.confirm) {
                                        console.log('用户点击是');
                                        this.btnType = 3
                                    } else if (res.cancel) {
                                        console.log('用户点击否');
                                        uni.navigateBack()
                                    }
                                }
                            });
                        }
                        uni.showToast({
                            title:res.data.Message,
                            icon:'none'
                        })
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                        })
                    },
                });
            },
            //反审核
            abandonCheck(){
                uni.request({
                    url: this.serverUrl + '/Cj_StationEntrustInBill/set_AbandonCheck',
                    method:'GET',
                    dataType:"json",
                    data:{ 
                        CurUserName: uni.getStorageSync('HUserName'),
                        HInterID: this.linterid,
                    },
                    success: (res) => {
                        console.log(1,res);
                        uni.hideLoading()
                        if(res.data.count == 1){
                            let pages = getCurrentPages(); 
                            let prePage = pages[pages.length - 2];
                            prePage.$vm.getList()
                            this.btnType = 2
                            uni.showModal({
                                title: '操作成功',
                                content: '是否继续停留在当前页面?‘是’可进行审核,‘否’则回到上一级列表',
                                confirmText:'是',
                                cancelText:'否',
                                success: (res) => {
                                    if (res.confirm) {
                                        console.log('用户点击是');
                                        this.btnType = 2
                                    } else if (res.cancel) {
                                        console.log('用户点击否');
                                        uni.navigateBack()
                                    }
                                }
                            });
                        }
                        uni.showToast({
                            title:res.data.Message,
                            icon:'none'
                        })
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title:'接口请求失败',
                            icon:'none'
                        })
                    },
                });
            },
            goBack(){
                uni.showModal({
                    title: '提示',
                    content: '确认要退出当前页面吗?',
                    success: (res) => {
                        if (res.confirm) {
                            console.log('用户点击确定');
                            uni.navigateBack()
                        } else if (res.cancel) {
                            console.log('用户点击取消');
                        }
                    }
                });
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .form{
        width: 668rpx;
        margin: 20rpx auto;
        padding-bottom: 240rpx;
    }
    .tab_area{
        width: 100%;
        height: 50rpx;
    }
    .other{
        margin-top: 8rpx;
        text-align: center;
        font-size: 28rpx;
        padding: 4rpx 18rpx;
        color: #1890FF;
    }
    .form-item{
        display: flex;
        align-items: center;
        font-size: 30rpx;
        padding: 6rpx 0;
        position: relative;
        
        .title{
            width: 208rpx;
            text{
                color: red;
                font-weight: bold;
            }
        }
        .right{
            width: 450rpx;
            border-radius: 22rpx;
            border: 1px solid #acacac;
        }
        .righton{
            width: 450rpx;
            border-radius: 22rpx;
            border: 1px solid #e4e4e4;
            background-color: #e4e4e4;
        }
        input{
            width: 100%;
            padding: 8rpx 20rpx;
            font-size: 30rpx;
        }
        textarea{
            width: 98%;
            padding: 8rpx 20rpx;
            font-size: 30rpx;
        }
 
    }
    .bottom-btn{
        width: 100%;
        // height: 120rpx;
        position: fixed;
        bottom: 0;
        left: 0;
        background-color: #fff;
        box-shadow: 0 2rpx 10rpx 2rpx rgba(0, 0, 0, 0.4);
        padding: 30rpx 40rpx 40rpx 40rpx;
        button{
            border-radius: 50rpx;
            width: 180rpx;
            height: 66rpx;
            line-height: 66rpx;
            font-size: 28rpx;
        }
        .btn-a{
            background-color: #3A78FF;
            color: #fff;
        }
        .btn-b{
            background-color: #41a863;
            color: #fff;
        }
        .btn-c{
            background-color: #acacac;
            color: #fff;
            position: absolute;
            right: 120rpx;
        }
        .btn-d{
            background-color: #ff8901;
            color: #fff;
        }
    }
</style>