From 4f02a4e8881202c1051e4ea98afce530e325df1d Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 17 四月 2026 13:01:31 +0800
Subject: [PATCH] fix: 销售订单产品额外加工清除错误

---
 src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductProcessBindServiceImpl.java |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductProcessBindServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductProcessBindServiceImpl.java
index 9c4a8fe..5f67b2f 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductProcessBindServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductProcessBindServiceImpl.java
@@ -1,10 +1,15 @@
 package com.ruoyi.sales.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.sales.pojo.SalesLedgerProductProcess;
 import com.ruoyi.sales.pojo.SalesLedgerProductProcessBind;
 import com.ruoyi.sales.mapper.SalesLedgerProductProcessBindMapper;
 import com.ruoyi.sales.service.ISalesLedgerProductProcessBindService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
+
+import java.util.List;
 
 /**
  * <p>
@@ -17,4 +22,20 @@
 @Service
 public class SalesLedgerProductProcessBindServiceImpl extends ServiceImpl<SalesLedgerProductProcessBindMapper, SalesLedgerProductProcessBind> implements ISalesLedgerProductProcessBindService {
 
+    @Override
+    public void updateProductProcessBind(List<SalesLedgerProductProcess> list, Long salesLedgerProductId) {
+        if (salesLedgerProductId == null) {
+            throw new ServiceException("鏂板/淇敼澶辫触,閿�鍞彴璐︿骇鍝佸紓甯�");
+        }
+        baseMapper.delete(new LambdaQueryWrapper<SalesLedgerProductProcessBind>().in(SalesLedgerProductProcessBind::getSalesLedgerProductId, salesLedgerProductId));
+        if (list != null && !list.isEmpty()) {
+            list.forEach(s -> {
+                SalesLedgerProductProcessBind salesLedgerProductProcessBind = new SalesLedgerProductProcessBind();
+                salesLedgerProductProcessBind.setSalesLedgerProductId(salesLedgerProductId);
+                salesLedgerProductProcessBind.setSalesLedgerProductProcessId(s.getId());
+                salesLedgerProductProcessBind.setQuantity(s.getQuantity());
+                baseMapper.insert(salesLedgerProductProcessBind);
+            });
+        }
+    }
 }

--
Gitblit v1.9.3