package cn.iocoder.yudao.module.mes.service.wm.unitconvert;
|
|
import java.math.BigDecimal;
|
|
/**
|
* MES 物料主辅单位换算 Service 接口
|
*
|
* 出入库单据行的数量统一按物料主单位记账,本服务负责把「按辅单位/型号单位录入的数量」
|
* 换算成主单位数量。换算比率来源优先级:
|
* 1. 行上指定的物料型号(型号上配置的单位 + 比率);
|
* 2. 物料主数据上的辅单位 1 / 辅单位 2(存量配置);
|
* 3. 物料型号中该单位下唯一的比率。
|
*
|
* @author 超级管理员
|
*/
|
public interface MesWmItemUnitConvertService {
|
|
/**
|
* 解析换算比率:1 个指定单位 = N 个物料主单位
|
*
|
* @param itemId 物料编号
|
* @param itemModelId 物料型号编号(可为空)
|
* @param unitMeasureId 录入单位编号(可为空,为空视为主单位)
|
* @return 换算比率,主单位或未指定单位时返回 1
|
*/
|
BigDecimal resolveRateToPrimaryUnit(Long itemId, Long itemModelId, Long unitMeasureId);
|
|
/**
|
* 将录入数量换算为物料主单位数量
|
*
|
* @param itemId 物料编号
|
* @param itemModelId 物料型号编号(可为空)
|
* @param unitMeasureId 录入单位编号(可为空,为空视为主单位)
|
* @param enterQuantity 录入数量
|
* @return 主单位数量;录入单位即主单位时原样返回
|
*/
|
BigDecimal convertToPrimaryUnit(Long itemId, Long itemModelId, Long unitMeasureId, BigDecimal enterQuantity);
|
|
}
|