From 124a6178ae918de05886b52199b7755d4fa1ece3 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期三, 18 三月 2026 17:06:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_宁夏_中盛建材' into dev_宁夏_中盛建材
---
src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java | 22 ++++++++++++++++++----
1 files changed, 18 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..cedf8f6 100644
--- a/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
+++ b/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
@@ -7,6 +7,7 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.appendix.service.AppendixService;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.StringUtils;
@@ -14,6 +15,7 @@
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.config.AliDingConfig;
import com.ruoyi.framework.util.AliDingUtils;
+import com.ruoyi.production.enums.ProductOrderStatusEnum;
import com.ruoyi.production.pojo.ProductMaterialSku;
import com.ruoyi.production.pojo.ProductOrder;
import com.ruoyi.production.service.ProductMaterialService;
@@ -76,6 +78,9 @@
@Autowired
private ProductMaterialService productMaterialService;
+ @Autowired
+ private AppendixService appendixService;
+
/**
* 鍚屾閿侊紝纭繚鎵嬪姩鍜屽畾鏃朵换鍔′笉鍚屾椂鎵ц
*/
@@ -122,8 +127,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("鍚堝苟澶辫触锛屽瓨鍦ㄤ笉鍚岀殑浜у搧瑙勬牸");
}
@@ -141,6 +146,15 @@
ProductOrder productOrder = new ProductOrder();
productOrder.setQuantity(productionPlanDto.getTotalAssignedQuantity());
productOrder.setPlanCompleteTime(productionPlanDto.getPlanCompleteTime());
+ productOrder.setStatus(ProductOrderStatusEnum.WAIT.getCode());
+
+ // 褰撲笅鍙戠殑浜у搧涓虹爩鍧楁垨鏉挎潗锛屽氨鎷夊彇BOM瀛愰泦涓庡伐鑹鸿矾绾垮瓙闆嗘暟鎹瓨鍏ュ埌闄勮〃涓�
+ if ("鐮屽潡".equals(productionPlanDto.getProductName())) {
+ productOrder.setRouteId(appendixService.populateBlocks(productionPlanDto));
+ }
+ if ("鏉挎潗".equals(productionPlanDto.getProductName())) {
+ productOrder.setRouteId(appendixService.populatePlates(productionPlanDto));
+ }
productOrderService.addProductOrder(productOrder);
// 鏍规嵁涓嬪彂鏁伴噺锛屼粠绗竴涓敓浜ц鍒掑紑濮嬪垎閰嶆柟鏁�
@@ -164,10 +178,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