From 86d777aff8412b49fa83f51a1d9e0524e58f6059 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期三, 18 三月 2026 14:31:13 +0800
Subject: [PATCH] fix: 删除生产订单未回退下发数量与更新下发状态
---
src/main/java/com/ruoyi/production/service/impl/ProductStructureServiceImpl.java | 23 ++++++++++++++++-------
1 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductStructureServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductStructureServiceImpl.java
index 381b642..22f248e 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductStructureServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductStructureServiceImpl.java
@@ -86,17 +86,27 @@
// 鐪熷疄鐨勭埗鑺傜偣 ID
Long realParentId;
for (ProductStructureDto psDto : flatDtoList) {
- if (psDto.getId() == null && psDto.getParentTempId() != null) {
+ String parentTempId = psDto.getParentTempId();
+ if (psDto.getId() == null && parentTempId != null && !parentTempId.isEmpty()) {
ProductStructure child = tempEntityMap.get(psDto.getTempId());
- if (tempEntityMap.containsKey(psDto.getParentTempId())) {
+ if (tempEntityMap.containsKey(parentTempId)) {
// 鐖惰妭鐐规槸鏂拌妭鐐�
- realParentId = tempEntityMap.get(psDto.getParentTempId()).getId();
+ realParentId = tempEntityMap.get(parentTempId).getId();
} else {
// 鐖惰妭鐐规槸鑰佽妭鐐�
- realParentId = Long.valueOf(psDto.getParentTempId());
+ try {
+ realParentId = Long.valueOf(parentTempId);
+ } catch (NumberFormatException e) {
+ realParentId = 0L;
+ }
}
child.setParentId(realParentId);
+ parentFixList.add(child);
+ } else if (psDto.getId() == null) {
+ // 濡傛灉 parentTempId 涓虹┖锛屽垯鏄《绾ц妭鐐�
+ ProductStructure child = tempEntityMap.get(psDto.getTempId());
+ child.setParentId(0L);
parentFixList.add(child);
}
}
@@ -104,7 +114,6 @@
if (!parentFixList.isEmpty()) {
this.updateBatchById(parentFixList);
}
-
if (!updateList.isEmpty()) {
this.updateBatchById(updateList);
}
@@ -130,8 +139,8 @@
@Override
- public List<ProductStructureDto> listBybomId(Integer bomId) {
- List<ProductStructureDto> list = productStructureMapper.listBybomId(bomId);
+ public List<ProductStructureDto> listByBomId(Integer bomId) {
+ List<ProductStructureDto> list = productStructureMapper.listByBomId(bomId);
Map<Long, ProductStructureDto> map = new HashMap<>();
for (ProductStructureDto node : list) {
--
Gitblit v1.9.3