Explorar el Código

aps-订单产品明细关键字段变更时增加判断是否变更

sucheng hace 10 meses
padre
commit
6d286deddf

+ 6 - 1
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProductDetailServiceImpl.java

@@ -490,6 +490,8 @@ public class ApsProductDetailServiceImpl extends ServiceImpl<ApsProductDetailDao
         List<ApsProductDetailDo> nowUpdateList = apsProductDetailDoList.stream().filter(item -> item.getId().equals(nowId)).collect(Collectors.toList());
         List<ApsProductDetailDo> updateOrInsertDetailList = apsProductDetailDoList.stream().filter(item -> !item.getId().equals(nowId)).collect(Collectors.toList());
 
+        boolean needDelNowId = false;
+
         if (nowUpdateList.size() > 0 && ObjectUtil.isNotEmpty(nowUpdateList.get(0))) {
             //产品明细变更
             ApsProductDetailDo apsProductDetailDo = nowUpdateList.get(0);
@@ -502,6 +504,7 @@ public class ApsProductDetailServiceImpl extends ServiceImpl<ApsProductDetailDao
                 //复制新的产品明细
                 apsProductDetailDo.setId(SecurityUtil.getUUID());
                 updateOrInsertDetailList.add(apsProductDetailDo);
+                needDelNowId = true;
 
                 //====================更新坯料计划及其输出成品===========================
                 //检查订单产品明细对应的所有相关的坯料计划的输出成品,
@@ -591,7 +594,9 @@ public class ApsProductDetailServiceImpl extends ServiceImpl<ApsProductDetailDao
         }
 
         //删除指定ID的产品明细
-        this.removeById(nowId);
+        if (needDelNowId) {
+            this.removeById(nowId);
+        }
         //更新或新增 产品明细
         if (ObjectUtil.isNotEmpty(updateOrInsertDetailList)) {
             this.updateOrSaveProductDetails(updateOrInsertDetailList);