package org.wcs.constant.enums.database;

import lombok.Getter;

/**
 * 箱式线任务类型枚举
 */
@Getter
public enum ConveyTaskTypeEnum {
    PICK(1, "捡选任务"),
    CHECK(2, "复核任务"),
    SEND(3, "发货任务"),
    PUT(4, "补货任务");

    private final Integer code;
    private final String msg;

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

    public static String getMsgByCode(Integer code) {
        for (ConveyTaskTypeEnum value : ConveyTaskTypeEnum.values()) {
            if (value.code.equals(code)) {
                return value.msg;
            }
        }
        return null;
    }

    /**
     * 判断是否存在
     * @param code 任务类型
     * @return 存在结果
     */
    public static boolean isExist(Integer code) {
        for (ConveyTaskTypeEnum value : ConveyTaskTypeEnum.values()) {
            if (value.code.equals(code)) {
                return true;
            }
        }
        return false;
    }

}
