chenlu
2025-12-18 aece48b253b2e0b814bbdf5ee3d474e8cf697122
north-glass-erp/src/main/resources/mapper/pp/Report.xml
@@ -833,7 +833,9 @@
        rw.this_process,
        rw.creator,
        rw.reporting_work_id,
        JSON_UNQUOTE(JSON_EXTRACT(pd.separation, '$.thickness')) AS thickness
        JSON_UNQUOTE(JSON_EXTRACT(pd.separation, '$.thickness')) AS thickness,
        ROUND(round( ogd.child_width * ogd.child_height * dd.breakage_quantity / 1000000, 2 )
        * SUBSTRING_INDEX(IFNULL(JSON_UNQUOTE(JSON_EXTRACT(pd.separation, '$.thickness')), '0'), 'mm', 1),2) AS pingfang
        FROM
        sd.ORDER AS o
        LEFT JOIN sd.order_glass_detail AS ogd ON ogd.order_id = o.order_id
@@ -1441,7 +1443,9 @@
               rw.this_process,
               rw.creator,
               rw.reporting_work_id,
               JSON_UNQUOTE(JSON_EXTRACT(pd.separation, '$.thickness')) AS thickness
               JSON_UNQUOTE(JSON_EXTRACT(pd.separation, '$.thickness')) AS thickness,
            ROUND(round( ogd.child_width * ogd.child_height * dd.breakage_quantity / 1000000, 2 )
            * SUBSTRING_INDEX(IFNULL(JSON_UNQUOTE(JSON_EXTRACT(pd.separation, '$.thickness')), '0'), 'mm', 1),2) AS pingfang
        FROM sd.ORDER AS o
                 LEFT JOIN sd.order_glass_detail AS ogd ON ogd.order_id = o.order_id
                 LEFT JOIN reporting_work AS rw ON rw.order_id = o.order_id
@@ -2721,7 +2725,9 @@
    <select id="damageReportFootSum">
        SELECT
            SUM(dd.breakage_quantity) AS breakageQuantity,
            ROUND(SUM(ogd.child_width * ogd.child_height * dd.breakage_quantity) / 1000000, 2) AS area
            ROUND(SUM(ogd.child_width * ogd.child_height * dd.breakage_quantity) / 1000000, 2) AS area,
        SUM(ROUND(round( ogd.child_width * ogd.child_height * dd.breakage_quantity / 1000000, 2 )
        * SUBSTRING_INDEX(IFNULL(JSON_UNQUOTE(JSON_EXTRACT(pd.separation, '$.thickness')), '0'), 'mm', 1),2)) AS pingfang
        FROM
            sd.ORDER AS o
                LEFT JOIN sd.order_glass_detail AS ogd ON ogd.order_id = o.order_id
@@ -2973,7 +2979,7 @@
        od.quantity,
        ogd.child_width,
        ogd.child_height,
        d.numCounts + d.patchNumSum - d.numCount -d.broken_num as stockNum,
        d.numCounts + d.patchNumSum - d.numCount -d.broken_num-ifnull(fc.termination_quantity,0) as stockNum,
        ROUND(ogd.child_width * ogd.child_height *
        (d.numCounts + d.patchNumSum - d.numCount -
        d.broken_num) / 1000000, 2) as stockArea,
@@ -3454,8 +3460,13 @@
                 SELECT g.*
                      ,GROUP_CONCAT(g.glass_child SEPARATOR '+')  as childName
                 from( SELECT f.*,
        e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num as quantity,
        (e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num)*f.area as glassArea
        if((e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num-f.termination_quantity)>0,
        (e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num-f.termination_quantity),
            0
            ) as quantity,
        if((e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num-f.termination_quantity)>0,
        (e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num-f.termination_quantity)  ,
            0)*f.area as glassArea
                       from (SELECT a.order_id,
                                   if(a.batch!="",CONCAT(a.project,'(',a.batch,')'),a.project) as project,
                                    C.product_id,
@@ -3468,7 +3479,8 @@
                                    b.id,
                                    c.area,
                                    d.glass_child,
                                    ifnull(cb.patchNumSum,0) as patchNumSum
                                    ifnull(cb.patchNumSum,0) as patchNumSum,
                                    fc.termination_quantity
                             FROM sd.`order` as a
                                      LEFT JOIN sd.order_process_detail as b
@@ -3530,6 +3542,7 @@
             ) as h
        where h.quantity >0
        <choose>
            <when test="optionVal == 1">
                GROUP BY thisProcess