package com.sdtool.common.entity.base;

/**
 * Created by jlutt on 2020-08-12
 * 业务操作
 * 暂存或提交
 *
 * @author jlutt
 */
public enum BusinessOperation {

    NONE("", "", 0),

    SAVE("暂存", "Save", 1),

    SUBMIT("提交", "Submit", 2),

    /**
     * 直接完成，主要用于其它服务调用进销存单据，直接写完成
     */
    FORCE("直接完成", "Force", 3);

    private final String name;
    private final String code;
    private final int value;

    BusinessOperation(String name, String code, int value) {
        this.name = name;
        this.code = code;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public String getCode() {
        return code;
    }

    public int getValue() {
        return value;
    }

    public static BusinessOperation valueOf(int val) {
        for (BusinessOperation p : BusinessOperation.values()) {
            if (p.getValue() == val) return p;
        }
        return null;
    }
}
