廖井涛
2025-07-08 ae5a0421846584e31d3c3572217f2bd8a9adff3e
north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -3172,4 +3172,102 @@
    <select id="getSumQuantity">
        select quantity from  sd.`order` where order_id=#{orderId}
    </select>
    <select id="getDetailCompoundList">
        select fc.order_number,
        concat(IF(ROUND(ogd.child_width, 1) = FLOOR(ogd.child_width), FLOOR(ogd.child_width), ROUND(ogd.child_width, 1)), "*", IF(ROUND(child_height, 1) = FLOOR(child_height), FLOOR(child_height), ROUND(child_height, 1)))   as child_width,
        SUM(fc.quantity) as quantity,
        round(SUM(ogd.total_area), 2)                                       as total_area,
        SUM(od.perimeter) as perimeter,
        if(od.bend_radius!=null || od.bend_radius!='',od.bend_radius,if(od.shape=2,JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04')),'')) as bend_radius,
        concat(IFNULL(od.processing_note, ''), IFNULL(od.remarks, '')) as remarks,
        od.other_columns,
        round(ogd.child_width)                                         as width,
        round(ogd.child_height)                                        as height,
        pd.separation,
        #{compound} as technology_number,
        IFNULL(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S02')),'') as mapNumber,
        od.building_number
        from flow_card as fc
        left join sd.order_glass_detail as ogd
        on fc.order_id = ogd.order_id and fc.order_number = ogd.order_number and
        fc.technology_number = ogd.technology_number
        left join sd.order_detail as od on od.order_id = fc.order_id and od.order_number = fc.order_number
        left join sd.product_detail as pd
        on pd.prod_id = od.product_id and pd.glass_sort = ogd.technology_number
        left join flow_card_sort as fcs
        on fcs.process_id = fc.process_id and fcs.order_number = fc.order_number and
        fcs.technology_number = fc.technology_number
        and fcs.process = #{process}
        where fc.process_id = #{processId}
        and position(fc.technology_number in #{compound})
        group by fc.process_id, fc.order_number
        <choose>
            <!-- flashback = 1 时正序 -->
            <when test="flashback == 1">
                ORDER BY
                CASE
                WHEN fcs.sort IS NOT NULL AND fcs.sort &lt;&gt;  '' THEN fcs.sort
                ELSE fc.order_number
                END ASC
            </when>
            <!-- flashback != 1 时倒序 -->
            <otherwise>
                ORDER BY
                CASE
                WHEN fcs.sort IS NOT NULL AND fcs.sort &lt;&gt;  '' THEN fcs.sort
                ELSE fc.order_number
                END DESC
            </otherwise>
        </choose>
    </select>
    <select id="getDetailListLikeCompound">
        select fc.order_number,
        concat(IF(ROUND(ogd.child_width, 1) = FLOOR(ogd.child_width), FLOOR(ogd.child_width), ROUND(ogd.child_width, 1)), "*", IF(ROUND(child_height, 1) = FLOOR(child_height), FLOOR(child_height), ROUND(child_height, 1)))   as child_width,
        sum(fc.quantity) as quantity,
        round(sum(ogd.total_area), 2)                                       as total_area,
        sum(od.perimeter) as perimeter,
        if(od.bend_radius!=null || od.bend_radius!='',od.bend_radius,if(od.shape=2,JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04')),'')) as bend_radius,
        concat(IFNULL(od.processing_note, ''), IFNULL(od.remarks, '')) as remarks,
        od.other_columns,
        round(ogd.child_width)                                         as width,
        round(ogd.child_height)                                        as height,
        pd.separation,
        #{compound} as technology_number,
        IFNULL(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S02')),'') as mapNumber,
        od.building_number
        from flow_card as fc
        left join sd.order_glass_detail as ogd
        on fc.order_id = ogd.order_id and fc.order_number = ogd.order_number and
        fc.technology_number = ogd.technology_number
        left join sd.order_detail as od on od.order_id = fc.order_id and od.order_number = fc.order_number
        left join sd.product_detail as pd
        on pd.prod_id = od.product_id and pd.glass_sort = ogd.technology_number
        left join flow_card_sort as fcs
        on fcs.process_id = fc.process_id and fcs.order_number = fc.order_number and
        fcs.technology_number = fc.technology_number
        and fcs.process = #{process}
        where fc.process_id = #{processId}
        and position(fc.technology_number in #{compound})
        group by fc.process_id, fc.order_number
        <choose>
            <!-- flashback = 1 时正序 -->
            <when test="flashback == 1">
                ORDER BY
                CASE
                WHEN fcs.sort IS NOT NULL AND fcs.sort &lt;&gt;  '' THEN fcs.sort
                ELSE fc.order_number
                END ASC
            </when>
            <!-- flashback != 1 时倒序 -->
            <otherwise>
                ORDER BY
                CASE
                WHEN fcs.sort IS NOT NULL AND fcs.sort &lt;&gt;  '' THEN fcs.sort
                ELSE fc.order_number
                END DESC
            </otherwise>
        </choose>
    </select>
</mapper>