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

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @Description : sweb枚举类
 * @Reference :
 * @Author : jack.lv
 * @CreateDate : 2019-04-02 20:21
 * @Modify:
 **/
public class SwebEnumUtil {

    /**
     * 单据主表状态(ASN,PO,MOVE,QC)
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ORDER_MASTER_STATUS {
        CREATE(10, "CREATE", "新建"),
        RECEIPT(20, "RECEIPT", "已发布"),
        SURE(30, "SURE", "已确认"),
        PRINTED(40, "PRINTED", "已打印"),
        DELIVERY(50, "DELIVERY", "已发货");

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

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

        public int getValue() {
            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 int codeOf(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;
        }
    }

    /**
     * 订单明细状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ORDER_DETAILS_STATUS {
        CREATE(10, "CREATE", "新建"),
        RECEIPT(20, "RECEIPT", "已发布"),
        SURE(30, "SURE", "已确认"),
        PRINTED(40, "PRINTED", "已打印"),
        DELIVERY(50, "DELIVERY", "已发货");

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

        ORDER_DETAILS_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 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 int codeOf(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;
        }
    }

    /**
     * 单据条码状态（PO/DOC_MOVE）
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ORDER_SN_STATUS {
        CREATE(10, "N", "创建"),
        RECEIPTED(20, "R", "已完成"),
        CANCEL(30, "C", "行取消"),
        PRINTED(40, "C", "已打印");

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

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

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public String getCode() {
            return code;
        }

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

    /**
     * PO订单来源
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ORDER_SOURCE {
        WMS(10, "WMS", "WMS"),
        SWEB(20, "SWEB", "SWEB");

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

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

        public int getValue() {
            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 int codeOf(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;
        }
    }

    /**
     * 包装类型枚举
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PACKAGE_TYPE {
        BOX(10, "BOX", "BOX（盒）"),
        CARTON(20, "CARTON", "CARTON（箱）"),
        PALLET(30, "PALLET", "PALLET（栈板）"),
        CONTAINER(40, "PALLET", "PALLET（集装箱）");

        private String code;
        private String description;
        int value;

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

    /**
     * 订单类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ORDER_TYPE {
        STANDARD(10, "STANDARD", "标准包装"),
        NON_STANDARD(20, "NON_STANDARD", "非标准包装");

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

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

    /**
     * 数据状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum DATA_STATUS {
        YES(1, "是", "fa fa-success cell-fa fa-check"),
        NO(2, "否", "fa fa-disabled cell-fa fa-times-circle");

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

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

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public String getCode() {
            return code;
        }

        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].getDescription();
                }
            }
            return tmp;
        }
    }

    /**
     * 用户消息类型
     * 1.NOTICE：通知
     * 2.STATION_LETTER：站内信
     * 3.SWEB_NOTICE：SWEB通知
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum MESSAGE_TYPE {

//        MAIL(1, "邮件", "邮件"),
//        LETTER(2, "站内信", "站内信"),
        SWEB_NOTICE(3, "SWEB通知", "SWEB通知"),
        SWEB_PUBLIC_NOTICE(4, "SWEB公告", "SWEB公告");

        private int value;
        private String name;
        private String description;

        MESSAGE_TYPE() {
        }

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

        public int getValue() {
            return value;
        }

        public String getName() {
            return name;
        }

        public String getDescription() {
            return description;
        }

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

    /**
     * 附件来源
     * 1.NOTICE：通知
     * 2.STATION_LETTER：站内信
     * 3.SWEB_NOTICE：SWEB通知
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum FILE_ATTACH_SOURCE {
        MAIL(1, "邮件", "邮件"),
        LETTER(2, "站内信", "站内信"),
        SWEB_NOTICE(3, "SWEB通知", "SWEB通知"),
        SWEB_PUBLIC_NOTICE(4, "SWEB公告", "SWEB公告");

        private int value;
        private String name;
        private String description;

        FILE_ATTACH_SOURCE() {
        }

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

        public int getValue() {
            return value;
        }

        public String getName() {
            return name;
        }

        public String getDescription() {
            return description;
        }

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

    /**
     * 前端系统平台
     * IMPP_FE：impp系统
     * SWEB_FE：sweb系统
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum FE_PLATFORM {
        IMPP_FE("IMPP_FE", "IMPP_FE", "impp系统"),
        SWEB_FE("SWEB_FE", "SWEB_FE", "sweb系统");

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

        FE_PLATFORM() {
        }

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

    /**
     * 用户消息状态
     * 1.READ：已读
     * 2.UNREAD：未读
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum MESSAGE_STATUS {

        READ(1,"已读","fa cell-fa fa-file-text"),
        UNREAD(2,"未读","fa cell-fa fa-file-o");

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

        MESSAGE_STATUS() {
        }

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

    /**
     * 移库单业务类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum OUT_MOVEMENT_BUSI_TYPE {
        PRODUCTION_MATERIAS(10, "PROD_MATERIALS", "生产领料"),
        CUSTOMER_SHPING(20, "CUS_SHPING", "客户发运"),
        OUTWARD_SHIPMENT(30, "OUT_SHIPMENT", "委外发运"),
        ALLOCATION(40, "ALLOCATION", "调拨"),
        SCATTERED_OUT(50, "SCATTERED_OUT", "零星出库"),
        SCATTERED_IN(60, "SCATTERED_IN", "零星入库"),
        NC_WAREHOSING_IN(70, "NC_WAREHOSING", "NC入库"),
        SUPPLIER_RETURN(80, "SUPPLIER_RETURN", "供应商退货"),//默认DMR
        CUSTOMER_RETURN(90, "CUSTOMER_RETURN", "客户退货"),
        PRODUCT_RETURN(100, "PRODUCT_RETURN", "生产退料"),
        INSTRUCTION_MOVE(110, "INSTRUCTION_MOVE", "指令移库"),
        SCRAPPING_OUT(120, "SCRAPPING_OUT", "报废出库"),
        RECEIVING_IN(130, "RECEIVING_IN", "收货入库"),
        OUTSOURCING_BACK(140, "OUTSOURCING_BACK", "委外退回"),
        NC_WAREHOSING_OUT(150, "NC_WAREHOSING_OUT", "NC出库"),
        SUPPLIER_RETURN_SMRR(190, "SUPPLIER_RETURN_SMRR", "供应商退货(SMRR)"),
        NC_DISMANTLING_PICKING(160, "NC_DISMANTLING_PICKING", "NC拆解领料"),
        NC_DISMANTLING_RETREAT(170, "NC_DISMANTLING_RETREAT", "NC拆解退料"),
        LINE_EDGE_SCRAPPING_OUT(180, "LINE_EDGE_SCRAPPING_OUT", "线边报废出库"),
        ASN(200, "ASN", "ASN"),
        PO(210, "PO", "PO"),
        QC(220, "QC", "QC"),
        AMPR(230, "AMPR", "AMPR"),
        FINISHGOODS(240, "FINISHGOODS", "VDA生产快速入库"),
        VDA_REPORT(250, "VDA_REPORT", "VDA生产报工"),
        VDA_PR_INSTOCK(260, "VDA_PR_INSTOCK", "VDA生产推荐入库"),
        VDA_PICKING_GOODS(270, "VDA_PICKING_GOODS", "VDA生产领料"),
        VDA_ONE_PICKING_GOODS(280, "VDA_ONE_PICKING_GOODS", "VDA单箱领料"),
        VDA_QC(290, "VDA_QC", "VDA质检"),
        VDA_SN_SPLIT(300, "VDA_SN_SPLIT", "VDA物料拆分"),
        VDA_SN_MERGE(310, "VDA_SN_MERGE", "VDA物料合并"),
        KT_RECEPTION(320, "KT_RECEPTION", "KT让步接收"),
        KT_SCRAP(330, "KT_SCRAP", "KT报废"),
        KT_QUARANTINE(340, "KT_QUARANTINE", "KT隔离"),
        KT_BACK_QUARANTINE(350, "KT_BACK_QUARANTINE", "KT反隔离"),
        KT_DEFINITE_FAIL(360, "KT_DEFINITE_FAIL", "KT不合格"),
        KT_RETURN(370, "KT_RETURN", "KT退货"),
        KT_REWORK(380, "KT_REWORK", "KT返工"),
        KT_MISCALCULATION(390, "KT_MISCALCULATION", "KT误判"),
        KT_SORTING(400, "KT_SORTING", "KT分选"),
        VDA_STATIC_CS(410, "VDA_STATIC_CS", "静态盘点"),
        VDA_CS_SEARCH(420, "VDA_CS_SEARCH", "VDA盘点查询"),
        KT_DEFINITE(430, "KT_DEFINITE", "KT合格"),
        VDA_PACKAGE_MANAGE(440, "VDA_PACKAGE_MANAGE", "VDA编组管理"),
        KT_PURCHASE_RC(450, "KT_PURCHASE_RC", "采购收货"),
        KT_PACK_RC(460, "KT_PACK_RC", "坤泰包装收货"),
        FINISH_PRODUCT_SHPING(470, "FINISH_PRODUCT_SHPING", "成品发运"),
        KT_PICK_RC(480, "KT_PICK_RC", "坤泰拣货"),
        PRODUCE_INSTOCK(490, "PRODUCE_INSTOCK", "VDA生产入库"),
        UTENSIL_CONSUMING(500, "UTENSIL_CONSUMING", "器具领用"),
        TG_PICKING_GOODS(510, "TG_PICKING_GOODS", "TG生产领料"),
        EXTERNAL_PULL(520, "EXTERNAL_PULL", "外部拉动"),
        LOADING_ORDER(530, "LOADING_ORDER", "装车单"),
        SALE_ON_WAY(540, "SALE_ON_WAY", "销售在途");
        private int value;
        private String code;
        private String description;

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

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public String getCode() {
            return code;
        }

        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 String codeOf(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 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);
        }
    }

    /**
     * 条码类型 10=实物条码，20=虚拟条码
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ORDER_STOCK_TYPE {
        SOURCE(10, "实物条码"),
        TARGET(20, "虚拟条码"),
        CUST_SN(30, "客户条码");

        private int value;
        private String description;

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

        public int getValue() {
            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 String valueOfDescription(int val) {
            return valueOf(val);
        }
    }
}
