/*
 *  Copyright 2019-2020 Zheng Jie
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.youchain.businessdata.service;

import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.domain.Stock;
import com.youchain.businessdata.domain.Inventory;
import com.youchain.businessdata.domain.ItemKey;
import com.youchain.businessdata.domain.Task;
import com.youchain.businessdata.service.dto.InvQueryCriteria;
import com.youchain.businessdata.service.dto.InventoryDto;
import com.youchain.businessdata.service.dto.InventoryQueryCriteria;
import com.youchain.modules.system.domain.Dept;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;
import java.util.List;
import java.io.IOException;
import java.util.Set;
import javax.servlet.http.HttpServletResponse;

/**
 * @author huojin
 * @website https://eladmin.vip
 * @description 服务接口
 * @date 2023-08-22
 **/
public interface InventoryService {

    /**
     * 查询数据分页
     *
     * @param criteria 条件
     * @param pageable 分页参数
     * @return Map<String, Object>
     */
    Map<String, Object> queryAll(InventoryQueryCriteria criteria, Pageable pageable);


    /**
     * 查询所有数据不分页
     *
     * @param criteria 条件参数
     * @return List<InventoryDto>
     */
    List<InventoryDto> queryAll(InventoryQueryCriteria criteria);

    /**
     * 根据ID查询
     *
     * @param id ID
     * @return InventoryDto
     */
    Inventory findById(Long id);

    /**
     * 创建
     *
     * @param resources /
     * @return InventoryDto
     */
    InventoryDto create(Inventory resources);

    /**
     * 编辑
     *
     * @param resources /
     */
    void update(Inventory resources);

    /**
     * 多选删除
     *
     * @param ids /
     */
    void deleteAll(Long[] ids);

    /**
     * 导出数据
     *
     * @param all      待导出的数据
     * @param response /
     * @throws IOException /
     */
    void download(List<InventoryDto> all, HttpServletResponse response) throws IOException;

    /**
     * 清空指定容器库存
     *
     * @param stock 容器
     */
    void clearInventory(Stock stock);


    /**
     * 创建库存
     *
     * @param itemKey 物料
     * @param point   点位
     * @param stock   容器
     * @param dept    仓库
     */
    Inventory createInventory(ItemKey itemKey, Point point, Stock stock, Dept dept, Double quantity);

    /**
     * 查询库存信息
     *
     * @param stockId 容器Id
     * @param itemCode  物料Id
     * @param pointId 点位Id
     * @param areaName 库区
     * @param deptId  仓库Id
     */
    List<Inventory> queryInventory(Long stockId, String itemCode, Long pointId, String areaName, Long deptId);

    /**
     * 根据箱号和容器查询对应库存信息
     *
     * @param orderNumber  箱号
     * @param srcStockCode 容器
     */
    Inventory findByOrderNumber(String orderNumber, String srcStockCode);

    /**
     * 根据容器查询所有库存
     * @param stockCode 容器
     */
    List<Inventory> findByStockCode(String stockCode);

    /**
     * 查询大屏点位信息
     * @param currentPage 当前页
     * @param pageSize 每页显示条数
     */
    Page<List<Object[]>> queryBigScreenPointInfo(int currentPage, int pageSize);


    /**
     * 根据箱号查询所有库存
     * @param orderNumbers 箱号
     */
    List<Inventory> findByOrderNumbers(List<String> orderNumbers);

    /**
     * 导入大件物料库存
     * @param multipartFile 文件
     * @return  ResponseEntity<Object>
     */
    ResponseEntity<Object> impoertBigItemInventory(MultipartFile multipartFile);


}
