package easydo.technology.enums;

import java.util.HashMap;
import java.util.Map;

public enum MESEnum {

    FLOW_NO_TYPE_PROCESS_STAGE("process_stage", "工序管理"),
    FLOW_NO_TYPE_PROCESS_ROUTE("process_route", "工艺路线"),
    FLOW_NO_TYPE_PRODUCT_MATERIAL("product_material", "物料管理"),
    FLOW_NO_TYPE_PRODUCT_BOM("product_bom", "bom清单"),
    FLOW_NO_TYPE_QUALITY_INSPECT_TOOL("quality_inspect_tool", "质检工具"),
    FLOW_NO_TYPE_QUALITY_INSPECT_FUNCTION("quality_inspect_function", "质检方法"),
    FLOW_NO_TYPE_QUALITY_INSPECT_PROGRAM("quality_inspect_program", "质检方案"),
    FLOW_NO_TYPE_CUSTOMER("customer", "供应商/客户"),
    FLOW_NO_TYPE_SALE_PLAN("sale_plan", "销售计划"),
    FLOW_NO_TYPE_SALE_ORDER("sale_order", "销售订单"),
    FLOW_NO_TYPE_WAREHOUSE("warehouse", "仓库管理"),

    PROCESS_STAGE_OF_CATEGORY_PREPARATION("preparation","准备工序"),
    PROCESS_STAGE_OF_CATEGORY_PROCESSING("processing","加工工序"),
    PROCESS_STAGE_OF_CATEGORY_INSPECTION("inspection","检验工序"),
    PROCESS_STAGE_OF_CATEGORY_AUXILIARY("auxiliary","辅助工序"),

    PROCESS_STAGE_OF_PROCESS_TYPE_SELF_MADE("self_made","自制"),
    PROCESS_STAGE_OF_PROCESS_TYPE_OUTSOURCING("outsourcing","委外"),

    PROCESS_STAGE_OF_CALCULATE_METHOD_BOTH_RATES("both_rates","计件+计时都支持"),
    PROCESS_STAGE_OF_CALCULATE_METHOD_PIECE_RATE("piece_rate","计件"),
    PROCESS_STAGE_OF_CALCULATE_METHOD_TIME_RATE("time_rate","计时"),
    PROCESS_STAGE_OF_CALCULATE_METHOD_NON_PROD_PAY("non_prod_pay","不计生产工资"),

    PROCESS_OF_STATUS_ENABLE("enable","启用"),
    PROCESS_OF_STATUS_DISABLE("disable","停用"),

    PRODUCT_MATERIAL_OF_NEED_TYPE_SELF_MADE("self_made", "自制"),
    PRODUCT_MATERIAL_OF_NEED_TYPE_OUT_PURCHASE("out_purchase", "外采"),
    PRODUCT_MATERIAL_OF_NEED_TYPE_OUTSOURCING("outsourcing", "委外"),

    PRODUCT_MATERIAL_OF_MATERIAL_TYPE_RAW_MATERIAL("raw_material", "原材料"),
    PRODUCT_MATERIAL_OF_MATERIAL_TYPE_SEMI_FINISHED("semi_finished", "半成品"),
    PRODUCT_MATERIAL_OF_MATERIAL_TYPE_FINISHED_PRODUCT("finished_product", "半成品"),
    PRODUCT_MATERIAL_OF_MATERIAL_TYPE_PACKAGING_MATERIAL("packaging_material", "包装材料"),
    PRODUCT_MATERIAL_OF_MATERIAL_TYPE_TRADE_GOODS("trade_goods", "贸易品"),

    QUALITY_INSPECT_PROGRAM_OF_STATUS_PENDING("pending", "待审批"),
    QUALITY_INSPECT_PROGRAM_OF_STATUS_APPROVED("approved", "同意"),
    QUALITY_INSPECT_PROGRAM_OF_STATUS_REJECTED("rejected", "拒绝"),

    QUALITY_INSPECT_PROGRAM_OF_TYPE_FULL("full", "全检"),
    QUALITY_INSPECT_PROGRAM_OF_TYPE_SAMPLING("sampling", "抽检"),

    SALE_PLAN_OF_STATUS_INACTIVE("inactive","待进行"),
    SALE_PLAN_OF_STATUS_ACTIVE("active","进行中"),
    SALE_PLAN_OF_STATUS_DONE("done","已完成"),

    SALE_ORDER_OF_STATUS_PENDING("pending", "待处理"),
    SALE_ORDER_OF_STATUS_PROCESSING("processing", "备货中"),
    SALE_ORDER_OF_STATUS_PARTIALLY("partially", "部分发货"),
    SALE_ORDER_OF_STATUS_SHIPPED("shipped", "已发货"),
    SALE_ORDER_OF_STATUS_COMPLETE("complete", "已完成"),
    ;

    MESEnum(String value, String comment) {
        this.value = value;
        this.comment = comment;
    }

    private static Map<String, MESEnum> typelookup = new HashMap<>();

    static {
        for (MESEnum mspEnum : MESEnum.values()) {
            typelookup.put(mspEnum.value, mspEnum);
        }
    }

    public static boolean isContainsValue(String type) {
        return typelookup.containsKey(type);
    }

    public static MESEnum forType(String type) {
        return typelookup.get(type);
    }

    private String value;
    private String comment;

    public String getValue() {
        return value;
    }

    public String getComment() {
        return comment;
    }


}
