From 7ba23e6e4870465855d80d026cf31490e0f8d427 Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期一, 22 九月 2025 11:20:47 +0800
Subject: [PATCH] 中空一线、二线。三线页面改造

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

diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
index cab76b1..3efc604 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
@@ -13,12 +13,15 @@
     <resultMap id="lackBaseMap" type="com.mes.hollow.entity.dto.LackDetailsDTO">
         <result column="flow_card_id" property="flowCardId"/>
         <result column="layer" property="layer"/>
+        <result column="order_sort" property="glassType"/>
         <result column="films_id" property="filmsId"/>
         <result column="first_length" property="width"/>
         <result column="second_Length" property="height"/>
         <result column="thickness" property="thickness"/>
-        <result column="lack_cout" property="lackCount"/>
+        <result column="lack_count" property="lackCount"/>
+        <result column="damage_count" property="damageCount"/>
     </resultMap>
+
     <select id="queryFlowCardIdMaxLayerGlassInfo" resultMap="baseMap">
         with temp_flow as (SELECT t.process_id,
                                   t.order_id,
@@ -106,6 +109,7 @@
         with relation_length as (
             select flow_card_id,
                    layer,
+                   order_sort,
                    tempering_layout_id,
                    tempering_feed_sequence,
                    GREATEST(width, height) as first_length,
@@ -118,14 +122,75 @@
             where flow_card_id = #{flowCardId}
               and tempering_layout_id is null
               and tempering_feed_sequence is null
-        )
-        select flow_card_id, layer, first_length, films_id, second_Length, thickness, count(*) as lack_cout
-        from relation_length
-        group by flow_card_id, layer, films_id, first_length, second_Length, thickness
+        ),
+             lack_count_temp as (
+                 select flow_card_id,
+                        layer,
+                        order_sort,
+                        first_length,
+                        films_id,
+                        second_Length,
+                        thickness,
+                        count(*) as lack_count
+                 from relation_length
+                 group by flow_card_id, layer, order_sort, films_id, first_length, second_Length, thickness
+             ),
+             damage_count_temp as (
+                 select process_id        as flow_card_id,
+                        technology_number as layer,
+                        order_number      as order_sort,
+                        count(1)          as damage_count
+                 from damage
+                 where process_id = #{flowCardId} and type in (8,9) and status &lt; 3
+                 group by process_id, technology_number, order_number
+             ),
+             result_count as (
+                 select t.*, IFNULL(t1.damage_count, 0) damage_count
+                 from lack_count_temp t
+                          left join damage_count_temp t1 on t.flow_card_id = t1.flow_card_id and t.layer = t1.layer and
+                                                            t.order_sort = t1.order_sort
+             )
+        select *
+        from result_count
     </select>
     <select id="queryLayerByFlowCardId" resultType="java.lang.Integer">
         select count(distinct layer)
         from hollow_glass_relation_info
         where flow_card_id = #{flowCardId}
     </select>
+    <select id="queryProductNameByFlowCardId" resultType="com.mes.hollow.entity.dto.OrderDetailsDTO">
+        select t.product_name, t1.customer_name
+        from sd.order_detail t
+        inner join sd.order t1 on t.order_id = t1.order_id
+        where (t.order_id, t.order_number) = (
+        select min(order_id) as order_id, min(order_number) as order_number
+        from pp.flow_card
+        where process_id = #{flowCardId}
+        <if test="productName != null and productName != ''">
+            and t.product_name like concat('%', #{productName}, '%')
+        </if>
+        <if test="customerName != null and customerName != ''">
+            and t1.customer_name like concat('%', #{customerName}, '%')
+        </if>
+        )
+        limit 1
+    </select>
+
+    <update id="clearDirtyFlowCardData">
+        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 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)
+        )
+    </update>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0