From 7d45b1aa345be565648f9ae01cd200631eb008a2 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期三, 18 三月 2026 13:30:53 +0800
Subject: [PATCH] 生产计划的下发状态逻辑调整+能耗统计查询sql优化

---
 src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java |    8 ++++----
 1 files changed, 4 insertions(+), 4 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 698199c..28cba27 100644
--- a/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
+++ b/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
@@ -122,8 +122,8 @@
         }
 
         // 鏍¢獙鏄惁瀛樺湪涓嶅悓鐨勪骇鍝佽鏍�
-        String firstProductSpec = plans.get(0).getSpecification();
-        if (plans.stream().anyMatch(p -> p.getSpecification() == null || !p.getSpecification().equals(firstProductSpec))) {
+        String firstProductSpec = plans.get(0).getModel();
+        if (plans.stream().anyMatch(p -> p.getModel() == null || !p.getModel().equals(firstProductSpec))) {
             throw new BaseException("鍚堝苟澶辫触锛屽瓨鍦ㄤ笉鍚岀殑浜у搧瑙勬牸");
         }
 
@@ -164,10 +164,10 @@
                 // 鏈�鍚庝竴涓鍒掞紝鍒嗛厤鍓╀綑鏂规暟
                 BigDecimal lastRemainingVolume = productionPlanDto.getTotalAssignedQuantity().subtract(assignedVolume);
                 plan.setStatus(1);
-                if (lastRemainingVolume.compareTo(BigDecimal.ZERO) <= 0) {
+                plan.setAssignedQuantity(plan.getAssignedQuantity().add(lastRemainingVolume));
+                if (plan.getAssignedQuantity().compareTo(plan.getVolume()) >= 0) {
                     plan.setStatus(2);
                 }
-                plan.setAssignedQuantity(plan.getAssignedQuantity().add(lastRemainingVolume));
                 productOrderPlan.setAssignedQuantity(lastRemainingVolume);
                 productionPlanMapper.updateById(plan);
                 productOrderPlanMapper.insert(productOrderPlan);

--
Gitblit v1.9.3