From 1342f568f4b6470efdfc69be7bb153e2b12762f9 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期二, 31 三月 2026 17:00:57 +0800
Subject: [PATCH] feat:1.销售,采购,库存,质检模块产品添加批号,供应商 2.销售产品关联批号,供应商递归查询

---
 src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java
index 3d694ca..f479a16 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java
@@ -24,6 +24,7 @@
 import com.ruoyi.production.service.ProductOrderService;
 import com.ruoyi.quality.mapper.QualityInspectMapper;
 import com.ruoyi.stock.mapper.StockInventoryMapper;
+import com.ruoyi.stock.pojo.StockInventory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -247,8 +248,9 @@
 
     @Override
     public List<SelectOptionDTO<String>> getProductOrderBatchNo() {
-        List<ProductOrder> productOrders = productOrderMapper.selectList(null);
-        return productOrders.stream().map(productOrder -> new SelectOptionDTO<>(productOrder.getBatchNo(), productOrder.getBatchNo())).collect(Collectors.toList());
+        //鏌ヨ搴撳瓨鎵瑰彿
+        List<StockInventory> stockInventoryList = stockInventoryMapper.selectList(null);
+        return stockInventoryList.stream().map(stockInventory -> new SelectOptionDTO<>(stockInventory.getBatchNo(), stockInventory.getBatchNo())).collect(Collectors.toList());
     }
 
     @Override
@@ -278,7 +280,9 @@
         if (productOrder != null) {
             List<DrawMaterialDto> materialDtoList = JSON.parseArray(productOrder.getDrawMaterials(), DrawMaterialDto.class);
             for (DrawMaterialDto drawMaterialDto : materialDtoList) {
-                stockUtils.addStock(drawMaterialDto.getProductModelId(), drawMaterialDto.getRequisitionQty(), null, productOrderDto.getId());
+                stockUtils.addStock(drawMaterialDto.getProductModelId(), drawMaterialDto.getRequisitionQty(), null, productOrderDto.getId(),
+                        drawMaterialDto.getBatchNo(), drawMaterialDto.getCustomer()
+                );
             }
         }
 
@@ -288,7 +292,9 @@
                 if (drawMaterialDto.getProductModelId() == null) {
                     throw new RuntimeException("浜у搧鍨嬪彿ID涓嶈兘涓虹┖");
                 }
-                stockUtils.substractStock(drawMaterialDto.getProductModelId(), drawMaterialDto.getRequisitionQty(), StockOutQualifiedRecordTypeEnum.DRAW_MATERIALS_STOCK_OUT.getCode(), productOrderDto.getId());
+                stockUtils.substractStock(drawMaterialDto.getProductModelId(), drawMaterialDto.getRequisitionQty(),
+                        StockOutQualifiedRecordTypeEnum.DRAW_MATERIALS_STOCK_OUT.getCode(), productOrderDto.getId(),
+                        drawMaterialDto.getBatchNo(),drawMaterialDto.getCustomer());
             }
         } catch (Exception e) {
             throw new RuntimeException("棰嗘枡澶辫触锛�" + e.getMessage());

--
Gitblit v1.9.3