package com.sunxung.factoring.service.acceptancesheet;

import com.baomidou.mybatisplus.extension.service.IService;
import com.sunxung.factoring.component.util.XMlToDoc;
import com.sunxung.factoring.entity.acceptance.AcceptanceApproval;
import com.sunxung.factoring.entity.acceptance.AcceptanceBasicInfo;
import com.sunxung.factoring.entity.acceptance.AcceptanceBusinessApproval;
import com.sunxung.factoring.entity.acceptance.AcceptancePersonInfo;
import com.sunxung.factoring.entity.acceptance.vo.GoodsSearch;
import com.sunxung.factoring.entity.project.vo.BusinessProcessingTaskVo;
import com.sunxung.factoring.entity.project.vo.SearchBusinessProcessingTask;
import com.sunxung.factoring.entity.settlement.SettlementBasicInfo;
import com.sunxung.factoring.entity.steelwaiter.SearchVo;
import org.springframework.http.ResponseEntity;

import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.List;

/**
 * @author liutao
 * @date 2021.9.10
 */
public interface AcceptanceBasicInfoService extends IService<AcceptanceBasicInfo> {

    /**
     * 新建验收单
     *
     * @param acceptanceBasicInfo
     * @return
     */
    void add(AcceptanceBasicInfo acceptanceBasicInfo);


    /**
     * 查询详情
     * @param id
     * @return
     */
    AcceptanceBasicInfo  getDetail(Long id);

    /**
     * 法务审核
     *
     * @param acceptanceApproval
     */
    void legalReview(AcceptanceApproval acceptanceApproval) throws Exception;

    /**
     * 业务审核
     */
    void businessReview(AcceptanceBusinessApproval acceptanceBusinessApproval);


    File inputData(AcceptanceBasicInfo acceptanceBasicInfo, XMlToDoc xmlDoc);


    /**
     * 根据id查询所需数据 流程控制反射调用
     *
     * @param id
     * @return
     */
    AcceptanceBasicInfo get(Long id);

    /**
     * 查询我已处理的验收单
     *
     * @param search
     * @return
     */
    List<BusinessProcessingTaskVo> findMyCompletedList(SearchBusinessProcessingTask search);

    /**
     * 查询所有
     *
     * @param search
     * @return
     */
    List<BusinessProcessingTaskVo> findAllList(SearchBusinessProcessingTask search);

    /**
     * 生成PDF保存并预览
     *
     * @param acceptanceBasicInfoId
     * @throws Exception
     */
    ResponseEntity<Object> downloadPdfSign(Long acceptanceBasicInfoId, HttpServletResponse res) throws Exception;


    ResponseEntity<Object>  downloadCertificate(Long acceptanceBasicInfoId, HttpServletResponse res);



    /**
     * 获取验收点相关文件
     *
     * @param acceptanceBasicInfoId
     * @return
     */
    AcceptanceApproval findFileList(Long acceptanceBasicInfoId);

    /**
     *
     */

    /**
     * 查询已经结算并且审核通过的单信息
     *
     * @param goodsSearch
     * @return
     */
    List<SettlementBasicInfo> findGoodsBySettlement(GoodsSearch goodsSearch);

    /**
     * 获取可以做结算的验收单
     *
     * @param businessNumber
     * @param supplierId
     * @param status
     * @return
     */
    List<AcceptanceBasicInfo> getCanBeBillGoodsInformation(String businessNumber, Long supplierId, Long status);

    /**
     * 查询所有  供应商登录
     *
     * @param search
     * @return
     */
    List<BusinessProcessingTaskVo> findAllListSupplier(SearchBusinessProcessingTask search);


    /**
     * 删除验收单
     *
     * @param id
     */
    void deleteAcceptanceBasicInfo(Long id);

    /**
     * 填充审核也页所有附件
     *
     * @param acceptanceBasicInfoId
     * @return
     */
    AcceptanceApproval autoAllfiles(Long acceptanceBasicInfoId);

    /**
     * 下载所有验收单文件
     */
    void downloadAllfile(Long id,HttpServletResponse response);

    /**
     * 获取采购合同  和销售合同处理人
     *
     * @param supplierId
     * @param customerId
     * @param businessNumber
     * @return
     */
    List<AcceptancePersonInfo> personInfoList(Long supplierId, Long customerId, String businessNumber);

    /**
     * 下载货物信息
     *
     * @param searchVo
     * @param response
     */
    void downloadGoodsInfos(SearchVo searchVo, HttpServletResponse response);

    /**
     * 修改验收单处理流程
     *
     * @param acceptanceBasicInfo
     */
    void updateDetailHandleProcess(AcceptanceBasicInfo acceptanceBasicInfo);
}

