package com.prolog.eis.enums.base;

import lombok.Getter;

/**
 * @program: eis-dsl-parent
 * @description: 通用状态
 * @author: Xiong
 * @create: 2021-12-30 17:28
 **/
public enum BaseStatusEnum {
    STATUS_EIS_FAIL(-99, "EIS内部取消"),
    STATUS_FAIL(-10, "取消"),
    STATUS_NO_STOCK(-20, "库存不足"),
    STATUS_INIT(0, "创建"),
    STATUS_WAIT(1, "已组单"),
    STATUS_STARTED(10, "已开始"),
    STATUS_OFFER(15, "已复核"),
    STATUS_GRID(16, "全部落格"),
    STATUS_CARRY(11, "搬运全部下发"),
    STATUS_FINISH(20, "已完成"),
//    LACK_FINISH(30, "短拣"),
    CALLBACK_FINISH(40, "已回告"),
    ;
    @Getter
    private Integer code;
    @Getter
    private String msg;

    BaseStatusEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static BaseStatusEnum getByCode(Integer code) {
        BaseStatusEnum statusEnum = null;

        for (BaseStatusEnum value : values()) {
            if (value.getCode().equals(code)) {
                statusEnum = value;
            }
        }
        return statusEnum;
    }
}
