2026-06-29 940c8481d2fdcf51341db4ccd6fd6fcc2d43debb
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
package cn.iocoder.yudao.module.mdm.api.item;
 
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemCreateReqDTO;
import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemRespDTO;
import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemUpdateReqDTO;
 
import java.util.Collection;
import java.util.List;
import java.util.Map;
 
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
 
/**
 * MDM 物料 API 接口
 *
 * @author 芋道源码
 */
public interface MdmItemApi {
 
    String PREFIX = "/rpc-api/mdm/item";
 
    /**
     * 创建物料
     *
     * @param createReqDTO 创建信息
     * @return 物料编号
     */
    CommonResult<Long> createItem(MdmItemCreateReqDTO createReqDTO);
 
    /**
     * 更新物料
     *
     * @param updateReqDTO 更新信息
     * @return 是否成功
     */
    CommonResult<Boolean> updateItem(MdmItemUpdateReqDTO updateReqDTO);
 
    /**
     * 获取物料
     *
     * @param id 物料编号
     * @return 物料
     */
    CommonResult<MdmItemRespDTO> getItem(Long id);
 
    /**
     * 获取物料列表
     *
     * @param ids 物料编号列表
     * @return 物料列表
     */
    CommonResult<List<MdmItemRespDTO>> getItemList(Collection<Long> ids);
 
    /**
     * 获取物料 Map
     *
     * @param ids 物料编号列表
     * @return 物料 Map
     */
    default Map<Long, MdmItemRespDTO> getItemMap(Collection<Long> ids) {
        List<MdmItemRespDTO> list = getItemList(ids).getCheckedData();
        return convertMap(list, MdmItemRespDTO::getId);
    }
 
    /**
     * 获取物料分页
     *
     * @param itemType 物料类型
     * @param status   状态
     * @param pageNo   页码
     * @param pageSize 每页数量
     * @return 物料分页
     */
    CommonResult<PageResult<MdmItemRespDTO>> getItemPage(Integer itemType, Integer status, Integer pageNo, Integer pageSize);
 
    /**
     * 根据状态获取物料列表
     *
     * @param status 状态
     * @return 物料列表
     */
    CommonResult<List<MdmItemRespDTO>> getItemListByStatus(Integer status);
 
    /**
     * 校验物料存在
     *
     * @param id 物料编号
     * @return 物料
     */
    CommonResult<MdmItemRespDTO> validateItemExists(Long id);
 
    /**
     * 校验物料存在且启用
     *
     * @param id 物料编号
     * @return 物料
     */
    CommonResult<MdmItemRespDTO> validateItemExistsAndEnable(Long id);
 
    /**
     * 根据编码获取物料
     *
     * @param code 物料编码
     * @return 物料
     */
    CommonResult<MdmItemRespDTO> getItemByCode(String code);
 
    /**
     * 根据条码获取物料
     *
     * @param barCode 物料条码
     * @return 物料
     */
    CommonResult<MdmItemRespDTO> getItemByBarCode(String barCode);
 
    /**
     * 根据分类编号统计物料数量
     *
     * @param categoryId 分类编号
     * @return 物料数量
     */
    CommonResult<Long> getItemCountByCategoryId(Long categoryId);
 
    /**
     * 根据单位编号统计物料数量
     *
     * @param unitMeasureId 单位编号
     * @return 物料数量
     */
    CommonResult<Long> getItemCountByUnitMeasureId(Long unitMeasureId);
 
    /**
     * 更新物料状态
     *
     * @param id     物料编号
     * @param status 状态
     * @return 是否成功
     */
    CommonResult<Boolean> updateItemStatus(Long id, Integer status);
 
}