package com.zt.plat.module.erp.enums.warehouseFactory;

import org.apache.commons.lang3.StringUtils;

/**
 * 仓库工厂关系-库位绑定ERP库位操作类型(字典: WAREHOUSE_OPERATION)
 * 枚举(字典: WAREHOUSE_OPERATION)
 *
 */
public enum WarehouseFactoryOperationTypeEnum {
    OUT("SHIPPING","出库"),
    INTO("RECEIVING","入库"),
    MOVE("MOVE","移库"),
    ;


    /**
     * 编码
     */
    private String code;

    /**
     * 名称
     */
    private String name;

    WarehouseFactoryOperationTypeEnum(String code, String name){
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static WarehouseFactoryOperationTypeEnum getEnumByCode(String code){
        for (WarehouseFactoryOperationTypeEnum e : WarehouseFactoryOperationTypeEnum.values()) {
            if (e.getCode().equals(code)) {
                return e;
            }
        }
        return OUT;
    }

    public static WarehouseFactoryOperationTypeEnum getEnumByName(String name){
        if (StringUtils.isEmpty(name)) return OUT;
        for (WarehouseFactoryOperationTypeEnum e : WarehouseFactoryOperationTypeEnum.values()) {
            if (name.equals(e.getName())) {
                return e;
            }
        }
        return OUT;
    }

}
