package cn.estsh.i3plus.pojo.base.enumutil;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.StringUtils;

/**
 * @Description :
 * @Reference :
 * @Author : silliter
 * @CreateDate : 2019-05-13 15:53
 * @Modify:
 **/
public class AndonEnumUtil {

    /**
     * 状态机异常处理状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ROUTE_STATUS_ERROR_RECORD_HANDLE_STATUS {
        TRUE(10, "已处理"),
        FALSE(20, "未处理");

        private int value;
        private String description;

        ROUTE_STATUS_ERROR_RECORD_HANDLE_STATUS(int value, String description) {
            this.value = value;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }
    }

    /**
     * 状态机执行方法
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ROUTE_STATUS_ACTION_TYPE {
        TRIGGER("10", "trigger", "触发"),
        ENTRY("20", "entry", "进入状态"),
        EXIT("30", "exit", "离开状态");

        private String value;
        private String code;
        private String description;

        ROUTE_STATUS_ACTION_TYPE(String value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public static ROUTE_STATUS_ACTION_TYPE getByValue(String value) {
            for (ROUTE_STATUS_ACTION_TYPE actionType : values()) {
                if (actionType.getValue().equals(value)) {
                    return actionType;
                }
            }
            return null;
        }

        public String getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }
    }


    /**
     * 状态点界面编号--此部分枚举后续要创建一个表存储。
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ANDON_ROUTE_STATUS_INTERFACE_NO {
        DEFAULT_ALARM_CALL("DEFAULT_ALARM_CALL", "默认呼叫无界面"),
        EQUMENT_ALARM_CALL("EQUMENT_ALARM_CALL", "设备呼叫弹框界面"),
        QUALITY_ALARM_CALL("QUALITY_ALARM_CALL", "质量呼叫弹框界面"),
        PART_ALARM_CALL("PART_ALARM_CALL", "物料呼叫弹框界面"),
        ROUTING_ALARM_CALL("ROUTING_ALARM_CALL", "工艺呼叫弹框界面"),
        OTHER_ALARM_CALL("OTHER_ALARM_CALL", "自处理呼叫弹框界面"),
        FIX_ERROR_CALL("FIX_ERROR_CALL", "自动报警呼叫弹框界面"),
        ALARM_SIGN("ALARM_SIGN", "响应弹框界面"),
        ALARM_CANCEL("ALARM_CANCEL", "撤销二次提醒框"),
        ALARM_RESOLVE("ALARM_RESOLVE", "解决弹框界面");

        private String value;
        private String description;

        ANDON_ROUTE_STATUS_INTERFACE_NO(String value, String description) {
            this.value = value;
            this.description = description;
        }

        public String getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }
    }

    /**
     * 组件参数类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ACTION_MODULE_PARAM_TYPE {

        QUALIFIED(10, "number", "数字"),
        DEFECTED(20, "text", "字符串"),
        SCRAPED(30, "select", "可选值"),
        BUTTON(40, "button", "按钮");

        private int value;
        private String code;
        private String description;

        ACTION_MODULE_PARAM_TYPE(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 组件类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ACTION_MODULE_AM_TYPE {
        COMMON_MODULE(10, "通用组件");

        private int value;
        private String description;

        ACTION_MODULE_AM_TYPE(int value, String description) {
            this.value = value;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }
    }

    /**
     * 流程状态-触发类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ROUTE_STATUS_TRIGGER_TYPE {
        INNER_TRIGGER(10, "内部触发"),
        OUTER_TRIGGER(20, "外部触发");

        private int value;
        private String description;

        ROUTE_STATUS_TRIGGER_TYPE(int value, String description) {
            this.value = value;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }
    }

    /**
     * 组件状态类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ROUTE_STATUS_TYPE {
        START(10, "START", "开始状态"),
        EXECUTING(20, "EXECUTING", "执行中状态"),
        FINISH(30, "FINISH", "完成状态");

        private int value;
        private String code;
        private String description;

        ROUTE_STATUS_TYPE(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }
    }

    /**
     * 安灯主界面产线或者站点运行状态
     * 正常 = 10，故障 = 20
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum RUNNING_STATUS{
        RUNNING("10","正常"),
        STOP("20","故障");

        private String value;
        private String description;

        RUNNING_STATUS(String value, String description) {
            this.value = value;
            this.description = description;
        }

        public String getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].value,val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String descriptionOfValue(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 安灯配置表分组列枚举
     * 10-是，20-否
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ANDON_CONFIG_GROUP {
        BROAD_GROUP(10,"广播配置分组");

        private int value;
        private String description;

        ANDON_CONFIG_GROUP(int value, String description) {
            this.value = value;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static int descriptionOfValue(String val) {
            int tmp = -1;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }
    /**
     * 成功失败标识
     *
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ANDON_SUCCESS_FLAG{
        SUCCESS(1, "1","成功"),
        FAIL(2, "2","失败");

        private int value;
        private String code;
        private String description;

        ANDON_SUCCESS_FLAG(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode(){ return code; }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String codeOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].code, val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static int descriptionOfValue(String val) {
            int tmp = -1;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String descriptionOfCode(String val) {
            String tmp = "";
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }
    }

    /**
     * 通知超时标识
     *
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum NOTICE_OVER_TIME_FLAG{
        CALL(1,"呼叫超时"),
        SIGN(2,"响应超时");

        private int value;
        private String description;

        NOTICE_OVER_TIME_FLAG(int value, String description) {
            this.value = value;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static int descriptionOfValue(String val) {
            int tmp = -1;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 广播内容占位符
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum BROADCAST_CUSTOM_CONDITION {
        LINE("{A}","workCenterCode","产线代码"),
        LINE_NAME("{B}","workCenterName","产线名称"),
        CELL("{C}","workCellCode","工位代码"),
        CELL_NAME("{D}","workCellName","工位名称"),
        ALARM_CODE("{E}","alarmCode","安灯类型代码"),
        ALARM_NAME("{F}","alarmName","安灯类型名称"),
        CALL_USER("{G}","callUser","呼叫人名称"),
        ALARM_DETAIL("{H}","alarmDetailCode","安灯子类型"),
        ALARM_DETAIL_NAME("{L}","alarmDetailNameRdd","安灯子类型名称"),
        AC_CODE("{J}","acCode","事件描述代码"),
        AC_NAME("{K}","acNameRdd","事件描述名称"),
        MEMO("{M}","MEMO","备注");

        private String value;
        private String code;
        private String description;

        BROADCAST_CUSTOM_CONDITION(String value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public String getValue() {
            return value;
        }

        public String getCode(){ return code; }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].value, val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String codeOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].code, val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String descriptionOfValue(String desc) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, desc)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String descriptionOfCode(String desc) {
            String tmp = "";
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, desc)) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }
    }


    /**
     * 按灯状态
     * 10-是，20-否
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum KNOWLEDGE_AUDIT_STATUS {
        PENDING(10,"待审批"),
        PASS(20,"审批通过"),
        STOP(99,"审批不通过");

        private int value;
        private String description;

        KNOWLEDGE_AUDIT_STATUS(int value, String description) {
            this.value = value;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static int descriptionOfValue(String val) {
            int tmp = -1;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 语音播报类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ANDON_VOICE_TYPE{
        MIC_EN("10","Microsoft Anna - English (United States)"),
        MIC_LILI("20","Microsoft Lili - Chinese (China)"),
        AI_MALE("30","Aisound_male"),
        AI_FEMALE("40","Aisound_female"),
        MIC_ZIRE_EN("50","Microsoft Zira Desktop - English (United States)"),
        MIC_HUI_CH("60","Microsoft Huihui Desktop - Chinese (Simplified)");

        private String value;
        private String description;

        ANDON_VOICE_TYPE(String value, String description) {
            this.value = value;
            this.description = description;
        }

        public String getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].value,val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String descriptionOfValue(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 标准处理 = 10，自处理 = 20
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum DISPOSAL_TYPE{
        STANDARD("10","标准处理"),
        SELF("20","自处理");

        private String value;
        private String description;

        DISPOSAL_TYPE(String value, String description) {
            this.value = value;
            this.description = description;
        }

        public String getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].value,val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String descriptionOfValue(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 标准类型 = 10，异常类型 = 20
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum WORK_CELL_TYPE{
        NORMAL("10","标准类型"),
        ABNORMAL("20","异常类型");

        private String value;
        private String description;

        WORK_CELL_TYPE(String value, String description) {
            this.value = value;
            this.description = description;
        }

        public String getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].value,val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String descriptionOfValue(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 审批状态：10=待审批，20=二级审批，30=三级审批，40=四级审批，100=已审批
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum APPROVAL_STATUS{
        WAIT("10","待审批"),
        SECOND_APPROVAL("20","二级审批"),
        THIRD_APPROVAL("30","三级审批"),
        FOUTH_APPROVAL("40","四级审批"),
        FINISH("60","已审批");

        private String value;
        private String description;

        APPROVAL_STATUS(String value, String description) {
            this.value = value;
            this.description = description;
        }

        public String getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].value,val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String descriptionOfValue(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 统计方式
     * 10-是，20-否
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum COUNT_TYPE {
        DAY("10","按照天统计"),
        WEEKEND("20","按照周统计");

        private String value;
        private String description;

        COUNT_TYPE(String value, String description) {
            this.value = value;
            this.description = description;
        }

        public String getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].value, val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String descriptionOfValue(String val) {
            String tmp = "";
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 处理标识
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum IS_ALARM_STATUS {
        TRUE(10, "是"), FALSE(20, "否");

        private int value;
        private String description;

        private IS_ALARM_STATUS(int value, String description) {
            this.value = value;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getValueStr() {
            return value + "";
        }

        public String getDescription() {
            return description;
        }

        public static String valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static int descOf(String desc) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].description.equals(desc)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {return valueOf(val);}
        public static int descriptionOfValue(String desc) {return descOf(desc);}
    }


    /**
     * 按灯状态
     * 10-是，20-否
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ALARM_STATUS {
        YES(10,"需要按灯"),
        ON(20,"不需要按灯");

        private int value;
        private String description;

        ALARM_STATUS(int value, String description) {
            this.value = value;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static int descriptionOfValue(String val) {
            int tmp = -1;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 按灯业务状态
     * 安灯状态=10，工号 =20 ，读取状态=30, 停线=40, 安灯子类型=50, 原因代码=60, 产品信息=70， 产品产量=80
     * 20201027 增加安灯状态 90 =优先级, 10 =故障字符串
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ALARM_BUSI_FLAG{
        ALARM_FLAG("10","安灯呼叫标识"),
        USER_CODE("20","用户工号"),
        READ_FLAG("30", "安灯读取状态"),
        STOP_FLAG("40", "停线状态"),
        DETAIL_TYPE("50", "安灯子类型"),
        AC_CODE("60", "原因代码"),
        PROD_INFO("70", "产品信息"),
        LINE_INFO("80", "产量信息"),
        PRIORITY_LEVEL("90", "优先级"),
        FAULT_STR("100", "故障字符串");

        private String value;
        private String description;

        ALARM_BUSI_FLAG(String value, String description) {
            this.value = value;
            this.description = description;
        }

        public String getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].value,val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String descriptionOfValue(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 按灯标识
     * 1-呼叫，2-签到，3-解决
     *
     * 20190917将“提交”更改为“解决待审”
     * 20190917将“审批”更改为“审批完成”
     * 20190917增加"撤销已确认"枚举
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ANDON_ACTION_TAG {
        CALL(1, "1","10","呼叫"),
        SIGN(2, "2","20","响应"),
        RESOLVE(3, "3","30","解决"),
        CANCEL(4, "4","40", "撤销"),
        COMMIT(5, "5","50","解决待审"),
        PASS(6, "6","60","审批完成"),
        REJECT(7, "7","70","驳回"),
        CONFIRMED_CANCEL(8, "8","80","撤销已确认");

        private int value;
        private String valueStr;
        private String code;
        private String description;

        ANDON_ACTION_TAG(int value, String valueStr, String code, String description) {
            this.value = value;
            this.valueStr = valueStr;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getValueStr(){ return valueStr; }

        public String getCode(){ return code; }

        public String getDescription() {
            return description;
        }

        public static ANDON_ACTION_TAG getByValue(int value) {
            for (ANDON_ACTION_TAG actionTag : values()) {
                if (actionTag.getValue() == value) {
                    return actionTag;
                }
            }
            return null;
        }

        public static ANDON_ACTION_TAG getByValueStr(String valueStr) {
            for (ANDON_ACTION_TAG actionTag : values()) {
                if (actionTag.getValueStr().equals(valueStr)) {
                    return actionTag;
                }
            }
            return null;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String codeOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].code, val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static int descriptionOfValue(String val) {
            int tmp = -1;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String descriptionOfCode(String val) {
            String tmp = "";
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }
    }

    /**
     * 优先级别
     * 10 - 一级，20 - 二级，30 - 三级
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ALARM_PRIORITY{
        FIRST(10,"一级"),
        SECOND(20,"二级"),
        THIRD(30,"三级"),
        FOUR(40,"四级");

        private int value;
        private String description;

        ALARM_PRIORITY(int value, String description) {
            this.value = value;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static int descriptionOfValue(String val) {
            int tmp = -1;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }
    /**
     * 安灯操作动作来源
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ALARM_OPERATION_SOURCE{
        PHYSICAL("10","物理操作"),
        SOFT("20","软件操作"),
        SCHEDULE("30","队列，定时操作"),
        INSERT("40","插入动作");

        private String value;
        private String description;

        ALARM_OPERATION_SOURCE(String value, String description) {
            this.value = value;
            this.description = description;
        }

        public String getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].value, val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String descriptionOfValue(String val) {
            String tmp = "";
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 安灯来源
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ALARM_SOURCE_TYPE{
        PHYSICAL("10","物理安灯"),
        SOFT("20","软件安灯");

        private String value;
        private String description;

        ALARM_SOURCE_TYPE(String value, String description) {
            this.value = value;
            this.description = description;
        }

        public String getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static ALARM_SOURCE_TYPE getByValue(String value) {
            for (ALARM_SOURCE_TYPE sourceType : values()) {
                if (sourceType.getValue().equals(value)) {
                    return sourceType;
                }
            }
            return null;
        }

        public static String valueOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].value, val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String descriptionOfValue(String val) {
            String tmp = "";
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * ANDON类型：MM=物料 QM=质量 EQ=设备 GY=工艺 JC=检测
     *
     * 下面的顺序不要更改，packBrokenTimeTypeRatioList方法有用到此枚举的顺序
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ALARM_TYPE {
        EQUIP("EQUMENT_ALARM", 110060106, "设备", "#D06D6A"),
        QUALITY("QUALITY_ALARM", 110060105, "质量", "#9084FF"),
        PART("PART_ALARM", 110060104, "物料", "#24BDBA"),
        PROCESS("ROUTING_ALARM", 110060107, "工艺", "#2B97F9"),
        CHECK("OTHER_ALARM", 110060108, "工装", "#EAA510"),
        FIX_ERROR("FIX_ERROR", 110060109, "自动报警", "#797B7F");

        private String value;
        private Integer code;
        private String description;
        private String colour;

        ALARM_TYPE(String value, Integer code, String description, String colour) {
            this.value = value;
            this.code = code;
            this.description = description;
            this.colour = colour;
        }

        public String getValue() {
            return value;
        }

        public Integer getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public String getColour() {
            return colour;
        }

        public static String valueOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].value, val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String descriptionOfValue(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String colourOfValue(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].value, val)) {
                    tmp = values()[i].colour;
                }
            }
            return tmp;
        }
    }

    /**
     * 组织模型树形菜单level
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PROD_ORG_LEVEL{
        LEVEL_ONE(1,"一级目录"),
        LEVEL_TWO(2,"二级目录"),
        LEVEL_THREE(3,"三级目录"),
        LEVEL_FOUR(4,"四级目录");

        private int value;
        private String description;

        PROD_ORG_LEVEL(int value, String description) {
            this.value = value;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static int descriptionOfValue(String val) {
            int tmp = -1;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 按灯停线标识
     * 1-停止产线，0-启动产线
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum STOP_LINE_FLAG{
        STOP("1","停止产线"),
        RESTART("0","启动产线");

        private String value;
        private String description;

        STOP_LINE_FLAG(String value, String description) {
            this.value = value;
            this.description = description;
        }

        public String getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].value, val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String descriptionOfValue(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 按灯通知方式
     * 10-短信，20-邮箱
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum NOTICE_MESSAGE_SEND_TYPE {
        SMS("10","短信"),
        EMAIL("20","邮箱"),
        BROAD_CAST("30","广播");

        private String value;
        private String description;

        NOTICE_MESSAGE_SEND_TYPE(String value, String description) {
            this.value = value;
            this.description = description;
        }

        public String getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].value, val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String descriptionOfValue(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 通知级别
     * 10 - 一级，20 - 二级，30 - 三级，40 - 四级
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum NOTICE_MESSAGE_SEND_LEVEL {
        FIRST(10,"一级"),
        SECOND(20,"二级"),
        THIRD(30,"三级"),
        FOUTH(40,"四级");

        private int value;
        private String description;

        NOTICE_MESSAGE_SEND_LEVEL(int value, String description) {
            this.value = value;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static int descriptionOfValue(String val) {
            int tmp = -1;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 安灯动作
     * <per>
     *     <br/> 10 = 呼叫
     *     <br/> 20 = 签到
     *     <br/> 30 = 解决
     *     <br/> 40 = 撤销
     *     <br/> 50 = 提交
     *     <br/> 60 = 审批
     *     <br/> 70 = 转呼
     * </per>
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ANDON_ACTION_FLAG{
        CALL_ACTION("10","呼叫动作"),
        SIGN_ACTION("20","签到动作"),
        RESOLVE_ACTION("30", "解决动作"),
        CANCEL_ACTION("40", "撤销动作"),
        COMMIT_ACTION("50","提交动作"),
        PASS_ACTION("60","审批动作"),
        REJECT_ACTION("70", "驳回动作"),
        OPEN_ACTION("80","放行动作");

        private String value;
        private String description;

        ANDON_ACTION_FLAG(String value, String description) {
            this.value = value;
            this.description = description;
        }

        public String getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].value, val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String descriptionOfValue(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 安灯重要等级
     * <per>
     *     <br/> 10 = 一级
     *     <br/> 20 = 二级
     *     <br/> 30 = 三级
     *     <br/> 40 = 四级
     * </per>
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ANDON_IMPORTANCE_LEVEL{
        FIRST_LEVEL("10","一级"),
        SECOND_LEVEL("20","二级"),
        THIRD_LEVEL("30","三级"),
        FORTH_LEVEL("40","四级");

        private String value;
        private String description;

        ANDON_IMPORTANCE_LEVEL(String value,String description) {
            this.value = value;
            this.description = description;
        }

        public String getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].value, val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String descriptionOfValue(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }


    /**
     * 设备状态：
     *      10=备用，
     *      20=运行，
     *      30=故障，
     *      40=检修
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ANDON_EQUIPMENT_STATUS{
        SPARE("10","备用"),
        RUN("20","运行"),
        ERROR("30","故障"),
        OVERHAUL("40","检修");

        private String value;
        private String description;

        ANDON_EQUIPMENT_STATUS(String value,String description) {
            this.value = value;
            this.description = description;
        }

        public String getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].value, val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String descriptionOfValue(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 接口调用标识

     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ANDON_CALL_TYPE{
        MANAGE("10","管理界面"),
        QUEUE ("20","队列");

        private String value;
        private String description;

        ANDON_CALL_TYPE(String value,String description) {
            this.value = value;
            this.description = description;
        }

        public String getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfDescription(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].value, val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static String descriptionOfValue(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }
}
