zhoushihao
2025-01-16 56599835685c0deb29601d9eb287b9436324b824
hangzhoumesParent/moduleService/howllowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml
@@ -39,6 +39,15 @@
            and state !=101
        </where>
    </update>
    <update id="updateDeviceIdBySlot">
        update big_storage_cage_details t inner join big_storage_cage t1 on t.slot = t1.slot
        set t.device_id = t1.device_id
        where t.slot in (
        <foreach collection="list" item="item" separator=",">
            #{item}
        </foreach>
        )
    </update>
    <select id="hollowIsAll" resultMap="baseMap">
        WITH sum_flow_layer_count AS ( SELECT flow_card_id, layer, min( films_id ) AS films_id, min(thickness) as
@@ -46,7 +55,7 @@
        real_flow_layer_count AS ( SELECT flow_card_id, layer, count(*) AS real_count FROM
        hollow_big_storage_cage_details t WHERE state = 100 GROUP BY flow_card_id, layer ),
        damage_flow_layer_count AS ( SELECT process_id AS flow_card_id, technology_number AS layer, count(*) as
        damage_count FROM damage GROUP BY process_id, technology_number ),
        damage_count FROM damage where type in(8,9) GROUP BY process_id, technology_number ),
        lack_flow_layer_count AS (
        SELECT
        t.flow_card_id,
@@ -197,4 +206,45 @@
            desc
        </if>
    </select>
    <select id="queryHollowbigStorageCageDetail" resultType="com.mes.base.entity.vo.BigStorageVO">
        SELECT SLOT, COUNT(1) AS COUNT
        FROM HOLLOW_BIG_STORAGE_CAGE_DETAILS
        where state in (100, 102, 103, 104)
        group by SLOT
        ORDER BY SLOT
    </select>
    <select id="querySlotMaxSequence" resultType="com.mes.hollow.entity.HollowBigStorageCageDetails">
        select max(sequence) as sequence, device_id, slot
        from hollow_big_storage_cage_details
        where (flow_card_id, total_layer, layer, virtual_slot) =
              (#{flowCardId}, #{totalLayer}, #{layer}, #{virtualSlot})
          and state in (0, 100, 102, 103, 104)
        group by device_id, slot
        order by sequence
    </select>
    <select id="queryPairGlassList" resultType="com.mes.hollow.entity.HollowBigStorageCageDetails">
        with hollow_sequence_temp as (
        SELECT hollow_sequence, count(distinct layer) as count
        FROM hollow_big_storage_cage_details
        WHERE flow_card_id = #{flowCardId}
        <if test="isOut == 0">
            AND STATE = 100
        </if>
        GROUP BY hollow_sequence
        having count = #{totalLayer}
        limit #{totalPairQuantity}
        ),
        hollow_details as (select *
        from hollow_big_storage_cage_details
        WHERE flow_card_id = #{flowCardId}
        <if test="isOut == 0">
            AND STATE = 100
        </if>
        )
        select *
        from hollow_details t
        inner join hollow_sequence_temp t1 on t.hollow_sequence = t1.hollow_sequence
        ORDER BY t.hollow_sequence
    </select>
</mapper>