package org.wcs.plugin.plc.constant;

import lombok.Getter;

/**
 * 堆垛机任务状态枚举 ---- 过账时用
 */
@Getter
public enum PlcStackerTaskStatusEnum {

    UNKNOWN(0, "未知"),
    CANCELED(2, "取消"),
    COMPLETED(1, "完成"),
    DOUBLE_IN(3, "重复入库"),
    EMPTY_OUT(4, "空出库");

    private final Integer code;
    private final String desc;

    PlcStackerTaskStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static PlcStackerTaskStatusEnum getByCode(Integer code) {
        for (PlcStackerTaskStatusEnum value : PlcStackerTaskStatusEnum.values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return UNKNOWN;
    }
}
