From 24888c4b2ca2ffc49c4d94aefd6aea32d515b6dd Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期日, 20 四月 2025 14:17:24 +0800
Subject: [PATCH] 分架明细报表修改查询问题

---
 north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml |   40 ++++++++++++++++------------------------
 1 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml b/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
index 47e25ea..91b3660 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
@@ -1020,27 +1020,22 @@
 
     <select id="getFootSum">
         SELECT
-            ifnull(SUM(this_completed_quantity),0) AS thisCompletedQuantity,
-            ifnull(SUM(ROUND(child_width * child_height * this_completed_quantity / 1000000, 2)),0) AS completedArea,
-            ifnull(SUM(this_worn_quantity),0) AS thisWornQuantity,
-            ifnull(SUM(ROUND(child_width * child_height * this_worn_quantity / 1000000, 2)),0) AS wornArea
-        FROM (
-                 -- 鍏堝 reporting_work_id 杩涜鍘婚噸
-                 SELECT
-                     rw.reporting_work_id,
-                     MAX(rw.this_completed_quantity) AS this_completed_quantity,
-                     MAX(rw.this_worn_quantity) AS this_worn_quantity,
-                     MAX(ogd.child_width) AS child_width,
-                     MAX(ogd.child_height) AS child_height
-                 FROM reporting_work as rw left join reporting_work_detail as rwd on rw.reporting_work_id=rwd.reporting_work_id
-        left join sd.order_glass_detail as ogd on ogd.order_id=rw.order_id and ogd.order_number=rwd.order_number and ogd.technology_number=rwd.technology_number
-        left join sd.`order` as o on o.order_id=rw.order_id
-                 WHERE rw.reviewed_state != 2
-      and rw.reporting_work_time >= #{selectTime1}
-                   AND rw.reporting_work_time &lt;  #{selectTime2}
-                   and position(#{orderId} in rw.order_id)
-                   AND rw.reviewed_state != -1
-                   AND o.create_order > 0
+        SUM(rw.this_completed_quantity) AS thisCompletedQuantity,
+        ROUND(SUM(ogd.child_width * ogd.child_height * rw.this_completed_quantity / 1000000), 2) AS completedArea,
+        SUM(rw.this_worn_quantity) AS thisWornQuantity,
+        ROUND(SUM(ogd.child_width * ogd.child_height * rw.this_worn_quantity / 1000000), 2) AS wornArea
+        FROM reporting_work AS rw
+        LEFT JOIN reporting_work_detail AS rwd ON rw.reporting_work_id = rwd.reporting_work_id
+        LEFT JOIN sd.order_glass_detail AS ogd ON ogd.order_id = rw.order_id
+        AND ogd.order_number = rwd.order_number
+        AND ogd.technology_number = rwd.technology_number
+        LEFT JOIN sd.`order` AS o ON o.order_id = rw.order_id
+        WHERE rw.reviewed_state != 2
+        and rw.reporting_work_time >= #{selectTime1}
+        AND rw.reporting_work_time &lt;  #{selectTime2}
+        AND position(#{orderId} in rw.order_id)
+        AND rw.reviewed_state != -1
+        AND o.create_order > 0
         <if test="reportingWork.reportingWorkId != null and reportingWork.reportingWorkId != ''">
             and rw.reporting_work_id regexp #{reportingWork.reportingWorkId}
         </if>
@@ -1065,9 +1060,6 @@
         <if test="reportingWork.teamsGroupsName != null and reportingWork.teamsGroupsName != ''">
             and rw.teams_groups_name regexp #{reportingWork.teamsGroupsName}
         </if>
-                 GROUP BY rw.reporting_work_id  -- 鎸� reporting_work_id 杩涜鍒嗙粍锛岀‘淇濆敮涓�
-
-             ) AS subquery;
 
     </select>
 

--
Gitblit v1.8.0