From 088ceb9faf6f1d0d9f57bb9cd65f542337d40b7f Mon Sep 17 00:00:00 2001
From: XiaoRuby <3114200645@qq.com>
Date: 星期四, 07 九月 2023 15:30:56 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/ProcessInspectServiceImpl.java |   89 +++-----------------------------------------
 1 files changed, 6 insertions(+), 83 deletions(-)

diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/ProcessInspectServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/ProcessInspectServiceImpl.java
index ca30a73..8756848 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/ProcessInspectServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/ProcessInspectServiceImpl.java
@@ -13,6 +13,7 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -29,15 +30,6 @@
 
     @Resource
     ProcessInspectMapper processInspectMapper;
-
-    @Resource
-    MaterialMapper materialMapper;
-
-    @Resource
-    StandardService standardService;
-
-    @Resource
-    SpecificationsService specificationsService;
 
     @Resource
     ProductService productService;
@@ -67,14 +59,16 @@
         BeanUtils.copyProperties(processInspectVo, processInspect);
         processInspectMapper.insert(processInspect);
         /*鎵归噺鏂板杩囩▼妫�楠岄」鐩〃*/
-        //鑾峰彇鍨嬪彿id
+        /*//鑾峰彇鍨嬪彿id
         Integer specificationId = getSpecificationId(processInspectVo.getMaterial(), processInspectVo.getMaterialCode(), processInspectVo.getSpecificationsModel());
         //鏌ヨ鏍囧噯BOM鎶�鏈寚鏍囦腑璇ュ瀷鍙峰伐鑹轰笅鏈�鏂扮増鏈殑妫�楠岄」鐩�
-        Integer ver = productService.selectVerByPro(specificationId).get(0);//璇ュ瀷鍙蜂笅鎶�鏈寚鏍囨渶鏂扮増鏈�
-        List<Product> productList = productService.selProByVerSpe(processInspectVo.getTechnologyId(), ver);
+        Integer ver = productService.selectVerByPro(specificationId).get(0);//璇ュ瀷鍙蜂笅鎶�鏈寚鏍囨渶鏂扮増鏈�*/
+        List<Product> productList = productService.selProByVerSpe(processInspectVo.getTechnologyId());
         List<InspectionItem> inspectionItemList = productList.stream().map(product -> {
             InspectionItem inspectionItem = new InspectionItem();
             BeanUtils.copyProperties(product, inspectionItem);
+            inspectionItem.setCreateTime(new Date());
+            inspectionItem.setUpdateTime(new Date());
             inspectionItem.setInspectId(processInspect.getId());
             inspectionItem.setType(1);
             return inspectionItem;
@@ -130,76 +124,5 @@
         return processInspectMapper.selectProcessInspectsList(page,techfather,result,name);
     }
 
-
-    /*鏍规嵁鏍峰搧鍚嶇О,鏍峰搧缂栧彿,鍨嬪彿瑙勬牸鑾峰彇鍨嬪彿id*/
-    private Integer getSpecificationId(String name, String mcode, String specification) {
-        //鑾峰彇鐗╂枡id
-        Material material = materialMapper.selectOne(Wrappers.<Material>query()
-                .eq("name", name)
-                .eq("code", mcode));
-        if (Objects.isNull(material)) {
-            return null;
-        }
-        //鑾峰彇瑙勬牸鍚嶇О鍜屽瀷鍙峰悕绉�
-        String[] split = specification.split("-");
-        String stName = split[0];
-        String spName = split[1];
-        //鑾峰彇瑙勬牸id
-        Standard standard = standardService.getOne(Wrappers.<Standard>query()
-                .eq("name", stName)
-                .eq("material_id", material.getId()));
-        //鑾峰彇鍨嬪彿id
-        Specifications specifications = specificationsService.getOne(Wrappers.<Specifications>query()
-                .eq("name", spName)
-                .eq("standard_id", standard.getId()));
-        return specifications.getId();
-    }
-
-    /*鍒ゆ柇妫�娴嬪�兼槸鍚︽弧瓒虫爣鍑嗗�煎拰鍐呮帶鍊肩殑瑕佹眰,濡傛灉涓嶆弧瓒冲垯妫�楠岀粨璁轰负涓嶅悎鏍�*/
-    private int checkValues(String standardValueStr, String controlValueStr, String detectionValueStr) {
-        boolean isStandardValueSatisfied = isValueSatisfied(standardValueStr, detectionValueStr);
-        boolean isControlValueSatisfied = isValueSatisfied(controlValueStr, detectionValueStr);
-
-        if (isStandardValueSatisfied && isControlValueSatisfied) {
-            return 1;
-        } else {
-            return 0;
-        }
-    }
-
-    private boolean isValueSatisfied(String valueStr, String detectionValueStr) {
-        String substring = valueStr.substring(1, 2);
-        if (substring.equals("=")) {
-            String operator = valueStr.substring(0, 2);
-            Double standardValue = Double.parseDouble(valueStr.substring(2));
-            Double detectionValue = Double.parseDouble(detectionValueStr);
-            switch (operator) {
-                case ">=":
-                    return detectionValue >= standardValue;
-                case "<=":
-                    return detectionValue <= standardValue;
-                default:
-                    return false;
-            }
-        } else {
-            String operator = valueStr.substring(0, 1);
-            Double standardValue = Double.parseDouble(valueStr.substring(1));
-            Double detectionValue = Double.parseDouble(detectionValueStr);
-            switch (operator) {
-                case ">":
-                    return detectionValue > standardValue;
-                case "鈮�":
-                    return detectionValue >= standardValue;
-                case "鈮�":
-                    return detectionValue <= standardValue;
-                case "<":
-                    return detectionValue < standardValue;
-                case "=":
-                    return detectionValue.equals(standardValue);
-                default:
-                    return false;
-            }
-        }
-    }
 }
 

--
Gitblit v1.9.3