guoyujie
2025-07-08 7104751e2f26872d4891d01d42ee88cf19715d01
north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -784,6 +784,10 @@
          and position(fc.technology_number in #{technologyNumber})
        group by fc.process_id, fc.order_number
        <choose>
            <!-- landingSequence != 1 时,优先按 landing_sequence 倒序 -->
            <when test="landingSequence != 1">
                ORDER BY landing_sequence DESC
            </when>
            <!-- flashback = 1 时正序 -->
            <when test="flashback == 1">
                ORDER BY
@@ -1473,6 +1477,10 @@
          and position(fc.technology_number in #{technologyNumber})
        group by fc.process_id, fc.order_number, fc.technology_number
        <choose>
            <!-- landingSequence != 1 时,优先按 landing_sequence 倒序 -->
            <when test="landingSequence != 1">
                ORDER BY landing_sequence DESC
            </when>
            <!-- flashback = 1 时正序 -->
            <when test="flashback == 1">
                ORDER BY
@@ -1522,6 +1530,10 @@
        where fc.process_id = #{processId} and fc.`merge`=1
        group by fc.process_id, fc.order_number
        <choose>
            <!-- landingSequence != 1 时,优先按 landing_sequence 倒序 -->
            <when test="landingSequence != 1">
                ORDER BY landing_sequence DESC
            </when>
            <!-- flashback = 1 时正序 -->
            <when test="flashback == 1">
                ORDER BY
@@ -2422,7 +2434,13 @@
               JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01'))                  AS glassNumber,
               od.order_number,
               ogd.child_width as width,
               ogd.child_height as height
               ogd.child_height as height,
                ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'') AS glassNumber,
                JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')) AS S01,
                JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S02')) AS S02,
                JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S03')) AS S03,
                JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S04')) AS S04,
                JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S05')) AS S05
        from flow_card as fc
                 left join sd.order_glass_detail as ogd
                           on ogd.order_id = fc.order_id and ogd.order_number = fc.order_number and
@@ -2462,11 +2480,16 @@
                   ' = ',#{printQuantity} )      as size,
               CONCAT(
                   od.order_number,')  ',
                   od.order_number,')      ',
                       TRIM(TRAILING '.' FROM TRIM(TRAILING '0' FROM CAST(width AS CHAR))),
                       ' X ',
                       TRIM(TRAILING '.' FROM TRIM(TRAILING '0' FROM CAST(height AS CHAR))),
                       ' = ',#{printQuantity} )      as numberSize,
               CONCAT(
                       od.order_number,')','   ',
                       TRIM(TRAILING '.' FROM TRIM(TRAILING '0' FROM CAST(width AS CHAR))),
                       ' X ',
                       TRIM(TRAILING '.' FROM TRIM(TRAILING '0' FROM CAST(height AS CHAR))))      as numberSizeQuantity,
               od.order_number                                       as orderNumber,
               fc.technology_number                                  as technologyNumber,
               od.building_number                                    as buildingNumber,
@@ -2476,6 +2499,7 @@
               c.customer_abbreviation                               as customerAbbreviation,
               p.product_abbreviation                                as productAbbreviation,
               fc.process_id                                         as processId,
               SUBSTRING(fc.process_id,12  )                                        as processIdAD ,/*-流程卡简写-*/
               o.create_time                                         as createTime,
               JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')) AS glassNumber,
               JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S02')) AS figureNumber,
@@ -3166,4 +3190,110 @@
    <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>
            <!-- landingSequence != 1 时,优先按 landing_sequence 倒序 -->
            <when test="landingSequence != 1">
                ORDER BY landing_sequence DESC
            </when>
            <!-- 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>
            <!-- landingSequence != 1 时,优先按 landing_sequence 倒序 -->
            <when test="landingSequence != 1">
                ORDER BY landing_sequence DESC
            </when>
            <!-- 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>