package com.sunda.spmsoversea.service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sunda.spmscommon.ResponseResult;
import com.sunda.spmsoversea.dto.OverseaInvCheckSearchDTO;
import com.sunda.spmsoversea.entity.OverseaInvCheck;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 仓库盘点任务表 服务类
 * </p>
 *
 * @author Wayne
 * @since 2021-05-10
 */
public interface IOverseaInvCheckService extends IService<OverseaInvCheck> {

    /*获取库存盘点任务列表
    *{
          "werks":["CN01","CM31"],
          "whsLocationCode":["1011","1061"],
          "inventoryCheckCategory":"1", //盘点类别 1-日常盘点 2-月度盘点 3-动态盘点 4-其它盘点
          "inventoryCheckDate":["20210401","20210501"],
          "inventoryCheckResult":"1", //盘点结果 1-账实相符 2-盘盈 3-盘亏 4-盘盈盘亏
          "isReview":"1", //是否复盘 1-初盘 2-复盘
          "spmsStatus":"1", //任务状态：1-待盘点；2-盘点中；3-复盘中；4-处理中；5-关闭(完成)
      }
    * */
    ResponseResult getInventoryCheck(JSONObject InvCheckFilter);

    /*按uuid获取InvCheck的详情数据*/
    ResponseResult getInventoryCheckWithDtl(String uuid)throws Exception ;

    /*新建盘点单
    * 1. 有uuid 更新
    * 2. 无uuid 新建
    * */
    ResponseResult updateInventoryCheck(JSONObject InvCheckDoc, String userId) throws Exception ;

    /*保存存盘点结果，生成盘盈盘亏单
    * {
      "invChkSurplus": [],
      "invChkLoss": [],
      "inventoryCheck":{},
      "inventoryCheckDtls":[]
      }
    * */
    ResponseResult saveInventoryCheckRes(JSONObject InvCheckRes, String userId)throws Exception ;

    /** 获取盘点单据相关操作日志 */
    List<Map<String, Object>> getInventoryCheckLogs(String uuid);
    /**当盘盈亏单据关闭时，查询关联的盘点单是否可以关闭*/
    ResponseResult checkAndCloseInvChk(String inventoryCheckId);

    /** 获取海外仓盘点任务，带明细不分页报表 */
    ResponseResult getOverseaInvCheck(OverseaInvCheckSearchDTO overseaInvCheckSearchDTO);
}
