package com.sunda.spmsoversea.service;

import java.util.List;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sunda.spmscommon.ResponseResult;
import com.sunda.spmsoversea.dto.OverseaWhsOutDTO;
import com.sunda.spmsoversea.dto.OverseaWhsOutGenerateDTO;
import com.sunda.spmsoversea.dto.OverseaWhsOutQueryDTO;
import com.sunda.spmsoversea.entity.OverseaWhsOut;

/**
 * <p>
 * 海外出库任务表 服务类
 * </p>
 *
 * @author Wayne
 * @since 2021-09-22
 */
public interface IOverseaWhsOutService extends IService<OverseaWhsOut> {

    /** 根据领用申请uuid初始化出库任务 */
    ResponseResult generateOverseaWhsOut(OverseaWhsOutGenerateDTO overseaWhsOutGenerateDTO, String userId)throws Exception;

    /** 根据海外出库任务uuid获取任务表头及明细 */
    ResponseResult getWhsOutAndDtl(String uuidWhsOut);

    /** 根据传入参数获取出库任务表头列表分页数据 */
    IPage getWhsOutPage(OverseaWhsOutQueryDTO overseaWhsOutQueryDTO);

    /** 出库任务关闭：1-0； 
     * @param cancelReason */
    ResponseResult closeWhsOut(String uuidWhsOut, Integer dataVersion, String userId, String cancelReason)throws Exception;

    /** 更新出库任务及明细：1-1；1-2(扣库存)； */
    ResponseResult updateWhsOut(OverseaWhsOutDTO overseaWhsOutDTO, String userId)throws Exception;

    /** 出库任务提交SAP：2-3；2-4；4-3；4-4； */
    ResponseResult toSapWhsOut(String uuidWhsOut, Integer dataVersion, String postingDate, String userId) throws Exception;

    /** 出库任务撤销/退回操作：3-2；2-1(加库存)；4-1(加库存)； */
    ResponseResult cancelWhsOut(String uuidWhsOut, Integer dataVersion, String cancelPostingDate, String userId)throws Exception;
    
    /** 根据来源单号查询仓库出库信息**/
    List<OverseaWhsOut> findListByRecord(String relateDocument);
    
    /** 根据SPMS单号查询领用出库的详情信息 **/
	ResponseResult getOverseaWhsOutHead(String spmsId);

    /** 推送SAP之前先保存幂等ID **/
    public  ResponseResult checkSapKeyCode(String uuidWhsOut,Integer dataVersion);
}
