package com.prolog.eis.dao.container;


import com.prolog.eis.dto.page.LockStockRespDto;
import com.prolog.eis.dto.page.PdaStockRespDto;
import com.prolog.eis.dto.page.StockReqDto;
import com.prolog.eis.dto.page.StockRespDto;
import com.prolog.eis.dto.rf.DemonstrateTask;
import com.prolog.eis.dto.rf.DemonstrateTaskDto;
import com.prolog.eis.dto.rf.DemonstrateTaskInfo;
import com.prolog.eis.dto.rf.DemonstrateTaskReqDto;
import com.prolog.eis.dto.strategy.ContainerInfoDto;
import com.prolog.eis.dto.wms.ItemContainerDto;
import com.prolog.eis.dto.wms.StockContainerReqDto;
import com.prolog.eis.dto.wms.StockContainerRespDto;
import com.prolog.eis.model.container.ContainerInfo;
import com.prolog.eis.model.led.LedC;
import com.prolog.framework.dao.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Repository
public interface ContainerInfoMapper extends BaseMapper<ContainerInfo> {

    List<ContainerInfoDto> getContainerInfoDto(@Param("warehouseArea") String warehouseArea,@Param("containerType")Integer containerType,@Param("billType")String billType);

    List<ContainerInfoDto> getAllStock(@Param("containerType")Integer containerType);


    /**
     * 查询不合格产品
     *
     * @param warehouseArea
     * @return
     */
    List<ContainerInfoDto> getContainerInfoDtoByFail(@Param("warehouseArea") String warehouseArea);

    @Select("select id,container_no containerNo,container_type containerType,create_time createTime,update_time updateTime,task_type taskType from container_info where task_type in(10,20,30,40,50,60)")
    List<ContainerInfo> findtest();


    @Select("SELECT\n" +
            "\tbiz_inbound_task.* \n" +
            "FROM\n" +
            "\tbiz_inbound_task\n" +
            "\tINNER JOIN biz_inbound_task_detail ON biz_inbound_task.id = biz_inbound_task_detail.inbound_id\n" +
            "\tINNER JOIN goods_info ON biz_inbound_task_detail.item_id = goods_info.item_id \n" +
            "WHERE\n" +
            "\tbiz_inbound_task.container_no = #{stockId}")
    LedC findContainerInfo(String stockId);

    List<StockRespDto> stockList(@Param("req") StockReqDto req);

    List<PdaStockRespDto> pdaStockList(@Param("containerNo") String containerNo);

    List<DemonstrateTask> findStockList(@Param("data") DemonstrateTaskDto demonstrateTaskDto);

    DemonstrateTaskInfo findDemonstrateTaskInfo(@Param("data") DemonstrateTaskReqDto demonstrateTaskReqDto);

    List<ItemContainerDto> itemContainer(@Param("req") ItemContainerDto req);

    List<StockContainerRespDto> getStockContainer(@Param("req") StockContainerReqDto req);

    List<LockStockRespDto> lockStockListPage(@Param("itemIds") List<String> itemIds, @Param("lotIds") List<String> lotIds, @Param("containerNoOrLocate") String containerNoOrLocate, @Param("isLock") Integer isLock);

}
