package com.sw.mes.enumvalue;

import com.sw.mes.core.enums.EnumValue;
import com.sw.mes.core.enums.EnumValues;
import lombok.Getter;

public class EnumValuesServer {

    /**
     * 任务状态 - 圆棒工单排除
     */
    @Getter
    public enum ProductionScheduleStatus implements EnumValue.KeyValueInt {
        未开始(0, "未开始"), 进行中(1, "进行中"), 已完成(2, "已完成"), 已取消(3, "已取消"), 待备料(4, "待备料"), 已备料(5, "已备料");

        private ProductionScheduleStatus(int key, String value) {
            this.key = key;
            this.value = value;
        }

        public static String getText(int value) {
            ProductionScheduleStatus[] businessModeEnums = values();
            for (ProductionScheduleStatus businessModeEnum : businessModeEnums) {
                if (businessModeEnum.getKey() == value) {
                    return businessModeEnum.getValue();
                }
            }
            return null;
        }
        private int key;
        private String value;
    }


    /**
     * 返切规则 - 圆棒状态
     */
    @Getter
    public enum RecutYbRule implements EnumValue.KeyValue {
        晶段("晶段", "J"), 回收料("回收料", "H"), 样片("样片", "Y");

        private RecutYbRule(String key, String value) {
            this.key = key;
            this.value = value;
        }

        public static String getText(String value) {
            RecutYbRule[] businessModeEnums = values();
            for (RecutYbRule businessModeEnum : businessModeEnums) {
                if (businessModeEnum.getKey() == value) {
                    return businessModeEnum.getValue();
                }
            }
            return null;
        }

        public static RecutYbRule getEnum(String value) {
            RecutYbRule[] enums = values();
            for (RecutYbRule enumz : enums) {
                if (enumz.getKey().equals(value)) {
                    return enumz;
                }
            }
            return null;
        }

        private String key;
        private String value;

    }

    /**
     * 订单类型 - 圆棒工单排除
     */
    @Getter
    public enum ProductionOrderType implements EnumValue.KeyValue {
        常规("常规", "常规"), 研发("研发", "研发"), 在建("ZH05", "在建"), 返工("ZH04", "返工"),
        内部代工("ZH06", "内部代工"), 客户受托("ZH07", "客户受托"), 工厂代工("工厂代工", "工厂代工"),
        实验("实验","实验"), ZRB4("ZRB4","研发工单");

        ProductionOrderType(String key, String value) {
            this.key = key;
            this.value = value;
        }

        public static String getText(String value) {
            ProductionOrderType[] businessModeEnums = values();
            for (ProductionOrderType businessModeEnum : businessModeEnums) {
                if (businessModeEnum.getKey() == value) {
                    return businessModeEnum.getValue();
                }
            }
            return null;
        }

        public static ProductionOrderType getEnum(String value) {
            ProductionOrderType[] enums = values();
            for (ProductionOrderType enumz : enums) {
                if (enumz.getKey().equals(value)) {
                    return enumz;
                }
            }
            return null;
        }
        private String key;
        private String value;
    }

    /**
     * 炉台类型
     */
    @Getter
    public enum FurnaceType implements EnumValue.KeyValueInt {
        常规(0, "常规"), 在建(1, "常规"), 研发(2, "研发");

        private FurnaceType(int key, String value) {
            this.key = key;
            this.value = value;
        }

        public static String getText(int value) {
            FurnaceType[] businessModeEnums = values();
            for (FurnaceType businessModeEnum : businessModeEnums) {
                if (businessModeEnum.getKey() == value) {
                    return businessModeEnum.getValue();
                }
            }
            return null;
        }

        private int key;
        private String value;
    }

    /**
     * 数据字典
     */
    @Getter
    public enum DictionaryTheme implements EnumValues.KeyValue {
        模块("module", "模块"),划线重量折算系数("WeightFractions", "划线重量折算系数"),长晶棒减长("CrystalRatio","长晶棒减长"),物料类别("materialType","物料类别"),产品长度("product_length","产品长度");

        DictionaryTheme(String key, String value) {
            this.key = key;
            this.value = value;
        }

        public static String getText(String value) {
            DictionaryTheme[] businessModeEnums = values();
            for (DictionaryTheme businessModeEnum : businessModeEnums) {
                if (businessModeEnum.getKey().equals(value)) {
                    return businessModeEnum.getValue();
                }
            }
            return null;
        }

        private String key;
        private String value;
    }



    /**
     * 晶棒画线打印
     */
    @Getter
    public enum Print implements EnumValues.KeyValue {
        画线晶棒打印单据名称("print_name", "晶棒画线条码"),画线晶棒打印单据模板("print_model","晶棒画线条码");

        Print(String key, String value) {
            this.key = key;
            this.value = value;
        }

        public static String getText(String value) {
            Print[] businessModeEnums = values();
            for (Print businessModeEnum : businessModeEnums) {
                if (businessModeEnum.getKey().equals(value)) {
                    return businessModeEnum.getValue();
                }
            }
            return null;
        }

        private String key;
        private String value;
    }

    /**
     * 画线类型 - 0：晶段，1：样片，2：回收料，//20220831
     * (画线类型 - 0：晶段，1：样片，2：回收料-孪晶，3：回收料直径，4：回收料)
     */
    @Getter
    public enum LineType implements EnumValues.KeyValueInt {
        晶段(0, "晶段"),样片(1, "样片"),回收料(2, "回收料"),直径异常回收料(3, "直径异常回收料"),孪晶回收料(4, "孪晶回收料"),头回收料(5, "头回收料"),尾回收料(6, "尾回收料");

        LineType(Integer key, String value) {
            this.key = key;
            this.value = value;
        }

        public static String getText(int value) {
            LineType[] businessModeEnums = values();
            for (LineType businessModeEnum : businessModeEnums) {
                if (businessModeEnum.getKey() == value) {
                    return businessModeEnum.getValue();
                }
            }
            return null;
        }

        private int key;
        private String value;
    }




    /**
     * 样片类型 - 0：头片 1：头尾片 2：尾头片 3：尾片 4：中间片 5：头尾尾头片（只有两段的时候）
     */
    @Getter
    public enum SampleType implements EnumValues.KeyValueInt {
        头片(0, "头片"),头尾片(1, "头尾片"),尾头片(2, "尾头片"),尾片(3, "尾片"),中间片(4, "中间片"),头尾尾头片(5, "头尾尾头片");

        SampleType(int key, String value) {
            this.key = key;
            this.value = value;
        }

        public static String getText(int value) {
            SampleType[] businessModeEnums = values();
            for (SampleType businessModeEnum : businessModeEnums) {
                if (businessModeEnum.getKey() == value) {
                    return businessModeEnum.getValue();
                }
            }
            return null;
        }

        private int key;
        private String value;
    }


    /**
     * 产品类别
     */
    @Getter
    public enum ProductCategory implements EnumValues.KeyValue {
        正泰("Z", "正泰"),
        颗粒硅实验("G", "G晶昇"),
        P型实验("A", "P型实验"),
        自有("T", "自有"),
        H型实验("B", "H型实验"),
        H型("H", "H型"),
        润阳("L", "润阳"),
        循环料纯投("C", "循环料纯投"),
        P型颗粒硅实验("P", "P型颗粒硅实验"),
        W盛达("W", "W盛达"),
        D级料("D", "D级料");

        private ProductCategory(String key, String value) {
            this.key = key;
            this.value = value;
        }

        public static String getText(String value) {
            ProductCategory[] businessModeEnums = values();
            for (ProductCategory businessModeEnum : businessModeEnums) {
                if (businessModeEnum.getKey().equals(value)) {
                    return businessModeEnum.getValue();
                }
            }
            return null;
        }

        private String key;
        private String value;
    }

    public static String SQUARE = "方棒";
    public static String FINALIDENTIFICATION = "W";
}
