package com.xisc.pm.infra.mapper;

import com.xisc.pm.api.dto.PmProContFilterRequestDTO;
import com.xisc.pm.api.dto.PmProContFilterResposeDTO;
import com.xisc.pm.api.dto.PmProContRequestDTO;
import com.xisc.pm.api.dto.PmProContSimpleDTO;
import com.xisc.pm.app.service.autoboard.dto.PmAutoBoardPolicyGroupDTO;
import com.xisc.pm.app.service.autoboard.dto.PmContBoardParam;
import com.xisc.pm.domain.entity.PmProCont;
import com.xisc.pm.domain.vo.CtMainVO;
import com.xisc.pm.domain.vo.QdToLineupResultSteelVO;
import io.choerodon.mybatis.common.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 生产合同主表Mapper
 *
 * @author 曾俊 jun.zeng@hand-china.com 2024-07-29 14:28:16
 */
public interface PmProContMapper extends BaseMapper<PmProCont> {

    /**
     * 查询合同简要信息
     * @param tenantId 租户ID，必填
     * @param orderNo 合同号，模糊匹配
     * @param stNo 钢种号：钢种+欠件大于零匹配
     * @return
     */
    List<PmProContSimpleDTO> selectProContSimpleList(@Param("tenantId") Long tenantId, @Param("orderNo") String orderNo,
            @Param("stNo") String stNo);

    /**
     * 合同抽取
     * 
     * @param pmProContFilterRequest
     * @return
     */
    List<PmProContFilterResposeDTO> orderFilterList(PmProContFilterRequestDTO pmProContFilterRequest);

    /**
     * 合同查询
     * 
     * @param orderNoList
     * @param pmProContRequest
     * @return
     */
    List<PmProCont> queryByOrderNoList(@Param("orderNoList") List<String> orderNoList,
            @Param("request") PmProContRequestDTO pmProContRequest);
    
    /**
     * 自动组板合同查询
     * @param policyGroup
     * @param tenantId
     * @return
     */
    List<PmContBoardParam> selectAutoBoardContList(@Param("policyGroup") PmAutoBoardPolicyGroupDTO policyGroup , @Param("tenantId") Long tenantId);

    /**
     * 根据合同产线查询板坯位置代码
     *
     * @param orderNoList
     * @param mscLineNoList
     * @param tenantId
     * @return
     */
    List<QdToLineupResultSteelVO> selectSlabPlaceCode(@Param("orderNoList")List<String> orderNoList, @Param("mscLineNoList")List<String> mscLineNoList, @Param("tenantId")Long tenantId);

    /**
     * 根据合同的前八位查询合约欠量
     *
     * @param orderNoList
     * @param tenantId
     * @return
     */
    List<CtMainVO> queryOrderRemNumByOrderNoList(@Param("orderNoList") List<String> orderNoList, @Param("tenantId") Long tenantId);
}
