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
| package com.dy.pmsGlobal.util;
|
| public enum DeviceStatus {
| PENDING_PRODUCTION(0, "待生产"),
| ASSEMBLING(1, "组装中"),
| COMPLETED(2, "完成"),
| REPAIR(3, "维修"),
| WASTE(4, "报废");
| //TEST_FAIL(5, "测试不通过"),
| //INSPECTION_FAIL(6, "品检不通过");
|
| private final int code;
| private final String description;
|
| DeviceStatus(int code, String description) {
| this.code = code;
| this.description = description;
| }
|
| public int getCode() {
| return code;
| }
|
| public String getDescription() {
| return description;
| }
|
| // 根据code值获取对应的枚举值
| public static DeviceStatus fromCode(int code) {
| for (DeviceStatus status : values()) {
| if (status.code == code) {
| return status;
| }
| }
| throw new IllegalArgumentException("未知的枚举code: " + code);
| }
| }
|
|