From dc658c83dcb919df1b263dc9cd10a228e7a234ec Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期三, 24 六月 2026 14:39:45 +0800
Subject: [PATCH] fix: 反审核重复新增
---
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java | 60 +++++++++++++-----------------------------------------------
1 files changed, 13 insertions(+), 47 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 faaae71..b1304b9 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));
}
@@ -1910,11 +1915,7 @@
BigDecimal stockedQty = item.getStockedQuantity() == null ? BigDecimal.ZERO : item.getStockedQuantity();
return orderQty.compareTo(BigDecimal.ZERO) <= 0 || stockedQty.compareTo(orderQty) >= 0;
});
- int newStockStatus = allStocked ? 2 : (hasStocked ? 1 : 0);
- if (newStockStatus > 0 && ledger.getDeliveryDate() == null) {
- ledger.setDeliveryDate(LocalDate.now().plusDays(7));
- }
- ledger.setStockStatus(newStockStatus);
+ ledger.setStockStatus(allStocked ? 2 : (hasStocked ? 1 : 0));
baseMapper.updateById(ledger);
}
@@ -2079,11 +2080,7 @@
return sq != null && sq.compareTo(BigDecimal.ZERO) > 0;
});
boolean allLinesFull = ledgerAllProducts.stream().allMatch(p -> Objects.equals(p.getProductStockStatus(), 2));
- int newStockStatus = allLinesFull ? 2 : (anyInbound ? 1 : 0);
- if (newStockStatus > 0 && salesLedger.getDeliveryDate() == null) {
- salesLedger.setDeliveryDate(LocalDate.now().plusDays(7));
- }
- salesLedger.setStockStatus(newStockStatus);
+ salesLedger.setStockStatus(allLinesFull ? 2 : (anyInbound ? 1 : 0));
baseMapper.updateById(salesLedger);
}
@@ -3090,6 +3087,7 @@
SalesLedgerProductProcess bind = new SalesLedgerProductProcess();
bind.setId(process.getId());
bind.setQuantity(entry.getValue());
+ bind.setUnitPrice(process.getUnitPrice());
result.add(bind);
}
return result;
@@ -3930,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;
@@ -4675,3 +4640,4 @@
}
}
+
--
Gitblit v1.9.3