package com.shkj.wms.service;


import com.baomidou.mybatisplus.extension.service.IService;
import com.shkj.common.core.domain.Result;
import com.shkj.wms.bo.SysStockDetailAddBo;
import com.shkj.wms.bo.SysStockDetailEditBo;
import com.shkj.wms.bo.SysStockDetailQueryBo;
import com.shkj.wms.domain.BaseGoodsData;
import com.shkj.wms.domain.BusinDataTask;
import com.shkj.wms.domain.SysStockDetail;
import com.shkj.wms.vo.SysStockDetailVo;

import java.util.List;
import java.util.Map;

/**
 * 库存明细Service接口
 *
 * @author lch
 * @date 2023-05-05
 */
public interface ISysStockDetailService extends IService<SysStockDetail> {
    /**
     * 查询单个
     *
     * @param id
     * @return
     */
    Result<SysStockDetailVo> queryById(Long id);

    /**
     * 查询列表
     *
     * @param bo
     * @return
     */
    List<SysStockDetailVo> queryList(SysStockDetailQueryBo bo);

    /**
     * 根据新增业务对象插入库存明细
     * @param bo 库存明细新增业务对象
     * @return
     */
    Result<Boolean> insertByAddBo(SysStockDetailAddBo bo);

    /**
     * 根据编辑业务对象修改库存明细
     * @param bo 库存明细编辑业务对象
     * @return
     */
    Result<Boolean> updateByEditBo(SysStockDetailEditBo bo);

    /**
     * 校验并删除数据
     * @param ids 主键集合
     * @param isValid 是否校验,true-删除前校验,false-不校验
     * @return
     */
    Result<Boolean> deleteWithValidById(List<Long> ids, Boolean isValid);
    /**
     * 根据货位查询库存
     *
     * @param locationId 货位Id
     * @return
     */
    Result<List<SysStockDetailVo>> queryByLocation(Long locationId);

    /**
     * 入库
     *
     * @param locationId  货位ID
     * @param containerId 治具编号
     * @param batch       批次
     * @param isPuch      是否冲孔
     * @param goods       入库产品信息
     * @return
     */
    Result<Boolean> productDepositDetail(Long locationId, Long containerId, String batch, String isPuch, List<Map<String, String>> goods,Long storageCode);


    /**
     * 查询库存明细
     * @param branchId
     * @param locationId
     * @param storageId
     * @param areaId
     * @param goods
     * @return
     */
    Result<Boolean> reduceInventoryDetail(Long branchId, Long locationId, Long storageId,Long areaId, List<Map<String, String>> goods);

    /**
     * 库存查询
     *
     */
    List<SysStockDetailVo> StockInquiry(SysStockDetailQueryBo bo);

    /**
     * 修改信息
     */
    Result<Boolean>  updateStock(BaseGoodsData goodsData,String id);

    /**
     * 库位调整
     */
    Result<Boolean> removeLocation(String oldLocation, String newLoaction,String id,String newid);

    /**
     * 查询货位
     */
    Map<String,List<String>> getLocationneaten(List<SysStockDetailVo> goodsnoList);

    List<SysStockDetailVo> getLocation(List<String> goodsnoList);

    List<SysStockDetail> selectsystock(List<String> goods,Long locationid);

    /**
     * 扣减库存信息
     * @param locationId
     * @return
     */
    boolean deleteBySysStockByLocationId(Long locationId);


}
