From 36bf91da721916d0ef5d658b1f0dec89364ef9d2 Mon Sep 17 00:00:00 2001 From: b110212000 Date: Tue, 1 Mar 2022 13:55:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B6=9C=E5=90=88=E5=A0=B1=E8=A1=A8=E6=9C=88?= =?UTF-8?q?=E5=A0=B1=20=E7=99=BC=E5=B8=83=E9=8C=AF=E8=AA=A4=E4=BF=AE?= =?UTF-8?q?=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) {