package com.jwipc.inquiry.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jwipc.inquiry.entity.InquiryMaterialSupplier;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jwipc.inquiry.model.po.AssistantSupplierPO;
import com.jwipc.inquiry.model.po.InquiryMaterialSupplierPO;
import com.jwipc.inquiry.model.po.InquiryMaterialSupplierQuotaJobPO;
import com.jwipc.inquiry.model.query.InquiryQuoteQuery;

import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 * <p>
 * 询价供应商表 服务类
 * </p>
 *
 * @author shenyang.ou
 * @since 2024-02-21
 */
public interface IInquiryMaterialSupplierService extends IService<InquiryMaterialSupplier> {

    /**
     * 根据询价id查询询价供应商（分组）
     */
    List<InquiryMaterialSupplierPO> getGroupListByInquiryId(Long inquiryId,Integer bidFlag);

    /**
     * 根据询价id和询价物料id查询询价物料供应商
     *
     * @param inquiryId         询价id
     * @param inquiryMaterialId 询价物料id
     * @return 询价物料供应商
     */
    List<InquiryMaterialSupplierPO> getListByInquiryIdAndInquiryMaterialId(Long inquiryId, Long inquiryMaterialId);

    /**
     * 获取供应商报价列表
     *
     * @param query  查询条件
     * @return 供应商报价列表
     */
    List<InquiryMaterialSupplierPO> quoteList(InquiryQuoteQuery query);
    List<InquiryMaterialSupplierPO> quoteListPage(Page<InquiryMaterialSupplier> dbPage,InquiryQuoteQuery query);

    /**
     * 获取已经报价的供应商列表
     *
     * @param inquiryId 询价id
     * @return 已经报价的供应商列表
     */
    List<AssistantSupplierPO> getAssistantSupplierByInquiryId(Long inquiryId);

    List<AssistantSupplierPO> getAssistantSupplierByInquiryIdAndInquiryMaterialIdAndSupplierCodeList(Long inquiryId, Long inquiryMaterialId,Set<String> supplierCodeList);

    List<InquiryMaterialSupplierQuotaJobPO> getSupplierQuotaJob(Date startTime, Date endTime);

    List<InquiryMaterialSupplierQuotaJobPO> getQuotationEndNoticeJob();

    /**
     * 通过采购订单编码获取供应商定价的询价物料
     * @param purchaseApplyCode 采购申请单号
     * @param itemNo 采购申请单行项目号
     * @return 询价下的询价物料
     */
    List<InquiryMaterialSupplierPO> getBidInquiryListByPurchaseApplyCode(String purchaseApplyCode, String itemNo);
}
