From fd35c0ee025e8f5471acd4075af33b9f59f4d817 Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期四, 05 十二月 2024 13:39:11 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/YiWuProject
---
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml | 127 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 114 insertions(+), 13 deletions(-)
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml
index 8306c6f..9611a10 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml
@@ -13,9 +13,21 @@
<result column="engineer_id" property="engineerId"/>
<result column="tempering_layout_id" property="temperingLayoutId"/>
<result column="slot" property="slot"/>
+ <result column="glass_count" property="glassCount"/>
<result column="max_sequence" property="maxSequence"/>
<result column="min_sequence" property="minSequence"/>
<result column="remain_width" property="remainWidth"/>
+ </resultMap>
+
+ <resultMap id="virtualSlotSequenceDTO" type="com.mes.bigstorage.entity.dto.BigStorageRelationDTO">
+ <result column="engineer_id" property="engineerId"/>
+ <result column="tempering_layout_id" property="temperingLayoutId"/>
+ <result column="virtual_slot" property="virtualSlot"/>
+ </resultMap>
+ <resultMap id="baseSlotSequenceDTO" type="com.mes.bigstorage.entity.dto.BigStorageSequenceDTO">
+ <result column="slot" property="slot"/>
+ <result column="max_sequence" property="maxSequence"/>
+ <result column="min_sequence" property="minSequence"/>
</resultMap>
<select id="temperingIsAll" resultMap="temperingLayoutDTO">
@@ -24,33 +36,36 @@
SELECT T.ENGINEER_ID,
T.TEMPERING_LAYOUT_ID,
COUNT(T.TEMPERING_FEED_SEQUENCE) AS COUNT
- FROM
- GLASS_INFO T
- LEFT JOIN DAMAGE T1
- ON T.ENGINEER_ID = T1.ENGINEER_ID
- AND T.GLASS_ID = T1.GLASS_ID
- WHERE
- T1.GLASS_ID IS NULL
- GROUP BY
- T.ENGINEER_ID,
- T.TEMPERING_LAYOUT_ID
+ FROM GLASS_INFO T
+ LEFT JOIN DAMAGE T1
+ ON T.ENGINEER_ID = T1.ENGINEER_ID
+ AND T.GLASS_ID = T1.GLASS_ID
+ AND (T1.TYPE = 8
+ OR T1.TYPE = 9)
+ WHERE T1.GLASS_ID IS NULL
+ GROUP BY T.ENGINEER_ID,
+ T.TEMPERING_LAYOUT_ID
) T2
INNER JOIN (SELECT ENGINEER_ID, TEMPERING_LAYOUT_ID, COUNT(TEMPERING_FEED_SEQUENCE) AS COUNT
FROM BIG_STORAGE_CAGE_DETAILS
- WHERE STATE in (100, 101, 102)
+ WHERE STATE in (100)
GROUP BY ENGINEER_ID, TEMPERING_LAYOUT_ID) T3 ON T2.ENGINEER_ID = T3.ENGINEER_ID
AND T2.TEMPERING_LAYOUT_ID = T3.TEMPERING_LAYOUT_ID
AND T2.COUNT = T3.COUNT
+ INNER JOIN ENGINEERING T4 ON T2.ENGINEER_ID = T4.ENGINEER_ID
+ ORDER BY T4.ID, T2.TEMPERING_LAYOUT_ID
</select>
<select id="queryTemperingOccupySlot" resultMap="temperingLayoutDTO">
- SELECT TEMPERING_LAYOUT_ID,
+ SELECT ENGINEER_ID,
+ TEMPERING_LAYOUT_ID,
COUNT(DISTINCT SLOT) as SLOT_COUNT
FROM BIG_STORAGE_CAGE_DETAILS
WHERE STATE = 100
GROUP BY ENGINEER_ID,
TEMPERING_LAYOUT_ID
- HAVING SLOT_COUNT >= #{count} LIMIT 1
+ HAVING SLOT_COUNT >= #{count}
+ ORDER BY SLOT_COUNT DESC
</select>
<select id="queryGlassMaxAndMin" resultMap="slotSequenceDTO">
SELECT T.*,
@@ -59,6 +74,7 @@
SELECT ENGINEER_ID,
TEMPERING_LAYOUT_ID,
SLOT,
+ count(*) as glass_count,
MAX(TEMPERING_FEED_SEQUENCE) AS MAX_SEQUENCE,
MIN(TEMPERING_FEED_SEQUENCE) AS MIN_SEQUENCE
FROM BIG_STORAGE_CAGE_DETAILS
@@ -71,4 +87,89 @@
INNER JOIN BIG_STORAGE_CAGE T1 ON T.SLOT = T1.SLOT
ORDER BY T.MAX_SEQUENCE DESC
</select>
+
+ <update id="updateBySlot">
+ update big_storage_cage_details
+ <set>
+ state = #{state}
+ </set>
+ <where>
+ (glass_id,slot) in (
+ <foreach collection="list" item="item" separator=",">
+ (#{item.glassId}, #{item.targetSlot})
+ </foreach>
+ )
+ and state !=101
+ </where>
+ </update>
+
+ <select id="selectTemperingGlassCount" resultType="java.util.Map">
+ select a.engineer_id,
+ a.tempering_layout_id,
+ count2,
+ count1,
+ count2 - count1 as count3,
+ count(c.glass_id) as count4
+ from (select engineer_id, tempering_layout_id, count(*) as count1
+ from big_storage_cage_details
+ where state = 100
+ group by engineer_id, tempering_layout_id) as a
+ left join
+ (select engineer_id, tempering_layout_id, count(*) as count2
+ from glass_info
+ group by engineer_id, tempering_layout_id) as b
+ on a.engineer_id = b.engineer_id and a.tempering_layout_id = b.tempering_layout_id
+ left join damage as c
+ on a.engineer_id = c.engineer_id and a.tempering_layout_id = c.tempering_layout_id and
+ (type = 8 or type = 9)
+ group by a.engineer_id, a.tempering_layout_id
+ order by a.engineer_id, a.tempering_layout_id
+ </select>
+
+ <select id="queryIsAllNeedDispatchVirtualSlot" resultMap="virtualSlotSequenceDTO">
+ with relation_temp as (
+ select engineer_id, tempering_layout_id, virtual_slot, count(1) as slot_count
+ from big_storage_glass_relation_info
+ group by engineer_id, tempering_layout_id, virtual_slot
+ ),
+ details_temp as (
+ select t.engineer_id, t.tempering_layout_id, t.virtual_slot, count(1) as slot_count
+ from big_storage_glass_relation_info t
+ left join big_storage_cage_details t1 on
+ t.engineer_id = t1.engineer_id and t.tempering_layout_id = t1.tempering_layout_id and
+ t.tempering_feed_sequence = t1.tempering_feed_sequence
+ where t1.state = 100
+ group by t.engineer_id, t.tempering_layout_id, t.virtual_slot
+ ),
+ result_one as (
+ select t.*, t1.slot_count as tslot_count
+ from relation_temp t
+ INNER JOIN details_temp t1 on t.engineer_id = t1.engineer_id and
+ t.tempering_layout_id = t1.tempering_layout_id and
+ t.virtual_slot = t1.virtual_slot
+ where t.slot_count = t1.slot_count
+ )
+ select engineer_id, tempering_layout_id, virtual_slot
+ from result_one
+ order by engineer_id, tempering_layout_id
+ </select>
+
+ <select id="queryNeedDispatchSlot" resultMap="baseSlotSequenceDTO">
+ with glass_id_temp as (
+ select engineer_id, tempering_layout_id, tempering_feed_sequence
+ from big_storage_glass_relation_info
+ where (engineer_id, tempering_layout_id, virtual_slot) =
+ (#{engineerId}, #{temperingLayoutId}, #{virtualSlot})
+ )
+ select t.slot, max(t1.tempering_feed_sequence) as max_sequence, min(t1.tempering_feed_sequence) as min_sequence
+ from big_storage_cage_details t
+ inner join big_storage_glass_relation_info t1
+ on t.engineer_id = t1.engineer_id and t.tempering_layout_id = t1.tempering_layout_id and
+ t.tempering_feed_sequence = t1.tempering_feed_sequence
+ where (t.engineer_id, t.tempering_layout_id, t.tempering_feed_sequence) in
+ (select engineer_id, tempering_layout_id, tempering_feed_sequence from glass_id_temp)
+ and t.state = 100
+ group by t.slot
+ order by max_sequence desc
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.8.0