ZengTao
2025-05-20 fc178515868eb2c443f781fd0253ac98f36540d5
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml
@@ -131,6 +131,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="selectTemperingGlassCount" resultMap="temperingGlassCount">
        with glass_info_temp as (
@@ -165,8 +174,8 @@
        total_count,
        real_count,
        ifnull(damage_count, 0) as damage_count,
        total_count - real_count - ifnull(damage_count, 0) as lack_count
        case when total_count - real_count - ifnull(damage_count, 0) &lt; 0 then 0 else
        total_count - real_count - ifnull(damage_count, 0) end as lack_count
        from big_details_temp t
        inner join glass_info_temp t1 on t.engineer_id = t1.engineer_id and
        t.tempering_layout_id = t1.tempering_layout_id
@@ -175,7 +184,7 @@
        )
        select *
        from result
        order by engineer_id
        order by engineer_id,tempering_layout_id
    </select>
    <select id="queryIsAllNeedDispatchVirtualSlot" resultMap="virtualSlotSequenceDTO">
@@ -227,13 +236,18 @@
    <select id="queryLackGlassInfo" resultMap="glassInfoLackDTO">
        WITH glass_info_temp AS (SELECT *
                                 FROM glass_info
                                 WHERE engineer_id = #{engineerId} AND tempering_layout_id = #{temperingLayoutId}),
                                 WHERE engineer_id = #{engineerId}
                                   AND tempering_layout_id = #{temperingLayoutId}),
             big_details_temp AS (SELECT *
                                  FROM big_storage_cage_details
                                  WHERE state = 100 AND engineer_id = #{engineerId} AND tempering_layout_id =  #{temperingLayoutId}),
                                  WHERE state = 100
                                    AND engineer_id = #{engineerId}
                                    AND tempering_layout_id = #{temperingLayoutId}),
             damage_temp AS (SELECT *
                             FROM damage
                             WHERE type IN (8, 9) AND engineer_id = #{engineerId} AND tempering_layout_id =  #{temperingLayoutId}),
                             WHERE type IN (8, 9)
                               AND engineer_id = #{engineerId}
                               AND tempering_layout_id = #{temperingLayoutId}),
             result_lack AS (SELECT t.*
                             FROM glass_info_temp t
                                      LEFT JOIN big_details_temp t1 ON t.glass_id = t1.glass_id
@@ -252,4 +266,12 @@
        SELECT *
        FROM result
    </select>
    <select id="querybigStorageCageDetail" resultType="com.mes.base.entity.vo.BigStorageVO">
        select bsc.device_id, bsc.slot, count(bscd.glass_id) as count
        from big_storage_cage bsc
                 left join big_storage_cage_details bscd
                           on bsc.slot = bscd.slot and bscd.state in (100, 102, 103, 104)
        group by bsc.device_id, bsc.slot
        order by bsc.device_id, bsc.slot
    </select>
</mapper>