From 393f885a8de372323f4e3d4da26afb216d7563ee Mon Sep 17 00:00:00 2001 From: cesar liu Date: Mon, 28 Feb 2022 15:26:58 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=A8=88=E7=AE=97=E6=AF=8F=E6=97=A5?= =?UTF-8?q?=E5=96=AE=E5=83=B9=20=E6=94=B9=E6=8A=93=E5=8F=96=20station=5Fho?= =?UTF-8?q?ur.todayKWH?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + solarApp/Service/procStationSvc.cs | 6 ++---- solarApp/fmArchive.cs | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index d06434a..3cc603f 100644 --- a/.gitignore +++ b/.gitignore @@ -346,3 +346,4 @@ healthchecksdb /SolarPower/wwwroot/upload/report/20210819 /SolarPower/SolarPower.zip /SolarPower.zip +/SolarPower/wwwroot/upload/report/20220227 diff --git a/solarApp/Service/procStationSvc.cs b/solarApp/Service/procStationSvc.cs index fd130d6..80deb8c 100644 --- a/solarApp/Service/procStationSvc.cs +++ b/solarApp/Service/procStationSvc.cs @@ -228,7 +228,7 @@ namespace solarApp.Service WHEN b.SolarType = 1 THEN a.TOTALKWH * PowerRate * c.LeaseRate ELSE a.TOTALKWH * PowerRate END TOTALMONEY,*/ - (KWH * PowerRate) MONEY, + (a.TODAYKWH * PowerRate) MONEY, (a.TOTALKWH * PowerRate) TOTALMONEY, (KWH * CarbonRate) CARBON, round((a.TOTALKWH * CarbonRate), 4) TOTALCARBON from @@ -269,9 +269,7 @@ namespace solarApp.Service #endregion day #region month - sql = @" - delete from power_station_history_month where powerstationID = @powerStationID and left(`TIMESTAMP`, 7) = @date1 ; - + sql = @" INSERT INTO solar_master.power_station_history_month(PowerStationId, `TIMESTAMP`, SITEID, SITETYPE, monthKwh , TOTALKWH, KWHKWP, PR, MP, SOLARHOUR, MONEY, TOTALMONEY, CARBON, TOTALCARBON) diff --git a/solarApp/fmArchive.cs b/solarApp/fmArchive.cs index 9703a54..8ba8401 100644 --- a/solarApp/fmArchive.cs +++ b/solarApp/fmArchive.cs @@ -319,7 +319,7 @@ namespace solarApp private void gv_inv_detail_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (gv_inv_detail.Columns.Count == 5) return; + if (gv_inv_detail.Columns.Count == 5 || e.RowIndex == -1) return; string inverterID = gv_inv_detail.Rows[e.RowIndex].Cells[1].Value.ToString(); //MessageBox.Show(inverterID); From 36bf91da721916d0ef5d658b1f0dec89364ef9d2 Mon Sep 17 00:00:00 2001 From: b110212000 Date: Tue, 1 Mar 2022 13:55:52 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=B6=9C=E5=90=88=E5=A0=B1=E8=A1=A8?= =?UTF-8?q?=E6=9C=88=E5=A0=B1=20=E7=99=BC=E5=B8=83=E9=8C=AF=E8=AA=A4?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/StationReportController.cs | 1 + .../Quartz/Jobs/OperationScheduleJob.cs | 64 ++++++++++++------- .../Implement/StationReportRepository.cs | 4 +- 3 files changed, 43 insertions(+), 26 deletions(-) diff --git a/SolarPower/Controllers/StationReportController.cs b/SolarPower/Controllers/StationReportController.cs index 974f887..771f12b 100644 --- a/SolarPower/Controllers/StationReportController.cs +++ b/SolarPower/Controllers/StationReportController.cs @@ -1099,6 +1099,7 @@ namespace SolarPower.Controllers var thour = ""; var tpr = ""; var tkwh = ""; var kWhkwp = ""; var ntd = ""; var ntdone = ""; var GeneratingCapacity = ""; foreach (dynamic body in Formbody.Result.Data) { + index = 0; var dbody = body as IDictionary; thour = Checknull(Math.Round(Convert.ToDouble(dbody["tothour"]), 2).ToString()); diff --git a/SolarPower/Quartz/Jobs/OperationScheduleJob.cs b/SolarPower/Quartz/Jobs/OperationScheduleJob.cs index b1a9027..10a1d73 100644 --- a/SolarPower/Quartz/Jobs/OperationScheduleJob.cs +++ b/SolarPower/Quartz/Jobs/OperationScheduleJob.cs @@ -2,6 +2,7 @@ using Newtonsoft.Json; using Quartz; using SolarPower.Models; +using SolarPower.Models.User; using SolarPower.Repository.Interface; using System; using System.Collections.Generic; @@ -198,10 +199,25 @@ namespace SolarPower.Quartz.Jobs #region 寄送日月報 var users = userRepository.GetAllAsync(); - var ttt = new List() { - "s506488@gmail.com", - "cesarliuc@gmail.com" - }; + + //var usertest = new List(); + //var oneuser = new User() + //{ + // Account = "cesarliuc@gmail.com", + // Password = "np/F0eliIy3lPJe1tU18oiG7dzKRrpVw16/XZpHOph8=", + // Id = 13, + // Email = "cesarliuc@gmail.com", + // Status = 1, + // Name = "TEST" + //}; + //usertest.Add(oneuser); + + //var ttt = new List() { + // "s506488@gmail.com", + // "cesarliuc@gmail.com" + //}; + + foreach (var user in users.Result) { @@ -244,15 +260,15 @@ namespace SolarPower.Quartz.Jobs Type = 1 }; List properties = new List() - { - "UserId", - "EmailType", - "RecipientEmail", - "Subject", - "Attachment", - "RecipientName", - "Type" - }; + { + "UserId", + "EmailType", + "RecipientEmail", + "Subject", + "Attachment", + "RecipientName", + "Type" + }; await noticeScheduleRepository.AddOneAsync(DaySchedule, properties); } } @@ -279,24 +295,24 @@ namespace SolarPower.Quartz.Jobs Type = 1 }; List properties = new List() - { - "UserId", - "EmailType", - "RecipientEmail", - "Subject", - "Attachment", - "RecipientName", - "Type" - }; + { + "UserId", + "EmailType", + "RecipientEmail", + "Subject", + "Attachment", + "RecipientName", + "Type" + }; await noticeScheduleRepository.AddOneAsync(MaxSchedule, properties); if (DateTime.Now.ToString("dd") == "01") { Select_table2 maxmonthexcel = new Select_table2() { - FormType = 0, + FormType = 1, PowerStation = sentMaxpowerstations, - SearchType = 0, + SearchType = 1, Time = DateTime.Now.AddDays(-1).ToString("yyyy-MM"), Userid = user.Id }; diff --git a/SolarPower/Repository/Implement/StationReportRepository.cs b/SolarPower/Repository/Implement/StationReportRepository.cs index 1111802..596da1e 100644 --- a/SolarPower/Repository/Implement/StationReportRepository.cs +++ b/SolarPower/Repository/Implement/StationReportRepository.cs @@ -393,7 +393,7 @@ namespace SolarPower.Repository.Implement GROUP BY a.Id,a.time ) n ON n.Id = ps.Id WHERE ps.Id IN @ids ORDER BY ps.CityId"; - result = (await conn.QueryAsync(sql,new { ids = ids})).ToList(); + result = (await conn.QueryAsync(sql,new { ids = ids}, commandTimeout: 300)).ToList(); } catch (Exception exception) { @@ -597,7 +597,7 @@ namespace SolarPower.Repository.Implement break; } - a = await conn.QueryAsync(sql); + a = await conn.QueryAsync(sql,commandTimeout: 300); } catch (Exception exception) { From 31447af5569ce2e8d5a4fc0d96ba390bd88675c0 Mon Sep 17 00:00:00 2001 From: b110212000 Date: Wed, 2 Mar 2022 11:18:52 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=A0=B1=E8=A1=A8=E7=99=BC=E9=80=81?= =?UTF-8?q?=E5=A4=B1=E6=95=97=E4=BF=AE=E5=BE=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SolarPower/Controllers/StationReportController.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SolarPower/Controllers/StationReportController.cs b/SolarPower/Controllers/StationReportController.cs index 771f12b..2e19f88 100644 --- a/SolarPower/Controllers/StationReportController.cs +++ b/SolarPower/Controllers/StationReportController.cs @@ -1046,6 +1046,10 @@ namespace SolarPower.Controllers } var sheet = workbook.CreateSheet(powerstationid.Name); var Formbody = GetForm(select_Table);//取body + if(Formbody.Result.Data.Count == 0) + { + continue; + } var Formhead = GetTableHead(select_Table);//取head int RowPosition = 0;