package com.sunda.spmsoversea.service;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sunda.spmscommon.ResponseResult;
import com.sunda.spmsoversea.dto.OverseaInvCheckActionSearchDTO;
import com.sunda.spmsoversea.entity.OverseaInvCheckAction;
import com.sunda.spmsuser.entity.SpmsUser;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 仓库盘盈盘亏 服务类
 * </p>
 *
 * @author Wayne
 * @since 2021-05-10
 */
public interface IOverseaInvCheckActionService extends IService<OverseaInvCheckAction> {

    /** 获取库存盘点盘盈盘亏列表
    *{
          "werks":["CN01","CM31"],
          "whsLocationCode":["1011","1061"],
          "inventoryCheckType":"X",  // X-备件货, M-贸易货
          "inventoryCheckCategory":"1", //盘点类别 1-日常盘点 2-月度盘点 3-动态盘点 4-其它盘点
          "createDate":["20210401","20210501"],
          "inventoryCheckId":"CN01-20210511-INV",
          "spmsStatus":"1", //任务状态：1-待盘点；2-盘点中；3-复盘中；4-处理中；5-关闭(完成)
      }
    * */
    ResponseResult getInvCheckAcList(JSONObject InvCheckFilter);

    /** 新建盘盈盘亏单
     * 1. 有uuid 更新
     * 2. 无uuid 新建
     * */
    ResponseResult updateInvCheckAc(JSONObject InvCheckDoc, String userId)throws Exception ;

    /*按uuid获取InvCheckAc的详情数据*/
    ResponseResult getInvCheckAcWithDtl(String uuid)throws Exception ;

    /** 根据任务uuid，获取盘盈盘亏结果提交SAP */
    ResponseResult getInventoryCheckActionToSap(String uuid, String postingDate, String userId, String remarks, String currentStatus) throws Exception ;

    /** 获取盘盈盘亏单据相关日志信息 */
    List<Map<String, Object>> getICALogs(String uuid);

    /**根据盘点单Id获取关联的盘盈亏单*/
    List<OverseaInvCheckAction> getInvChkAcByInvChkId(String invChkId);

    /**
     * 海外收货任务提交OA。
     * @param spmsUser
     * @return
     */
    ResponseResult overseaInvChkAcToOa(JSONObject overseaInvChkAc, SpmsUser spmsUser,JSONArray invCheckAcDtls,boolean newOa)throws Exception  ;

    /**
     * OA 审批回写接口
     */
    ResponseResult updateOverseaInvChkAcByOa(String userId, String oaBianhao, String oaStatus) throws Exception ;

    /** 获取海外仓盘盈盘亏任务，带明细不分页报表 */
    ResponseResult getOverseaInvCheckAction(OverseaInvCheckActionSearchDTO overseaInvCheckActionSearchDTO);
    
    /** 根据单据号查询海外盘盈盘亏的详情信息 **/
	ResponseResult getOverseaInvCheckHead(String spmsId);
	
	/**
	 * 撤销单据
	 * @param userId
	 * @param invCheckDoc
	 * @return
	 */
	ResponseResult cancel(String userId, JSONObject invCheckDoc) throws Exception;
	
	/**
	 * 关闭单据
	 * @param userId
	 * @param invCheckDoc
	 * @return
	 */
	ResponseResult closeInvCheck(String userId, JSONObject invCheckDoc) throws Exception;
}
