From 96a6f204fadc4c2516f7ca00c6f1f3874279b32b Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期三, 24 六月 2026 15:38:33 +0800
Subject: [PATCH] fix: 多余字段列去除

---
 src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java |   52 +++++++++++++---------------------------------------
 1 files changed, 13 insertions(+), 39 deletions(-)

diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
index 4f28ad7..73cdfd2 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -274,8 +274,12 @@
             if (!bindList.isEmpty()) {
                 List<Integer> processIds = bindList.stream().map(SalesLedgerProductProcessBind::getSalesLedgerProductProcessId).collect(Collectors.toList());
                 Map<Integer, Integer> processQuantityMap = bindList.stream().collect(Collectors.toMap(SalesLedgerProductProcessBind::getSalesLedgerProductProcessId, SalesLedgerProductProcessBind::getQuantity, (a, b) -> a));
+                Map<Integer, BigDecimal> processAmountMap = bindList.stream().collect(Collectors.toMap(SalesLedgerProductProcessBind::getSalesLedgerProductProcessId, SalesLedgerProductProcessBind::getAmount, (a, b) -> a));
                 List<SalesLedgerProductProcess> processList = salesLedgerProductProcessService.listByIds(processIds);
-                processList.forEach(p -> p.setQuantity(processQuantityMap.get(p.getId())));
+                processList.forEach(p -> {
+                    p.setQuantity(processQuantityMap.get(p.getId()));
+                    if (processAmountMap.get(p.getId()) != null) p.setUnitPrice(processAmountMap.get(p.getId()));
+                });
                 product.setSalesProductProcessList(processList);
             }
             ProductModel productModel = productModelMap.get(product.getProductModelId());
@@ -652,6 +656,7 @@
                                         SalesLedgerProductProcess p = new SalesLedgerProductProcess();
                                         p.setId(process.getId());
                                         p.setQuantity(processQty.intValue());
+                                        p.setUnitPrice(process.getUnitPrice());
                                         processList.add(p);
                                         extraProcessAmountPerPiece = extraProcessAmountPerPiece.add(defaultDecimal(process.getUnitPrice()).multiply(processQty));
                                     }
@@ -3082,6 +3087,7 @@
             SalesLedgerProductProcess bind = new SalesLedgerProductProcess();
             bind.setId(process.getId());
             bind.setQuantity(entry.getValue());
+            bind.setUnitPrice(process.getUnitPrice());
             result.add(bind);
         }
         return result;
@@ -3455,7 +3461,7 @@
 
         QualityTestStandard selectedStandard = null;
         if (dbProduct.getProductId() != null) {
-            List<QualityTestStandard> standards = qualityTestStandardMapper.getQualityTestStandardByProductId(dbProduct.getProductId(), 2, null);
+            List<QualityTestStandard> standards = qualityTestStandardMapper.getQualityTestStandardByProductId(dbProduct.getProductId(), 2);
             if (CollectionUtils.isNotEmpty(standards)) {
                 selectedStandard = standards.get(0);
                 qualityInspect.setTestStandardId(selectedStandard.getId());
@@ -3517,7 +3523,7 @@
 
         QualityTestStandard selectedStandard = null;
         if (dbProduct.getProductId() != null) {
-            List<QualityTestStandard> standards = qualityTestStandardMapper.getQualityTestStandardByProductId(dbProduct.getProductId(), 2, null);
+            List<QualityTestStandard> standards = qualityTestStandardMapper.getQualityTestStandardByProductId(dbProduct.getProductId(), 2);
             if (CollectionUtils.isNotEmpty(standards)) {
                 selectedStandard = standards.get(0);
                 qualityInspect.setTestStandardId(selectedStandard.getId());
@@ -3922,43 +3928,10 @@
             // 5. 鍙栨秷瀹℃壒娴佺▼
             cancelApproveProcesses(id, originalLedger.getSalesContractNo());
 
-            // 6. 閲嶆柊鐢熸垚锛氬垱寤烘柊鍙拌处鍓湰
+            // 6. 閲嶆柊鐢熸垚锛氭澶勪笉鐩存帴鍦ㄥ悗绔叆搴擄紝鑰屾槸杩斿洖鍘熷崟鎹甀D缁欏墠绔�
+            // 鍓嶇鎷垮埌ID鍚庝細鑾峰彇鍘熷崟鎹鎯呭苟璺宠浆鍒版柊澧為〉闈紙甯﹀叆棰勫~鏁版嵁锛夛紝鐢辩敤鎴峰湪椤甸潰涓婄紪杈戝悗缁熶竴鏂板锛屼互閬垮厤鏁版嵁閲嶅鐢熸垚
             if (dto.getCounterReviewType() == 2) {
-                SalesLedger newLedger = new SalesLedger();
-                BeanUtils.copyProperties(originalLedger, newLedger);
-                newLedger.setId(null);
-                newLedger.setSalesContractNo(generateSalesContractNo());
-                newLedger.setDeliveryStatus(1);
-                newLedger.setStockStatus(0);
-                newLedger.setReviewStatus(0);
-                newLedger.setCounterReviewTime(null);
-                newLedger.setCounterReviewPerson(null);
-                newLedger.setCounterReviewPersonId(null);
-                newLedger.setCounterReviewType(null);
-                newLedger.setCounterReviewDesc(null);
-                salesLedgerMapper.insert(newLedger);
-
-                // 澶嶅埗浜у搧鍒版柊鍙拌处
-                List<SalesLedgerProduct> originalProducts = salesLedgerProductMapper.selectList(
-                        Wrappers.<SalesLedgerProduct>lambdaQuery()
-                                .eq(SalesLedgerProduct::getSalesLedgerId, id)
-                );
-                for (SalesLedgerProduct originalProduct : originalProducts) {
-                    SalesLedgerProduct newProduct = new SalesLedgerProduct();
-                    BeanUtils.copyProperties(originalProduct, newProduct);
-                    newProduct.setId(null);
-                    newProduct.setSalesLedgerId(newLedger.getId());
-                    newProduct.setStockedQuantity(BigDecimal.ZERO);
-                    newProduct.setShippedQuantity(BigDecimal.ZERO);
-                    newProduct.setUnqualifiedStockedQuantity(BigDecimal.ZERO);
-                    newProduct.setUnqualifiedShippedQuantity(BigDecimal.ZERO);
-                    newProduct.setReturnQuality(BigDecimal.ZERO);
-                    newProduct.setAvailableQuality(newProduct.getQuantity().subtract(newProduct.getReturnQuality()));
-                    newProduct.setProductStockStatus(0);
-                    newProduct.fillRemainingQuantity();
-                    salesLedgerProductMapper.insert(newProduct);
-                }
-                newLedgerIds.add(newLedger.getId());
+                newLedgerIds.add(id);
             }
         }
         return newLedgerIds;
@@ -4667,3 +4640,4 @@
     }
 
 }
+

--
Gitblit v1.9.3