From 09ddece4effc738f2611c053d8f0f1fb22102597 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期二, 08 四月 2025 17:28:17 +0800
Subject: [PATCH] 1.原辅料下单标准

---
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java |  112 ++++++++++++++++++++++++++++++--------------------------
 1 files changed, 60 insertions(+), 52 deletions(-)

diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
index 43fcea6..d02085a 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
@@ -12,14 +12,14 @@
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.basic.dto.*;
 import com.ruoyi.basic.pojo.IfsInventoryQuantity;
 import com.ruoyi.common.constant.InsOrderTypeConstants;
+import com.ruoyi.common.core.domain.Result;
 import com.ruoyi.common.core.domain.entity.User;
-import com.ruoyi.common.properties.WechatProperty;
+import com.ruoyi.common.config.WechatProperty;
 import com.ruoyi.common.utils.LimsDateUtil;
 import com.ruoyi.common.utils.QueryWrappers;
 import com.ruoyi.common.utils.SecurityUtils;
@@ -57,7 +57,6 @@
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
-import java.util.stream.Collectors;
 
 /**
  * @Author zhuo
@@ -82,65 +81,55 @@
 
 
     @Override
-    public RawMaterialStandardTreeDto selectStandardTreeListByPartNo(String partNo) {
-        if (StringUtils.isBlank(partNo)) {
-            throw new ErrorException("闆朵欢鍙蜂涪澶�");
-        }
+    public Result selectStandardTreeListByPartNo(String partNo) {
         List<FactoryDto> factoryDtos = standardTreeMapper.selectStandardTreeListByPartNo(partNo);
         if (CollectionUtil.isEmpty(factoryDtos)) {
-            throw new ErrorException("闆朵欢鍙蜂负" + partNo + "鐨勫師鏉愭枡娌℃湁瀵瑰簲鐨勬爣鍑嗗簱閰嶇疆");
+            return Result.success(null, "闆朵欢鍙蜂负" + partNo + "鐨勫師鏉愭枡娌℃湁瀵瑰簲鐨勬爣鍑嗗簱閰嶇疆");
         }
         RawMaterialStandardTreeDto rawMaterialStandardTreeDto = new RawMaterialStandardTreeDto();
-        Set<String> sampleTypeValues = new HashSet<>();
         for (FactoryDto factoryDto : factoryDtos) {
             for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) {
-                for (SampleTypeDto sampleTypeDto : laboratoryDto.getChildren()) {
-                    if (sampleTypeDto.getChildren().size() == 0) {
-                        sampleTypeValues.add(sampleTypeDto.getValue());
-                    }
-                }
-            }
-        }
-        // 鎵归噺鏌ヨ鎵�鏈� sampleTypeDto 鐨勬暟鎹�
-        List<SampleDto> standardList = standardTreeMapper.getStandardTree3Batch(sampleTypeValues);
-        Map<String, List<SampleDto>> standardTreeMap = standardList.stream().collect(Collectors.groupingBy(SampleDto::getValue));
-
-        for (FactoryDto factoryDto : factoryDtos) {
-            for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) {
-                for (SampleTypeDto sampleTypeDto : laboratoryDto.getChildren()) {
-                    List<SampleDto> standardTreeList = standardTreeMap.get(sampleTypeDto.getValue());
-                    if (sampleTypeDto.getChildren().size() == 0) {
-                        sampleTypeDto.getChildren().addAll(standardTreeList);
-                    }
-                    // 鍒ゆ柇缁戝畾鐨勬槸鍚︽槸褰撳墠闆朵欢鍙�
-                    if (sampleTypeDto.getPartNo() != null && sampleTypeDto.getPartNo().equals(partNo)) {
-                        // 娣诲姞瀵硅薄
-                        rawMaterialStandardTreeDto.setTreeName(factoryDto.getValue() + "-"
-                                + laboratoryDto.getValue() + "-"
-                                + sampleTypeDto.getValue());
-                        rawMaterialStandardTreeDto.setCode(sampleTypeDto.getCode());
-                        rawMaterialStandardTreeDto.setLabel(sampleTypeDto.getLabel());
-                        rawMaterialStandardTreeDto.setValue(sampleTypeDto.getValue());
-                        rawMaterialStandardTreeDto.setChildren1(sampleTypeDto.getChildren());
-                    } else {
-                        for (SampleDto sampleDto : sampleTypeDto.getChildren()) {
-                            if (sampleDto.getPartNo() != null && sampleDto.getPartNo().equals(partNo)) {
+                for (ObjectTypeDto objectTypeDto : laboratoryDto.getChildren()) {
+                    for (WorkShopNameDto workShopNameDto : objectTypeDto.getChildren()) {
+                        for (SampleTypeDto sampleTypeDto : workShopNameDto.getChildren()) {
+                            if (sampleTypeDto.getChildren().size() == 0) {
+                                sampleTypeDto.setChildren(standardTreeMapper.getStandardTree3(sampleTypeDto.getValue()));
+                            }
+                            // 鍒ゆ柇缁戝畾鐨勬槸鍚︽槸褰撳墠闆朵欢鍙�
+                            if (sampleTypeDto.getPartNo() != null && sampleTypeDto.getPartNo().equals(partNo)) {
                                 // 娣诲姞瀵硅薄
                                 rawMaterialStandardTreeDto.setTreeName(factoryDto.getValue() + "-"
-                                        + laboratoryDto.getValue() + "-"
-                                        + sampleTypeDto.getValue() + "-"
-                                        + sampleDto.getValue());
-                                rawMaterialStandardTreeDto.setCode(sampleDto.getCode());
-                                rawMaterialStandardTreeDto.setLabel(sampleDto.getLabel());
-                                rawMaterialStandardTreeDto.setValue(sampleDto.getValue());
-                                rawMaterialStandardTreeDto.setChildren2(sampleDto.getChildren());
+                                        + laboratoryDto.getValue() + "-" + objectTypeDto.getValue() + "-" + workShopNameDto.getValue() + "-"
+                                        + sampleTypeDto.getValue());
+                                rawMaterialStandardTreeDto.setCode(sampleTypeDto.getCode());
+                                rawMaterialStandardTreeDto.setLabel(sampleTypeDto.getLabel());
+                                rawMaterialStandardTreeDto.setValue(sampleTypeDto.getValue());
+                                rawMaterialStandardTreeDto.setChildren1(sampleTypeDto.getChildren());
+                                rawMaterialStandardTreeDto.setWorkShopName(sampleTypeDto.getWorkShopName());
+                                rawMaterialStandardTreeDto.setWorkShopId(sampleTypeDto.getWorkShopId());
+                            } else {
+                                for (SampleDto sampleDto : sampleTypeDto.getChildren()) {
+                                    if (sampleDto.getPartNo() != null && sampleDto.getPartNo().equals(partNo)) {
+                                        // 娣诲姞瀵硅薄
+                                        rawMaterialStandardTreeDto.setTreeName(factoryDto.getValue() + "-"
+                                                + laboratoryDto.getValue() + "-" + objectTypeDto.getValue() + "-" + workShopNameDto.getValue() + "-"
+                                                + sampleTypeDto.getValue() + "-"
+                                                + sampleDto.getValue());
+                                        rawMaterialStandardTreeDto.setCode(sampleDto.getCode());
+                                        rawMaterialStandardTreeDto.setLabel(sampleDto.getLabel());
+                                        rawMaterialStandardTreeDto.setValue(sampleDto.getValue());
+                                        rawMaterialStandardTreeDto.setChildren2(sampleDto.getChildren());
+                                        rawMaterialStandardTreeDto.setWorkShopName(sampleTypeDto.getWorkShopName());
+                                        rawMaterialStandardTreeDto.setWorkShopId(sampleTypeDto.getWorkShopId());
+                                    }
+                                }
                             }
                         }
                     }
                 }
             }
         }
-        return rawMaterialStandardTreeDto;
+        return Result.success(rawMaterialStandardTreeDto);
     }
 
     @Override
@@ -156,6 +145,7 @@
 
     /**
      * 鎶ユ
+     *
      * @param ids
      * @return
      */
@@ -199,6 +189,7 @@
 
     /**
      * 鎾ら攢鎶ユ
+     *
      * @param id
      * @return
      */
@@ -212,6 +203,7 @@
 
     /**
      * 鎵撳嵃鏍囩鏌ヨ
+     *
      * @param ids
      * @return
      */
@@ -222,6 +214,7 @@
 
     /**
      * 鎶ユ
+     *
      * @param ifsInventoryQuantity
      * @return
      */
@@ -252,6 +245,7 @@
 
     /**
      * 鑾峰彇閾滀骇涓氶摼妫�娴嬫暟鎹�
+     *
      * @param id
      * @return
      */
@@ -262,6 +256,7 @@
 
     /**
      * 鍘熸潗鏂欐挙閿�鎺ュ彛
+     *
      * @param ifsInventoryId
      * @return
      */
@@ -288,6 +283,7 @@
 
     /**
      * 鍘熸潗鏂欏厤妫�涓嬪崟
+     *
      * @param list
      * @param insOrder
      * @return
@@ -364,6 +360,7 @@
 
     /**
      * 鏌ヨ寰呬笅鍗�
+     *
      * @param page
      * @param ifsInventoryQuantity
      * @return
@@ -375,6 +372,7 @@
 
     /**
      * 鏌ヨ宸叉楠�
+     *
      * @param page
      * @param ifsInventoryQuantityDto
      * @return
@@ -387,11 +385,13 @@
         ifsInventoryQuantityDto.setBeginDeclareDate(null);
         ifsInventoryQuantityDto.setEndDeclareDate(null);
 
-        return standardTreeMapper.getIfsByOver(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate);
+        IPage<IfsInventoryQuantitySupplierDto> ifsByOver = standardTreeMapper.getIfsByOver(page, QueryWrappers.queryWrappers(ifsInventoryQuantityDto), beginDeclareDate, endDeclareDate);
+        return ifsByOver;
     }
 
     /**
      * 鍒犻櫎鍘熸潗鏂欐姤妫�淇℃伅
+     *
      * @param id
      * @return
      */
@@ -402,6 +402,7 @@
 
     /**
      * 鍘熸潗鏂欐斁琛屽厤妫�
+     *
      * @param ifsInventoryId
      * @return
      */
@@ -455,8 +456,9 @@
 
     /**
      * 0, 鏃犳彁绀�, 1鎻愮ず  褰撳墠鎵规鐨勬牱鍝佸凡妫�楠岃繃, 鍙互鍏嶆, 2 鎻愮ず 褰撳墠鎵规鐨勬牱鍝佸凡瓒�20鍚�, 闇�瑕佸绾у娆℃楠�
-     *
+     * <p>
      * 鍘熸潗鏂欎笅鍗曢�氱煡鍏嶆鎴栬�呭娆℃楠�
+     *
      * @param ifsInventoryId
      * @return
      */
@@ -496,6 +498,7 @@
 
     /**
      * 鎶ユ鍙互鏂板鎶ユ淇℃伅
+     *
      * @param ifsInventoryQuantity
      */
     @Override
@@ -507,10 +510,9 @@
     }
 
 
-
-
     /**
      * 閾滃崟涓濅笅鍗曞厤妫�
+     *
      * @param list
      * @param insOrder
      */
@@ -607,6 +609,7 @@
 
     /**
      * 鍘熸潗鏂欒繘鍘傛挙閿�涓嬪崟
+     *
      * @param enterOrderId
      * @return
      */
@@ -645,6 +648,7 @@
 
     /**
      * 鍘熸潗鏂欏搴︽挙閿�涓嬪崟
+     *
      * @param quarterOrderId
      * @return
      */
@@ -685,6 +689,7 @@
 
     /**
      * 鍘熸潗鏂欐姤妫�鍏ㄩ儴淇℃伅瀵煎嚭
+     *
      * @param ifsInventoryQuantityDto
      * @param response
      */
@@ -747,6 +752,7 @@
 
     /**
      * 鍘熸潗鏂欐煡璇㈠彲浠ュ搴︽楠岀殑鍐呭
+     *
      * @param page
      * @param ifsInventoryQuantityDto
      * @return
@@ -765,6 +771,7 @@
 
     /**
      * 鎻愬墠鍏ュ簱
+     *
      * @param ifsInventoryId
      * @return
      */
@@ -792,6 +799,7 @@
 
     /**
      * 娣诲姞宸ユ椂
+     *
      * @param insOrder
      * @param ifsInventoryQuantity
      */

--
Gitblit v1.9.3