package com.prolog.eis.enums.wms;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * @desc:
 * @author: zhangJie
 * @date: 2023/9/1 16:26
 */
@Getter
@AllArgsConstructor
public enum WmsCarryTaskType {

    INBOUND_TYPE(1, "入库任务"),
    EMPTY_INBOUND_TYPE(2, "空托垛入库任务"),
    ITEM_CARRY_TYPE(3, "物料搬运任务"),
    EMPTY_SHELVE_TYPE(4, "空托上架任务"),
    DD_OUT_TYPE(5, "地堆拣货出库任务"),
    AGV_EMPTY_IN_TYPE(6, "拆零库区入库"),
    ;

    private Integer type;
    private String desc;

    private static Map<Integer, WmsCarryTaskType> cache;

    static {
        cache = Arrays.stream(WmsCarryTaskType.values()).collect(Collectors.toMap(WmsCarryTaskType::getType, Function.identity()));
    }

    public static WmsCarryTaskType of(Integer code) {
        return cache.get(code);
    }
}
