From efaa975ca9a7fe133744e353e4eb321f11470fd2 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 20 三月 2026 11:28:45 +0800
Subject: [PATCH] fix: service导入修改
---
src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 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 6bc06ff..5702c18 100644
--- a/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
+++ b/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
@@ -14,8 +14,10 @@
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.IProductionOrderAppendixService;
import com.ruoyi.production.service.ProductMaterialService;
import com.ruoyi.production.service.ProductMaterialSkuService;
import com.ruoyi.production.service.ProductOrderService;
@@ -75,6 +77,9 @@
@Autowired
private ProductMaterialService productMaterialService;
+
+ @Autowired
+ private IProductionOrderAppendixService productionOrderAppendixService;
/**
* 鍚屾閿侊紝纭繚鎵嬪姩鍜屽畾鏃朵换鍔′笉鍚屾椂鎵ц
@@ -141,7 +146,20 @@
ProductOrder productOrder = new ProductOrder();
productOrder.setQuantity(productionPlanDto.getTotalAssignedQuantity());
productOrder.setPlanCompleteTime(productionPlanDto.getPlanCompleteTime());
- productOrderService.addProductOrder(productOrder);
+ productOrder.setStatus(ProductOrderStatusEnum.WAIT.getCode());
+ productOrder.setStrength(productionPlanDto.getStrength());
+
+ Long orderId = productOrderService.insertProductOrder(productOrder);
+
+ // 褰撲笅鍙戠殑浜у搧涓虹爩鍧楁垨鏉挎潗锛屽氨鎷夊彇BOM瀛愰泦涓庡伐鑹鸿矾绾垮瓙闆嗘暟鎹瓨鍏ュ埌闄勮〃涓�
+ if ("鐮屽潡".equals(productionPlanDto.getProductName())) {
+ productOrder.setRouteId(productionOrderAppendixService.populateBlocks(orderId, productionPlanDto));
+ }
+ if ("鏉挎潗".equals(productionPlanDto.getProductName())) {
+ productOrder.setRouteId(productionOrderAppendixService.populatePlates(orderId, productionPlanDto));
+ }
+ // 鏇存柊缁戝畾鐨勫伐鑹鸿矾绾�
+ productOrderService.updateById(productOrder);
// 鏍规嵁涓嬪彂鏁伴噺锛屼粠绗竴涓敓浜ц鍒掑紑濮嬪垎閰嶆柟鏁�
BigDecimal assignedVolume = BigDecimal.ZERO;
@@ -164,10 +182,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