From e6e5a67f94513e90da40cc28f21d0d2c6d9cbe7d Mon Sep 17 00:00:00 2001
From: zhuo <2089219845@qq.com>
Date: 星期二, 15 四月 2025 17:34:01 +0800
Subject: [PATCH] 修改ifs对接方法

---
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java |   43 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 36 insertions(+), 7 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 aed6e35..dba348e 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
@@ -155,9 +155,21 @@
             spotCheckQuarterItemMapper.updateById(spotCheckQuarterItem);
         }
 
-
         // 鍒涘缓宸ユ椂鏆傚瓨
         // 缂撳瓨鏍峰搧id, 缂栧彿map
+//        addWorkingHoursTemporary(userId, insSamples, ids, order);
+
+        return 1;
+    }
+
+    /**
+     * 鍒涘缓宸ユ椂鏆傚瓨
+     * @param userId
+     * @param insSamples
+     * @param ids
+     * @param order
+     */
+    private void addWorkingHoursTemporary(Integer userId, List<InsSample> insSamples, List<Integer> ids, InsOrder order) {
         Map<Integer, String> sampleMap = insSamples.stream().collect(Collectors.toMap(InsSample::getId, InsSample::getSampleCode));
         List<InsProduct> insProductList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                 .in(InsProduct::getInsSampleId, ids)
@@ -189,8 +201,6 @@
             return auxiliaryOutputWorkingHours;
         }).collect(Collectors.toList());
         auxiliaryOutputWorkingHoursTemporaryService.saveBatch(outputWorkingHours);
-
-        return 1;
     }
 
     public static String getWeek(String dayStr) {
@@ -644,7 +654,7 @@
             ifsInventoryQuantity.setIsSource(1);
             ifsInventoryQuantity.setState(0);
 
-            IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectOne(new LambdaQueryWrapper<IfsInventoryQuantity>()
+            Long count = ifsInventoryQuantityMapper.selectCount(new LambdaQueryWrapper<IfsInventoryQuantity>()
                     .eq(IfsInventoryQuantity::getOrderNo, ifsInventoryQuantity.getOrderNo())
                     .eq(IfsInventoryQuantity::getLineNo, ifsInventoryQuantity.getLineNo())
                     .eq(IfsInventoryQuantity::getReleaseNo, ifsInventoryQuantity.getReleaseNo())
@@ -656,8 +666,7 @@
                     .eq(IfsInventoryQuantity::getWaivDevRejNo, ifsInventoryQuantity.getWaivDevRejNo())
                     .eq(IfsInventoryQuantity::getActivitySeq, ifsInventoryQuantity.getActivitySeq())
             );
-            if(Objects.isNull(one)) {
-
+            if(count == 0) {
                 ifsInventoryQuantity.setIsFirst(0);
                 // 鏌ヨ浜т笟閾炬娴嬫暟鎹�
                 String industryChainAttrFields = IndustryChainUtils.getIndustryChainAttrFields(ifsInventoryQuantity.getOrderNo(),
@@ -932,7 +941,8 @@
         // 鏌ヨ鏍囧噯鏍�
         List<StandardProductList> standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
                 .eq(StandardProductList::getStandardMethodListId, insProduct.getStandardMethodListId())
-                .eq(StandardProductList::getTree, tree));
+                .eq(StandardProductList::getTree, tree)
+                .orderByAsc(StandardProductList::getSort));
         for (StandardProductList standardProductList : standardProductLists) {
             standardProductList.setId(null);
         }
@@ -957,6 +967,7 @@
                 product.setCreateUser(null);
                 product.setUpdateTime(null);
                 product.setUpdateUser(null);
+                product.setSection(null);
                 product.setInsSampleId(omitOrderProductDto.getInsSampleId());
                 if (StringUtils.isBlank(product.getCableTag())) {
                     product.setCableTag(null);
@@ -1023,6 +1034,24 @@
         }
     }
 
+    /**
+     * 淇敼鏍峰搧鍨嬪彿
+     * @param insSample
+     */
+    @Override
+    public void updateSampleModel(InsSample insSample) {
+        // 鍒ゆ柇褰撳墠璁㈠崟鏄惁鐢熸垚浜嗘姤鍛�, 鐢熸垚浜嗘姤鍛婁笉鑳戒慨鏀瑰崟鍙�
+        Long count = insReportMapper.selectCount(Wrappers.<InsReport>lambdaQuery()
+                .eq(InsReport::getInsOrderId, insSample.getInsOrderId()));
+        if (count > 0 ) {
+            throw new ErrorException("褰撳墠璁㈠崟宸茬粡鐢熸垚浜嗘姤鍛婁笉鑳戒慨鏀圭紪鍙�");
+        }
+
+        insSampleService.update(Wrappers.<InsSample>lambdaUpdate()
+                .eq(InsSample::getId, insSample.getId())
+                .set(InsSample::getModel, insSample.getModel()));
+    }
+
 }
 
 

--
Gitblit v1.9.3