package com.prolog.upcloud.base.wh.operate.utils;

import com.prolog.cs.basic.item.model.vo.ItemBaseInfoVO;
import com.prolog.cs.basic.warehouse.model.vo.WarehouseLocatorBasicInfo;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
public class BizHelper {

    public static String getLocationCode(String locationId, List<WarehouseLocatorBasicInfo> list) {
        WarehouseLocatorBasicInfo info = list.stream().filter(w -> w.getWarehouseLocatorId().equals(locationId)).findFirst().orElse(null);
        return info != null ? info.getWarehouseLocatorCode() : "";
    }

    public static String getItemCode(String itemId, List<ItemBaseInfoVO> list) {
        ItemBaseInfoVO info = list.stream().filter(i -> i.getItemId().equals(itemId)).findFirst().orElse(null);
        return info != null ? info.getItemCode() : "";
    }

    public static String getItemName(String itemId, List<ItemBaseInfoVO> list) {
        ItemBaseInfoVO info = list.stream().filter(i -> i.getItemId().equals(itemId)).findFirst().orElse(null);
        return info != null ? info.getItemName() : "";
    }


}
