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

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

/**
 * @Description :
 * @Reference :
 * @Author : alwaysfrin
 * @CreateDate : 2018-10-23 15:53
 * @Modify:
 **/
public class MesPcnEnumUtil {

    /**
     * mes 工位类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum MES_WORK_CELL_TYPE {

        NORMAL(10, "正常"),
        REWORK(20, "返修");

        private int value;
        private String description;

        MES_WORK_CELL_TYPE(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;
        }

    }

    /**
     * mes 物料绑定记录结果
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum MES_PRODUCE_SN_RESULT {

        OK(10, "OK");

        private int value;
        private String description;

        MES_PRODUCE_SN_RESULT(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;
        }

    }

    /**
     * mes缺陷原因类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum MES_DEFECT_CAUSE_TYPE {

        QUALITY_DEFECTS(10, "质量缺陷"),
        PROCESS_DEFECTS(20, "工艺缺陷"),
        EQUIPMENT_DEFECT(30, "设备缺陷");

        private int value;
        private String description;

        MES_DEFECT_CAUSE_TYPE(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;
        }

    }


    /**
     * mes 图片面位
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum MES_SIDE_LOCATION {

        A_SIDE(10, "A面"),
        B_SIDE(20, "B面"),
        C_SIDE(30, "C面"),
        D_SIDE(40, "D面");

        private int value;
        private String description;

        MES_SIDE_LOCATION(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;
        }

    }

    /**
     * mes 维修状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum MES_REPAIR_STATUS {

        REPAIRED(10, "已维修"),
        NO_REPAIR(20, "待维修");

        private int value;
        private String description;

        MES_REPAIR_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;
        }

    }

    /**
     * mes过程质量检测类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum MES_QC_CHECK_TYPE {

        FIRST_CHECK(10, "首检"),
        ON_SITE_CHECK(20, "巡检"),
        END_CHECK(30, "尾检");

        private int value;
        private String description;

        MES_QC_CHECK_TYPE(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 Integer descriptionOfValue(String description) {
            Integer tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].description.equals(description)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * mes-pcn定时任务状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum MES_PCN_TASK_STATUS {

        OPEN(1, "OPEN"),
        CLOSE(2, "CLOSE");

        private int value;
        private String description;

        MES_PCN_TASK_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;
        }
    }

    /**
     * mes-pcn定时任务同步结果状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum MES_PCN_TASK_SYNC_STATUS {

        SUCCESS(1, "mes主服务定时任务工作清单同步成功"),
        ERROR(2, "mes主服务定时任务工作清单同步失败");

        private int value;
        private String description;

        MES_PCN_TASK_SYNC_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;
        }
    }

    /**
     * PCN同步MES主数据同步方式枚举
     * 10.
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum SYNC_PATTERN {

        UPDATE(1, "修改或新增"),
        INSERT(2, "新增");

        private int value;
        private String description;

        SYNC_PATTERN(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;
        }
    }

    /**
     * PCN同步MES主数据同步类型枚举
     * 10.
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum SYNC_TYPE {

        GET_MES_DATA(1, "pcn获取mes数据"),
        DATA_TO_MES(2, "pcn推送数据至mes");

        private int value;
        private String description;

        SYNC_TYPE(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;
        }
    }

    /**
     * PCN 缓存名称
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PCN_CACHE {

        PCH_EHCACHE(10, "PCN_EHCACHE");

        private int value;
        private String description;

        PCN_CACHE(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;
        }
    }


    /**
     * MesProduceSn实体对应的printStatus值  条码表条码打印状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PRODUCE_SN_PRINT_STATUS {

        CREATE(10, "创建"),
        ONLINE(20, "上线打印"),
        OFFLINE(30, "下线打印");

        private int value;
        private String description;

        PRODUCE_SN_PRINT_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;
        }
    }

    /**
     * RAW_PART_TYPE 原材料类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum RAW_PART_TYPE {

        RAW(10, "lotNo", "原材料"),
        SEMIFINISHED(20, "fixLotNo", "半成品");

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

        RAW_PART_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;
        }
    }

    /**
     * RAW_PART_STATUS 原材料状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum RAW_PART_STATUS {

        READY(10, "待投料"),
        ALREADY(20, "已投料");

        private int value;
        private String description;

        RAW_PART_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;
        }
    }

    /**
     * PROCESS_BOM_ISFEED 是否投料
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PROCESS_BOM_ISFEED {

        FEED(1, "投料"),
        NOT_FEED(2, "不投料");

        private int value;
        private String description;

        PROCESS_BOM_ISFEED(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;
        }
    }

    /**
     * MesWorkCenter 工作中心运行状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum WORK_CENTER_RUNNING_STATUS {

        RUNNING("Y", "start", "开线"),
        STOPPED("N", "stop", "停线");

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

        WORK_CENTER_RUNNING_STATUS(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 (values()[i].value.equals(val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

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

    /**
     * WC_CHECK_TYPE 开线检查的模块
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum WC_CHECK_TYPE {

        PERSON(10, "people", "人员"),
        EQUIPMENT(20, "equipments", "设备"),
        MATERIAL(30, "materials", "物料"),
        ROUTE(40, "routes", "工艺"),
        ONLINE_SIGNAL(50, "onlineSignal", "开线信号"),
        MAKE_UP_SIGNAL(60, "makeUpSignal", "补偿信号");


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

        WC_CHECK_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;
        }

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

    /**
     * 开线检查
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ONLINE_SIGNAL {

        CHECK(10, "检查"),
        NON_CHECK(20, "不检查");

        private int value;
        private String description;

        ONLINE_SIGNAL(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;
        }
    }

    /**
     * 开线检查
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum IS_WCCHECK_PASS {

        PASS(10, "通过"),
        NON_PASS(20, "不通过");

        private int value;
        private String description;

        IS_WCCHECK_PASS(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;
        }
    }


    /**
     * 设备连接类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum EQP_CONNECT_TYPE {

        PLC(10, "PLC"),
        DB(20, "DB"),
        OTHER(30, "OTHER");

        private int value;
        private String description;

        EQP_CONNECT_TYPE(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;
        }
    }

    /**
     * 数据库操作类型 开线检查的模块
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum DB_OPERATION_TYPE {

        INSERT(10, "insert", "新增"),
        SELECT(20, "select", "查询"),
        UPDATE(30, "update", "更新");

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

        DB_OPERATION_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;
        }

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

    /**
     * 数据库连接方式
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum DATA_SOURCE_TYPE {
        SOURCE_MARIA_DB(10, "MariaDB", "MariaDB 10.1", "com.mysql.jdbc.Driver", 3306, null),
        SOURCE_SQL_SERVER(20, "SQL Server", "SQL Server 2017", "com.microsoft.sqlserver.jdbc.SQLServerDriver", 1433, "dbo"),
        SOURCE_ORACLE(30, "Oracle", "Oralce 12C", "oracle.jdbc.driver.OracleDriver", 1521, null),
        SOURCE_POSTGRE_SQL(40, "PostgreSql", "PostgreSql 10.5", "org.postgresql.Driver", 5432, "public");

        private int value;
        private String code;
        private String description;
        private String driverClassName;
        private int defaultPort;
        private String defaultSchemaPattern;

        private DATA_SOURCE_TYPE(int value, String code, String description, String driverClassName, int port, String defaultSchemaPattern) {
            this.value = value;
            this.code = code;
            this.description = description;
            this.driverClassName = driverClassName;
            this.defaultPort = port;
            this.defaultSchemaPattern = defaultSchemaPattern;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public String getDriverClassName() {
            return driverClassName;
        }

        public int getDefaultPort() {
            return defaultPort;
        }

        public String getDefaultSchemaPattern() {
            return defaultSchemaPattern;
        }

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

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

        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 DATA_SOURCE_TYPE valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

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

        public String getJDBCUrl(String database, String host, Integer port) {
            if (this.getValue() == SOURCE_MARIA_DB.getValue()) {
                return getJDBCUrlMySQL(database, host, port);
            } else if (this.getValue() == SOURCE_ORACLE.getValue()) {
                return getJDBCUrlOracle(database, host, port);
            } else if (this.getValue() == SOURCE_POSTGRE_SQL.getValue()) {
                return getJDBCUrlPostgreSQL(database, host, port);
            } else if (this.getValue() == SOURCE_SQL_SERVER.getValue()) {
                return getJDBCUrlSQLServer(database, host, port);
            }
            return null;
        }

        public static DATA_SOURCE_TYPE getDataSourceURL(String databaseProductName) {
            if (StringUtils.isNotBlank(databaseProductName)) {
                if (databaseProductName.indexOf(":mysql:") != -1) {
                    return SOURCE_MARIA_DB;
                } else if (databaseProductName.indexOf(":oracle:") != -1) {
                    return SOURCE_ORACLE;
                } else if (databaseProductName.indexOf(":postgresql:") != -1) {
                    return SOURCE_POSTGRE_SQL;
                } else if (databaseProductName.indexOf(":sqlserver:") != -1) {
                    return SOURCE_SQL_SERVER;
                }
            }
            return null;
        }

        private String getJDBCUrlMySQL(String database, String host, Integer port) {
            return "jdbc:mysql://" + host + ":" + port + "/" + database + "?autoReconnect=true&useSSL=false&characterEncoding=utf-8";
        }

        private String getJDBCUrlOracle(String database, String host, Integer port) {
            return "jdbc:oracle:thin:@" + host + ":" + port + ":" + database;
        }

        private String getJDBCUrlPostgreSQL(String database, String host, Integer port) {
            return "jdbc:postgresql://" + host + ":" + port + "/" + database;
        }

        private String getJDBCUrlSQLServer(String database, String host, Integer port) {
            return "jdbc:sqlserver://" + host + ":" + port + ";database=" + database;
        }
    }

    /**
     * MesPlanOrder实体对应的status值   计划状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PLAN_ORDER_STATUS {

        CREATE(10, "CREATED", "创建"),
        DE_COMPOSE_ING(20, "DE_COMPOSE_ING", "分解中"),
        DE_COMPOSE_ED(30, "DE_COMPOSE_ED", "分解完成"),
        CLOSE(40, "CLOSE", "关闭");

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

        PLAN_ORDER_STATUS(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;
        }
    }

    /**
     * MesWorkOrder实体对应的workOrderStatus值  工单状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum WORK_ORDER_STATUS {

        CREATE(10, "创建"),
        LANDED(20, "下达"),
        OPEN(30, "启动"),
        PAUSE(40, "暂停"),
        CANCEL(50, "取消"),
        CLOSE(60, "关闭"),
        COMPLETE(70, "完成");

        private int value;
        private String description;

        WORK_ORDER_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;
        }
    }

    /**
     * MesWorkOrder实体对应的workOrderType值  工单类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum WORK_ORDER_TYPE {

        STANDARD_ORDER(10, "标准工单"),
        BTS_ORDER(20, "BTS工单"),
        ATTEMPT_ORDER(30, "试制工单"),
        BH_ORDER(40, "B&H工单");

        private int value;
        private String description;

        WORK_ORDER_TYPE(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;
        }
    }

    /**
     * MesPlanOrder实体对应的planType值  计划类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PLAN_ORDER_TYPE {

        STANDARD_ORDER(10, "标准");

        private int value;
        private String description;

        PLAN_ORDER_TYPE(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 Integer descriptionOfValue(String description) {
            Integer tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].description.equals(description)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * MesPlanOrder实体对应的source值  计划来源
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PALN_ORDER_SOURCE {

        MES("MES", "来源于MES"),
        SAP("SAP", "来源于SAP");

        private String value;
        private String description;

        PALN_ORDER_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(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value.equals(val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * MesWorkOrder实体对应的source值  计划来源
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum WORK_ORDER_SOURCE {

        MES("MES", "来源于MES"),
        AMES("AMES", "来源于AMES"),
        SAP("SAP", "来源于SAP"),
        CREATE("CREATE", "手工新增"),
        RESOLVE("RESOLVE", "计划分解");

        private String value;
        private String description;

        WORK_ORDER_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(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value.equals(val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * MesQueueOrder实体对应的status值  队列主表状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum QUEUE_ORDER_STATUS {

        NORMAL(10, "正常"),
        ONLINE(20, "已上线"),
        OFFLINE(30, "已下线"),
        CLOSE(40, "已关闭"),
        ;

        private int value;
        private String description;

        QUEUE_ORDER_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;
        }
    }

    /**
     * MesQueueOrderDetail实体对应的status值  队列详情状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum QUEUE_ORDER_DETAIL_STATUS {

        NORMAL(10, "正常"),
        CLOSE(20, "关闭");

        private int value;
        private String description;

        QUEUE_ORDER_DETAIL_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;
        }
    }

    /**
     * MesPartCategory实体对应的categoryType值  条码表条码质量状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PART_CATEGORY_TYPE {

        CATEGORY_ONE("Category1", "类型1"),
        CATEGORY_TWO("Category2", "类型2"),
        CATEGORY_THREE("Category3", "类型3");

        private String value;
        private String description;

        PART_CATEGORY_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 (val.equals(values()[i].value)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * MesWorkOrder实体对应的approvalStatus值  审批状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum WORK_ORDER_APPROVAL_STATUS {

        WAIT_APPROVAL(10, "待审批"),
        COMPLETE_APPROVAL(20, "已审批"),
        REJECT_APPROVAL(30, "驳回");

        private int value;
        private String description;

        WORK_ORDER_APPROVAL_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 String valueOfDescription2(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description.equals("已审批") ? "审批" : values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 条码生成业务类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum COMPANY_TYPE {
        RULECODE("ruleCode", "规则编码"),
        PREFIX("prefix", "前缀"),
        PART_NO("partNo", "物料号"),
        CUST_PART_NO("custPartNo", "客户物料号"),
        CUST_CODE("custCode", "客户代码"),
        PROD_LOCATION("prodLocation", "产地"),
        YEAR("year", "年"),
        MOTH("month", "月"),
        DAY("day", "日"),
        HOUR("hour", "小时"),
        MINUTE("minute", "分钟"),
        SECOND("second", "秒"),
        SERIAL("serialNo", "序列号");

        private String value;
        private String description;

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

        public String getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }
    }


    /**
     * mes工步类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum MES_STEP_TYPE {

        AUTO_RUN(10, "自动执行"),
        SCAN_RUN(20, "扫描执行");


        private Integer value;
        private String description;

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

        public Integer 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 (values()[i].value.equals(val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * MesRoute 流程的类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ROUTE_TYPE {

        SCAN(10, "扫描流程"),
        MONITOR(20, "监控流程");

        private int value;
        private String description;

        ROUTE_TYPE(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 String valueOfDescription2(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description.equals("已审批") ? "审批" : values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * redis过期时间
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum EXPIRE_TIME {

        NEVER(-1, "不过期"),
        ONE_HOUR(3600, "一小时"),
        ONE_MIN(60, "一分钟");

        private int value;
        private String description;

        EXPIRE_TIME(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 String valueOfDescription2(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description.equals("已审批") ? "审批" : values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 条码类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PCN_SN_TYPE {

        NORMAL(10, "正常件"),
        FIRST_INSPECTION(20, "首检件");

        private int value;
        private String description;

        PCN_SN_TYPE(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;
        }
    }


    /**
     * MesPlanOrder实体对应的source值  计划来源
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum CACHE_KEY {

        TRAY("TRAY:", "托盘缓存key"),

        SERIAL_NO("PCN_SERIAL:", "条码缓存key");

        private String value;
        private String description;

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

        public String 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.equals(val)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }


    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PRODUCE_SN_STATUS {

        CREATE(10, "创建"),
        PROCESS(20, "加工"),
        OFFLINE(30, "下线"),
        PACKAGE_SCAN(35, "打包扫描"),
        INSTOCKED(40, "入库"),
        SHIPING(50, "发运"),
        CLOSE(90, "关闭"),
        ;

        private int value;
        private String description;

        PRODUCE_SN_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;
        }
    }


    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PACKAGE_IS_SEALED {

        UNSEALED(1, "未封箱"),
        SEALED(2, "已封箱");

        private int value;
        private String description;

        PACKAGE_IS_SEALED(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;
        }
    }

    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PACKAGE_OP_TYPE {

        PACK(10, "打包"),
        UNPACK(20, "拆包");

        private int value;
        private String description;

        PACKAGE_OP_TYPE(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;
        }
    }

    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PACKAGE_PRINT_STATUS {

        UNPRINTED(10, "未打印"),
        PRINTED(20, "打印");

        private int value;
        private String description;

        PACKAGE_PRINT_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;
        }
    }

    /**
     * 工位程序交互时的业务类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum STATION_BUSI_TYPE {
        MESSAGE("message", "返回信息"),
        STEP_LIST("stepList", "工步列表"),
        STEP_CONTENT("stepContent", "工步内容"),
        MODULE_CONTENT("moduleContent", "组件内容"),
        CUSTOM_COMPONENT("customComponent", "定制内容"),
        TASK_COMPLETE("taskComplete", "整个扫描完成"),
        STEP_RAN_STATUS("stepRanStatus", "工步列表执行前"),
        RUNNING_INFO("runningInfo", "执行信息"),
        RENEW_REQUEST_PARAMS("renewRequestParams", "回传刷新StationResultBean");


        private String value;
        private String description;

        STATION_BUSI_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 (val.equals(values()[i].value)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }


}
