package cn.gov.customs.wxjy.ibmmq.enums;

/**
 * 单据类型
 */
public enum BillTypeEnum {
    BUS_TYPE_MATERIAL_PO("1","采购入库单"),
    BUS_TYPE_MATERIAL_MO("3","材料入库单"),
    BUS_TYPE_MATERIAL_PP("4","生产加工单"),
    BUS_TYPE_MATERIAL_FGW("5","产成品入库"),
    BUS_TYPE_MATERIAL_SO("6","销售出库单"),
    BUS_TYPE_SUPERVISION_LOG("7","企业生产日志"),

    BUS_TYPE_PACK_CATALOG("8","包装种类目录"),
    BUS_TYPE_CHEMICALS_CATALOG("9","危化品目录"),
    BUS_TYPE_GOODS_CATALOG("10","危险货物目录");

    private final String code;
    private final String name;
    BillTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }
    public String getCode() {
        return code;
    }
    public String getName() {
        return name;
    }

    // 根据 code 获取对应的枚举实例
    public static BillTypeEnum fromCode(String code) {
        for (BillTypeEnum status : BillTypeEnum.values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("未知的状态码: " + code);
    }

    // 根据 code 获取对应的 name
    public static String getNameByCode(String code) {
        BillTypeEnum status = fromCode(code);
        return status.getName();
    }
}
