package com.xisc.pm.infra.enums;

import io.choerodon.core.exception.CommonException;

/**
     * 厚板组板材料类型
     * 
     * @author jun.zeng
     *
     */
    public enum PdMatType {
        A("A", "钢锭组板") , B("B", "钢锭组板") ,C("C", "出钢材组板"), D("D", "钢锭组板"), P("P", "余材钢板组板"), S("S", "余坯组板")
        
        ,FHB("FHB" , "复合板组板" , "S") , MID_SPLIT("MID_SPLIT" , "二次开坯" , "C");

        private final String code;
        private final String desc;
        
        private final String actualPdMatType;
        
        private PdMatType(String code, String desc , String actualPdMatType) {
            this.code = code;
            this.desc = desc ;
            this.actualPdMatType = actualPdMatType;
        }

        private PdMatType(String code, String desc) {
            this.code = code;
            this.desc = desc;
            this.actualPdMatType = code;
        }

        public String getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }

        // 可以根据需要添加更多方法，例如根据code查找枚举值
        public static PdMatType getByCode(String code) {
            for (PdMatType status : PdMatType.values()) {
                if (status.getCode().equals(code)) {
                    return status;
                }
            }
            throw new CommonException("pm.pm_pro_cont_049" , code);
        }

        public String getActualPdMatType() {
            return actualPdMatType;
        }
    }