From eccad5a129106377a275be4f7cdc58e99e9b95d4 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 21 七月 2026 13:45:14 +0800
Subject: [PATCH] feat(mes): 实现库存移库功能

---
 yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/api/item/MdmItemApiImpl.java |  130 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 130 insertions(+), 0 deletions(-)

diff --git a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/api/item/MdmItemApiImpl.java b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/api/item/MdmItemApiImpl.java
new file mode 100644
index 0000000..9ec6300
--- /dev/null
+++ b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/api/item/MdmItemApiImpl.java
@@ -0,0 +1,130 @@
+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.framework.common.util.object.BeanUtils;
+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 cn.iocoder.yudao.module.mdm.controller.admin.item.vo.MdmItemPageReqVO;
+import cn.iocoder.yudao.module.mdm.controller.admin.item.vo.MdmItemSaveReqVO;
+import cn.iocoder.yudao.module.mdm.dal.dataobject.item.MdmItemDO;
+import cn.iocoder.yudao.module.mdm.dal.mysql.item.MdmItemMapper;
+import cn.iocoder.yudao.module.mdm.service.item.MdmItemService;
+import jakarta.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Collection;
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+/**
+ * MDM 鐗╂枡 API 瀹炵幇绫�
+ *
+ * @author 鑺嬮亾婧愮爜
+ */
+@RestController
+@RequestMapping(MdmItemApi.PREFIX)
+@Validated
+public class MdmItemApiImpl implements MdmItemApi {
+
+    @Resource
+    private MdmItemService itemService;
+
+    @Resource
+    private MdmItemMapper itemMapper;
+
+    @Override
+    public CommonResult<Long> createItem(MdmItemCreateReqDTO createReqDTO) {
+        MdmItemSaveReqVO saveReqVO = BeanUtils.toBean(createReqDTO, MdmItemSaveReqVO.class);
+        // 璁剧疆榛樿鐘舵��
+        if (saveReqVO.getStatus() == null) {
+            saveReqVO.setStatus(0);
+        }
+        return success(itemService.createItem(saveReqVO));
+    }
+
+    @Override
+    public CommonResult<Boolean> updateItem(MdmItemUpdateReqDTO updateReqDTO) {
+        MdmItemSaveReqVO saveReqVO = BeanUtils.toBean(updateReqDTO, MdmItemSaveReqVO.class);
+        itemService.updateItem(saveReqVO);
+        return success(true);
+    }
+
+    @Override
+    public CommonResult<MdmItemRespDTO> getItem(Long id) {
+        MdmItemDO item = itemService.getItem(id);
+        return success(BeanUtils.toBean(item, MdmItemRespDTO.class));
+    }
+
+    @Override
+    public CommonResult<List<MdmItemRespDTO>> getItemList(Collection<Long> ids) {
+        List<MdmItemDO> list = itemService.getItemList(ids);
+        return success(BeanUtils.toBean(list, MdmItemRespDTO.class));
+    }
+
+    @Override
+    public CommonResult<PageResult<MdmItemRespDTO>> getItemPage(Integer itemType, Integer status, Integer pageNo, Integer pageSize) {
+        MdmItemPageReqVO pageReqVO = new MdmItemPageReqVO();
+        pageReqVO.setItemType(itemType);
+        pageReqVO.setStatus(status);
+        pageReqVO.setPageNo(pageNo);
+        pageReqVO.setPageSize(pageSize);
+        PageResult<MdmItemDO> pageResult = itemService.getItemPage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, MdmItemRespDTO.class));
+    }
+
+    @Override
+    public CommonResult<List<MdmItemRespDTO>> getItemListByStatus(Integer status) {
+        MdmItemPageReqVO pageReqVO = new MdmItemPageReqVO();
+        pageReqVO.setStatus(status);
+        pageReqVO.setPageNo(1);
+        pageReqVO.setPageSize(Integer.MAX_VALUE);
+        PageResult<MdmItemDO> pageResult = itemService.getItemPage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult.getList(), MdmItemRespDTO.class));
+    }
+
+    @Override
+    public CommonResult<MdmItemRespDTO> validateItemExists(Long id) {
+        MdmItemDO item = itemService.validateItemExists(id);
+        return success(BeanUtils.toBean(item, MdmItemRespDTO.class));
+    }
+
+    @Override
+    public CommonResult<MdmItemRespDTO> validateItemExistsAndEnable(Long id) {
+        MdmItemDO item = itemService.validateItemExistsAndEnable(id);
+        return success(BeanUtils.toBean(item, MdmItemRespDTO.class));
+    }
+
+    @Override
+    public CommonResult<MdmItemRespDTO> getItemByCode(String code) {
+        MdmItemDO item = itemService.getItemByCode(code);
+        return success(BeanUtils.toBean(item, MdmItemRespDTO.class));
+    }
+
+    @Override
+    public CommonResult<MdmItemRespDTO> getItemByBarCode(String barCode) {
+        MdmItemDO item = itemMapper.selectByBarCode(barCode);
+        return success(BeanUtils.toBean(item, MdmItemRespDTO.class));
+    }
+
+    @Override
+    public CommonResult<Long> getItemCountByCategoryId(Long categoryId) {
+        return success(itemService.getItemCountByCategoryId(categoryId));
+    }
+
+    @Override
+    public CommonResult<Long> getItemCountByUnitMeasureId(Long unitMeasureId) {
+        return success(itemService.getItemCountByUnitMeasureId(unitMeasureId));
+    }
+
+    @Override
+    public CommonResult<Boolean> updateItemStatus(Long id, Integer status) {
+        itemService.updateItemStatus(id, status);
+        return success(true);
+    }
+
+}
\ No newline at end of file

--
Gitblit v1.9.3