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

import com.prolog.cs.basic.item.model.vo.ItemBaseInfoVO;
import com.prolog.cs.basic.warehouse.model.vo.WarehouseLocatorBasicInfo;
import com.prolog.upcloud.base.inventory.vo.BatchNumberListVO;
import com.prolog.upcloud.base.wh.operate.model.WmsAdjustD;
import com.prolog.upcloud.base.wh.operate.model.WmsInvCheckD;
import com.prolog.upcloud.base.wh.operate.model.WmsInvCheckH;
import com.prolog.upcloud.base.wh.operate.vo.EisInventoryRequestVO;
import com.prolog.upcloud.base.wh.operate.vo.EisPushTaskVO;
import com.prolog.upcloud.base.wh.operate.vo.MoveDListVO;
import com.prolog.upcloud.base.wh.operate.vo.TaskFinishedConfirmSubListVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

@Mapper(componentModel = "spring")
public interface EisConvert {

    @Mapping(target = "warehouseId", source = "d.warehouseId")
    @Mapping(target = "ownerId", source = "d.cargoOwnerId")
    @Mapping(target = "billNo", source = "d.moveHeaderId")
    @Mapping(target = "seqNo", source = "d.moveLineId")
    @Mapping(target = "workType", expression = "java(com.prolog.upcloud.base.wh.operate.constant.EisWorkType.WT_MOVE)")
    @Mapping(target = "businessType", expression = "java(com.prolog.upcloud.base.wh.operate.constant.EisBusinessType.BT_MOVE)")
    @Mapping(target = "itemCode", source = "d.itemCode")
    @Mapping(target = "qty", source = "d.pieceQuantity")
    @Mapping(target = "lotNo", source = "d.manufacturerLotNum")
    @Mapping(target = "yieldDate", source = "d.batchExpiredDate")
    @Mapping(target = "expDate", source = "d.batchExpiredDate")
    @Mapping(target = "wmslocationCode", expression = "java(com.prolog.upcloud.base.wh.operate.constant.EisConstant.EIS_LOCATION)")
    @Mapping(target = "msgId", source = "d.moveLineId")
    TaskFinishedConfirmSubListVO genTaskFinishVo(MoveDListVO d);

    @Mapping(target = "warehouseId", source = "warehouseId")
    @Mapping(target = "ownerId", source = "d.cargoOwnerId")
    @Mapping(target = "billNo", source = "d.adjustHeaderId")
    @Mapping(target = "seqNo", source = "d.adjustLineId")
    @Mapping(target = "containerNo", source = "d.containerCode")
    @Mapping(target = "itemCode", source = "item.itemCode")
    @Mapping(target = "itemName", source = "item.itemName")
    @Mapping(target = "yieldDate", source = "batch.batchProductionDateShow")
    @Mapping(target = "expDate", source = "batch.batchExpiredDateShow")
    @Mapping(target = "lotNo", source = "batch.manufacturerLotNum")
    @Mapping(target = "inventoryQty", source = "d.pieceAccount")
    @Mapping(target = "countQty", source = "d.pieceAccountFact")
    @Mapping(target = "wmslocationCode", expression = "java(com.prolog.upcloud.base.wh.operate.constant.EisConstant.EIS_LOCATION)")
    @Mapping(target = "msgId", source = "d.adjustLineId")
    EisInventoryRequestVO generateEisInventoryRequestVO(WmsAdjustD d, ItemBaseInfoVO item, BatchNumberListVO batch, String warehouseId);
}