jiangping
2023-08-17 513485caca0c56c713797bfd208c6f22c7ce7727
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
package doumeemes.core.utils;
 
import com.alibaba.fastjson.JSONObject;
import doumeemes.dao.business.model.Plans;
import doumeemes.dao.business.model.WorkPlans;
import doumeemes.dao.ext.vo.CompanyExtListVO;
import doumeemes.dao.ext.vo.WorkorderExtListVO;
import jdk.nashorn.internal.ir.LexicalContext;
import org.apache.commons.lang3.StringUtils;
 
import java.math.BigDecimal;
import java.text.DecimalFormat;
 
public class Constants {
 
 
//    public static   String REDIS_VERSION="alks_";
    public static   String REDIS_VERSION="dm_";
    public static final int ZERO = 0 ;
    public static final int ONE = 1 ;
    public static final int TWO = 2 ;
    public static final int THREE = 3 ;
 
    public static final String WORKORDER_SOURCE ="WORKORDER_SOURCE";
    public static final String WORKORDER_SOURCE_PLAN="WORKORDER_SOURCE_PLAN";
    public static final String WORKORDER_SOURCE_MANUAL="WORKORDER_SOURCE_MANUAL";
    public static final String ACCESS_ID="ACCESS_ID";
    public static final String BUCKETNAME = "BUCKETNAME";
    public static final String OSS = "OSS";
    public static final String ACCESS_KEY = "ACCESS_KEY";
    public static final String ENDPOINT = "ENDPOINT";
    public static final String RESOURCE_PATH = "RESOURCE_PATH";
    public static final String DEFAULT = "DEFAULT";
    public static final String USER_PWD = "USER_PWD";
    public static final String MENU_IMG ="MENU_IMG" ;
    public static final String ROUTE_CONFIG ="ROUTE_CONFIG" ;
//    public static final String OUT_TYPE_URL = "OUT_TYPE";
//    public static final String IN_TYPE_URL = "IN_TYPE";
//    public static final String WOUT_IN_URL = "WOUT_IN_URL";
//    public static final String WOUT_OUT_URL = "WOUT_OUT_URL";
//    public static final String FINISH_TYPE_URL = "FINISH_TYPE";
    public static final String SYSTEM_APPLIANCE_TYPE ="SYSTEM_APPLIANCE_TYPE" ;
    public static final String TEMPL_NAME_RUE = "instance_tmp_${type}_#{factotyId}";
    public static final String LINGYANG_PARAM = "LINGYANG_PARAM";
    public static final String LINGYANG_AESKEY = "LINGYANG_AESKEY";
    public static final String LINGYANG_APPKEY = "LINGYANG_APPKEY";
    public static final String LINGYANG_SECRET = "LINGYANG_SECRET";
    public static final String LINGYANG_DEMO_USER = "LINGYANG_DEMO_USER";
    public static final String COMPANY_FILE_PATH = "COMPANY_FILE_PATH";
 
    public static final String EDGP_PARAM = "EDGP_PARAM";
    public static final String EDGP_AESKEY = "EDGP_AESKEY";
    public static final String EDGP_APPKEY = "EDGP_APPKEY";
    public static final String EDGP_SECRET = "EDGP_SECRET";
    public static final String EDGP_SERVER_URL = "EDGP_SERVER_URL";
    public static final String LINGYANG_DEMO_COMPANY ="LINGYANG_DEMO_COMPANY" ;
    public static final String EDGP_DEMO_COMPANY = "EDGP_DEMO_COMPANY";
    public static final String EDGP_DEMO_USER = "EDGP_DEMO_USER";
    public static final String EDGP_ACCESSTOKEN ="EDGP_ACCESSTOKEN" ;
    public static final String SYSTEM_URL ="SYSTEM_URL" ;
 
    /**
     * 获取企业钉钉信息
     * @param company
     * @param key
     * @return
     */
    public static String getNoticeUrl(CompanyExtListVO company, String key) {
        try {
            String ddInfo = company.getDingdingInfo();
            JSONObject j = JSONObject.parseObject(ddInfo);
            return  j.getString(key);
        }catch (Exception e){
 
        }
        return  null;
 
    }
 
    public interface DINGDING_NOTICE_URL {
        String in = "in_type";
        String out = "out_type";
        String finish = "finish_type";
        String woutOut = "wout_out_url";
        String woutIn = "wout_in_url";
    }
//数据来源 0认证数据1OCR数据2手工输入 3羚羊平台 4EDGP平台
    public interface COMPANY_ORIGIN {
        int auth = 0;
        int ocr = 1;
        int plat = 2;
        int lingyang = 3;
        int edgp = 4;
    }
    public interface USER_LOGIN_ORIGIN {
        int pc = 0;
        int dingding = 1;
        int lingyang = 2;
        int edgp = 3;
    }
 
    /**
     * mq tag
     */
    public interface MQ_TAG{
        public static final  String statistics = "statistics";
    }
    /**
     * bom物料生产投料方式 0推式 1拉式
     */
    public interface BOM_TYPE{
        public static final  int push = 0;
        public static final  int pull = 1;
    }
 
    public interface RELOBJ_TYPE{
        public static final  int workorder = 0;
        public static final  int change = 1;
    }
    /**
     * 统计数量,key信息
     */
    public interface STATISTIC{
        public static final  String distribute = "distribute";
        public static final  String unqulified  = "unqulified";
        public static final  String qulified  = "qulified";
        public static final  String done  = "done";
        public static final  String distributeNoDone  = "distributeNoDone";
    }
    /**
     * 检验类型 0巡线、1巡检、2终检
     */
    public interface WORKORDER_CHECKTYPE{
        public static final  int line = 0;
        public static final  int check  = 1;
        public static final  int done  = 2;
    }
    /**
     * 通知类型 0车间领料-待发货
     * 1车间领料-待入库
     * 2机台备料-待发货
     * 3机台备料-待入库
     * 4完工入库-待接收
     * 5库存转库-待发货
     * 6库存转库-待入库
     * 7申请审批
     * 8客退/返品回厂检验
     */
    public interface NOTICE_TYPE{
        public static final  int materialSend = 0;
        public static final  int materialStock  = 1;
        public static final  int readySend  = 2;
        public static final  int readyStock  = 3;
        public static final  int doneRecieve  = 4;
        public static final  int transferSend  = 5;
        public static final  int transferStock = 6;
        public static final  int applyTask  = 7;
        public static final  int backCheck  = 8;
    }
    /**
     * 集计划来源 0人工创建、1Excel导入、2计划程序生成
     */
    public interface PLAS_ORIGIN{
        public static final  int user  = 0;
        public static final  int imports  = 1;
        public static final  int auto  = 2;
    }
    /**
     * 出入库单据状态 0已生成、1已处理、2已取消
     */
    public interface WOUTBOUND_STATUS{
        public static final  int create  = 0;
        public static final  int dealed  = 1;
        public static final  int cancel  = 2;
    }
 
 
    /**
     * 车间领料 - 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
     */
    public interface WOUTBOUND_BILLTYPE{
        public static final  int workshopIn  = 1;
        public static final  int finish  = 4;
        public static final  int workerOrderOut  = 20;
        public static final  int workerOrderIn  = 24;
    }
 
 
    /**
     * 出入库类型 0出库单 1入库单
     */
    public interface WOUTBOUND_TYPE{
        public static final  int in  = 1;
        public static final  int out  = 0;
    }
    /**
     * 工装器具位置类型 0仓库1.车间
     */
    public interface APPLIANCES_POSITION{
        public static final  int warehouse  = 0;
        public static final  int workshop  = 1;
    }
 
    /**
     * 工装器具状态 0.合格 1不良 2报废 3混合
     */
    public interface APPLIANCES_TYPE_LABLE{
        public static final  String qualified  = "APPLIANCE_ONTEST";
        public static final  String rejects = "APPLIANCE_OFFTEST";
        public static final  String  scrap= "APPLIANCE_USELESS";
        public static final  String mix = "APPLIANCE_MIX";
    }
    /**
     * 工装器具状态 0.报废、1.空、2.部分、3.满
     */
    public interface APPLIANCES_STATUS{
        public static final  int scrap = 0;
        public static final  int empty = 1;
        public static final  int part = 2;
        public static final  int full = 3;
    }
    /**
     * 工单类型(0正常、1异常、2返工返修)
     */
    public interface WORKORDER_TYPE{
        public static final  int normal = 0;
        public static final  int unnormal = 1;
        public static final  int repair = 2;
    }
    /**
     * 工单状态 0已创建、1已备料、2已完工、3已检验、4已报工、5已入库、6已取消"
     */
    public interface WORKORDER_STATUS{
       public static final  int create = 0;
       public static final  int material = 1;
       public static final  int done = 2;
       public static final  int check = 3;
       public static final  int baogong= 4;
       public static final  int instock = 5;
       public static final  int cancel = 6;
        static String getTitleByStatus(WorkorderExtListVO p, int status) {
            String title = "";
            switch (status){
                case create:
                    title="创建工单";
                    break;
                case material:
                    title="工单已备料";
                    break;
                case done:
                    title="工单完工检";
                    break;
                case check:
                    title="工单已检验";
                    break;
                case baogong:
                    title="工单报工";
                    break;
                case instock:
                    title="工单已入库";
                    break;
                case cancel:
                    title="工单取消";
                    break;
                default:
                    break;
            }
            return title;
        }
        static String getInfoByStatus(WorkorderExtListVO p, int status) {
            String title = "";
            switch (status){
                case create:
                    title="创建工单";
                    break;
                case material:
                    title="工单已备料";
                    break;
                case done:
                    title="工单完工";
                    break;
                case check:
                    title="工单已检验";
                    break;
                case baogong:
                    title="工单已报工";
                    break;
                case instock:
                    title="工单已入库";
                    break;
                case cancel:
                    title="工单取消";
                    break;
                default:
                    break;
            }
            return title;
        }
    }
    /**
     * 返工审批状态 0待审批 1审批通过 2审批未通过  3审批终止
     */
    public interface BACKORDER_STATUS{
        public static final int ing = 0;
        public static final int yes = 1;
        public static final int no = 2;
        public static final int stop = 3;
    }
 
    //产品质量属性 0合格 1不良 2报废
/*    public interface QUALITY_TYPE{
        public static final int qualified = 0;
        public static final int rejects = 1;
        public static final int scrap = 2;
    }*/
    /**
     * mq tag
     */
    public interface QUALITIY_TYPE{
        public static final  int normal = 0;
        public static final  int unqulified = 1;
        public static final  int scrap = 2;
    }
    /**
     * 返工类型 0不良返工 1客退 2客返 3报废申请
     */
    public interface BACKORDER_TYPE{
       public static final  int unqualified = 0;
       public static final  int customer_return = 1;
       public static final  int customer_back = 2;
       public static final  int scrap = 3;
        static String getTitleByType(int type) {
            String title = "";
            switch (type){
                case unqualified:
                    title="工序返工申请";
                    break;
                case customer_return:
                    title="客退返修申请";
                    break;
                case customer_back:
                    title="客返返修申请";
                    break;
                case scrap:
                    title="报废申请";
                    break;
                default:
                    break;
            }
            return title;
        }
    }
    /**
     * 工单状态 0已创建、1已投料、2已完工、3已检验、4已报工、5已入库、6已暂停、7已取消、8已关闭 9已恢复 10更换人员 11 已备料 12 产出"
     */
    public interface WORKORDER_HISTORY_STATUS{
       public static final  int create = 0;
       public static final  int material = 1;
       public static final  int done = 2;
       public static final  int check = 3;
       public static final  int baogong= 4;
       public static final  int instock = 5;
       public static final  int pause = 6;
       public static final  int cancel = 7;
       public static final  int close = 8;
       public static final  int reagain = 9;
       public static final  int redistribute = 10;
       public static final  int readyMaterial = 11;
       public static final  int produce = 12;
        static String getTitleByStatus(WorkorderExtListVO p, int status) {
            String title = "";
            switch (status){
                case create:
                    title="创建工单";
                    break;
                case material:
                    title="工单已投料";
                    break;
                case done:
                    title="工单完工";
                    break;
                case check:
                    title="工单已检验";
                    break;
                case baogong:
                    title="工单报工";
                    break;
                case instock:
                    title="工单已入库";
                    break;
                case pause:
                    title="工单暂停";
                    break;
                case cancel:
                    title="工单取消";
                    break;
                case close:
                    title="工单关闭";
                    break;
                case reagain:
                    title="工单恢复";
                    break;
                case redistribute:
                    title="工单重新分配";
                    break;
                case readyMaterial:
                    title="工单已备料";
                    break;
                case produce:
                    title="工单产出";
                    break;
                default:
                    break;
            }
            return title;
        }
        static String getInfoByStatus(WorkorderExtListVO p, int status) {
            String title = "";
            switch (status){
                case create:
                    title="创建工单";
                    break;
                case material:
                    title="工单已领料";
                    break;
                case done:
                    title="工单完工";
                    break;
                case check:
                    title="工单已检验";
                    break;
                case baogong:
                    title="工单已报工";
                    break;
                case instock:
                    title="工单已入库";
                    break;
                case pause:
                    title="工单暂停";
                    break;
                case cancel:
                    title="工单取消";
                    break;
                case close:
                    title="工单关闭";
                    break;
                case reagain:
                    title="工单恢复";
                    break;
                case redistribute:
                    title="工单重新分配";
                    break;
                case readyMaterial:
                    title="工单已备料";
                    break;
                case produce:
                    title="工单产出";
                    break;
                default:
                    break;
            }
            return title;
        }
    }
    /**
     * 计划历史 操作类型 0创建 1发布 2撤回 3取消 4分配 5暂停 6完工 7入库 8关闭 9恢复
     */
    public interface PLANHISTORY_TYPE{
       public static final  int create = 0;
       public static final  int publish = 1;
       public static final  int back = 2;
       public static final  int cancel = 3;
       public static final  int distribute= 4;
       public static final  int pause = 5;
       public static final  int done = 6;
       public static final  int instock = 7;
       public static final  int close = 8;
       public static final  int reagain = 9;
       public static final  int delete = 10;
        static String getTitleByStatus(Plans p, int status) {
            String title = "";
            switch (status){
                case create:
                    title="创建计划";
                    break;
                case publish:
                    title="发布计划";
                    break;
                case back:
                    title="撤回计划";
                    break;
                case cancel:
                    title="取消计划";
                    break;
                case distribute:
                    title="分配计划";
                    break;
                case pause:
                    title="暂停计划";
                    break;
                case done:
                    title="计划已完成";
                    break;
                case instock:
                    title="产品已入库";
                    break;
                case close:
                    title="关闭计划";
                    break;
                case reagain:
                    title="计划恢复";
                    break;
                case delete:
                    title="计划删除";
                    break;
                default:
                    break;
            }
            return title;
        }
        static String getInfoByStatus(Plans p, int status) {
            String title = "";
            switch (status){
                case create:
                    title="创建计划";
                    break;
                case publish:
                    title="发布计划";
                    break;
                case back:
                    title="撤回计划";
                    break;
                case cancel:
                    title="取消计划";
                    break;
                case distribute:
                    title="分配计划";
                    break;
                case pause:
                    title="暂停计划";
                    break;
                case done:
                    title="计划已完成";
                    break;
                case instock:
                    title="产品已入库";
                    break;
                case close:
                    title="关闭计划";
                    break;
                case reagain:
                    title="计划恢复";
                    break;
                case delete:
                    title="计划删除";
                    break;
                default:
                    break;
            }
            return title;
        }
    }
 
 
 
    public interface WORKPLANHISTORY_TYPE{
        public static final  int create = 0;
        public static final  int publish = 1;
        public static final  int back = 2;
        public static final  int cancel = 3;
        public static final  int distribute= 4;
        public static final  int pause = 5;
        public static final  int done = 6;
        public static final  int instock = 7;
        public static final  int close = 8;
        public static final  int reagain = 9;
        public static final  int delete = 10;
        static String getTitleByStatus(WorkPlans p, int status) {
            String title = "";
            switch (status){
                case create:
                    title="创建计划";
                    break;
                case publish:
                    title="发布计划";
                    break;
                case back:
                    title="撤回计划";
                    break;
                case cancel:
                    title="取消计划";
                    break;
                case distribute:
                    title="分配计划";
                    break;
                case pause:
                    title="暂停计划";
                    break;
                case done:
                    title="计划已完成";
                    break;
                case instock:
                    title="产品已入库";
                    break;
                case close:
                    title="关闭计划";
                    break;
                case reagain:
                    title="计划恢复";
                    break;
                case delete:
                    title="计划删除";
                    break;
                default:
                    break;
            }
            return title;
        }
        static String getInfoByStatus(WorkPlans p, int status) {
            String title = "";
            switch (status){
                case create:
                    title="创建计划";
                    break;
                case publish:
                    title="发布计划";
                    break;
                case back:
                    title="撤回计划";
                    break;
                case cancel:
                    title="取消计划";
                    break;
                case distribute:
                    title="分配计划";
                    break;
                case pause:
                    title="暂停计划";
                    break;
                case done:
                    title="计划已完成";
                    break;
                case instock:
                    title="产品已入库";
                    break;
                case close:
                    title="关闭计划";
                    break;
                case reagain:
                    title="计划恢复";
                    break;
                case delete:
                    title="计划删除";
                    break;
                default:
                    break;
            }
            return title;
        }
    }
 
 
    /**
     * 计划状态 0已生成、1已发布、2已撤回、3已取消、4已分配、5已暂停、6已完工、7已入库、8已关闭
     */
    public interface PLAN_STATUS{
       public static final  int create = 0;
       public static final  int publish = 1;
       public static final  int back = 2;
       public static final  int cancel = 3;
       public static final  int distribute= 4;
       public static final  int pause = 5;
       public static final  int done = 6;
       public static final  int instock = 7;
       public static final  int close = 8;
 
    }
    /**
     * 计划类型 0正常 1异常 2返工
     */
    public interface PLAN_TYPE{
       public static final  int normal = 0;
       public static final  int unnormal = 1;
       public static final  int back = 2;
    }
    /**
     * 工单记录类型 0投料 1产出
     */
    public interface WORKORDER_RECORD_TYPE{
       public static final  int materail = 0;
       public static final  int produce = 1;
    }
    /**
     * 权限类型 0全部 1所属部门及下属部门 2所属部门及其子部门 3仅所属部门
     */
    public interface DATAPERMISSION_TYPE{
       public static final  int all = 0;
        public static final  int departAndChild = 1;
        public static final  int departAndLeaf = 2;
        public static final  int depart = 3;
        public static final  int custom = 4;
        public static final  int self = -1;
    }
    /**
     * 组织类型 0公司 1工厂 2部门 3班组 4平台组织
     */
    public interface DEPART_TYPE{
       public static final  int com = 0;
        public static final  int  factory = 1;
        public static final  int  depart = 2;
        public static final  int  group = 3;
        public static final  int plat = 4;
    }
    /**
     * 角色类型 0平台角色 1企业默认角色 2企业自定义角色
     */
    public interface ROLETYPE{
       public static final  int plat = 0;
        public static final  int com_def = 1;
        public static final  int com = 2;
    }
    public interface PlatType{
       public static final  int admin = 0;
        public static final  int company = 1;
        public static final int companyH5 =2 ;
    }
 
    /**
     * Redis存储数据key值
     */
    public interface RedisKeys {
        public static final String PLAT_DEPART_TREE_KEY = REDIS_VERSION+"plattree_";
        public static final String COM_DEPART_TREE_KEY = REDIS_VERSION+"cdtree_";
        public static final String COM_DEPART_LIST_KEY = REDIS_VERSION+"cdlist_";
        public static final String COM_OUTBOUND_IN_KEY = REDIS_VERSION+"obin_";
        public static final String COM_WORK_PLAN_KEY =REDIS_VERSION+ "workplan_";
        public static final String COM_OUTBOUND_OUT_KEY = REDIS_VERSION+"obout_";
        public static final String COM_TRANSFER_KEY =REDIS_VERSION+ "transfer_";
        public static final String COM_PLANS_CODE_KEY = REDIS_VERSION+"pcode_";
        public static final String COM_CHECK_CODE_KEY = REDIS_VERSION+"ccode_";
        public static final String COM_APPLIANCECHANGER_CODE_KEY = REDIS_VERSION+"acode_";
        public static final String COM_WORKORDER_CODE_KEY = REDIS_VERSION+"wcode_";
        public static final String COM_BACKORDER_CODE_KEY = REDIS_VERSION+"wback_";
        public static final String COM_PLAN_BATCH_KEY = REDIS_VERSION+"wpbatch_";
        public static final String COM_INFO_KEY =REDIS_VERSION+ "ci_";
        public static final String COM_BARCODE_KEY = REDIS_VERSION+"bc_";
        public static final String COM_PROCEDURE_KEY =REDIS_VERSION+ "procedure_";
        public static final String COM_DINGDING_TOKEN = REDIS_VERSION+"ddtoken_";
        public static final String COM_DINGDING_JSAPITIKCKT= REDIS_VERSION+"ddticket_";
        public static final String COM_CATEGORY_KEY=REDIS_VERSION+ "cate_";
        public static final String COM_WOUTBOUND_WTRANSFER_KEY= REDIS_VERSION+"transfer_woutbound_";
        public static final String COM_WOUTBOUND_KEY= REDIS_VERSION+"woutbound_";
        public static final String COM_ENDCHECK_KEY = REDIS_VERSION+"endcheck_";
        public static final String COM_DEVICE_CHECK_KEY = REDIS_VERSION+"devicecheck_";
 
        public static final String COM_WAREHOUSE_CHECK_KEY = REDIS_VERSION+"warehouse_";
        public static final String COM_LOCATION_CHECK_KEY = REDIS_VERSION+"location_";
        public static final String COM_DEVIECE_CHECK_KEY = REDIS_VERSION+"device_";
        public static final String COM_MATERIAL_CHECK_KEY = REDIS_VERSION+"material_";
        public static final String COM_CATEGORY_CHECK_KEY = REDIS_VERSION+"category_";
        public static final String COM_PROCEDURES_CHECK_KEY = REDIS_VERSION+"procedures_";
        public static final String COM_ROUTE_CHECK_KEY = REDIS_VERSION+"route_";
 
    }
    /**
     * 前缀类型类型0物料、1仓库、2货位、3工单、4篮筐(工装器具)、5设备、6员工、7转库单、8、出库单、9、入库单
     */
    public interface BARCODEPARAM_TYPE {
        public static final int material  = 0;
        public static final int warehouse  = 1;
        public static final int localtion = 2;
        public static final int workorder  = 3;
        public static final int appliance  = 4;
        public static final int device  = 5;
        public static final int user  = 6;
        public static final int transfer  = 7;
        public static final int out  = 8;
        public static final int in  = 9;
    }
    /**
     * 用户类型
     */
    public interface USERTYPE {
        public static final int PLAT =0;
        public static final int COM =1;
    }
 
    /**
     * 消息队列TOPIC类型
     */
    public interface MqTopicKeys {
        public static final String TOPIC_TEST = "cl_test";
        public static final String TOPIC_STATISTIC_NUM = "cl_statistic_num";
        public static final String MQ_TOPIC = "cl_mq_topic";
    }
    public interface  RabbitMqQueue{
        public static final String TEST = "queue_topic1";
        public static final String QUEUE_STATISTIC = "queue_statistic_topic";
    }
 
 
    /**
     * 出入库单据 来源单据类型  0采购订单、1生产工单、2销售订单、3转库单、4盘点单
     */
    public interface WOUTBOUND_ORIGIN_TYPE{
        public static final  int purchase  = 0;
        public static final  int produce  = 1;
        public static final  int sale  = 2;
        public static final  int transfer  = 3;
        public static final  int stocktaking  = 4;
    }
 
 
    // 0车间领料-待发货 1车间领料-待入库 2机台备料-待发货 3机台备料-待入库 4完工入库-待接收 5库存转库-待发货 6库存转库-待入库 7申请审批 8客退/返品回厂检验
    public enum Notices_Type{
        workShopOut("车间领料-待发货", 0, "需要您进行出库操作,请及时前往处理",""), //"车间领料-待发货"
        workShopIn("车间领料-待入库", 1, "需要您进行入库操作,请及时前往处理",""), //车间领料-待入库
        transferWaitOut("机台备料-待发货", 2, "需要您进行备料出库操作,请及时前往处理",""), //机台备料-待发货
        transferWaitIn("机台备料-待入库", 3, "需要您进行备料接收操作,请及时前往处理",""), //机台备料-待入库
        finishIn("完工入库-待接收", 4, "需要您进行完工交接入库操作,请及时前往处理",""), //完工入库-待接收
        wStockTransferOut("库存转库-待发货", 5, "需要您进行出库操作,请及时前往处理",""), //库存转库-待发货
        wStockTransferIn("库存转库-待入库", 6, "需要您进行入库操作,请及时前往处理",""), //库存转库-待入库
        applicationApproval("", 7, "",""),
        backInspect("", 8, "","");
 
        String title;
        int type;
        String content;
        String url;
 
        Notices_Type(String title, int type ,String content,String url) {
            this.title = title;
            this.type = type;
            this.content = content;
            this.url = content;
        }
 
        public String getTitle() {
            return title;
        }
        public int getType() {
            return type;
        }
        public String getContent() {
            return content;
        }
        public String getUrl() {
            return url;
        }
 
 
        public static Notices_Type checkEnum(Integer number){
            for (Notices_Type noticesType:Notices_Type.values()) {
                if(noticesType.getType() == number){
                    return noticesType;
                }
            }
            return null;
        }
    }
 
    public enum Notices_Type_Transfer{
        title1("车间领料", "需要您进行{optType}操作,请及时前往处理",1 ,0,1),
        title2("计划领料", "需要您进行{optType}操作,请及时前往处理",2 ,0,1),
        title3("机台备料", "需要您进行备料{optType}操作,请及时前往处理",3 ,2,3),
        title4("完工入库", "需要您进行完工交接{optType}操作,请及时前往处理",4 ,0,4),
        title5("车间转库", "需要您进行{optType}操作,请及时前往处理",5,0,1),
        title6("外协领料转库", "需要您进行{optType}操作,请及时前往处理",6,0,1),
        title7("外协完工转库","需要您进行{optType}操作,请及时前往处理", 7,0,1),
        title8("成品入库", "需要您进行{optType}操作,请及时前往处理",8,0,1),
        title9("成品转库", "需要您进行{optType}操作,请及时前往处理",9,0,1),
        title10("让步放行", "需要您进行{optType}操作,请及时前往处理",10,0,1),
        title11("让步放行转库", "需要您进行{optType}操作,请及时前往处理",11,0,1),
        title12("客返品返修领料", "需要您进行{optType}操作,请及时前往处理",12,0,1),
        title13("客返品返修入库", "需要您进行{optType}操作,请及时前往处理",13,0,1),
        title14("跨组织转库", "需要您进行{optType}操作,请及时前往处理",14,0,1),
        title15("工序报废", "需要您进行{optType}操作,请及时前往处理",15,0,1),
        title16("客退品返修领料", "需要您进行{optType}操作,请及时前往处理",16,0,1),
        title17("客退品返修入库", "需要您进行{optType}操作,请及时前往处理",17,0,1),
        title21("仓库报废", "需要您进行{optType}操作,请及时前往处理",21,8,1),
        title22("客退检验领料", "需要您进行{optType}操作,请及时前往处理",22,8,1),
        title23("客返检验领料", "需要您进行{optType}操作,请及时前往处理",23,8,1),
        title28("库存调整", "需要您进行{optType}操作,请及时前往处理",28,8,9),
        title30("废品入库", "需要您进行{optType}操作,请及时前往处理",30,0,1);
        String title;
        String content;
        int type;
        int noticeOutType;
        int noticeInType;
 
        Notices_Type_Transfer(String title, String content ,int type ,int noticeOutType,int noticeInType) {
            this.title = title;
            this.content = content;
            this.type = type;
            this.noticeOutType = noticeOutType;
            this.noticeInType = noticeInType;
        }
 
        public String getTitle() {
            return title;
        }
        public String getContent() {
            return content;
        }
        public int getType() {
            return type;
        }
        public int getNoticeOutType() {
            return noticeOutType;
        }
        public int getNoticeInType() {
            return noticeInType;
        }
 
 
        public static Notices_Type_Transfer checkEnum(Integer number){
            for (Notices_Type_Transfer notices_type_transfer:Notices_Type_Transfer.values()) {
                if(notices_type_transfer.getType() == number){
                    return notices_type_transfer;
                }
            }
            return null;
        }
    }
 
 
    public static Double formatDouble2Num(Double balance) {
        if (balance == null) {
            return 0d;
        }
        try {
            double temp = (new BigDecimal(balance).setScale(2, BigDecimal.ROUND_HALF_UP)).doubleValue();
            return temp;
        } catch (Exception e) {
            return 0.0;
        }
    }
 
    public static double add(Double v1, Double v2) {
        if (v1 == null) {
            v1 = 0d;
        }
        if (v2 == null) {
            v2 = 0d;
        }
        BigDecimal b1 = new BigDecimal(Double.toString(v1));
        BigDecimal b2 = new BigDecimal(Double.toString(v2));
        return b1.add(b2).doubleValue();
    }
 
    /**
     * 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指 定精度,以后的数字四舍五入。
     *
     * @param v1    被除数
     * @param v2    除数
     * @param scale 表示表示需要精确到小数点以后几位。
     * @return 两个参数的商
     */
    public static double div(Double v1, Double v2, Integer scale) {
        if (v1 == null) {
            v1 = 0d;
        }
        if (v2 == null) {
            v2 = 0d;
        }
        if (scale == null) {
            scale = 0;
        }
        if (v2 == 0) {
            throw new IllegalArgumentException("除数不能为0");
        }
        if (scale < 0) {
            throw new IllegalArgumentException("精确度必须为0或者正整数");
        }
        BigDecimal b1 = new BigDecimal(Double.toString(v1));
        BigDecimal b2 = new BigDecimal(Double.toString(v2));
        return b1.divide(b2, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
    }
 
 
    public static int formatIntegerNum(Integer d) {
        if (d == null) {
            d = 0;
        }
        return d.intValue();
    }
 
    /**
     * 质量属性和字典属性类型对应关系
     * (1)合格:APPLIANCE_ONTEST; 对应可以放入的质量属性 0合格
     * (2)不良:APPLIANCE_OFFTEST;对应可以放入的质量属性 1不良
     * (3)报废:APPLIANCE_USELESS;对应可以放入的质量属性 2报废
     * @param qualityType
     * @param dicCode
     * @return
     */
    public static boolean isQualityTypeValid(Integer qualityType,String dicCode) {
      if(Constants.equalsInteger(qualityType, QUALITIY_TYPE.unqulified)){
          //如果是不良
          if(StringUtils.equals(dicCode,APPLIANCES_TYPE_LABLE.rejects)){
              return true;
          }
      }else  if(Constants.equalsInteger(qualityType, QUALITIY_TYPE.scrap)){
          //如果是报废
          if(StringUtils.equals(dicCode,APPLIANCES_TYPE_LABLE.scrap)){
              return true;
          }
      }else  if(Constants.equalsInteger(qualityType, QUALITIY_TYPE.normal)){
          //如果是合格
          if(StringUtils.equals(dicCode,APPLIANCES_TYPE_LABLE.qualified)){
              return true;
          }
      }
      return false;
    }
    public static BigDecimal formatBigdecimal(BigDecimal d) {
        if (d == null) {
            d = new BigDecimal(0.0);
        }
        //保留两位小数且四舍五入
//        d = d.setScale(2, BigDecimal.ROUND_HALF_UP);
        return  d;
    }
    public static BigDecimal formatBigdecimal4Float(BigDecimal d) {
        if (d == null) {
            d = new BigDecimal(0.0);
        }
        //保留两位小数且四舍五入
        d = d.setScale(4, BigDecimal.ROUND_HALF_UP);
        return  d;
    }
    public static String formatCodeStr(String code) {
        if (code == null) {
            return "";
        }
        DecimalFormat df = new DecimalFormat("0000");
        int c = 0;
        try{
            c= Integer.parseInt(code);
        }catch (Exception e){
 
        }
        return df.format(c);
    }
 
 
    public static boolean equalsInteger(Integer a, Integer b) {
        if (formatIntegerNum(a) == formatIntegerNum(b)) {
            return true;
        }
        return false;
    }
 
 
    public enum wareHouse_QualityType{
        onTest("APPLIANCE_ONTEST", 0),
        offTest("APPLIANCE_OFFTEST", 1),
        useLess("APPLIANCE_USELESS", 2),
        mix("APPLIANCE_MIX", 3);
 
        String code;
        Integer type;
 
        wareHouse_QualityType(String code, int type) {
            this.code = code;
            this.type = type;
        }
 
        public String getCode() {
            return code;
        }
        public Integer getType() {
            return type;
        }
 
        public static wareHouse_QualityType checkEnum(String code){
            for (wareHouse_QualityType wareHouseQualityType:wareHouse_QualityType.values()) {
                if(wareHouseQualityType.getCode().equals(code)){
                    return wareHouseQualityType;
                }
            }
            return null;
        }
    }
 
    public enum CompanyUpdateType{
 
        UPDATE_ENABLE((byte)1,"启动"),
        UPDATE_DISABLE((byte)2,"禁用"),
        UPDATE_VAIL_DATE((byte)3,"调整有效期"),
        UPDATE_CONTENT((byte)4,"数据内容调整-编辑")
        ;
 
 
        private Byte key;
 
        private String desc;
 
        private String info;
 
        CompanyUpdateType(Byte key, String desc) {
            this.key = key;
            this.desc = desc;
 
        }
 
        public Byte getKey() {
            return key;
        }
 
        public void setKey(Byte key) {
            this.key = key;
        }
 
        public String getDesc() {
            return desc;
        }
 
        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
 
 
 
    public static void main(String[] args) {
        String outPut = "                *    \n               ***    \n              *****    \n";
        String newOutPut = "";
        if(StringUtils.isNotBlank(outPut)){
            String[] ostrs = outPut.split("\n");
            for(String str : ostrs){
                String  text = str.replace("\n","").replaceAll("\\s+$", "");
                newOutPut += text+"\n";
            }
        }
        System.out.println(newOutPut);
 
    }
}