package com.xisc.pm.domain.repository;

import java.util.Collection;
import java.util.List;

import org.hzero.mybatis.base.BaseRepository;

import com.xisc.pm.app.service.autoboard.dto.PmAutoPdResultRequestDTO;
import com.xisc.pm.app.service.autoboard.dto.PmAutoPdVersionDTO;
import com.xisc.pm.domain.entity.PmAutoPdContract;

/**
 * 自动组板合同总量表资源库
 *
 * @author jun.zeng 2024-11-21 11:05:32
 */
public interface PmAutoPdContractRepository extends BaseRepository<PmAutoPdContract> {

    List<PmAutoPdContract> selectList(PmAutoPdResultRequestDTO pmAutoPdResultRequest, Long organizationId);

    List<PmAutoPdVersionDTO> selectNumberByRemainingFlag(Long requestId, Long organizationId);

    int deleteByRequestId(List<Long> requestIds);

    /**
     * 新增
     * 
     * @param pmAutoPdContracts
     */
    void addLockQty(Long requestId, List<String> slabNoList, Long version , Long tenantId);

    /**
     * 新增
     * 
     * @param pmAutoPdContracts
     */
    void subLockQty(Long requestId, List<String> slabNoList, Long version, Long tenantId);
    
    /**
     * 通过虚拟板坯号查询合同信息
     * @param requestId
     * @param slabNoList
     * @param version
     * @param tenantId
     * @return
     */
    List<PmAutoPdContract> selectByVirtualSlabNoList(Long requestId, List<String> slabNoList, Long version, Long tenantId);

    /**
     * 自动组板锁定合同数据
     * @param requestId
     * @param virtualSlabNoList
     * @param version
     * @param organizationId
     * @return
     */
    Collection<PmAutoPdContract> lockPdContract(Long requestId, List<String> virtualSlabNoList, Long version, Long organizationId);
    
    /**
     * 自动组板提交生产合同方法
     * @param contracts
     * @param organizationId
     */
    void commitPdContract(Collection<PmAutoPdContract> contracts, Long organizationId);

}
