From eaf6548902e9472fc9b876d531db8508e16c4f2f Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 20 三月 2026 13:49:43 +0800
Subject: [PATCH] feat: 生产订单的撤回、删除;BOM的子集新增/修改统一使用临时ID处理
---
src/main/java/com/ruoyi/production/service/impl/ProductionOrderStructureServiceImpl.java | 22 ++++++++--------------
1 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderStructureServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderStructureServiceImpl.java
index 21f14df..a063566 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionOrderStructureServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionOrderStructureServiceImpl.java
@@ -2,7 +2,6 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.production.dto.ProductionOrderStructureDto;
import com.ruoyi.production.mapper.ProductionOrderStructureMapper;
import com.ruoyi.production.pojo.ProductionOrderStructure;
@@ -32,13 +31,7 @@
@Override
public List<ProductionOrderStructureDto> listByOrderId(Long orderId) {
- List<ProductionOrderStructure> list = list(new LambdaQueryWrapper<ProductionOrderStructure>().eq(ProductionOrderStructure::getOrderId, orderId));
-
- List<ProductionOrderStructureDto> dtoList = list.stream().map(item -> {
- ProductionOrderStructureDto dto = new ProductionOrderStructureDto();
- BeanUtils.copyProperties(item, dto);
- return dto;
- }).collect(Collectors.toList());
+ List<ProductionOrderStructureDto> dtoList = baseMapper.listByOrderId(orderId);
Map<Long, ProductionOrderStructureDto> map = new HashMap<>();
for (ProductionOrderStructureDto node : dtoList) {
@@ -58,12 +51,13 @@
}
@Override
- public void addOrUpdateBomStructs(ProductionOrderStructureDto instanceDto) {
- Long orderId = instanceDto.getOrderId();
-
+ public void addOrUpdateBomStructs(Long orderId, List<ProductionOrderStructureDto> list) {
// 鎵佸钩鍖栧墠绔紶鍏ョ殑鏍�
List<ProductionOrderStructureDto> flatList = new ArrayList<>();
- flattenTree(instanceDto.getChildren(), flatList);
+ for (ProductionOrderStructureDto root : list) {
+ flatList.add(root);
+ flattenTree(root.getChildren(), flatList);
+ }
// 鏌ヨ鏁版嵁搴撳凡鏈夋暟鎹�
List<ProductionOrderStructure> dbList = list(new LambdaQueryWrapper<ProductionOrderStructure>()
@@ -90,7 +84,7 @@
for (ProductionOrderStructureDto dto : flatList) {
ProductionOrderStructure entity = new ProductionOrderStructure();
- BeanUtils.copyProperties(dto, entity);
+ org.springframework.beans.BeanUtils.copyProperties(dto, entity);
entity.setOrderId(orderId);
if (dto.getId() == null) {
entity.setId(null);
@@ -110,13 +104,13 @@
// 鍥炲啓鏂板鑺傜偣鐨� parentId
List<ProductionOrderStructure> parentFixList = new ArrayList<>();
+ Long realParentId;
for (ProductionOrderStructureDto dto : flatList) {
if (dto.getId() != null) continue;
ProductionOrderStructure child = tempEntityMap.get(dto.getTempId());
if (child == null) continue;
String parentTempId = dto.getParentTempId();
if (parentTempId != null && !parentTempId.isEmpty()) {
- Long realParentId;
if (tempEntityMap.containsKey(parentTempId)) {
realParentId = tempEntityMap.get(parentTempId).getId();
} else {
--
Gitblit v1.9.3