From b25258e282d5a53d851a7e19132ecbc842eee7b9 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期一, 02 二月 2026 09:10:38 +0800
Subject: [PATCH] fix: 生产核算分析缺少数量及合格率

---
 src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml |   29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml b/src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml
index 31e95de..3535b77 100644
--- a/src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml
+++ b/src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml
@@ -88,18 +88,23 @@
 
     </select>
 
-
-
     <select id="selectDailyWagesStats" resultType="java.util.Map">
-        SELECT
-            DATE_FORMAT(scheduling_date, '%Y-%m-%d') as date,
-            SUM(finished_num * work_hours) as wages
-        FROM
-            sales_ledger_production_accounting
-        WHERE
-            scheduling_date &gt;= #{startDate}
-            AND scheduling_date &lt;= #{endDate}
-        GROUP BY
-            scheduling_date
+        SELECT DATE(ppout.create_time)                                                         AS dateStr,
+               SUM(ppout.quantity - IFNULL(ppout.scrap_qty, 0))                                AS numberOfCompleted,
+               SUM((ppout.quantity - IFNULL(ppout.scrap_qty, 0)) * IFNULL(pp.salary_quota, 0)) AS amount,
+               ROUND(
+                       SUM(ppout.quantity - IFNULL(ppout.scrap_qty, 0)) * 100 / NULLIF(SUM(ppout.quantity), 0),
+                       2
+               )                                                                               AS passRate
+        FROM production_product_output ppout
+                 LEFT JOIN production_product_main ppm ON ppm.id = ppout.product_main_id
+                 LEFT JOIN product_process_route_item ppri ON ppri.id = ppm.product_process_route_item_id
+                 LEFT JOIN product_process pp ON pp.id = ppri.process_id
+        WHERE ppout.create_time &gt;= #{startDate}
+          AND ppout.create_time &lt; #{endDate}
+        GROUP BY DATE(ppout.create_time)
+        ORDER BY DATE(ppout.create_time);
     </select>
+
+
 </mapper>

--
Gitblit v1.9.3