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.core.entity.DeviceCtg; 
 | 
import com.zy.asrs.wcs.core.service.DeviceCtgService; 
 | 
  
 | 
public enum DeviceCtgType { 
 | 
  
 | 
    CONVEYOR, 
 | 
    CRANE, 
 | 
    LIFT, 
 | 
    SHUTTLE, 
 | 
    AGV, 
 | 
    ; 
 | 
  
 | 
    DeviceCtgType() { 
 | 
    } 
 | 
  
 | 
    public long val() { 
 | 
        DeviceCtgService service = SpringUtils.getBean(DeviceCtgService.class); 
 | 
        DeviceCtg 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.equals(value.toString())) { 
 | 
                return value; 
 | 
            } 
 | 
        } 
 | 
        return null; 
 | 
    } 
 | 
  
 | 
} 
 |