package com.fjhx.wms.service.stock;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.common.entity.InOutBo;
import com.fjhx.common.enums.InOutType;
import com.fjhx.wms.entity.stock.dto.StockDto;
import com.fjhx.wms.entity.stock.dto.StockSelectDto;
import com.fjhx.wms.entity.stock.emums.JournalType;
import com.fjhx.wms.entity.stock.po.Stock;
import com.fjhx.wms.entity.stock.po.StockJournalDetails;
import com.fjhx.wms.entity.stock.vo.StockVo;
import com.ruoyi.common.core.service.BaseService;

import java.math.BigDecimal;
import java.util.List;


/**
 * <p>
 * 库存 服务类
 * </p>
 *
 * @author
 * @since 2023-03-20
 */
public interface StockService extends BaseService<Stock> {

    /**
     * 库存查询
     */
    Page<StockVo> getPage(StockSelectDto dto);

    /**
     * 库存明细
     */
    Stock detail(StockDto dto);

    /**
     * 手动入库
     */
    void add(StockDto stockDto);

    /**
     * 手动出库
     */
    void edit(StockDto stockDto);

    /**
     * 库存删除
     */
    void delete(Long id);

    void changeStock(List<? extends InOutBo> list, Long warehouseId, JournalType journalType);

    /**
     * 计算结存单价(在操作库存之前计算)
     */
    StockJournalDetails calculateUnitPrice(InOutType inOutType, Long productId, Long warehouseId, BigDecimal inOutQuantity, Integer purchaseArrival, BigDecimal price);

    /**
     * 库存预警分页
     */
    Page<StockVo> stockWarningPage(StockSelectDto dto);
}
