wangfei
2025-10-14 d271d4f365b0f76b415d49725652d8a575028fba
Merge branch 'master' of http://10.153.19.25:10105/r/YiWuProject
4个文件已修改
173 ■■■■■ 已修改文件
hangzhoumesParent/common/servicebase/src/main/resources/mapper/OrderMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml 146 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/resources/mapper/OrderMapper.xml
@@ -47,7 +47,7 @@
        where t.process_id = #{flowCardId}
            limit 1
    </select>
    <select id="queryFlowCardIdMaxLayerGlassInfo" resultType="com.mes.order.entity.HollowGlassDetailsDTO">
    <select id="queryFlowCardIdMaxLayerGlassInfo"  resultMap="baseMapHollowDetail">
        with temp_flow as (SELECT t.process_id,
                                  t.order_id,
                                  t.order_number,
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
@@ -303,8 +303,12 @@
        for (List<HollowGlassRelationInfo> item : tempHollowList) {
            relationInfoList.addAll(item);
        }
        log.info("分配完毕");
        this.saveBatch(relationInfoList);
        log.info("分配完毕:{}", relationInfoList);
        try {
            this.saveBatch(relationInfoList);
        } catch (Exception e) {
            log.error("保存失败:{}", e);
        }
    }
    @Override
@@ -409,7 +413,7 @@
    }
    @Override
    public Map<Integer,List<LackDetailsDTO>> queryLackByFlowCard(String flowCardId) {
    public Map<Integer, List<LackDetailsDTO>> queryLackByFlowCard(String flowCardId) {
        List<LackDetailsDTO> detailsDTOS = baseMapper.queryLackByFlowCard(flowCardId);
        return detailsDTOS.stream().collect(Collectors.groupingBy(item -> item.getLayer()));
    }
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml
@@ -255,17 +255,21 @@
    <select id="queryHollowAllFlowCard" resultType="com.mes.hollow.entity.dto.FlowCardGlassInfoDTO">
        WITH hollow_flow_temp AS (
        SELECT DISTINCT flow_card_id
        FROM hollow_big_storage_cage_details
        WHERE state = 100
        SELECT DISTINCT
        flow_card_id
        FROM
        hollow_big_storage_cage_details
        WHERE
        state = 100
        <if test="flowCardId != null and flowCardId != ''">
            AND flow_card_id LIKE CONCAT('%', #{flowCardId}, '%')
            AND flow_card_id LIKE CONCAT(
            '%',#{flowCardId}, '%')
        </if>
        <if test="filmsId != null and filmsId != ''">
            AND films_id LIKE CONCAT('%', #{filmsId}, '%')
            AND films_id LIKE CONCAT( '%', #{filmsId}, '%')
        </if>
        <if test="thickness != 0">
            AND thickness = #{thickness}
          AND thickness = #{thickness}
        </if>
        ),
        hollow_details_temp AS (
@@ -277,52 +281,64 @@
        layer,
        total_layer,
        hollow_sequence
        FROM hollow_big_storage_cage_details
        WHERE state = 100
        FROM
        hollow_big_storage_cage_details
        WHERE
        state = 100
        <if test="flowCardId != null and flowCardId != ''">
            AND flow_card_id LIKE CONCAT('%', #{flowCardId}, '%')
            AND flow_card_id LIKE CONCAT(
            '%',#{flowCardId}, '%')
        </if>
        <if test="filmsId != null and filmsId != ''">
            AND films_id LIKE CONCAT('%', #{filmsId}, '%')
            AND films_id LIKE CONCAT( '%', #{filmsId}, '%')
        </if>
        <if test="thickness != 0">
            AND thickness = #{thickness}
          AND thickness = #{thickness}
        </if>
        ),
        hollow_through_temp AS (
        SELECT
        flow_card_id,
        MIN(hollow_sequence) as hollow_sequence,
        MAX(total_layer) as total_layer
        FROM hollow_details_temp
        GROUP BY flow_card_id
        ),
        hollow_through_temp AS ( SELECT flow_card_id, MIN( hollow_sequence ) AS hollow_sequence, MAX( total_layer ) AS
        total_layer FROM hollow_details_temp GROUP BY flow_card_id ),
        hollow_pair_temp AS (
        SELECT
        t1.flow_card_id,
        COUNT(*) AS pair_count
        FROM hollow_details_temp t1
        INNER JOIN hollow_details_temp t2
        ON t1.flow_card_id = t2.flow_card_id
        FROM
        hollow_details_temp t1
        INNER JOIN hollow_details_temp t2 ON t1.flow_card_id = t2.flow_card_id
        AND t1.virtual_slot = t2.virtual_slot
        AND t1.sequence = t2.sequence
        AND t1.layer = 1 AND t2.layer = 2
        WHERE NOT EXISTS (
        SELECT 1
        FROM hollow_through_temp ht
        WHERE ht.flow_card_id = t1.flow_card_id
        AND ht.total_layer = 3
        ) OR EXISTS (
        SELECT 1
        FROM hollow_details_temp t3
        WHERE t3.flow_card_id = t1.flow_card_id
        AND t1.layer = 1
        AND t2.layer = 2
        WHERE
        NOT EXISTS ( SELECT 1 FROM hollow_through_temp ht WHERE ht.flow_card_id = t1.flow_card_id AND ht.total_layer = 3
        )
        OR EXISTS (
        SELECT
        1
        FROM
        hollow_details_temp t3
        WHERE
        t3.flow_card_id = t1.flow_card_id
        AND t3.virtual_slot = t1.virtual_slot
        AND t3.sequence = t1.sequence
        AND t3.layer = 3
        )
        GROUP BY t1.flow_card_id
        GROUP BY
        t1.flow_card_id
        ),
        glass_info_temp AS (
        SELECT
        gi.id,
        gi.glass_id,
        gi.flow_card_id,
        gi.layer,
        gi.thickness,
        gi.filmsId
        FROM
        hollow_flow_temp hft
        INNER JOIN glass_info gi ON hft.flow_card_id = gi.flow_card_id
        ),
        glass_engineer_temp AS (
        SELECT
        flow_card_id,
        engineer_id
@@ -331,72 +347,74 @@
        SELECT
        gi.flow_card_id,
        gi.engineer_id,
        ROW_NUMBER() OVER ( PARTITION BY gi.flow_card_id ,gi.layer ORDER BY COUNT( gi.glass_id ) DESC ) AS rn
        ROW_NUMBER() OVER ( PARTITION BY gi.flow_card_id, gi.layer ORDER BY COUNT( gi.glass_id ) DESC ) AS rn
        FROM
        hollow_flow_temp hft
        INNER JOIN glass_info gi ON hft.flow_card_id = gi.flow_card_id
        GROUP BY
        gi.flow_card_id,
        gi.engineer_id ,
        gi.layer
        gi.layer,
        gi.engineer_id
        ) t
        WHERE
        rn = 1
        ),
        glass_result AS (
        SELECT
        t1.id,
        t1.glass_id,
        count( t1.id ) AS sum_count,
        t1.flow_card_id,
        t1.layer,
        t1.thickness,
        t1.filmsId
        t1.layer
        FROM
        glass_info_temp t
        glass_engineer_temp t
        INNER JOIN glass_info t1 ON t.engineer_id = t1.engineer_id
        AND t.flow_card_id = t1.flow_card_id
        GROUP BY
        t1.flow_card_id,
        t1.layer
        ),
        damage_ranked AS (
        SELECT
        d.glass_id,
        d.type,
        d.status,
        ROW_NUMBER() OVER(PARTITION BY d.glass_id ORDER BY d.id DESC) as rn
        FROM hollow_flow_temp hft
        d.STATUS,
        ROW_NUMBER() OVER ( PARTITION BY d.glass_id ORDER BY d.id DESC ) AS rn
        FROM
        hollow_flow_temp hft
        INNER JOIN damage d ON hft.flow_card_id = d.process_id
        ),
        damage_latest AS (
        SELECT
        glass_id,
        type,
        status
        FROM damage_ranked
        WHERE rn = 1
        ),
        damage_latest AS ( SELECT glass_id, type, STATUS FROM damage_ranked WHERE rn = 1 ),
        result_temp AS (
        SELECT
        t.flow_card_id,
        t.layer,
        t.thickness,
        t.filmsId,
        COUNT(DISTINCT t.id) as sum_count,
        COUNT(DISTINCT t1.glass_id) as real_count,
        COUNT(DISTINCT t.id) - COUNT(DISTINCT t1.glass_id) as lack_count,
        COUNT(DISTINCT CASE WHEN t2.type IN (8,9) AND t2.status = 1 THEN t.glass_id END) as damage_count
        FROM glass_result t
        COUNT( DISTINCT t1.glass_id ) AS real_count,
        COUNT( DISTINCT CASE WHEN t2.type IN ( 7, 8 ) AND t2.STATUS = 1 THEN t.glass_id END ) AS damage_count
        FROM
        glass_info_temp t
        LEFT JOIN hollow_details_temp t1 ON t.glass_id = t1.glass_id
        LEFT JOIN damage_latest t2 ON t.glass_id = t2.glass_id
        GROUP BY t.flow_card_id, t.layer, t.thickness, t.filmsId
        )
        SELECT
        GROUP BY
        t.flow_card_id,
        t.layer,
        t.thickness,
        t.filmsId
        ) SELECT
        t.*,
        COALESCE(t1.pair_count, 0) as pair_count,
        t3.sum_count,
        t3.sum_count - t.real_count AS lack_count,
        COALESCE ( t1.pair_count, 0 ) AS pair_count,
        t2.hollow_sequence,
        t2.total_layer
        FROM result_temp t
        FROM
        result_temp t
        LEFT JOIN hollow_pair_temp t1 ON t.flow_card_id = t1.flow_card_id
        LEFT JOIN hollow_through_temp t2 ON t.flow_card_id = t2.flow_card_id
        ORDER BY t.flow_card_id
        LEFT JOIN glass_result t3 ON t.flow_card_id = t3.flow_card_id
        AND t.layer = t3.layer
        ORDER BY
        t.flow_card_id
    </select>
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
@@ -167,14 +167,17 @@
    <update id="clearDirtyFlowCardData">
        update tempering_glass_relation_info
        set shelf_order = null
          , state       = 0
        update hollow_glass_relation_info
        set glass_id                = null,
            tempering_layout_id     = null,
            tempering_feed_sequence = null,
            engineer_id             = null,
            state                   = 0
        where flow_card_id = #{flowCardId}
          and layer = #{layer}
          and shelf_order not in (
            select shelf_order
            from vertical_sheet_cage_details
          and glass_id not in (
            select glass_id
            from hollow_big_storage_cage_details
            where flow_card_id = #{flowCardId}
              and layer = #{layer}
              and state in (100, 102, 103, 104)