| | |
| | | from result |
| | | </select> |
| | | <select id="queryLackByFlowCard" resultMap="lackBaseMap"> |
| | | with relation_length as ( |
| | | select flow_card_id, |
| | | layer, |
| | | order_sort, |
| | | tempering_layout_id, |
| | | tempering_feed_sequence, |
| | | GREATEST(width, height) as first_length, |
| | | LEAST(width, height) as second_Length, |
| | | width, |
| | | height, |
| | | thickness, |
| | | films_id |
| | | from hollow_glass_relation_info |
| | | where flow_card_id = #{flowCardId} |
| | | and tempering_layout_id is null |
| | | and tempering_feed_sequence is null |
| | | with flow_card_id_info as ( |
| | | select distinct flow_card_id from hollow_big_storage_cage_details where state = 100 |
| | | ), |
| | | relation_length as ( |
| | | select flow_card_id, |
| | | layer, |
| | | order_sort, |
| | | tempering_layout_id, |
| | | tempering_feed_sequence, |
| | | GREATEST(width, height) as first_length, |
| | | LEAST(width, height) as second_Length, |
| | | width, |
| | | height, |
| | | thickness, |
| | | films_id |
| | | from hollow_glass_relation_info |
| | | where flow_card_id in (select flow_card_id from flow_card_id_info) |
| | | and tempering_layout_id is null |
| | | and tempering_feed_sequence is null |
| | | ), |
| | | lack_count_temp as ( |
| | | select flow_card_id, |
| | | layer, |
| | |
| | | order_number as order_sort, |
| | | count(1) as damage_count |
| | | from damage |
| | | where process_id = #{flowCardId} and type in (8,9) and status < 3 |
| | | where process_id in (select flow_card_id from flow_card_id_info) |
| | | and type in (8, 9) |
| | | and status < 3 |
| | | group by process_id, technology_number, order_number |
| | | ), |
| | | result_count as ( |
| | |
| | | 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 |
| | | order by t.flow_card_id, t.layer |
| | | ) |
| | | select * |
| | | from result_count |