From 804c80b0fd284c7464066efbd5e5833ddacfb635 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期五, 11 四月 2025 13:11:16 +0800
Subject: [PATCH] 原辅材下单优化

---
 basic-server/src/main/java/com/ruoyi/basic/service/impl/IfsInventoryQuantityServiceImpl.java |    5 ++
 basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java  |   60 ++++++++++++++++++++++++------
 2 files changed, 53 insertions(+), 12 deletions(-)

diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/IfsInventoryQuantityServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/IfsInventoryQuantityServiceImpl.java
index cff3fb3..9841424 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/IfsInventoryQuantityServiceImpl.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/IfsInventoryQuantityServiceImpl.java
@@ -4,6 +4,8 @@
 import com.ruoyi.basic.mapper.*;
 import com.ruoyi.basic.pojo.*;
 import com.ruoyi.basic.service.*;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.system.mapper.SysUserMapper;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 
@@ -16,8 +18,11 @@
 
     private IfsInventoryQuantityMapper ifsInventoryQuantityMapper;
 
+    private SysUserMapper sysUserMapper;
+
     @Override
     public int addIfsInventory(IfsInventoryQuantity ifsInventoryQuantity) {
+//        ifsInventoryQuantity.setDeclareUser(sysUserMapper.sel);
         ifsInventoryQuantity.setDeclareDate(LocalDateTime.now());
         if (ifsInventoryQuantity.getId() ==null){
             ifsInventoryQuantity.setState(0);
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java
index 94fcbd8..7603c55 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java
@@ -133,18 +133,54 @@
                                 if (Objects.equals(a.getBsm(), "1")) {
                                     return true;
                                 } else {
-                                    if (sections.get(i).contains("&")) {
-                                        String[] split = sections.get(i).split("&");
-                                        isIf = getIsIf(split[0], modelNum, cores.get(i), conductorMaterials.get(i), conductorTypes.get(i), insSample)
-                                                && getIsIf(split[1], modelNum, cores.get(i), conductorMaterials.get(i), conductorTypes.get(i), insSample);
-                                    } else {
-                                        isIf = getIsIf(sections.get(i), modelNum, cores.get(i), conductorMaterials.get(i), conductorTypes.get(i), insSample);
+                                    int firstIndex = a.getTree().indexOf(" - ");
+                                    String result2 = null;
+                                    if (firstIndex != -1) {
+                                        int secondIndex = a.getTree().indexOf(" - ", firstIndex + 3);
+                                        if (secondIndex != -1) {
+                                            int thirdIndex = a.getTree().indexOf(" - ", secondIndex + 3);
+                                            if (thirdIndex != -1) {
+                                                result2 = a.getTree().substring(secondIndex + 3, thirdIndex);
+                                            }
+                                        }
                                     }
-                                    if (isIf) {
-                                        a.setSection(sections.get(i));
-                                        a.setAsk(asks.get(i));
-                                        a.setTell(tells.get(i));
-                                        return true;
+                                    // 鍒ゆ柇  鍘熻緟鏉�  鍖呮潗
+                                    Set<String> targetStrings = new HashSet<>();
+                                    targetStrings.add("鍘熻緟鏉�");
+                                    targetStrings.add("鍖呮潗");
+                                    boolean isType;
+                                    isType = targetStrings.contains(result2);
+                                    if (isType) {
+                                        if (StringUtils.isNotEmpty(modelNum)){
+                                            String currentSection = sections.get(i);
+                                            String sectionValue = currentSection;
+                                            int equalIndex = currentSection.indexOf("=");
+                                            if (equalIndex != -1) {
+                                                sectionValue = currentSection.substring(equalIndex + 1);
+                                            }
+                                            if (modelNum.equals(sectionValue)) {
+                                                a.setSection(sections.get(i));
+                                                a.setAsk(asks.get(i));
+                                                a.setTell(tells.get(i));
+                                                return true;
+                                            }
+                                        }else {
+                                            return false;
+                                        }
+                                    } else {
+                                        if (sections.get(i).contains("&")) {
+                                            String[] split = sections.get(i).split("&");
+                                            isIf = getIsIf(split[0], modelNum, cores.get(i), conductorMaterials.get(i), conductorTypes.get(i), insSample)
+                                                    && getIsIf(split[1], modelNum, cores.get(i), conductorMaterials.get(i), conductorTypes.get(i), insSample);
+                                        } else {
+                                            isIf = getIsIf(sections.get(i), modelNum, cores.get(i), conductorMaterials.get(i), conductorTypes.get(i), insSample);
+                                        }
+                                        if (isIf) {
+                                            a.setSection(sections.get(i));
+                                            a.setAsk(asks.get(i));
+                                            a.setTell(tells.get(i));
+                                            return true;
+                                        }
                                     }
                                 }
                             }
@@ -213,7 +249,7 @@
             if (StringUtils.isNotEmpty(productPart.getInspectionItem())) {
                 String inspectionItem = productPart.getInspectionItem();
                 list = list.stream()
-                        .filter(standardProductList -> inspectionItem.equals(standardProductList.getInspectionItem()))
+                        .filter(standardProductList -> inspectionItem.contains(standardProductList.getInspectionItem()))
                         .collect(Collectors.toList());
             }
         }

--
Gitblit v1.9.3