StorageConstants.java
17.8 KB
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
package com.myproject.util;
import com.google.common.base.Strings;
import java.util.*;
/**
* Created by kangmor on 2015/12/2.
*/
public class StorageConstants {
public final static String COMPONENT = "component";
public final static String COMPONENT_SEARCH_VIEW = "redirect:componentSearch.html";
public final static String BARCODE_TYPE = "barcode";
public final static String BARCODE_SEARCH_VIEW = "redirect:/barcode/barcodeSearch.html";
public final static String STORAGE_TYPE = "storage";
public final static String STORAGE_UPDATE_VIEW = "redirect:storageUpdate.html";
// public final static int STA_PUT_IN_FINISHED = 3;
// public final static int STA_CHECKOUT_FINISHED = 4;
// public final static int STA_REST = 5;
public final static String SAVE = "save";
public final static String ADD = "add";
public final static String DELETE = "delete";
public final static String REMOVE = "remove";
public final static String FETCH = "fetch";
public final static int DEFAULT_HEIGHT = 20;
/**
* /// <summary>
/// 操作码(0无操作(发送料仓状态给服务器),1扫码入库(扫码成功后发送给服务器),2 出库(服务器发送) )
/// </summary>
*/
public static class OP{
/**
* 0无操作
*/
public final static int NON_OP = 0;
/**
* 1扫码入库
*/
public final static int PUT_IN = 1;
/**
* 2 出库
*/
public final static int CHECKOUT = 2;
/**
* 3 有错误消息
*/
public final static int ERROR = 3;
/**
* 4扫码
*/
public final static int SCAN_CODE = 4;
/**
* 5获取报警温湿度值
*/
public final static int ALARM_DATA = 5;
/**
* 6 锡膏回温取料
*/
public final static int REWARM_TAKING = 6;
/**
* 7 锡膏回温放料
*/
public final static int REWARM_PUTTING = 7;
/**
* 8 锡膏搅拌
*/
public final static int MIX = 8;
}
/// 整体料仓状态
/// 1=正常运行中
/// 2=急停中
/// 3=故障(气压检测不到等,用msg发送详细故障说明)
/// 4=警告(用msg发送提醒,如出库到达工位但是没有工人操作)
public static class STATUS{
/**
* 1=正常运行中
*/
public final static int READY = 1;
/**
* 2=急停中
*/
public final static int EMERGENCY = 2;
/**
* 3=故障(气压检测不到等,用msg发送详细故障说明)
*/
public final static int PROBLEM = 3;
/**
* 4=警告(用msg发送提醒,如出库到达工位但是没有工人操作)
*/
public final static int WARNING = 4;
/**
* 999=离线
*/
public final static int OFFLINE = 999;
}
/// <summary>
/// 单台BOX状态
/// 1=正常运行中
/// 2=急停,3=故障,4=警告,5=调试中
/// 6入库执行中,7入仓位完成,8入库失败
/// 9出库执行中,10出仓位完成,11出库失败
/// </summary>
public static class BOX_STATUS{
/**
* 1=准备就绪
*/
public final static int READY = 1;
/**
* 2=急停
*/
public final static int EMERGENCY = 2;
/**
* 3=故障
*/
public final static int PROBLEM = 3;
/**
* 4=警告(用msg发送提醒,如出库到达工位但是没有工人操作)
*/
public final static int WARNING = 4;
/**
* 5=调试中
*/
public final static int DEBUG = 5;
/**
* 6入库执行中
*/
public final static int PUTIN = 6;
/**
* 7入仓位完成,
*/
public final static int IN_FINISHED = 7;
/**
* 8入库失败
*/
public final static int IN_FAILED = 8;
/**
*9出库执行中,
*/
public final static int CHECKOUT = 9;
/**
* 10出仓位完成
*/
public final static int OUT_FINISHED = 10;
/**
* 11出库完成
*/
public final static int OUT_END = 11;
/**
* 12出库移栽中
*/
public final static int OUT_MOVING = 12;
/**
* 13原点返回中
*/
public final static int RESET = 13;
/**
* 14 回温取料中
*/
public final static int REWARM_TAKING = 14;
/**
* 15 回温取料完成
*/
public final static int REWARM_TAKING_END = 15;
/**
* 16 回温放料中
*/
public final static int REWARM_PUTTING = 16;
/**
* 17 回温放料完成
*/
public final static int REWARM_PUTTING_END = 17;
/**
* 18 搅拌取料中
*/
public final static int MIX_TAKING = 18;
/**
* 19 等待搅拌
*/
public final static int WAIT_MIX = 19;
/**
* 20 搅拌执行中
*/
public final static int MIXING = 20;
/**
* 21 搅拌完成回仓
*/
public final static int MIX_PUTTING = 21;
/**
* 22 搅拌完成放回原来的仓中
*/
public final static int MIX_END = 22;
}
/**
* 料仓类型:0单台自动料仓,1手动料仓2流水线料仓
*/
public static enum TYPE{
/**
*0单台自动料仓
*/
AUTO("storage.type.auto"),
/**
* 1手动料仓
*/
MANUAL("storage.type.manual"),
/**
* 2流水线料仓
*/
LINE("storage.type.line"),
/**
* 3 虚拟料仓
*/
VIRTUAL("storage.type.virtual"),
/**
* 4 在线料仓(上下层两个 BOX)
*/
ONLINE("storage.type.online"),
/**
* 5批量上下料料仓
*/
BATCH("storage.type.batch"),
/**
* 6智能料架
*/
SHELF("storage.type.shelf"),
/**
* 7 料柜
*/
CABINET("storage.type.cabinet"),
/**
* 8 料架
*/
ACCSHELF("storage.type.accShelf"),
/**
* 9 新料架,支持合并库位确认
*/
NEWSHELF("storage.type.newShelf"),
/**
* 9 扫码料架
*/
CODESHELF("storage.type.codeShelf"),
/**
* 10 锡膏料仓
*/
SOLDERPASTE("storage.type.solderPaste"),
/**
* 11 垂直货柜
*/
VERTICALBOX("storage.type.smdVl"),
/**
* 12 SMD-XL(方仓)
*/
SMD_XL("storage.type.smdXl")
;
private String key;
TYPE(String key) {
this.key = key;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getName(){
return name();
}
}
/**
* 操作状态
*/
public enum OP_STATUS{
/**
* 无状态
*/
NONE,
/**
* 等待
*/
WAIT,
/**
* 正在执行
*/
EXECUTING,
/**
* 已暂停
*/
PAUSE,
/**
* 已完成
*/
FINISHED,
/**
* 已取消
*/
CANCEL,
/**
* 已结束
*/
END
;
}
/**
* 任务来源:1=Feeder
*/
public static enum TASK_SOURCE{
/**
* 站位列表
*/
FEEDER,
/**
* 指定批次
*/
BATCH,
/**
* 呆滞物料出库
*/
INACTION
;
}
public static class ALARM_TYPE_MSG{
private static Map<String,String> msgMap = new HashMap<>();
static {
msgMap.put("0-1","原点返回");
msgMap.put("0-2","复位");
msgMap.put("1-1","急停");
msgMap.put("1-2","无气压信号");
msgMap.put("1-3","托盘错乱");
msgMap.put("2-1","旋转轴错误");
msgMap.put("2-2","上下轴错误");
msgMap.put("2-3","前进轴错误");
msgMap.put("2-4","压紧轴错误");
msgMap.put("2-5","上下电缸错误");
}
public static String getMsg(String type, String detail){
String key = type + "-" + detail;
return getMsg(key);
}
public static String getMsg(String detailType){
// String msg = msgMap.get(detailType);
// if(Strings.isNullOrEmpty(msg)){
// msg = detailType;
// }
// return msg;
return detailType;
}
}
/**
* 出库策略 效率优先/严格先进先出/尾料优先/先过期先出/先生产先出
*/
public static enum CHECKOUT_TYPE{
EFFICIENCY,FIFO,USED_FIRST,EXPIRE_FIRST,PRODUCE_DATE;
}
/**
* 物料类型
*/
public static class COMPONENT_TYPE{
public static final int COMPONENT = 0;
/** 锡膏 */
public static final int SOLDERPASTE = 1;
/** PCB板 */
public static final int PCB = 2;
/** 其他物料*/
public static final int OTHERS = 3;
/** 夹具 */
public static final int FIXTURE = 4;
}
/**
* 二维码类型,用于在界面上展示对应的图片
*/
public static enum CODE_TYPE{
COMPONENT,
PCB,
OTHERS,
PCB_FIXTURE,
SOLDER_FIXTURE,
FIXTURE,
/**
* 管装锡膏
*/
TUBE_SOLDER,
/**
* 罐装锡膏
*/
CAN_SOLDER;
public static CODE_TYPE fromComponentType(int type){
switch (type){
case COMPONENT_TYPE.COMPONENT:
return COMPONENT;
case COMPONENT_TYPE.FIXTURE:
return FIXTURE;
case COMPONENT_TYPE.OTHERS:
return OTHERS;
case COMPONENT_TYPE.PCB:
return PCB;
}
return null;
}
}
/**
* 图表展示方式
*/
public static enum CHART_SHOW_TYPE{
YEAR,MONTH,DAY
}
/**
* 夹具类型
*/
public enum PACKAGE_TYPE{
PCB_FIXTURE("PCB 夹具",420,45,"PCB_FIXTURE"), SOLDER_FIXTURE("锡膏夹具",325,65, "SOLDER_FIXTURE");
private String showStr;
/**
* 可放物料数量,用于验证
*/
private String code;
private int count = 1;
private int w;
private int h;
public static PACKAGE_TYPE fromWH(int w, int h){
for(PACKAGE_TYPE type : PACKAGE_TYPE.values()){
if(type.w == w && type.h == h){
return type;
}
}
return null;
}
PACKAGE_TYPE(String showStr, int width, int height, String code) {
this.showStr = showStr;
this.w = width;
this.h = height;
this.code = code;
}
PACKAGE_TYPE(String showStr, int width, int height, int count) {
this.showStr = showStr;
this.w = width;
this.h = height;
this.count = count;
this.code = code;
}
public String getShowStr() {
return showStr;
}
public void setShowStr(String showStr) {
this.showStr = showStr;
}
public int getW() {
return w;
}
public void setW(int w) {
this.w = w;
}
public int getH() {
return h;
}
public void setH(int h) {
this.h = h;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
public static class BARCODE_STATUS{
/**
*-1新建
*/
public static int NEW = -1;
/**
* 0在库
*/
public static int IN_STORE = 0;
/**
* 1已出库正常
*/
public static int OUT_NORMAL = 1;
/**
* 2已出库且已过期
*/
public static int OUT_EXPIRED = 2;
}
/**
* 兼容类型:0=完全匹配,1=完全兼容,2=同尺寸兼容
*/
public static enum COMPATIBLE_TYPE{
/**
* 完全匹配
*/
EXACT_MATCH("storage.match.exactMatch"),
/**
* 完全兼容
*/
FULLY_COMPATIBLE("storage.match.fullyCompatible"),
/**
* 同尺寸兼容
*/
SIZE_COMPATIBLE("storage.match.sizeCompatible");
COMPATIBLE_TYPE(String key) {
this.key = key;
}
private String key;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getName(){
return name();
}
}
public static class CABINET_STEP{
/**
* 0=等待刷卡;1=等待开门;2=门已打开,等待关闭;
*/
public static int WAIT_CARD = 0;
/**
* 0=等待刷卡;1=等待开门;2=门已打开,等待关闭;
*/
public static int WAIT_OPEN_DOOR = 1;
/**
* 0=等待刷卡;1=等待开门;2=门已打开,等待关闭;
*/
public static int WAIT_CLOSE_DOOR = 2;
}
/**
* 轻工单执行状态
*/
public static class LITEORDER_STATUS{
/**新建的工单*/
public static int NEW=0;
/**首套料正在执行*/
public static int BOM=1;
/**首盘料已结束,等待出尾料*/
public static int BOM_FINISHED=2;
/**正在出尾料*/
public static int TAILS=3;
/**尾料已完成*/
public static int TAILS_FINISHED=4;
/**正在补料*/
public static int ONE=5;
/**补料已完成*/
public static int ONE_FINISHED=6;
}
/**
*
锡膏状态:
冷藏中
回温中 (从冷藏中取出,未达到回温时间)
待搅拌 (回温完成或二次入库重新搅拌,等待搅拌)
搅拌中 (搅拌动作执行中)
待出库 (已回温完成,搅拌完成或不需要搅拌,等待出库)
出库中 (出库动作执行中)
退库存储 (二次入库存储在暂存区,使用时可直接出库,与待出库状态一样)
*/
public static class SOLDER_STATUS{
public static int NONE = 0;
/**
* 冷藏中
*/
public static int UNDER_REFRIGERATION = 1;
/**
* 回温中 (从冷藏中取出,未达到回温时间)
*/
public static int REWARMING = 2;
/**
* 待搅拌 (回温完成或二次入库重新搅拌,等待搅拌)
*/
public static int TO_BE_MIXED = 3;
/**
* 搅拌中 (搅拌动作执行中)
*/
public static int MIXING = 4;
/**
* 待出库 (已回温完成,搅拌完成或不需要搅拌,等待出库)
*/
public static int TO_BE_OUT = 5;
/**
* 出库中 (出库动作执行中)
*/
public static int OUTING = 6;
/**
* 退库存储 (二次入库存储在暂存区,使用时可直接出库,与待出库状态一样)
*/
public static int RETREAT_STORAGE = 7;
}
private static int currentColorIndex = -1;
/**
* 工单颜色, 入库绿色,出库红色,库位检查使用黄色, 其他颜色用于工单出库颜色
*/
public enum ORDER_COLOR{
//magenta,cyan,firebrick,purple,skyblue,pink,forestgreen,lightblue,indianred,darkgreen
//洋红,青色,砖红色,紫色,天蓝色,粉色,森林绿,浅蓝色,印度红,深绿色
BLUE("0000FF"),
MAGENTA("FF00FF"),
CYAN("00FFFF"),
FIREBRICK("B22222"),
PURPLE("A020F0"),
SKYBLUE("6CA6CD"),
PINK("FF1493"),
FORESTGREEN("228B22"),
LIGHTBLUE("8470FF"),
INDIANRED("8B3A3A"),
DARKGREEN("556B2F");
private String rgb;
ORDER_COLOR(String rgb){
this.rgb = rgb;
}
public String getRgb() {
return rgb;
}
public void setRgb(String rgb) {
this.rgb = rgb;
}
public static ORDER_COLOR fromRgb(String rgb){
for (ORDER_COLOR order_color : values()) {
if(order_color.getRgb().equals(rgb)){
return order_color;
}
}
return null;
}
public static ORDER_COLOR nextColor(Collection<String> excludeColors){
ORDER_COLOR[] allColors = values();
if (excludeColors.size() >= allColors.length){
return null;
}
int nextColorIndex = (currentColorIndex + 1) % allColors.length;
for (ORDER_COLOR color : allColors) {
if(!excludeColors.contains(color.getRgb()) && color.ordinal() >= nextColorIndex){
currentColorIndex = color.ordinal();
return color;
}
}
return null;
}
}
}