From 558f962538eb372d803d89e64c3a025119fbe07f Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期四, 05 十二月 2024 11:51:22 +0800
Subject: [PATCH] 1、fixbug:查询数据丢失, 修改sql查询玻璃总数、实际进笼、破损、缺失 2、修改接口,查询缺片数量以流程为维度返回数据

---
 /dev/null                                                                                                                            |    0 
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassRelationInfoMapper.java            |    2 
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java |    6 ++-
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml                   |   67 ++++++++++-----------------------
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassRelationInfoController.java    |    4 +-
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassRelationInfoService.java          |    2 
 6 files changed, 28 insertions(+), 53 deletions(-)

diff --git a/UI-Project/src/views/UnLoadGlass.rar b/UI-Project/src/views/UnLoadGlass.rar
deleted file mode 100644
index a4932b3..0000000
--- a/UI-Project/src/views/UnLoadGlass.rar
+++ /dev/null
Binary files differ
diff --git a/UI-Project/src/views/UnLoadGlass.zip b/UI-Project/src/views/UnLoadGlass.zip
deleted file mode 100644
index 6435317..0000000
--- a/UI-Project/src/views/UnLoadGlass.zip
+++ /dev/null
Binary files differ
diff --git a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassRelationInfoController.java b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassRelationInfoController.java
index 8a7ed1e..7bddf61 100644
--- a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassRelationInfoController.java
+++ b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassRelationInfoController.java
@@ -36,8 +36,8 @@
 
     @ApiOperation("鏌ヨ鎸囧畾娴佺▼鍗″強灞傛暟鐨勭己鐗囪鎯�")
     @PostMapping("/queryLackByFlowCard")
-    public Result<List<LackDetailsDTO>> queryLackByFlowCard(String flowCardId, int layer) {
-        List<LackDetailsDTO> lackDetailsList = hollowGlassRelationInfoService.queryLackByFlowCard(flowCardId, layer);
+    public Result<Map<Integer, List<LackDetailsDTO>> > queryLackByFlowCard(String flowCardId) {
+        Map<Integer, List<LackDetailsDTO>>  lackDetailsList = hollowGlassRelationInfoService.queryLackByFlowCard(flowCardId);
         return Result.success(lackDetailsList);
     }
 
diff --git a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassRelationInfoMapper.java b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassRelationInfoMapper.java
index 611fd94..639ce9e 100644
--- a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassRelationInfoMapper.java
+++ b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassRelationInfoMapper.java
@@ -22,6 +22,6 @@
 
     List<HollowGlassDetailsDTO> queryFlowCardIdLayerGlassInfo(@Param("flowCardId") String flowCardId, @Param("totalLayer") int totalLayer, @Param("layer") int layer);
 
-    List<LackDetailsDTO> queryLackByFlowCard(String flowCardId, int layer);
+    List<LackDetailsDTO> queryLackByFlowCard(String flowCardId);
 }
 
diff --git a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassRelationInfoService.java b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassRelationInfoService.java
index d5e5f59..193473b 100644
--- a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassRelationInfoService.java
+++ b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassRelationInfoService.java
@@ -30,7 +30,7 @@
 
     Map<String, List<FlowCardGlassInfoDTO>> queryHollowAllFlowCard();
 
-    List<LackDetailsDTO> queryLackByFlowCard(String flowCardId, int layer);
+    Map<Integer, List<LackDetailsDTO>>  queryLackByFlowCard(String flowCardId);
 
 }
 
diff --git a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
index 8bb8edc..f7c5a54 100644
--- a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
+++ b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
@@ -243,8 +243,10 @@
     }
 
     @Override
-    public List<LackDetailsDTO> queryLackByFlowCard(String flowCardId, int layer) {
-        return this.baseMapper.queryLackByFlowCard(flowCardId, layer);
+    public Map<Integer, List<LackDetailsDTO>>  queryLackByFlowCard(String flowCardId) {
+        List<LackDetailsDTO> lackDetailsList = this.baseMapper.queryLackByFlowCard(flowCardId);
+        Map<Integer, List<LackDetailsDTO>> listMap = lackDetailsList.stream().collect(Collectors.groupingBy(LackDetailsDTO::getLayer));
+        return listMap;
     }
 
 }
diff --git a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml
index 800ad1e..33b44fd 100644
--- a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml
+++ b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml
@@ -39,52 +39,25 @@
     </update>
 
     <select id="hollowIsAll" resultMap="baseMap">
-        WITH sum_flow_layer_count AS (
-        SELECT
-        flow_card_id,
-        layer,
-        min( films_id ) AS films_id,
-        count(*) AS sum_count
-        FROM
-        hollow_glass_relation_info
-        GROUP BY
-        flow_card_id,
-        layer
-        ),
-        real_flow_layer_count AS (
-        SELECT
-        flow_card_id,
-        layer,
-        count(*) AS real_count
-        FROM
-        hollow_glass_relation_info
-        WHERE
-        tempering_layout_id IS NOT NULL
-        AND tempering_feed_sequence IS NOT NULL
-        GROUP BY
-        flow_card_id,
-        layer
-        ),
-        damage_flow_layer_count AS ( SELECT process_id AS flow_card_id, technology_number AS layer, count(*)
-        damage_count FROM damage GROUP BY process_id, technology_number ),
+        WITH sum_flow_layer_count AS ( SELECT flow_card_id, layer, min( films_id ) AS films_id, count(*) AS sum_count FROM hollow_glass_relation_info GROUP BY flow_card_id, layer ),
+        real_flow_layer_count AS ( SELECT flow_card_id, layer, count(*) AS real_count FROM hollow_glass_relation_info WHERE tempering_layout_id IS NOT NULL AND tempering_feed_sequence IS NOT NULL GROUP BY flow_card_id, layer ),
+        damage_flow_layer_count AS ( SELECT process_id AS flow_card_id, technology_number AS layer, count(*) as damage_count FROM damage GROUP BY process_id, technology_number )
+        ,
         lack_flow_layer_count AS (
         SELECT
         t.flow_card_id,
         t.layer,
-        ( sum_count - real_count - damage_count ) AS lack_count
+        ifnull((sum_count - real_count - ifnull(damage_count,0)),0) AS lack_count
         FROM
         sum_flow_layer_count t
-        INNER JOIN real_flow_layer_count t1 ON t.flow_card_id = t1.flow_card_id
+        left JOIN real_flow_layer_count t1 ON t.flow_card_id = t1.flow_card_id
         AND t.layer = t1.layer
-        INNER JOIN damage_flow_layer_count t2 ON t1.flow_card_id = t2.flow_card_id
+        left JOIN damage_flow_layer_count t2 ON t1.flow_card_id = t2.flow_card_id
         AND t1.layer = t2.layer
         ),
-        layer_one AS ( SELECT * FROM hollow_glass_relation_info WHERE layer = 1 AND tempering_layout_id IS NOT NULL AND
-        tempering_feed_sequence IS NOT NULL ),
-        layer_two AS ( SELECT * FROM hollow_glass_relation_info WHERE layer = 2 AND tempering_layout_id IS NOT NULL AND
-        tempering_feed_sequence IS NOT NULL ),
-        layer_three AS ( SELECT * FROM hollow_glass_relation_info WHERE layer = 3 AND tempering_layout_id IS NOT NULL
-        AND tempering_feed_sequence IS NOT NULL )
+        layer_one AS ( SELECT * FROM hollow_glass_relation_info WHERE layer = 1 AND tempering_layout_id IS NOT NULL AND tempering_feed_sequence IS NOT NULL ),
+        layer_two AS ( SELECT * FROM hollow_glass_relation_info WHERE layer = 2 AND tempering_layout_id IS NOT NULL AND tempering_feed_sequence IS NOT NULL ),
+        layer_three AS ( SELECT * FROM hollow_glass_relation_info WHERE layer = 3 AND tempering_layout_id IS NOT NULL AND tempering_feed_sequence IS NOT NULL )
         ,
         pair_flow_layer_count AS (
         SELECT
@@ -102,25 +75,25 @@
         </if>
         GROUP BY
         t.flow_card_id
-        )
-        ,result_flow_layer_count AS (
+        ),
+        result_flow_layer_count AS (
         SELECT
         t.flow_card_id,
         t.layer,
         t.films_id,
         sum_count,
-        t3.pair_count,
-        IFNULL(real_count,0) as real_count,
-        IFNULL(damage_count,0) as damage_count,
-        IFNULL(lack_count,0) as lack_count
+        IFNULL( t3.pair_count, 0 ) AS pair_count,
+        IFNULL( real_count, 0 ) AS real_count,
+        IFNULL( damage_count, 0 ) AS damage_count,
+        IFNULL( lack_count, 0 ) AS lack_count
         FROM
         sum_flow_layer_count t
-        left JOIN real_flow_layer_count t1 ON t.flow_card_id = t1.flow_card_id
+        LEFT JOIN real_flow_layer_count t1 ON t.flow_card_id = t1.flow_card_id
         AND t.layer = t1.layer
-        left JOIN lack_flow_layer_count t2 ON t.flow_card_id = t2.flow_card_id
+        LEFT JOIN lack_flow_layer_count t2 ON t.flow_card_id = t2.flow_card_id
         AND t.layer = t2.layer
-        left JOIN pair_flow_layer_count t3 ON t.flow_card_id = t3.flow_card_id
-        left JOIN damage_flow_layer_count t4 ON t.flow_card_id = t4.flow_card_id
+        LEFT JOIN pair_flow_layer_count t3 ON t.flow_card_id = t3.flow_card_id
+        LEFT JOIN damage_flow_layer_count t4 ON t.flow_card_id = t4.flow_card_id
         AND t.layer = t4.layer
         ) SELECT
         *

--
Gitblit v1.8.0