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 |   33 ++++++++++++++++++++++++++++-----
 1 files changed, 28 insertions(+), 5 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 5370f98..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);
+    }
+
     /**
      * 娣诲姞妫�楠岄」
      *
@@ -439,16 +457,16 @@
     @Override
     public Map<String, Object> getInsOrder(Integer id) {
         Map<String, Object> map = new HashMap<>();
-        InsOrder insOrder = insOrderMapper.selectById(id);
+        IfsOrderVO ifsOrderVO = insOrderMapper.selectOrderInfoById(id);
         List<SampleProductDto> list;
         // 鍒ゆ柇鏄惁鏄繘鍘傛姤鍛婂厤妫�
-        if (insOrder.getIsExemption().equals(1)) {
+        if (ifsOrderVO.getIsExemption().equals(1)) {
             list = insSampleMapper.selectExemptionByOrderId(id);
         } else {
             list = insSampleMapper.selectSampleProductListByOrderId2(id);
         }
         Map<String, Object> map1 = insSampleMapper.selectInsOrder(id);
-        map.put("insOrder", insOrder);
+        map.put("insOrder", ifsOrderVO);
         map.put("sampleProduct", list);
         map.put("insOrderTemplate", map1);
         return map;
@@ -626,8 +644,8 @@
             if (map1.get("APPROVED_DATE") != null) {
                 ifsInventoryQuantity.setApprovedDate(LocalDateTime.parse(map1.get("APPROVED_DATE").toString(), dateTimeFormatter)); // 瀹℃壒鏃ユ湡
             }
-            ifsInventoryQuantity.setReqCeater(map1.get("REQ_CEATER") == null ? "" : map1.get("REQ_CEATER").toString()); // 閲囪喘鐢宠鍒涘缓浜�
-            ifsInventoryQuantity.setReqCeaterName(map1.get("REQ_CEATER_NAME") == null ? "" : map1.get("REQ_CEATER_NAME").toString()); // 閲囪喘鐢宠鍒涘缓浜哄悕绉�
+            ifsInventoryQuantity.setReqCeater(map1.get("REQ_CREATER") == null ? "" : map1.get("REQ_CREATER").toString()); // 閲囪喘鐢宠鍒涘缓浜�
+            ifsInventoryQuantity.setReqCeaterName(map1.get("REQ_CREATER_NAME") == null ? "" : map1.get("REQ_CREATER_NAME").toString()); // 閲囪喘鐢宠鍒涘缓浜哄悕绉�
             ifsInventoryQuantity.setLineRemarks(map1.get("LINE_REMARKS") == null ? "" : map1.get("LINE_REMARKS").toString()); // 閲囪喘璁㈠崟琛屽娉�
             ifsInventoryQuantity.setBuyUnitMeas(map1.get("BUY_UNIT_MEAS") == null ? "" : map1.get("BUY_UNIT_MEAS").toString()); // 閲囪喘鍗曚綅
             ifsInventoryQuantity.setReceiverDate(LocalDateTime.now()); // 鎺ユ敹鏃ユ湡
@@ -1285,6 +1303,11 @@
         return toLocation;
     }
 
+    @Override
+    public Map<String, Object> getInsOrderList(List<Integer> selectOrderIds) {
+        return insOrderMapper.selectOrderInfoByIds(selectOrderIds);
+    }
+
 
     /**
      * 鍏堜慨鏀归噰璐鍗曟壒娆″彿, 鍚庤繘琛岀Щ搴撴搷浣�

--
Gitblit v1.9.3