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/controller/admin/item/MdmItemController.java |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/MdmItemController.java b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/MdmItemController.java
index fee0f83..d271a28 100644
--- a/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/MdmItemController.java
+++ b/yudao-module-mdm/src/main/java/cn/iocoder/yudao/module/mdm/controller/admin/item/MdmItemController.java
@@ -7,9 +7,14 @@
 import cn.iocoder.yudao.module.mdm.controller.admin.item.vo.MdmItemRespVO;
 import cn.iocoder.yudao.module.mdm.controller.admin.item.vo.MdmItemSaveReqVO;
 import cn.iocoder.yudao.module.mdm.controller.admin.item.vo.MdmItemStatusUpdateReqVO;
+import cn.iocoder.yudao.module.mdm.dal.dataobject.category.MdmItemCategoryDO;
+import cn.iocoder.yudao.module.mdm.dal.dataobject.item.MdmItemBatchConfigDO;
 import cn.iocoder.yudao.module.mdm.dal.dataobject.item.MdmItemDO;
 import cn.iocoder.yudao.module.mdm.dal.dataobject.unit.MdmUnitMeasureDO;
 import cn.iocoder.yudao.module.mdm.dal.dataobject.warehouse.MdmWarehouseDO;
+import cn.iocoder.yudao.module.mdm.service.brand.MdmBrandService;
+import cn.iocoder.yudao.module.mdm.service.category.MdmItemCategoryService;
+import cn.iocoder.yudao.module.mdm.service.item.MdmItemBatchConfigService;
 import cn.iocoder.yudao.module.mdm.service.item.MdmItemService;
 import cn.iocoder.yudao.module.mdm.service.unit.MdmUnitMeasureService;
 import cn.iocoder.yudao.module.mdm.service.warehouse.MdmWarehouseService;
@@ -38,10 +43,15 @@
     private MdmItemService itemService;
 
     @Resource
+    private MdmItemCategoryService itemCategoryService;
+    @Resource
     private MdmUnitMeasureService unitMeasureService;
-
     @Resource
     private MdmWarehouseService warehouseService;
+    @Resource
+    private MdmBrandService brandService;
+    @Resource
+    private MdmItemBatchConfigService itemBatchConfigService;
 
     @PostMapping("/create")
     @Operation(summary = "鍒涘缓鐗╂枡")
@@ -75,6 +85,15 @@
         return success(true);
     }
 
+    @DeleteMapping("/delete-list")
+    @Operation(summary = "鎵归噺鍒犻櫎鐗╂枡")
+    @Parameter(name = "ids", description = "缂栧彿鍒楄〃", required = true, example = "1,2,3")
+    @PreAuthorize("@ss.hasPermission('mdm:item:delete')")
+    public CommonResult<Boolean> deleteItemList(@RequestParam("ids") List<Long> ids) {
+        itemService.deleteItemList(ids);
+        return success(true);
+    }
+
     @GetMapping("/get")
     @Operation(summary = "鑾峰緱鐗╂枡")
     @Parameter(name = "id", description = "缂栧彿", required = true, example = "1")
@@ -84,6 +103,8 @@
         MdmItemRespVO resp = BeanUtils.toBean(item, MdmItemRespVO.class);
         if (resp != null) {
             enrichItemRespVO(resp);
+            // 濉厖鎵规灞炴�ч厤缃�
+            enrichItemBatchConfig(resp);
         }
         return success(resp);
     }
@@ -93,6 +114,9 @@
     @PreAuthorize("@ss.hasPermission('mdm:item:query')")
     public CommonResult<PageResult<MdmItemRespVO>> getItemPage(@Valid MdmItemPageReqVO pageReqVO) {
         PageResult<MdmItemDO> pageResult = itemService.getItemPage(pageReqVO);
+        // 鍏宠仈鏌ヨ鍒嗙被鍚嶇О
+        Map<Long, MdmItemCategoryDO> categoryMap = itemCategoryService.getItemCategoryMap(
+                convertSet(pageResult.getList(), MdmItemDO::getCategoryId));
         // 鍏宠仈鏌ヨ璁¢噺鍗曚綅鍚嶇О
         Map<Long, MdmUnitMeasureDO> unitMap = unitMeasureService.getUnitMeasureMap(
                 convertSet(pageResult.getList(), MdmItemDO::getUnitMeasureId));
@@ -116,6 +140,11 @@
                         .collect(Collectors.toMap(MdmWarehouseDO::getId, w -> w));
         // 璧嬪��
         respList.forEach(resp -> {
+            // 鍒嗙被鍚嶇О
+            MdmItemCategoryDO category = categoryMap.get(resp.getCategoryId());
+            if (category != null) {
+                resp.setCategoryName(category.getName());
+            }
             MdmUnitMeasureDO unit = unitMap.get(resp.getUnitMeasureId());
             if (unit != null) {
                 resp.setUnitMeasureName(unit.getName());
@@ -146,9 +175,16 @@
     }
 
     /**
-     * 濉厖鐗╂枡鍝嶅簲 VO 鐨勫叧鑱斿悕绉帮紙涓诲崟浣嶃�佽緟鍗曚綅銆佷粨搴撳悕绉帮級
+     * 濉厖鐗╂枡鍝嶅簲 VO 鐨勫叧鑱斿悕绉帮紙鍒嗙被銆佷富鍗曚綅銆佽緟鍗曚綅銆佷粨搴撳悕绉帮級
      */
     private void enrichItemRespVO(MdmItemRespVO resp) {
+        // 鍒嗙被鍚嶇О
+        if (resp.getCategoryId() != null) {
+            MdmItemCategoryDO category = itemCategoryService.getItemCategory(resp.getCategoryId());
+            if (category != null) {
+                resp.setCategoryName(category.getName());
+            }
+        }
         // 涓诲崟浣嶅悕绉�
         if (resp.getUnitMeasureId() != null) {
             MdmUnitMeasureDO unit = unitMeasureService.getUnitMeasure(resp.getUnitMeasureId());
@@ -179,4 +215,20 @@
         }
     }
 
+    /**
+     * 濉厖鐗╂枡鎵规灞炴�ч厤缃�
+     */
+    private void enrichItemBatchConfig(MdmItemRespVO resp) {
+        MdmItemBatchConfigDO config = itemBatchConfigService.getItemBatchConfigByItemId(resp.getId());
+        if (config != null) {
+            resp.setProduceDateFlag(config.getProduceDateFlag());
+            resp.setExpireDateFlag(config.getExpireDateFlag());
+            resp.setReceiptDateFlag(config.getReceiptDateFlag());
+            resp.setVendorFlag(config.getVendorFlag());
+            resp.setPurchaseOrderCodeFlag(config.getPurchaseOrderCodeFlag());
+            resp.setLotNumberFlag(config.getLotNumberFlag());
+            resp.setQualityStatusFlag(config.getQualityStatusFlag());
+        }
+    }
+
 }
\ No newline at end of file

--
Gitblit v1.9.3