| | |
| | | <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"/> |
| | |
| | | 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 |
| | |
| | | ) T2 |
| | | INNER JOIN (SELECT ENGINEER_ID, TEMPERING_LAYOUT_ID, COUNT(TEMPERING_FEED_SEQUENCE) AS COUNT |
| | | FROM BIG_STORAGE_CAGE_DETAILS |
| | | WHERE STATE = 100 |
| | | 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 LIMIT 1 |
| | | 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 |
| | | AND TEMPERING_LAYOUT_ID!=0 AND THICKNESS < 8 |
| | | GROUP BY ENGINEER_ID, |
| | | TEMPERING_LAYOUT_ID |
| | | HAVING SLOT_COUNT >= #{count} LIMIT 1 |
| | | TEMPERING_LAYOUT_ID |
| | | HAVING SLOT_COUNT >= #{count} |
| | | ORDER BY ID |
| | | </select> |
| | | <select id="queryGlassMaxAndMin" resultMap="slotSequenceDTO"> |
| | | SELECT T.*, |
| | |
| | | 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 |
| | | WHERE ENGINEER_ID = #{engineerId} |
| | | AND TEMPERING_LAYOUT_ID = #{temperingLayoutId} |
| | | AND STATE = 100 |
| | | GROUP BY ENGINEER_ID, |
| | | TEMPERING_LAYOUT_ID, |
| | | SLOT |
| | |
| | | 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, |
| | | count4, |
| | | slots |
| | | from (select engineer_id, |
| | | tempering_layout_id, |
| | | count(*) as count1, |
| | | group_concat(distinct slot order by tempering_feed_sequence) as slots |
| | | from big_storage_cage_details |
| | | where state = 100 |
| | | and tempering_layout_id!=0 |
| | | group by engineer_id, tempering_layout_id) as a |
| | | left join |
| | | (select gi.engineer_id, gi.tempering_layout_id, count(gi.glass_id) as count2,count(d.glass_id) as count4 |
| | | from glass_info gi left join damage d on gi.glass_id=d.glass_id and (d.type=8 or d.type=9) |
| | | 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 |
| | | group by a.engineer_id, a.tempering_layout_id |
| | | order by a.engineer_id, a.tempering_layout_id |
| | | </select> |
| | | |
| | | <select id="selectFlowCardCount" resultType="com.mes.bigstorage.entity.dto.FlowCardDTO"> |
| | | SELECT fc.engineer_id AS engineerId, |
| | | count(DISTINCT fc.flow_card_id, fc.layer) AS flowCardIdCount, |
| | | count(DISTINCT gi.tempering_layout_id) AS totalTemper, |
| | | e.glass_total_area, |
| | | count(distinct bscd.tempering_layout_id) as cageTemper, |
| | | round(sum(bscd.width*bscd.height/1000000),2) as cageArea |
| | | FROM ( |
| | | SELECT engineer_id, |
| | | flow_card_id, |
| | | IF |
| | | (combine = 0, layer, 1) AS layer, |
| | | combine |
| | | FROM glass_info |
| | | WHERE engineer_id IN (SELECT DISTINCT engineer_id FROM big_storage_cage_details WHERE state = 100) |
| | | GROUP BY engineer_id, |
| | | flow_card_id, |
| | | IF |
| | | (combine = 0, layer, 1), |
| | | combine |
| | | ) AS fc |
| | | INNER JOIN glass_info gi ON fc.engineer_id = gi.engineer_id |
| | | AND gi.tempering_layout_id != 0 |
| | | INNER JOIN engineering e |
| | | ON fc.engineer_id = e.engineer_id |
| | | left join big_storage_cage_details bscd on gi.glass_id=bscd.glass_id and bscd.state=100 and fc.flow_card_id=bscd.flow_card_id and fc.layer=bscd.layer |
| | | GROUP BY |
| | | fc.engineer_id |
| | | </select> |
| | | </mapper> |