package com.sunda.spmsoversea.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sunda.spmscommon.ResponseResult;
import com.sunda.spmsoversea.dto.OverseaWhsMoveSearchDTO;
import com.sunda.spmsoversea.dto.OverseaWhsMoveUpdateDTO;
import com.sunda.spmsoversea.entity.OverseaWhsMove;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 海外仓调拨业务 服务类
 * </p>
 *
 * @author Wayne
 * @since 2022-01-20
 */
public interface IOverseaWhsMoveService extends IService<OverseaWhsMove> {

    //调拨任务状态(0删除;1保存;2提交SPMS/库存更新;3提交SAP失败;4提交SAP成功;5调拨任务已撤销;)

    /** 获取海外仓调拨任务表头分页列表 */
    IPage getOverseaWhsMovePage(OverseaWhsMoveSearchDTO overseaWhsMoveSearchDTO);

    /** 获取海外仓调拨任务一条明细 */
    Map<String, Object> getOverseaWhsMoveByUuid(String uuid);

    /** 获取海外仓调拨任务详细明细信息 */
    List<Map<String, Object>> getOverseaWhsMoveDtlList(String uuid);

    /** 更新或新建海外仓调拨任务及明细，目标状态：1新建或更新；2提交SPMS更新两边仓库库存； */
    ResponseResult updateOverseaWhsMove(OverseaWhsMoveUpdateDTO overseaWhsMoveUpdateDTO, String userId)throws Exception ;

    /** 海外仓调拨任务提交SAP：2——3、2——4 或 3——4 */
    ResponseResult submitOverseaWhsMoveSap(String uuid, String postingDate, Integer dataVersion, String userId)throws Exception ;

    /** 海外仓调拨任务关闭 1-0；*/
    ResponseResult closeOverseaWhsMoveTask(String uuid, Integer dataVersion, String userId);

    /** 调拨任务撤销，状态变化：2——1，3——1，4——1，都要更新库存 */
    ResponseResult cancelOverseaWhsMove(String uuid, Integer dataVersion, String cancelPostingDate, String userId)throws Exception ;
    
    /** 根据SPMS单号查询调拨单详情 **/
	ResponseResult getOverseaWhsMoveHead(String spmsId);

//    调拨任务详情推送工厂与物料到MDM
    ResponseResult whsMoveToMdM(String uuid,String userId) throws Exception;

    //    推送工厂与物料到MDM
    ResponseResult werksToMdM(String werks,String materialNumbers,String userId) throws Exception;

}


