From 844cae1a3be7bd2fbf8803a7ee33b0622208de05 Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期三, 29 四月 2026 09:43:43 +0800
Subject: [PATCH] fix(production): 修复生产报表数据查询问题

---
 src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml |   31 ++++++++-----------------------
 1 files changed, 8 insertions(+), 23 deletions(-)

diff --git a/src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml b/src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml
index b7339b0..87f3a21 100644
--- a/src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml
+++ b/src/main/resources/mapper/production/SalesLedgerProductionAccountingMapper.xml
@@ -50,17 +50,11 @@
         group by t4.id
         order by t4.scheduling_date desc
     </select>
-    <select id="pageProductionAccounting"
-            resultType="com.ruoyi.production.dto.SalesLedgerProductionAccountingDto">
+    <select id="pageProductionAccounting" resultType="com.ruoyi.production.dto.SalesLedgerProductionAccountingDto">
 
         SELECT
-        slpa.scheduling_user_id,
-        MIN(slpa.scheduling_user_name) AS scheduling_user_name,
-
+        slpa.scheduling_user_name,
         SUM(ppout.quantity) AS output_num,
-
-        SUM(slpa.finished_num * slpa.work_hours) AS wages,
-
         CONCAT(
         ROUND(
         CASE
@@ -69,28 +63,21 @@
         END, 2
         ),
         '%'
-        ) AS output_rate,
-        GROUP_CONCAT(
+        ) AS output_rate, GROUP_CONCAT(
         CONCAT(
-        IFNULL(
-        TIMESTAMPDIFF(MINUTE, ppm.start_time, ppm.end_time),
-        0
-        ),
+        IFNULL(slpa.work_hour, 0),
         '|$|',
-        IFNULL(ppm.device_name, '鏈煡鏈哄彴')
+        IFNULL(dl.device_name, '鏈煡鏈哄彴')
         )
-        ORDER BY ppm.start_time
+        ORDER BY slpa.create_time
         SEPARATOR '>>>'
         ) AS device_work_info
-
         FROM sales_ledger_production_accounting slpa
-
         LEFT JOIN production_product_main ppm
         ON slpa.product_main_id = ppm.id
-
         LEFT JOIN production_product_output ppout
         ON ppm.id = ppout.product_main_id
-
+        left join device_ledger dl on dl.id = slpa.device_id
         <where>
             <if test="ew.schedulingUserName != null and ew.schedulingUserName !=''">
                 and slpa.scheduling_user_name = #{ew.schedulingUserName}
@@ -103,10 +90,8 @@
                 and slpa.scheduling_date >= #{ew.entryDateStart}
                 and slpa.scheduling_date &lt; DATE_ADD(DATE(#{ew.entryDateEnd}), INTERVAL 1 DAY)
             </if>
-
         </where>
-        GROUP BY slpa.scheduling_user_id
-
+        GROUP BY slpa.scheduling_user_name
     </select>
 
     <select id="selectDailyWagesStats" resultType="java.util.Map">

--
Gitblit v1.9.3