From 831163b8a651e5b4e752581d48762f4f7db4ed80 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期三, 11 三月 2026 17:43:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_宁夏_中盛建材' into dev_宁夏_中盛建材
---
src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java | 33 +++++++++++++++++++--------------
1 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java b/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
index 4b7b827..1b21552 100644
--- a/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
+++ b/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
@@ -122,14 +122,14 @@
}
- // 鍙犲姞鏂规暟
- BigDecimal totalVolume = plans.stream()
- .map(ProductionPlan::getVolume)
+ // 鍙犲姞鍓╀綑鏂规暟
+ BigDecimal totalRemainingVolume = plans.stream()
+ .map(ProductionPlan::getRemainingVolume)
.filter(v -> v != null)
.reduce(BigDecimal.ZERO, BigDecimal::add);
- // 鍒ゆ柇涓嬪彂鏁伴噺鏄惁澶т簬绛変簬鏂规暟
- if (productionPlanDto.getTotalAssignedQuantity().compareTo(totalVolume) > 0) {
- throw new BaseException("鎿嶄綔澶辫触锛屼笅鍙戞暟閲忎笉鑳藉ぇ浜庢柟鏁�");
+ // 鍒ゆ柇涓嬪彂鏁伴噺鏄惁澶т簬绛変簬鍓╀綑鏂规暟
+ if (productionPlanDto.getTotalAssignedQuantity().compareTo(totalRemainingVolume) > 0) {
+ throw new BaseException("鎿嶄綔澶辫触锛屼笅鍙戞暟閲忎笉鑳藉ぇ浜庡墿浣欐柟鏁�");
}
// 鍒涘缓鐢熶骇璁㈠崟
@@ -145,29 +145,34 @@
if (volume == null) {
continue;
}
+ // 璁$畻鍓╀綑鏂规暟
+ BigDecimal remainingVolume = plan.getRemainingVolume();
+ if (remainingVolume.compareTo(BigDecimal.ZERO) <= 0) {
+ continue;
+ }
ProductOrderPlan productOrderPlan = new ProductOrderPlan();
productOrderPlan.setProductOrderId(productOrder.getId());
productOrderPlan.setProductionPlanId(plan.getId());
- if (assignedVolume.add(volume).compareTo(productionPlanDto.getTotalAssignedQuantity()) >= 0) {
+ if (assignedVolume.add(remainingVolume).compareTo(productionPlanDto.getTotalAssignedQuantity()) >= 0) {
// 鏈�鍚庝竴涓鍒掞紝鍒嗛厤鍓╀綑鏂规暟
- BigDecimal remainingVolume = productionPlanDto.getTotalAssignedQuantity().subtract(assignedVolume);
- plan.setAssignedQuantity(plan.getAssignedQuantity().add(remainingVolume));
- productOrderPlan.setAssignedQuantity(remainingVolume);
+ BigDecimal lastRemainingVolume = productionPlanDto.getTotalAssignedQuantity().subtract(assignedVolume);
+ plan.setAssignedQuantity(plan.getAssignedQuantity().add(lastRemainingVolume));
+ productOrderPlan.setAssignedQuantity(lastRemainingVolume);
productionPlanMapper.updateById(plan);
productOrderPlanMapper.insert(productOrderPlan);
break;
}
// 鍒嗛厤褰撳墠璁″垝鏂规暟
- plan.setAssignedQuantity(plan.getAssignedQuantity().add(volume));
- productOrderPlan.setAssignedQuantity(volume);
+ plan.setAssignedQuantity(plan.getAssignedQuantity().add(remainingVolume));
+ productOrderPlan.setAssignedQuantity(remainingVolume);
// 鏇存柊鐢熶骇璁″垝
productionPlanMapper.updateById(plan);
// 鍒涘缓鍏宠仈鍏崇郴
productOrderPlanMapper.insert(productOrderPlan);
- assignedVolume = assignedVolume.add(volume);
+ assignedVolume = assignedVolume.add(remainingVolume);
}
return true;
}
@@ -309,7 +314,7 @@
searchParam.put("appType", aliDingConfig.getAppType());
searchParam.put("systemToken", aliDingConfig.getSystemToken());
searchParam.put("userId", aliDingConfig.getUserId());
- searchParam.put("formUuid", aliDingConfig.getFormUuid());
+ searchParam.put("formUuid", aliDingConfig.getProducePlanFormUuid());
searchParam.put("currentPage", pageNumber);
searchParam.put("pageSize", pageSize);
--
Gitblit v1.9.3