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);
|
|
}
|