ZengTao
2025-09-12 66d9a37adfa32014d479ae1e67575d2392084676
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml
@@ -44,7 +44,7 @@
                             GROUP BY ENGINEER_ID, TEMPERING_LAYOUT_ID) T3 ON T2.ENGINEER_ID = T3.ENGINEER_ID
            AND T2.TEMPERING_LAYOUT_ID = T3.TEMPERING_LAYOUT_ID
            AND T2.COUNT = T3.COUNT
                 INNER JOIN ENGINEERING T4 ON T2.ENGINEER_ID=T4.ENGINEER_ID
                 INNER JOIN ENGINEERING T4 ON T2.ENGINEER_ID = T4.ENGINEER_ID
        ORDER BY T4.ID, T2.TEMPERING_LAYOUT_ID
    </select>
    <select id="queryTemperingOccupySlot" resultMap="temperingLayoutDTO">
@@ -52,11 +52,12 @@
               TEMPERING_LAYOUT_ID,
               COUNT(DISTINCT SLOT) as SLOT_COUNT
        FROM BIG_STORAGE_CAGE_DETAILS
        WHERE STATE = 100 AND TEMPERING_LAYOUT_ID!=0 AND THICKNESS &lt; 8
        WHERE STATE = 100
          AND TEMPERING_LAYOUT_ID!=0 AND THICKNESS &lt; 8
        GROUP BY ENGINEER_ID,
                 TEMPERING_LAYOUT_ID
            TEMPERING_LAYOUT_ID
        HAVING SLOT_COUNT &gt;= #{count}
        ORDER BY ID DESC
        ORDER BY ID
    </select>
    <select id="queryGlassMaxAndMin" resultMap="slotSequenceDTO">
        SELECT T.*,
@@ -96,13 +97,57 @@
    </update>
    <select id="selectTemperingGlassCount" resultType="java.util.Map">
        select a.engineer_id,a.tempering_layout_id,count2,count1,count2-count1 as count3,count(c.glass_id) as count4 from
            (select engineer_id,tempering_layout_id,count(*) as count1 from big_storage_cage_details where state=100 and tempering_layout_id!=0 group by engineer_id,tempering_layout_id) as a
                left join
            (select engineer_id,tempering_layout_id,count(*) as count2 from glass_info group by engineer_id,tempering_layout_id) as b
            on a.engineer_id=b.engineer_id and a.tempering_layout_id=b.tempering_layout_id
                left join damage as c on a.engineer_id=c.engineer_id and a.tempering_layout_id=c.tempering_layout_id and (type = 8 or type = 9)
        group by a.engineer_id,a.tempering_layout_id
        order by a.engineer_id,a.tempering_layout_id
        select a.engineer_id,
               a.tempering_layout_id,
               count2,
               count1,
               count2 - count1   as count3,
               count4,
               slots
        from (select engineer_id,
                     tempering_layout_id,
                     count(*)                                                     as count1,
                     group_concat(distinct slot order by tempering_feed_sequence) as slots
              from big_storage_cage_details
              where state = 100
                and tempering_layout_id!=0
              group by engineer_id, tempering_layout_id) as a
                 left join
             (select gi.engineer_id, gi.tempering_layout_id, count(gi.glass_id) as count2,count(d.glass_id) as count4
              from glass_info gi left join damage d on gi.glass_id=d.glass_id and (d.type=8 or d.type=9)
              group by engineer_id, tempering_layout_id) as b
             on a.engineer_id = b.engineer_id and a.tempering_layout_id = b.tempering_layout_id
        group by a.engineer_id, a.tempering_layout_id
        order by a.engineer_id, a.tempering_layout_id
    </select>
    <select id="selectFlowCardCount" resultType="com.mes.bigstorage.entity.dto.FlowCardDTO">
        SELECT fc.engineer_id                            AS engineerId,
               count(DISTINCT fc.flow_card_id, fc.layer) AS flowCardIdCount,
               count(DISTINCT gi.tempering_layout_id)    AS totalTemper,
               e.glass_total_area,
               count(distinct bscd.tempering_layout_id) as cageTemper,
               round(sum(bscd.width*bscd.height/1000000),2) as cageArea
        FROM (
                 SELECT engineer_id,
                        flow_card_id,
                        IF
                            (combine = 0, layer, 1) AS layer,
                        combine
                 FROM glass_info
                 WHERE engineer_id IN (SELECT DISTINCT engineer_id FROM big_storage_cage_details WHERE state = 100)
                 GROUP BY engineer_id,
                          flow_card_id,
                          IF
                              (combine = 0, layer, 1),
                          combine
             ) AS fc
                 INNER JOIN glass_info gi ON fc.engineer_id = gi.engineer_id
            AND gi.tempering_layout_id != 0
   INNER JOIN engineering e
        ON fc.engineer_id = e.engineer_id
            left join big_storage_cage_details bscd on gi.glass_id=bscd.glass_id and bscd.state=100 and fc.flow_card_id=bscd.flow_card_id and fc.layer=bscd.layer
        GROUP BY
            fc.engineer_id
    </select>
</mapper>