package com.fjhx.service;

import com.fjhx.base.BaseService;
import com.fjhx.constants.StockJournalTypeConstant;
import com.fjhx.entity.StockJournal;

import java.math.BigDecimal;

/**
 * <p>
 * 出入库流水记录 服务类
 * </p>
 *
 * @author ${author}
 * @since 2022-08-10
 */
public interface StockJournalService extends BaseService<StockJournal> {

    /**
     * 添加流水记录
     *
     * @param type           出入库类型 0出库 1入库
     * @param detailsType    详细类型
     * @param goodsId        物品id
     * @param warehouseId    仓库id
     * @param changeQuantity 变更数量
     * @param remarks        备注
     */
    void add(Integer type, Integer detailsType, Long goodsId, Long warehouseId, BigDecimal changeQuantity, String remarks);

    /**
     * 添加入库流水记录
     */
    default void addIn(Integer detailsType, Long goodsId, Long warehouseId, BigDecimal changeQuantity, String remarks) {
        add(StockJournalTypeConstant.IN, detailsType, goodsId, warehouseId, changeQuantity, remarks);
    }

    /**
     * 添加出库流水记录
     */
    default void addOut(Integer detailsType, Long goodsId, Long warehouseId, BigDecimal changeQuantity, String remarks) {
        add(StockJournalTypeConstant.OUT, detailsType, goodsId, warehouseId, changeQuantity, remarks);
    }

}
