guoyujie
2025-05-06 43bd3c136f3c2fd7fc54975d763bd2b24a4d0a92
north-glass-erp/src/main/resources/mapper/pp/GlassOptimize.xml
@@ -223,7 +223,7 @@
            fc.process_id,
            fc.order_number,
            fc.quantity,
            CONCAT(fc.technology_number, '/', COUNT(fc.technology_number)) AS layer,
            CONCAT(fc.technology_number, '/', COUNT(fc.layers_number)) AS layer,
            so.project,
            CONCAT(sd.child_width, ' × ', sd.child_height) AS sizes
        FROM
@@ -587,6 +587,17 @@
        where project_no = #{projectNumber}
    </delete>
    <select id="selectOptimizeDetailById">
        select * from pp.optimize_detail
        where project_no = #{projectNumber} and process_id= #{processId} and layer= #{layer} and order_sort= #{orderSort}
          and heat_layout_id is null limit 0,1;
    </select>
    <select id="selectOptimizeHeatDetail">
        select * from pp.optimize_heat_detail
        where project_no = #{projectNumber}
    </select>
    <select id="getProjectListMp">
        SELECT
            p.id,
@@ -847,7 +858,7 @@
    <insert id="addSimulation" parameterType="map">
        <foreach collection="projectdetail.data[0].glass_details" item="glass">
        <foreach collection="projectdetail" item="glass">
            INSERT INTO pp.optimize_heat_detail (
            project_no,
            process_id,
@@ -895,7 +906,7 @@
    </insert>
    <!--模拟计算结果保存-->
    <insert id="addratioResult" parameterType="map">
        <foreach collection="projectdetail.data[0].ratioResult" item="glass">
        <foreach collection="ratioResult" item="glass">
            INSERT INTO pp.optimize_heat_layout (
            project_no,
            layout_id,
@@ -925,6 +936,8 @@
        UPDATE pp.optimize_project
        SET
            state = 10,
            furnaces_qty=#{resultSum[0]},
            load_rate=#{resultSum[1]},
            chaos_pct = #{inputValues.chaos_pct},
            max_load_pct = #{inputValues.max_load_pct},
            max_area=#{inputValues.max_area},
@@ -932,8 +945,7 @@
            load_width=#{inputValues.load_width},
            load_length=#{inputValues.load_length},
            x_space=#{inputValues.x_space},
            y_space=#{inputValues.y_space},
            load_rate=#{inputValues.load_rate}
            y_space=#{inputValues.y_space}
        WHERE
            project_no = #{inputValues.project_no}
@@ -948,6 +960,12 @@
        update pp.optimize_project_file as u
        set u.content = #{jsonString}
        where  u.project_no=#{processId} and type='优化结果'
    </update>
    <update id="updateOptimizeDetail">
        update pp.optimize_detail
        set heat_layout_id=#{layoutId},heat_layout_sort=#{sort},glass_id=concat(process_id,'|',#{layoutId},'|',#{sort})
        where id=#{id};
    </update>
@@ -1035,4 +1053,116 @@
              c.process_id,
              c.order_number
    </select>
    <!--模拟计算查询流程卡第三方-->
    <select id="selectProjectComputeMpThirdParty">
        select
            process_id as processId,
            layer as technologyNumber,
            total_layer as total_layers,
            filmsid as TotalNumber,
            sum(glass_total) as total_num,
            product_name as glass_child,
            0 as tempering,
            0 as allow_rotate,
            0 as curtain_wall,
            0 as priority_level,
            1 as is_must
        from pp.other_flow_card where project_no = #{projectNo} group by process_id,layer
    </select>
    <!--模拟计算流程卡详情第三方-->
    <select id="selectComputeDetailMpThirdParty">
        select
            process_id as process_id,
            width as width,
            height as height,
            width as maxwidth,
            height as maxheight,
            order_number as order_number,
            glass_total as quantity,
            layer as technology_number,
            0 as patch_state
        from pp.other_flow_card where process_id = #{processId} and layer=#{technologyNumber}
    </select>
    <!--第一次优化查询-->
    <select id="firstOptimizationThirdParty">
        select
            project_no,
            concat( process_id, '-', layer ) AS process_id,
            width,
            height,
            layer,
            glass_total as quantity,
            product_name,
            order_number
        from pp.other_flow_card where project_no = #{projectNo}
    </select>
    <select id="analogComputationOptimizationThirdParty">
        SELECT
            h.project_no,
            h.layout_id,
            h.width AS width,
            h.height AS height,
            count( 1 ) AS quantity,
            concat( h.process_id, '-', h.layer ) AS 'process_id',
            h.layer,
            c.order_number
        from
            pp.`optimize_heat_detail` h
                LEFT JOIN pp.other_flow_card c ON h.process_id = c.process_id
                AND h.layer = c.technology_number
                AND h.order_sort = c.order_number
        WHERE
            h.project_no = #{projectNo}
        GROUP BY
            h.project_no,
            h.layout_id,
            h.width,
            h.height,
            h.process_id,
            h.layer,
            c.quantity,
            c.order_number
        ORDER BY
            LENGTH( h.layout_id ),
            h.layout_id;
    </select>
    <!--工程信息流程卡-->
    <select id="getProcessCardMpThirdParty">
        SELECT
            fc.process_id,
            fc.order_number,
            fc.glass_total as quantity,
            CONCAT(fc.layer, '/', COUNT(fc.total_layer)) AS layer,
            CONCAT(fc.width, ' × ', fc.height) AS sizes
        FROM
            pp.other_flow_card AS fc
        WHERE
            fc.project_no = #{projectNo}
        GROUP BY
            fc.layer,
            fc.order_number
    </select>
    <delete id="deleteOptimizeDetailThirdParty">
        delete from pp.other_flow_card
        where project_no = #{projectNumber}
    </delete>
</mapper>