#
Junjie
2024-09-26 7042950a224eea80226c316a80774983e2074ddc
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
package com.zy.asrs.wcs.core.model.enums;
 
import com.zy.asrs.framework.common.SpringUtils;
import com.zy.asrs.framework.exception.CoolException;
import com.zy.asrs.wcs.rcs.entity.DeviceType;
import com.zy.asrs.wcs.rcs.service.DeviceTypeService;
 
public enum DeviceCtgType {
 
    CONVEYOR,
    CRANE,
    LIFT,
    SHUTTLE,
    AGV,
    LED,
    MAP,
    ;
 
    DeviceCtgType() {
    }
 
    public long val() {
        DeviceTypeService service = SpringUtils.getBean(DeviceTypeService.class);
        DeviceType entity = service.selectByFlag(this.toString());
        if (entity == null) {
            throw new CoolException("DeviceCtgType Error!");
        }
        return entity.getId();
    }
 
 
    public static DeviceCtgType get(String el) {
        for (DeviceCtgType value : DeviceCtgType.values()) {
            if (el.toUpperCase().equals(value.toString())) {
                return value;
            }
        }
        return null;
    }
 
}