From e19d95da199d0d9e30d14b0a23c0470e37fd1883 Mon Sep 17 00:00:00 2001
From: 严智鑫 <test>
Date: 星期一, 19 八月 2024 08:51:32 +0800
Subject: [PATCH] 工程实体类移到 公共里

---
 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/mapper/DownGlassInfoMapper.xml |   46 ++++++++++++++++++++++++++++++++--------------
 1 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/mapper/DownGlassInfoMapper.xml b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/mapper/DownGlassInfoMapper.xml
index 76a9216..c633e7d 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/mapper/DownGlassInfoMapper.xml
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/mapper/DownGlassInfoMapper.xml
@@ -10,7 +10,7 @@
     <resultMap id="downGlassInfo" type="com.mes.downworkstation.entity.dto.DownGlassInfoDTO">
         <result column="flow_card_id" property="flowCardId"/>
         <result column="layer" property="layer"/>
-        <result column="count" property="count"/>
+        <result column="racks_number" property="racksNumber"/>
         <collection property="glassInfoList" ofType="com.mes.glassinfo.entity.GlassInfo">
             <id column="id" property="id"/>
             <result column="flow_card_id" property="flowCardId"/>
@@ -38,38 +38,56 @@
         order by count desc limit 1
     </select>
     <select id="queryMaxSequence" resultType="java.lang.Integer">
-        SELECT max(sequence) + 1 as sequence
+        SELECT COALESCE(max(sequence) + 1, 1) as sequence
         FROM down_glass_info
         WHERE flow_card_id = #{flowCardId}
           AND layer = #{layer}
     </select>
 
     <select id="queryWorkStationIsIn" resultMap="downGlassInfo">
-        SELECT T.*
+        SELECT
+        T.FLOW_CARD_ID,
+        T.LAYER,
+        T.RACKS_NUMBER
         <if test="!isDownload">
             ,T1.*
         </if>
-        FROM (
-        SELECT T.FLOW_CARD_ID,
-        T.LAYER,
-        COUNT(T.LAYER) AS COUNT
         FROM
         DOWN_WORKSTATION T
-        LEFT JOIN DOWN_GLASS_INFO T1 ON T.FLOW_CARD_ID = T1.FLOW_CARD_ID
-        GROUP BY T.FLOW_CARD_ID,LAYER
-        HAVING T.FLOW_CARD_ID IS NOT NULL
-        ) T
         INNER JOIN GLASS_INFO T1 ON T.FLOW_CARD_ID = T1.FLOW_CARD_ID
         AND T.LAYER = T1.LAYER
         LEFT JOIN DOWN_GLASS_INFO T2 ON T1.GLASS_ID = T2.GLASS_ID
         <where>
-            <if test="isDownload">
+            t.workstation_id in
+            <foreach collection="workList" item="item" open='(' close=')' separator=','>
+                #{item}
+            </foreach>
+            <if test="!isDownload">
                 AND T2.GLASS_ID IS NULL
             </if>
-            <if test="!isDownload">
+            <if test="isDownload">
                 AND T2.GLASS_ID IS not NULL
             </if>
+
         </where>
-        order by t.count desc
+        ORDER BY
+        T.RACKS_NUMBER DESC,
+        T1.TEMPERING_LAYOUT_ID,
+        T1.TEMPERING_FEED_SEQUENCE DESC
+    </select>
+    <select id="queryWorkStationFlowCard" resultMap="downGlassInfo">
+        SELECT
+        T.FLOW_CARD_ID,
+        T.LAYER,
+        T.RACKS_NUMBER
+        FROM
+        DOWN_WORKSTATION T
+        where
+        (t.flow_card_id is not null and t.flow_card_id != '')
+        and t.workstation_id in
+        <foreach collection="workList" item="item" open='(' close=')' separator=','>
+            #{item}
+        </foreach>
+        ORDER BY T.RACKS_NUMBER DESC
     </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0