| | |
| | | <result column="lack_count" property="lackCount"/> |
| | | <result column="damage_count" property="damageCount"/> |
| | | </resultMap> |
| | | <select id="queryLackByFlowCard" resultType="com.mes.hollow.entity.dto.LackDetailsDTO"> |
| | | with hollow_flow_temp AS ( |
| | | SELECT DISTINCT flow_card_id |
| | | FROM hollow_big_storage_cage_details |
| | | WHERE state = 100 |
| | | <if test="flowCardId != null and flowCardId != ''"> |
| | | and flow_card_id = #{flowCardId} |
| | | </if> |
| | | ) |
| | | , glass_temp as ( |
| | | select t1.* |
| | | from hollow_flow_temp t |
| | | INNER JOIN glass_info t1 on t.flow_card_id = t1.flow_card_id |
| | | ) |
| | | , detail_temp as ( |
| | | select t.* |
| | | from glass_temp t |
| | | left join hollow_big_storage_cage_details t1 on t.glass_id = t1.glass_id |
| | | where t1.glass_id is null |
| | | ) |
| | | , damage_ranked AS ( |
| | | SELECT t.flow_card_id, |
| | | t.layer, |
| | | t.glass_id, |
| | | t.glass_type, |
| | | t.width, |
| | | t.height, |
| | | t.filmsId, |
| | | t.thickness, |
| | | case |
| | | when type in (7, 8) and status = 1 then '' |
| | | else t1.working_procedure end as working_procedure, |
| | | ROW_NUMBER() OVER (PARTITION BY t1.glass_id ORDER BY t1.id DESC) as rn |
| | | FROM detail_temp t |
| | | inner join damage t1 on t.glass_id = t1.glass_id |
| | | ) |
| | | , damage_latest AS ( |
| | | SELECT * |
| | | FROM damage_ranked |
| | | WHERE rn = 1 |
| | | ) |
| | | select * |
| | | from damage_latest |
| | | |
| | | <select id="queryLackByFlowCard" resultMap="lackBaseMap"> |
| | | </select> |
| | | <select id="queryAllLackByFlowCard" resultMap="lackBaseMap"> |
| | | with flow_card_id_info as ( |
| | | select distinct flow_card_id from hollow_big_storage_cage_details where state = 100 |
| | | ), |
| | |
| | | from hollow_glass_relation_info |
| | | where flow_card_id = #{flowCardId} |
| | | </select> |
| | | <select id="queryLackGlassByFlowCard" resultType="com.mes.glassinfo.entity.GlassInfo"> |
| | | with glass_id_info as ( |
| | | select glass_id,order_sort from hollow_glass_relation_info where flow_card_id=#{flowCardId} and |
| | | order_sort=#{orderSort} and layer=#{layer} and glass_id is not null |
| | | ), |
| | | damage_glass_id as ( |
| | | select glass_id from damage where process_id=#{flowCardId} and order_number=#{orderSort} and |
| | | technology_number=#{layer} and type=8 and status < 3 and glass_id is not null |
| | | <select id="queryLackGlassByFlowCard" resultType="com.mes.hollow.entity.dto.LackDetailsDTO"> |
| | | with glass_temp as ( |
| | | select * |
| | | from glass_info |
| | | where flow_card_id = #{flowCardId} |
| | | and glass_type = #{orderSort} |
| | | and layer = #{layer} |
| | | ) |
| | | select t.* from glass_info t left join glass_id_info t1 on t.glass_id=t1.glass_id |
| | | left join damage_glass_id t2 on t.glass_id=t2.glass_id |
| | | where t.flow_card_id=#{flowCardId} and t.glass_type=#{orderSort} and t.layer=#{layer} and t1.glass_id is null |
| | | and t2.glass_id is null |
| | | , detail_temp as ( |
| | | select t.* |
| | | from glass_temp t |
| | | left join hollow_big_storage_cage_details t1 on t.glass_id = t1.glass_id and t1.state not in (8, 9) |
| | | WHERE t1.glass_id is null |
| | | ) |
| | | , damage_ranked AS ( |
| | | SELECT t.flow_card_id, |
| | | t.layer, |
| | | t.glass_id, |
| | | t.glass_type, |
| | | t.width, |
| | | t.height, |
| | | t.filmsId, |
| | | t.thickness, |
| | | case |
| | | when type in (7, 8) and status = 1 then '' |
| | | else t1.working_procedure end as working_procedure, |
| | | ROW_NUMBER() OVER (PARTITION BY t1.glass_id ORDER BY t1.id DESC) as rn |
| | | FROM detail_temp t |
| | | inner join damage t1 on t.glass_id = t1.glass_id |
| | | ) |
| | | , damage_latest AS ( |
| | | SELECT * |
| | | FROM damage_ranked |
| | | WHERE rn = 1 |
| | | ) |
| | | select * |
| | | from damage_latest |
| | | </select> |
| | | |
| | | |
| | | <update id="clearDirtyFlowCardData"> |
| | | update tempering_glass_relation_info |
| | | set shelf_order = null |