9 天以前 67c5d3ea86cfaad45c0150b96949dbcb6729b4d0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package cn.iocoder.yudao.module.mes.service.wm.stockreserve;
 
import cn.iocoder.yudao.module.mes.dal.dataobject.wm.stockreserve.MesWmStockReserveDO;
 
import java.math.BigDecimal;
import java.util.List;
 
/**
 * MES 库存占用 Service 接口
 */
public interface MesWmStockReserveService {
 
    /**
     * 创建库存占用
     *
     * @param materialStockId 库存记录ID
     * @param bizType         业务类型
     * @param bizId           业务单据ID
     * @param bizCode         业务单号
     * @param bizLineId       业务单据行ID
     * @param itemId          物料ID
     * @param quantity        占用数量
     */
    void createReserve(Long materialStockId, Integer bizType, Long bizId, String bizCode, Long bizLineId, Long itemId, BigDecimal quantity);
 
    /**
     * 批量创建库存占用
     *
     * @param reserves 占用信息列表
     */
    void createReserveBatch(List<ReserveInfo> reserves);
 
    /**
     * 释放库存占用(取消单据时)
     *
     * @param bizType 业务类型
     * @param bizId   业务单据ID
     */
    void releaseReserve(Integer bizType, Long bizId);
 
    /**
     * 确认占用转出库(执行出库时)
     * 更新占用记录状态为已出库,并扣减库存占用量字段
     *
     * @param bizType 业务类型
     * @param bizId   业务单据ID
     */
    void confirmReserveToOutbound(Integer bizType, Long bizId);
 
    /**
     * 查询指定业务单据的占用记录
     *
     * @param bizType 业务类型
     * @param bizId   业务单据ID
     * @return 占用记录列表
     */
    List<MesWmStockReserveDO> getReserveListByBiz(Integer bizType, Long bizId);
 
    /**
     * 查询指定物料的占用数量汇总
     *
     * @param itemId      物料ID
     * @param warehouseId 仓库ID(可选)
     * @return 占用数量
     */
    BigDecimal sumReservedQuantity(Long itemId, Long warehouseId);
 
    /**
     * 占用信息
     */
    record ReserveInfo(Long materialStockId, Integer bizType, Long bizId, String bizCode, Long bizLineId, Long itemId, BigDecimal quantity) {}
 
}