package com.prolog.cs.biz.inbound.dao.rcv;

import com.prolog.cs.basic.chain.model.customer.BaseCustomerMst;
import com.prolog.cs.basic.chain.model.supplier.BaseSupplierMst;
import com.prolog.cs.biz.inbound.dto.rcv.RcvHDTO;
import com.prolog.cs.biz.inbound.model.SupervisionCode;
import com.prolog.cs.biz.inbound.model.SupervisionCodeSmall;
import com.prolog.cs.biz.inbound.model.rcv.RcvHeaders;
import com.prolog.cs.biz.inbound.vo.RcvQueryVO;
import com.prolog.framework.dao.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @Description  
 * @Date 2021-03-24 
 */
public interface RcvHeadersMapper extends BaseMapper<RcvHeaders> {

	List<RcvHDTO> findList(RcvQueryVO rcvQueryVO);
	
	RcvHDTO findByPkId(String pkId);

	BigDecimal getRemainQty(String rcvHeaderId);

	List<RcvHDTO> getReportHeader(RcvQueryVO rcvQueryVO);

	Long getRcvSequence();
	
	BigDecimal getRemainQtyByBillId(String billId);
	
	String getRcvIdsByBillId(String billId);
	
	Long updateBillStatus(@Param("billId") String billId,@Param("status") String status);

	List<RcvHDTO> findByPkIdNew(@Param("rcvHeaderIdList") List<String> rcvHeaderIdList);

    void updateUploadFlag(@Param("rcvHeaderId") String rcvHeaderId,@Param("rcvLineId") String rcvLineId,@Param("uploadFlag") String uploadFlag,@Param("message") String message);

    void updateUploadFlagV2(@Param("rcvLineId") String rcvLineId, @Param("uploadFlag") String uploadFlag, @Param("message") String message);

	void updateUploadFlagV3(@Param("billno") String billno, @Param("uploadFlag") String uploadFlag, @Param("message") String message);

	void updateSupervisionCodeType(@Param("refbilllineids")List<String> refbilllineids, @Param("uploadShippId")String uploadShippId, @Param("uploadType")Integer uploadType);

	String findSupplierId(@Param("rcvHeaderId")String rcvHeaderId);

	List<SupervisionCode> findSupervisionCodes(@Param("srcCodes") List<String> srcCodes);

	List<SupervisionCode> findUnDownLoadSupervisionCode();

	List<SupervisionCodeSmall> findUnToHisSupervisionCode();

	String findBatchId(@Param("itemId")String itemId, @Param("manufacturerLotNum")String manufacturerLotNum, @Param("productionDate") String productionDate, @Param("expiredDate")String expiredDate);

	BigDecimal findFinishDetalQty(@Param("lineid")String lineid);

	List<SupervisionCode> findInSupervisionCode(@Param("asnHeaderId")String asnHeaderId);

	void updateDownFlag(@Param("message")String message, @Param("downFlag")Integer downFlag, @Param("supervisionCodes")List<String> supervisionCodes);

    List<BaseCustomerMst> findUnSaveCusEntId();

	void saveCusEntId(@Param("entId")String entId, @Param("customerId")String customerId);

	List<String> findUnSaveEntIdSupCode(@Param("srcCodes") List<String> srcCodes);

	List<BaseSupplierMst> findSupplierMstByIds(@Param("supperlierIds")List<String> supperlierIds);

	void saveEntIdSupCode(@Param("eleccode")String eleccode, @Param("shippId")String shippId, @Param("uploadType")Integer uploadType,@Param("srcCodes")List<String> srcCodes);

	List<BaseCustomerMst> findCustomerMstByIds(@Param("customerIds")List<String> customerIds);

	Integer checkendIdNum(@Param("billno")String billno);

	List<String> findUnUploadSrcCode();

	List<String> findUnSaveEntIdSrcCodeForCustomer();

	List<String> findUnSaveEntIdSrcCodeForSupplier();
}
