package com.hw.wms.mapper;

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

import com.hw.wms.domain.WmsRawStock;
import org.apache.ibatis.annotations.Param;

/**
 * 原材料库存Mapper接口
 *
 * @author xs
 * @date 2023-12-20
 */
public interface WmsRawStockMapper {
    /**
     * 查询原材料库存
     *
     * @param rawStockId 原材料库存主键
     * @return 原材料库存
     */
    public WmsRawStock selectWmsRawStockByRawStockId(Long rawStockId);

    /**
     * 查询原材料库存列表
     *
     * @param wmsRawStock 原材料库存
     * @return 原材料库存集合
     */
    public List<WmsRawStock> selectWmsRawStockList(WmsRawStock wmsRawStock);

    /**
     * 新增原材料库存
     *
     * @param wmsRawStock 原材料库存
     * @return 结果
     */
    public int insertWmsRawStock(WmsRawStock wmsRawStock);

    /**
     * 修改原材料库存
     *
     * @param wmsRawStock 原材料库存
     * @return 结果
     */
    public int updateWmsRawStock(WmsRawStock wmsRawStock);

    /**
     * 删除原材料库存
     *
     * @param rawStockId 原材料库存主键
     * @return 结果
     */
    public int deleteWmsRawStockByRawStockId(Long rawStockId);

    /**
     * 批量删除原材料库存
     *
     * @param rawStockIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteWmsRawStockByRawStockIds(Long[] rawStockIds);


    /**
     * 根据库位编码和入库批次号查询原材料库存
     * @param locationCode
     * @param instockBatch
     * @return WmsRawStock
     */
    public WmsRawStock selectRawStockByLocationAndBatch(@Param("locationCode") String locationCode,
                                                        @Param("instockBatch") String instockBatch);

    /**
     * 获取库存数量
     * @param wmsRawStock
     * @return
     */
    public BigDecimal getRawStockTotalAmount(WmsRawStock wmsRawStock);

    /**
     * 查询原材料库存列表供申请领料使用
     *
     * @param wmsRawStock 原材料库存
     * @return 原材料库存集合
     */
    public List<WmsRawStock> selectWmsRawStocks4Apply(WmsRawStock wmsRawStock);

    /**
     * 查询totalAmount>0的库存列表
     *
     * @param wmsRawStock 原材料库存
     * @return 原材料库存集合
     */
    public List<WmsRawStock> selectWmsRawStockInList(WmsRawStock wmsRawStock);


}
