package com.sw.mes.store.service;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sw.mes.core.utils.RequestPage;
import com.sw.mes.store.entity.WarehouseInventory;
import com.sw.mes.store.dto.AvailableInventoryDto;
import com.sw.mes.store.dto.WarehouseInventoryDto;
import javax.servlet.ServletRequest;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @Author wupeng
 * @Description 库存表
 * @Date 14:41 2023/7/31
 * @Param
 * @return
 **/
public interface WarehouseInventoryService extends IService<WarehouseInventory> {
    WarehouseInventory getByUniqueCode(String uniqueCode);

    List<WarehouseInventory> getByBatchNo(String batchNo);

    List<WarehouseInventory> getByBatchNoAndMaterialCodes(String batchNo, List<String> materialCodes);

    WarehouseInventory getByMaterialAndWarehouse(Long materialId, Long warehouseId);

    List<WarehouseInventory> getByWarehouseId(Long warehouseId);

    List<WarehouseInventory> getByWarehouseIds(List<Long> typeIds);

    List<WarehouseInventory> getByMaterialAndBatchNoAndWarehouseId(String batchNo, String materialModelCode, Long warehouseId);
    List<WarehouseInventory> getByMaterialAndBatchNoAndWarehouseCode(String batchNo, String materialModelCode, String warehouseCode);
    List<WarehouseInventory> getByMaterialAndBatchNoAndWarehouseCodes(String batchNo, String materialModelCode, String warehouseCode);

    Page<WarehouseInventory> groupByMaterial(ServletRequest request, RequestPage requestPage);
    List<WarehouseInventory>  findAllWarehouseInventory(ServletRequest request);

    Map<String, BigDecimal> getQuantity(List<WarehouseInventoryDto> inventoryDtos);

    List<WarehouseInventory> getByScanCode(String scanCode);

    List<WarehouseInventory> getByMaterialCode(String materialModelCode);

    List<WarehouseInventory> getByMaterialAndBatchNo(String batchNo, String materialCode);

    Page<WarehouseInventory> listByPage(ServletRequest request, RequestPage requestPage);

    void updateInventory(WarehouseInventory inventory, Integer type);

    List<AvailableInventoryDto> getAvailableInventorys(List<String> materialCodes);

    WarehouseInventory getByBatchWarehouseId(String batchNo, Long warehouseId);
    WarehouseInventory getByBatchWarehouseCode(String batchNo, String warehouseCode);

    void updateSafetyStockAndResidenceTimeAndTimeUnitByMaterialCode(String safetyStock, Integer residenceTime, String timeUnit, String materialModelCode);

    List<String> getUniqueCodesByBatchNo(String batchNo);

    List<String> findBatchNoBySerialNoOrTraceId(String serialNo,String traceId);

    List<WarehouseInventoryDto> findWarehouseInventoryByMaterialCode(String materialCode);

    WarehouseInventory getByCrystalNo(String crystalNo);
}
