yangys
2024-10-30 25db770e621f1259b8d5b7fd514207f7481c2d0f
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
package com.qianwen.smartman.common.enums;
 
public enum WorkstationParamStateEnum {
    COMM_FAILURE(0, "通讯失败, 网关与机床通讯失败 = 网关在线,机床离线"),
    BAD(1, "无效数据"),
    ERROR(2, "错误数据"),
    INITIAL(3, "通讯已经建立,但是没有进行第一次采集之前的默认值"),
    ADDRESS_BAD(4, "无效地址"),
    PROPERTY_BAD(5, "无效属性"),
    Good(15, "有效数据");
    
    private final Integer type;
    private final String description;
 
    WorkstationParamStateEnum(final Integer type, final String description) {
        this.type = type;
        this.description = description;
    }
 
    public Integer getType() {
        return this.type;
    }
 
    public String getDescription() {
        return this.description;
    }
 
    public static WorkstationParamStateEnum of(Integer messageType) {
        if (messageType == null) {
            return null;
        }
        WorkstationParamStateEnum[] values = values();
        for (WorkstationParamStateEnum messageEnum : values) {
            if (messageEnum.type.equals(messageType)) {
                return messageEnum;
            }
        }
        return null;
    }
 
    public boolean isEqual(Integer type) {
        return this.type.equals(type);
    }
}