package com.jwipc.finance.service;

import com.jwipc.finance.entity.PaymentAdvanceApply;
import com.jwipc.finance.entity.PaymentAdvanceApplyDetail;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jwipc.finance.model.po.CreatePaaDetailPO;
import com.jwipc.finance.model.po.InvoicedApplyPaPO;
import com.jwipc.finance.model.po.PaymentAdvanceApplyDetailPO;
import com.jwipc.finance.model.po.PaymentRecordPO;
import com.jwipc.finance.model.query.PaymentApplyItemQuery;

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

/**
 * <p>
 * 预付款申请明细表 服务类
 * </p>
 *
 * @author WT
 * @since 2024-03-08
 */
public interface IPaymentAdvanceApplyDetailService extends IService<PaymentAdvanceApplyDetail> {
    /**
     * 查询预付款明细数据
     * @param applyId 预付款主表id
     * @return
     */
    List<CreatePaaDetailPO> findPaaDetailByPaaId(Long applyId);

    /**
     * 新增时获取采购订单在SRM预付款申请情况
     *
     * @param poKeyList 采购订单号+行号
     * @return 结果
     */
    List<PaymentAdvanceApplyDetailPO> createGetPoSituationByPoKey(List<String> poKeyList);

    /**
     * 查询已经到票的金额
     * @param poKeyList
     * @return
     */
    List<PaymentAdvanceApplyDetailPO> findCodApplyByPoKey(List<String> poKeyList);

    /**
     * 编辑时获取采购订单在SRM预付款申请情况
     *
     * @param existedItemIdList 编辑仍然存在的申请明细ID集合(需要排除这些)
     * @param poKeyList 采购订单号+行号
     * @return 结果
     */
    List<PaymentAdvanceApplyDetailPO> editGetPoSituationByApplyId(List<Long> existedItemIdList, List<String> poKeyList);

    /**
     * 根据订单号查询每个订单所有的付款记录
     * @param poCodeList 订单号集合
     * @return
     */
    List<CreatePaaDetailPO> findPaymentDetailByPoCodeList(List<String> poCodeList);

    /**
     *  查询数据
     * @param poCode
     * @return
     */
    List<PaymentRecordPO> findDetailByPoCode(String poCode);

    public List<PaymentAdvanceApplyDetail> findByPaymentDetail(Long applyId);

    /**
     *更新明细行号问题
     * @param applyId
     */
    void updateDetailItemNo(Long applyId);

    /**
     *删除对账付款申请明细数据
     * @param applyIdList 预付款申请ID集合
     */
    void delDetailByApplyId(List<Long> applyIdList);

    /**
     * 开票申请获取预付款信息
     *
     * @param query 查询条件
     * @return 结果
     */
    List<InvoicedApplyPaPO> provideCreateAdvanceApply(PaymentApplyItemQuery query);

    List<InvoicedApplyPaPO> provideCreateAdvanceApplyNew(PaymentApplyItemQuery query,List<String> poKeyList);
    List<InvoicedApplyPaPO> provideCreateAdvanceApplyNew1(PaymentApplyItemQuery query,List<String> poKeyList);


    void updateReversedAmount(String paymentChangeNumber, String paymentChangeItemNo, BigDecimal strikePrice);

}
