package com.sdtool.common.datas;

import java.util.stream.Stream;

/**
 * Created by jlutt on 2020-08-19
 *
 * @author jlutt
 */
@SuppressWarnings("unused")
public enum ERPModule {

    NONE(0, "", "默认", "", "business"),

    SYSTEM(1, "system", "系统模块", "", "business"),

    DOC(2, "doc", "基础档案", "", "business"),

    CONFIG(3, "config", "系统配置", "", "config"),

    LOGIN(4, "login", "登录", "", "business"),

    DATA_SYNC(5, "sync", "数据库同步ES", "", "sync"),

    ACCESS_TOKEN(6, "accessToken", "token管理", "", "accessToken"),

    ERP_ORDER(10, "order", "订单业务", "", "order"),

    ERP_ORDER_SEARCH(11, "orderSearch", "订单搜索业务", "", "orderSearch"),

    CLIENT(12,"client","客户业务","","client"),

    ORDER_CRAFT(13,"orderCraft","订单工艺模块","","orderCraft"),

    ERP_ORDER_IMAGE_PROCESS(14, "imageProcess", "订单文件处理", "", "imageProcess"),

    JOIN_ORDER(15,"joinOrder","商城订单对接","","joinOrder"),

    ERP_ORDER_PRINT_TASK(16,"orderPrintTask","订单印刷任务","","orderPrintTask"),

    ERP_ORDER_COMPOSE(17,"orderCompose","订单组版任务","","orderCompose"),
    MACHINE_TYPE(21, "machineType", "机型印工计算", "QuotePrintFee_", "workCalc"),
    MACHINE_INFO(22, "machineInfo", "机台工时计算", "CalcWorkTime_", "workCalc"),

    LOGISTICS_INFO(23, "logisticsInfo", "物流费计算", "QuoteDeliveryFee_", "logistics"),

    INVENTORY(30, "", "进销存单据", "", "inventory"),
    INVENTORY_BILL_COMPLETE(31, "InventoryBillComplete", "进销存单据完成操作", "StockBillComplete_", "inventory"),

    INVENTORY_ACTION(32, "InventoryAction", "进销存单据流程步骤", "StockBillActExecutor_", "inventory"),

    INVENTORY_COLUMN(33, "InventoryColumn", "进销存单据明细显示列", "StockBillColumn_", "inventory"),

    INVENTORY_HIDE_BILL_ITEM_M(34, "InventoryHideBillItemM", "进销存单据明细不再处理", "HideStockBillItemM_", "inventory"),

    INVENTORY_HIDE_BILL(35, "InventoryHideBill", "进销存单据不再处理", "HideStockBill_", "inventory"),

    ERP_OUTASSIST_SEARCH(50, "outAssistSearch", "外协查询", "", "outAssistSearch"),

    INQUIREINFO(100, "inquireinfo", "查询统计", "InquireInfo_", "report"),

    PRODUCT_QUOTE(120, "productQuote", "产品报价", "QuoteScript_", "orderQuote"),

    PRODUCT(121, "product", "产品档案", "", "product"),

    PRODUCT_CENTER(122, "productCenter", "产品中心", "", "productCenter"),

    PRODUCT_WEIGHT(123, "productWeight", "产品重量", "", "orderWeight"),

    ERP_PRINT_BILL(130, "printBill", "施工单", "", "printBill"),

    ERP_PRINT_BILL_SEARCH(131, "printBillSearch", "施工单查询", "", "printBillSearch"),

    EXPORT(140, "export", "导出", "", "export"),

    APP(151, "app", "移动应用", "", "business"),

    CHARTS(152, "charts", "图表统计", "", "charts"),

    ADDRESSPARSER(153, "addressparser", "地址解析", "", "addressparser"),

    BOXCALC(154, "boxcalc", "包数计算", "", "boxcalc"),

    ERP_DELIVERY(160, "delivery", "入库发货", "", "delivery"),

    ERP_CALL(200, "erpCall", "服务接口", "", "erpCall"),

    MALL_CALL(201, "mallCall", "商城服务接口", "", "mallCall"),

    MALL_FRONT(220, "mallFront", "商城购物", "", "mallFront"),

    MALL_ADMIN(221, "mallAdmin", "商城后台", "", "mallAdmin"),

    MALL_MINI(222, "mallMini", "商城小程序", "", "mallMini"),

    PAY(300, "pay", "支付", "", "pay"),

    EXPRESS(400, "express", "快递对接", "", "express");


    private int value;

    private String moduleName;

    private String moduleDisplayName;

    private String scriptPrefix;

    private String saveDirectory;

    ERPModule(int value, String moduleName, String moduleDisplayName, String scriptPrefix, String saveDirectory) {
        this.value = value;
        this.moduleName = moduleName;
        this.moduleDisplayName = moduleDisplayName;
        this.scriptPrefix = scriptPrefix;
        this.saveDirectory = saveDirectory;
    }

    public static ERPModule getModule(int value) {
        return ERPModule.stream()
                .filter((x) -> x.getValue() == value)
                .findFirst()
                .orElse(ERPModule.NONE);
    }

    public static Stream<ERPModule> stream() {
        return Stream.of(ERPModule.values());
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public String getModuleName() {
        return moduleName;
    }

    public void setModuleName(String moduleName) {
        this.moduleName = moduleName;
    }

    public String getModuleDisplayName() {
        return moduleDisplayName;
    }

    public void setModuleDisplayName(String moduleDisplayName) {
        this.moduleDisplayName = moduleDisplayName;
    }

    public String getScriptPrefix() {
        return scriptPrefix;
    }

    public void setScriptPrefix(String scriptPrefix) {
        this.scriptPrefix = scriptPrefix;
    }

    public String getSaveDirectory() {
        return saveDirectory;
    }

    public void setSaveDirectory(String saveDirectory) {
        this.saveDirectory = saveDirectory;
    }
}
