package com.sw.mes.enumvalue;


import com.sw.mes.utils.StringUtils;

/**
 * @Author: xushu
 * @Date: 2022/08/17/16:59
 * @Description:
 */
public enum RecycleTypeEnum {
    硅料车间(1, "硅料车间"),
    籽晶车间(2, "籽晶车间"),
    余料入库(101, "余料入库"),
    废料入库(102, "废料入库"),
    余料(1, "余料"),
    废料(2, "废料");

    RecycleTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private Integer code;
    private String desc;

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static Integer getCodeByDesc(String desc) {
        if (StringUtils.isBlank(desc)) {
            return null;
        }
        for (RecycleTypeEnum item : RecycleTypeEnum.values()) {
            if (item.getDesc().equals(desc)) {
                return item.getCode();
            }
        }
        return null;
    }

    public static String getDescByCode(Integer code) {
        if (null == code) {
            return null;
        }
        for (RecycleTypeEnum item : RecycleTypeEnum.values()) {
            if (item.getCode().equals(code)) {
                return item.getDesc();
            }
        }
        return null;
    }

}

