From 1195e51e67436cf2b9513678b5e9d3f27a043de4 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期一, 22 十二月 2025 08:29:40 +0800
Subject: [PATCH] 1、中空选中除膜改为多选 2、流程卡报工情况查询添加工程号条件,添加线路,备注显示

---
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml |  107 ++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 69 insertions(+), 38 deletions(-)

diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
index aafab27..4d66e4d 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
@@ -43,7 +43,7 @@
         t.filmsId,
         t.thickness,
         case
-        when type in (7, 8) and status = 1 then ''
+        when type in (8, 9) and status = 1 then ''
         else t1.working_procedure end as working_procedure,
         ROW_NUMBER() OVER (PARTITION BY t1.glass_id ORDER BY t1.id DESC) as rn
         FROM detail_temp t
@@ -72,50 +72,47 @@
              detail_temp AS (
                  SELECT t.*
                  FROM glass_temp t
-                 WHERE NOT EXISTS (
+                 WHERE NOT EXISTS(
                          SELECT 1
                          FROM hollow_big_storage_cage_details t1
                          WHERE t1.glass_id = t.glass_id
-                           AND t1.state NOT IN (8,9)
+                           AND t1.state NOT IN (8, 9)
                      )
              ),
              damage_latest AS (
-                 SELECT
-                     dr.glass_id,
-                     dr.type,
-                     dr.status
+                 SELECT dr.glass_id,
+                        dr.type,
+                        dr.status
                  FROM (
-                          SELECT
-                              t1.glass_id,
-                              t1.type,
-                              t1.status,
-                              ROW_NUMBER() OVER(PARTITION BY t1.glass_id ORDER BY t1.id DESC) as rn
+                          SELECT t1.glass_id,
+                                 t1.type,
+                                 t1.status,
+                                 ROW_NUMBER() OVER(PARTITION BY t1.glass_id ORDER BY t1.id DESC) as rn
                           FROM detail_temp t
                                    INNER JOIN damage t1 ON t.flow_card_id = t1.process_id
                       ) dr
                  WHERE dr.rn = 1
              ),
              result_temp AS (
-                 SELECT
-                     t.flow_card_id,
-                     t.layer,
-                     t.glass_type,
-                     t.thickness,
-                     t.filmsId,
-                     t.width,
-                     t.height,
-                     COUNT(DISTINCT t.glass_id) as lack_count,
-                     COUNT(DISTINCT CASE WHEN t1.type IN (7,8) AND t1.status = 1 THEN t.glass_id END) as damage_count
+                 SELECT t.flow_card_id,
+                        t.layer,
+                        t.glass_type,
+                        t.thickness,
+                        t.filmsId,
+                        t.width,
+                        t.height,
+                        COUNT(DISTINCT t.glass_id)                                                        as lack_count,
+                        COUNT(DISTINCT
+                              CASE WHEN t1.type IN (8, 9) AND t1.status = 1 THEN t.glass_id END)          as damage_count
                  FROM detail_temp t
                           LEFT JOIN damage_latest t1 ON t.glass_id = t1.glass_id
-                 GROUP BY
-                     t.flow_card_id,
-                     t.layer,
-                     t.glass_type,
-                     t.thickness,
-                     t.filmsId,
-                     t.width,
-                     t.height
+                 GROUP BY t.flow_card_id,
+                          t.layer,
+                          t.glass_type,
+                          t.thickness,
+                          t.filmsId,
+                          t.width,
+                          t.height
              )
         SELECT *
         FROM result_temp
@@ -137,7 +134,7 @@
            , detail_temp as (
             select t.*
             from glass_temp t
-                     left join hollow_big_storage_cage_details t1 on t.glass_id = t1.glass_id and t1.state  not in (8,9)
+                     left join hollow_big_storage_cage_details t1 on t.glass_id = t1.glass_id and t1.state not in (8, 9)
             where t1.glass_id is null
         )
            , damage_ranked AS (
@@ -150,7 +147,7 @@
                    t.filmsId,
                    t.thickness,
                    case
-                       when type in (7, 8) and status = 1 then ''
+                       when type in (8, 9) and status = 1 then ''
                        else t1.working_procedure end as working_procedure,
                    ROW_NUMBER()                         OVER (PARTITION BY t1.glass_id ORDER BY t1.id DESC) as rn
             FROM detail_temp t
@@ -164,17 +161,51 @@
         select *
         from damage_latest
     </select>
+    <select id="queryLackByFlowCardByERP" resultType="com.mes.hollow.entity.dto.LackDetailsDTO">
+        WITH RECURSIVE nums(n) AS (
+        SELECT 1
+        UNION ALL
+        SELECT n + 1 FROM nums WHERE n &lt; (SELECT MAX(quantity) FROM (
+        <foreach collection="flowCardIdList" item="item" separator="UNION ALL">
+            SELECT #{item.lackQuantity} AS quantity
+        </foreach>
+        ) t)
+        )
+        <foreach collection="flowCardIdList" item="item" separator="UNION ALL">
+            SELECT t1.*
+            FROM (
+            SELECT
+            g.flow_card_id AS flowCardId,
+            g.layer AS layer,
+            g.glass_type AS glassType,
+            g.filmsid AS filmsId,
+            g.width AS width,
+            g.height AS height,
+            g.thickness AS thickness
+            FROM glass_info g
+            WHERE g.flow_card_id = #{item.processId}
+            AND g.layer = #{item.technologyNumber}
+            AND g.glass_type = #{item.orderNumber}
+            LIMIT 1
+            ) t1
+            CROSS JOIN nums
+            WHERE nums.n &lt;= #{item.lackQuantity}
+        </foreach>
+    </select>
 
 
     <update id="clearDirtyFlowCardData">
-        update tempering_glass_relation_info
-        set shelf_order = null
-          , state       = 0
+        update hollow_glass_relation_info
+        set glass_id                = null,
+            tempering_layout_id     = null,
+            tempering_feed_sequence = null,
+            engineer_id             = null,
+            state                   = 0
         where flow_card_id = #{flowCardId}
           and layer = #{layer}
-          and shelf_order not in (
-            select shelf_order
-            from vertical_sheet_cage_details
+          and glass_id not in (
+            select glass_id
+            from hollow_big_storage_cage_details
             where flow_card_id = #{flowCardId}
               and layer = #{layer}
               and state in (100, 102, 103, 104)

--
Gitblit v1.8.0