From c94ab7a91bfb3015d929a94837f3a45289e8bbf1 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期五, 03 四月 2026 11:51:49 +0800
Subject: [PATCH] feat:采购/库存入库添加批号

---
 src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
index 97a9912..0ade630 100644
--- a/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
@@ -95,7 +95,6 @@
     private StockInventoryService stockInventoryService;
 
 
-
     public ApproveProcess getApproveById(String id) {
         LambdaQueryWrapper<ApproveProcess> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(ApproveProcess::getApproveId, id);
@@ -107,7 +106,7 @@
     }
 
     @Override
-    public void initApproveNodes(String approveUserIds, String approveID, Long tenantId) {
+    public void initApproveNodes(String approveUserIds, String approveID, Long tenantId, Long approveProcessId) {
         Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
         String[] names = approveUserIds.split(",");
         for (int i = 0; i < names.length; i++) {
@@ -126,6 +125,9 @@
             approveNode.setUpdateUser(userId);
             approveNode.setCreateTime(LocalDateTime.now());
             approveNode.setUpdateTime(LocalDateTime.now());
+            if (approveProcessId != null) {
+                approveNode.setProcessId(approveProcessId);
+            }
             approveNodeMapper.insert(approveNode);
         }
     }
@@ -314,6 +316,20 @@
                             stockInRecordService.updateById(stockInRecord);
                         }
                     }
+                    if (approveProcess.getApproveType() == 5) {
+                        //閲囪喘鍏ュ簱
+                        ApproveProcess process = approveProcessMapper.selectById(approveNode.getProcessId());
+                        List<SalesLedgerProduct> salesLedgerProductList = salesLedgerProductMapper.selectList(new LambdaQueryWrapper<SalesLedgerProduct>().in(SalesLedgerProduct::getSalesLedgerId, process.getPurchaseLedgerId())
+                                .eq(SalesLedgerProduct::getType, 2));
+                        for (SalesLedgerProduct salesLedgerProduct : salesLedgerProductList) {
+                            StockInRecord stockInRecord = new StockInRecord();
+                            stockInRecord.setStockInNum(salesLedgerProduct.getQuantity());
+                            stockInRecord.setProductModelId(salesLedgerProduct.getProductModelId());
+                            stockInRecord.setWarnNum(salesLedgerProduct.getWarnNum());
+                            stockInRecord.setBatchNo(salesLedgerProduct.getBatchNo());
+                            stockInventoryService.updateOrCreateStockInventory(stockInRecord);
+                        }
+                    }
                 }
                 break;
             case 2:

--
Gitblit v1.9.3