From 79f2ade5f58cf1bfc5118bf0720f8aba426c7840 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期四, 11 六月 2026 21:31:06 +0800
Subject: [PATCH] fix: 修复生产驾驶舱工单执行效率分析、生产核算分析、投入产出分析数据不显示问题
---
src/main/resources/mapper/production/ProductionProductInputMapper.xml | 10 ++++++++++
src/main/resources/mapper/production/ProductionProductOutputMapper.xml | 4 ++--
src/main/resources/mapper/production/ProductionAccountMapper.xml | 4 +++-
src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java | 8 ++++----
4 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java b/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
index d3c21a2..4c00873 100644
--- a/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
+++ b/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
@@ -1345,15 +1345,15 @@
String endStr = endDate.atStartOfDay()
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-// List<Map<String, Object>> inputList = productionProductInputMapper.selectInputStats(startStr, endStr);
- List<Map<String, Object>> inputList = null;
+ List<Map<String, Object>> inputList = productionProductInputMapper.selectInputStats(startStr, endStr);
+ //List<Map<String, Object>> inputList = null;
List<Map<String, Object>> outputList = productionProductOutputMapper.selectDailyOutputStats(startStr, endStr);
Map<String, InputOutputAnalysisDto> dateMap = new HashMap<>();
if (!CollectionUtils.isEmpty(inputList)) {
for (Map<String, Object> map : inputList) {
- String date = (String) map.get("date");
+ String date = (String) map.get("statDate");
if (date == null)
continue;
InputOutputAnalysisDto dto = dateMap.getOrDefault(date, new InputOutputAnalysisDto());
@@ -1366,7 +1366,7 @@
if (!CollectionUtils.isEmpty(outputList)) {
for (Map<String, Object> map : outputList) {
- String date = (String) map.get("date");
+ String date = (String) map.get("statDate");
if (date == null)
continue;
InputOutputAnalysisDto dto = dateMap.getOrDefault(date, new InputOutputAnalysisDto());
diff --git a/src/main/resources/mapper/production/ProductionAccountMapper.xml b/src/main/resources/mapper/production/ProductionAccountMapper.xml
index 4be1c23..d66347f 100644
--- a/src/main/resources/mapper/production/ProductionAccountMapper.xml
+++ b/src/main/resources/mapper/production/ProductionAccountMapper.xml
@@ -124,8 +124,10 @@
select date_format(scheduling_date, '%m-%d') as dateStr,
cast(ifnull(sum(finished_num), 0) as decimal(18,2)) as numberOfCompleted,
cast(ifnull(sum(work_hours), 0) as decimal(18,2)) as amount,
- cast(0 as decimal(18,2)) as passRate
+ cast(sum(ppo.quantity) / sum(ppo.quantity + ppo.scrap_qty) * 100.00 as decimal(18,2)) as passRate
from production_account
+ left join production_product_main ppm on ppm.id = production_account.production_product_main_id
+ left join production_product_output ppo on ppo.production_product_main_id = ppm.id
where scheduling_date >= #{startDate}
and scheduling_date <= #{endDate}
group by date_format(scheduling_date, '%m-%d')
diff --git a/src/main/resources/mapper/production/ProductionProductInputMapper.xml b/src/main/resources/mapper/production/ProductionProductInputMapper.xml
index fe88ae3..f04a824 100644
--- a/src/main/resources/mapper/production/ProductionProductInputMapper.xml
+++ b/src/main/resources/mapper/production/ProductionProductInputMapper.xml
@@ -42,5 +42,15 @@
</where>
order by ppi.create_time desc
</select>
+ <select id="selectInputStats" resultType="java.util.Map">
+ select DATE_FORMAT(create_time, '%Y-%m-%d') as statDate,
+ sum(ifnull(quantity, 0)) as quantity
+# sum(ifnull(scrap_qty, 0)) as scrapQty
+ from production_product_input
+ where create_time >= #{startDate}
+ and create_time <= #{endDate}
+ group by DATE_FORMAT(create_time, '%Y-%m-%d')
+ order by statDate asc
+ </select>
</mapper>
diff --git a/src/main/resources/mapper/production/ProductionProductOutputMapper.xml b/src/main/resources/mapper/production/ProductionProductOutputMapper.xml
index f31ca01..04bd6a9 100644
--- a/src/main/resources/mapper/production/ProductionProductOutputMapper.xml
+++ b/src/main/resources/mapper/production/ProductionProductOutputMapper.xml
@@ -48,13 +48,13 @@
</select>
<select id="selectDailyOutputStats" resultType="java.util.Map">
- select date(create_time) as statDate,
+ select DATE_FORMAT(create_time, '%Y-%m-%d') as statDate,
sum(ifnull(quantity, 0)) as quantity,
sum(ifnull(scrap_qty, 0)) as scrapQty
from production_product_output
where create_time >= #{startDate}
and create_time <= #{endDate}
- group by date(create_time)
+ group by DATE_FORMAT(create_time, '%Y-%m-%d')
order by statDate asc
</select>
--
Gitblit v1.9.3