From 04d4186264b6c599ad533868f9a2a99018cf7457 Mon Sep 17 00:00:00 2001 From: "wanling040@gmail.com" Date: Thu, 4 Aug 2022 10:26:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=BB=E7=AB=99=E5=A0=B1=E8=A1=A8-=E6=97=A5?= =?UTF-8?q?=E5=A0=B1:=20=E7=B4=AF=E7=A9=8D=E6=97=A5=E7=85=A7=E9=A1=AF?= =?UTF-8?q?=E7=A4=BA=20IrrDayHour?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SolarPower/Controllers/StationReportController.cs | 10 +++++----- SolarPower/Models/PowerStation.cs | 1 + SolarPower/Models/StationReport.cs | 3 +++ .../Implement/StationReportRepository.cs | 14 +++++++------- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/SolarPower/Controllers/StationReportController.cs b/SolarPower/Controllers/StationReportController.cs index e44cf14..e7803e8 100644 --- a/SolarPower/Controllers/StationReportController.cs +++ b/SolarPower/Controllers/StationReportController.cs @@ -244,7 +244,7 @@ namespace SolarPower.Controllers { "小時發電量(kWh)", "小時發電量百分比(%)", - "小時累積日照度(W/㎡)", + "累積日照度(Wh/㎡)", "小時平均模組溫度(°C)" }; if(Formhead.Result.Data.ShowMoney == 1) @@ -443,7 +443,7 @@ namespace SolarPower.Controllers "日照小時(hr)", "日均發電度數", "PR%", - "累積日照度(W/㎡)", + "累積日照度(Wh/㎡)", "日平均模組溫度(°C)" }; @@ -717,7 +717,7 @@ namespace SolarPower.Controllers "日照小時(hr)", "日均發電度數", "PR%", - "月累積日照度(W/㎡)", + "累積日照度(Wh/㎡)", "月平均模組溫度(°C)" }; @@ -1116,7 +1116,7 @@ namespace SolarPower.Controllers { "小時發電量(kWh)", "小時發電量百分比(%)", - "小時累積日照度(W/㎡)", + "累積日照度(Wh/㎡)", "小時平均模組溫度(°C)" }; if (Formhead.Result.Data.ShowMoney == 1) @@ -1317,7 +1317,7 @@ namespace SolarPower.Controllers "日照小時(hr)", "有效發電小時", "PR%", - "累積日照量(W/㎡)", + "累積日照量(Wh/㎡)", "日平均模組溫度(°C)" }; diff --git a/SolarPower/Models/PowerStation.cs b/SolarPower/Models/PowerStation.cs index 70e780c..5e7403e 100644 --- a/SolarPower/Models/PowerStation.cs +++ b/SolarPower/Models/PowerStation.cs @@ -733,6 +733,7 @@ namespace SolarPower.Models.PowerStation public double Dust { get; set; } //落塵計 public double WingDirection { get; set; } //風向計 public double IrrDay { get; set; } //累計日照量 + public double IrrDayHour { get; set; }//每小時的累積日照 } public class AvgPyrheliometerHistory diff --git a/SolarPower/Models/StationReport.cs b/SolarPower/Models/StationReport.cs index 77393ec..770156c 100644 --- a/SolarPower/Models/StationReport.cs +++ b/SolarPower/Models/StationReport.cs @@ -97,6 +97,9 @@ namespace SolarPower.Models public double PowerRate { get; set; } public double GeneratingCapacity { get; set; } public double TotalKWH { get; set; } + public double IrrDay { get; set; } + public double IrrDayHour { get; set; } + private string mintime; private string maxtime; diff --git a/SolarPower/Repository/Implement/StationReportRepository.cs b/SolarPower/Repository/Implement/StationReportRepository.cs index 8dde273..188afef 100644 --- a/SolarPower/Repository/Implement/StationReportRepository.cs +++ b/SolarPower/Repository/Implement/StationReportRepository.cs @@ -89,7 +89,7 @@ namespace SolarPower.Repository.Implement DROP TABLE IF EXISTS temp_inv; create TEMPORARY TABLE temp_inv as SELECT DATE_FORMAT(a.report_date,'%m-%d %H') report_date, {inv} - a.hourKWH hourKWH, a.hourKWHp 'hourKWHp', a.irradiance 'irradiance', a.Temperature 'temperature', + a.hourKWH hourKWH, a.hourKWHp 'hourKWHp', IFNULL(a.irrDay, 0) irrDay, IFNULL(a.irrDayHour, 0) irrDayHour, a.Temperature 'temperature', a.hourmoney 'hourmoney', c.TODAYKWH 'totKWH', c.KWHKWP 'totKWHKWP', c.money 'totmoney', stationName, powerRate daymoney, c.SOLARHOUR tothour,round(a.PR, 2) as pr,GeneratingCapacity FROM report_invday a left join @@ -114,7 +114,7 @@ namespace SolarPower.Repository.Implement select * from temp_inv union SELECT '總計' report_date, {inv} - round(sum(hourKWH), 2) hourKWH, round(sum(hourKWHp), 2) hourKWHp, round(sum(irradiance), 2) irradiance, + round(sum(hourKWH), 2) hourKWH, round(sum(hourKWHp), 2) hourKWHp, avg(irrDay) irrDay, avg(irrDayHour) irrDayHour, avg(temperature) temperature, round(sum(hourmoney), 2) hourmoney, avg(totKWH) totKWH, avg(totKWHKWP) totKWHKWP, avg(totmoney) totmoney, '電站名稱' stationName, avg(daymoney) daymoney, avg(tothour) tothour, avg(pr) pr, avg(GeneratingCapacity) GeneratingCapacity from temp_inv2 a; "; @@ -363,7 +363,7 @@ namespace SolarPower.Repository.Implement break; } - a = await conn.QueryAsync(sql, commandTimeout: 300); + a = await conn.QueryAsync(sql, commandTimeout: 600); } catch (Exception exception) { @@ -406,7 +406,7 @@ namespace SolarPower.Repository.Implement sql = @$"select Id from power_station_history_month where powerstationid = {post.PowerStation} and DATE_FORMAT(`TIMESTAMP`,'%Y') = '{post.Time}'"; break; } - a = await conn.QueryFirstOrDefaultAsync(sql); + a = await conn.QueryFirstOrDefaultAsync(sql, 600); } catch (Exception exception) { @@ -572,7 +572,7 @@ namespace SolarPower.Repository.Implement LEFT JOIN area ar ON ar.Id = ps.AreaId left JOIN ( - SELECT powerStationid id, ps.SOLARHOUR AS 'SolarHour',ps.TODAYKWH 'Kwh' , PR, KWHKWP, TODAYKWH, TOTALKWH, + SELECT powerStationid id, ps.SOLARHOUR AS 'SolarHour',SUM(ps.TODAYKWH) 'Kwh' , PR, KWHKWP, TODAYKWH, TOTALKWH, DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') AS 'time', MAX(DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d %H:%i')) AS 'maxtime', MIN(DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d %H:%i')) AS 'mintime', ps.PowerStationId @@ -588,7 +588,7 @@ namespace SolarPower.Repository.Implement GROUP BY ps.PowerStationId ) c ON a.Id = c.PowerStationId and a.time = c.time WHERE ps.Id IN @ids ORDER BY ps.CityId"; - result = (await conn.QueryAsync(sql,new { ids = ids}, commandTimeout: 300)).ToList(); + result = (await conn.QueryAsync(sql,new { ids = ids}, commandTimeout: 600)).ToList(); } catch (Exception exception) { @@ -792,7 +792,7 @@ namespace SolarPower.Repository.Implement break; } - a = await conn.QueryAsync(sql,commandTimeout: 300); + a = await conn.QueryAsync(sql,commandTimeout: 600); } catch (Exception exception) {