From c542e5b9cf09e192d8a13cb955703857e9558ccc Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期六, 11 十月 2025 08:43:08 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

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

diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
index 57ecafc..afee4ad 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
@@ -15,6 +15,38 @@
     </resultMap>
 
     <select id="queryLackByFlowCard" resultMap="lackBaseMap">
+    <select id="queryFlowCardIdMaxLayerGlassInfo" resultMap="baseMap">
+        with temp_flow as (SELECT t.process_id,
+                                  t.order_id,
+                                  t.order_number,
+                                  t.technology_number,
+                                  t.quantity,
+                                  t1.child_width,
+                                  t1.child_height
+
+                           from pp.flow_card t
+                                    LEFT JOIN sd.order_glass_detail t1
+                                              on t.order_id = t1.order_id
+                                                  and t.order_number = t1.order_number
+                                                  and t.technology_number = t1.technology_number
+                           where t.process_id = #{flowCardId}),
+             glass_info_temp as (
+                 select process_id,
+                        order_id,
+                        GREATEST(child_width, child_height) as first_length,
+                        least(child_width, child_height)    as second_length,
+                        child_width,
+                        child_height,
+                        order_number,
+                        technology_number,
+                        quantity
+                 from temp_flow
+                 where technology_number = #{totalLayer}
+             )
+        select row_number() over (order by second_length desc,first_length desc) as rn, t.*
+        from glass_info_temp t
+    </select>
+    <select id="queryAllLackByFlowCard" resultMap="lackBaseMap">
         with flow_card_id_info as (
             select distinct flow_card_id from hollow_big_storage_cage_details where state = 100
         ),
@@ -87,6 +119,51 @@
         where t.flow_card_id=#{flowCardId} and t.glass_type=#{orderSort} and t.layer=#{layer} and t1.glass_id is null
         and t2.glass_id is null
     </select>
+    <select id="queryLackByFlowCard" resultType="com.mes.hollow.entity.dto.LackDetailsDTO">
+        with hollow_flow_temp AS (
+            SELECT DISTINCT flow_card_id
+            FROM hollow_big_storage_cage_details
+            WHERE state = 100
+        <if test="flowCardId != null and flowCardId != ''">
+            and flow_card_id = #{flowCardId}
+        </if>
+        )
+           , glass_temp as (
+            select t1.*
+            from hollow_flow_temp t
+                     INNER JOIN glass_info t1 on t.flow_card_id = t1.flow_card_id
+        )
+           , detail_temp as (
+            select t.*
+            from glass_temp t
+                     left join hollow_big_storage_cage_details t1 on t.glass_id = t1.glass_id
+            where t1.glass_id is null
+        )
+           , damage_ranked AS (
+            SELECT t.flow_card_id,
+                   t.layer,
+                   t.glass_id,
+                   t.glass_type,
+                   t.width,
+                   t.height,
+                   t.filmsId,
+                   t.thickness,
+                   case
+                       when type in (7, 8) 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
+                     inner join damage t1 on t.glass_id = t1.glass_id
+        )
+           , damage_latest AS (
+            SELECT *
+            FROM damage_ranked
+            WHERE rn = 1
+        )
+        select *
+        from damage_latest
+
+    </select>
 
     <update id="clearDirtyFlowCardData">
         update tempering_glass_relation_info

--
Gitblit v1.8.0