| | |
| | | </resultMap> |
| | | <resultMap id="virtualSlotSequenceDTO" type="com.mes.hollow.entity.dto.FlowCardVirtualSlotDTO"> |
| | | <result column="flow_card_id" property="flowCardId"/> |
| | | <result column="layer" property="layer"/> |
| | | <result column="virtual_slot" property="virtualSlot"/> |
| | | </resultMap> |
| | | <resultMap id="baseSlotSequenceDTO" type="com.mes.hollow.entity.dto.BigStorageSequenceDTO"> |
| | |
| | | |
| | | <select id="queryIsAllNeedDispatchVirtualSlot" resultMap="virtualSlotSequenceDTO"> |
| | | with relation_temp as ( |
| | | select flow_card_id, virtual_slot, count(1) as slot_count |
| | | select flow_card_id, layer, virtual_slot, count(1) as slot_count |
| | | from hollow_glass_relation_info |
| | | group by flow_card_id, virtual_slot |
| | | group by flow_card_id, layer, virtual_slot |
| | | ), |
| | | details_temp as ( |
| | | select flow_card_id, virtual_slot, count(1) as slot_count |
| | | select flow_card_id, layer, virtual_slot, count(1) as slot_count |
| | | from hollow_big_storage_cage_details |
| | | where state = 100 |
| | | group by flow_card_id, virtual_slot |
| | | group by flow_card_id, layer, virtual_slot |
| | | ), |
| | | result_one as ( |
| | | select t.*, t1.slot_count as tslot_count |
| | | from relation_temp t |
| | | INNER JOIN details_temp t1 on t.flow_card_id = t1.flow_card_id and |
| | | t.layer = t1.layer and |
| | | t.virtual_slot = t1.virtual_slot |
| | | where t.slot_count = t1.slot_count |
| | | ) |
| | | select flow_card_id, virtual_slot |
| | | select flow_card_id, layer, virtual_slot |
| | | from result_one |
| | | order by flow_card_id, virtual_slot |
| | | order by flow_card_id, layer, virtual_slot |
| | | </select> |
| | | |
| | | <select id="queryNeedDispatchSlot" resultMap="baseSlotSequenceDTO"> |
| | | with glass_id_temp as ( |
| | | select glass_id |
| | | from big_storage_glass_relation_info |
| | | where (flow_card_id, virtual_slot) = |
| | | (#{flowCardId}, #{virtualSlot}) |
| | | ) |
| | | select slot, max(sequence) as max_sequence, min(sequence) as min_sequence |
| | | from big_storage_cage_details |
| | | where glass_id in (select * from glass_id_temp) |
| | | and state = 100 |
| | | from hollow_big_storage_cage_details |
| | | where (flow_card_id, layer, virtual_slot) = (#{flowCardId}, #{layer}, #{virtualSlot}) |
| | | group by slot |
| | | order by max_sequence |
| | | </select> |
| | | <select id="queryOutGlassList" resultType="com.mes.hollow.entity.HollowBigStorageCageDetails"> |
| | | with flow_card_id_layer as ( |
| | | select flow_card_id, max(total_layer) as total_layer |
| | | FROM hollow_big_storage_cage_details |
| | | group by flow_card_id |
| | | ), |
| | | details_sequence_count_temp as ( |
| | | SELECT flow_card_id, hollow_sequence, count(1) as max_count |
| | | FROM hollow_big_storage_cage_details |
| | | and state = 100 |
| | | group by flow_card_id, hollow_sequence |
| | | ), |
| | | glass_out_temp as ( |
| | | select t1.*, case when t.total_layer = t1.max_count then 1 else 0 end is_pair |
| | | from flow_card_id_layer t |
| | | inner join details_sequence_count_temp t1 on t.flow_card_id = t1.flow_card_id |
| | | ), |
| | | result_detail as ( |
| | | select t.id, |
| | | t.device_id, |
| | | t.virtual_slot, |
| | | t.slot, |
| | | t.glass_id, |
| | | t.sequence, |
| | | t.flow_card_id, |
| | | t.glass_type, |
| | | t.width, |
| | | t.height, |
| | | t.thickness, |
| | | t.tempering_layout_id, |
| | | t.tempering_feed_sequence, |
| | | t.state, |
| | | t.gap, |
| | | t.engineer_id, |
| | | t.total_layer, |
| | | t.layer, |
| | | t.create_time, |
| | | t.update_time, |
| | | t.hollow_sequence, |
| | | t.films_id, |
| | | t1.is_pair |
| | | from hollow_big_storage_cage_details t |
| | | INNER JOIN glass_out_temp t1 |
| | | on t.flow_card_id = t1.flow_card_id and t.hollow_sequence = t1.hollow_sequence |
| | | where t.state = 100 |
| | | and t.flow_card_id = #{flowCardId} |
| | | ) |
| | | select * |
| | | from result_detail |
| | | order by flow_card_id, hollow_sequence |
| | | <if test="cell != 931"> |
| | | desc |
| | | </if> |
| | | </select> |
| | | </mapper> |