From 0debf5b7bb0246eaef1397975cdb16f4adb9e8d9 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期四, 29 十月 2026 14:36:31 +0800
Subject: [PATCH] refactor(inspection-order): 1.检验委托单绑定机制支持多次下单 2.合格率统计口径调整 3.外购铜导体推送入库MES增加米重 4.报告英文字段调整

---
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
index b05e79c..2328594 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
@@ -35,6 +35,7 @@
 import com.ruoyi.common.utils.api.IfsApiUtils;
 import com.ruoyi.framework.exception.ErrorException;
 import com.ruoyi.inspect.dto.*;
+import com.ruoyi.inspect.event.InsOrderDeletingEvent;
 import com.ruoyi.inspect.mapper.*;
 import com.ruoyi.inspect.pojo.*;
 import com.ruoyi.inspect.service.InsOrderService;
@@ -48,6 +49,7 @@
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
+import org.springframework.context.ApplicationEventPublisher;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -88,6 +90,7 @@
     private InsUnqualifiedRetestProductMapper insUnqualifiedRetestProductMapper;
     private IfsApiUtils ifsApiUtils;
     private SpotCheckQuarterItemMapper spotCheckQuarterItemMapper;
+    private ApplicationEventPublisher applicationEventPublisher;
     private StandardProductListMapper standardProductListMapper;
     private StructureItemParameterMapper structureItemParameterMapper;
 
@@ -406,6 +409,21 @@
         return insOrder.getId();
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean deleteReturnedOrder(Integer insOrderId) {
+        InsOrder order = insOrderMapper.selectById(insOrderId);
+        if (order == null) {
+            throw new ErrorException("鎴愬搧璁㈠崟涓嶅瓨鍦�");
+        }
+        if (!(Integer.valueOf(2).equals(order.getState()) || Integer.valueOf(3).equals(order.getState()))) {
+            throw new ErrorException("鍙湁閫�鍥炴垨鎾ら攢璁㈠崟鎵嶈兘鍒犻櫎");
+        }
+        Integer operatorId = SecurityUtils.getUserId().intValue();
+        applicationEventPublisher.publishEvent(new InsOrderDeletingEvent(insOrderId, operatorId, LocalDateTime.now()));
+        return removeById(insOrderId);
+    }
+
     /**
      * 娣诲姞妫�楠岄」
      *

--
Gitblit v1.9.3