diff --git a/SolarPower/Controllers/AnalysisInverterController.cs b/SolarPower/Controllers/AnalysisInverterController.cs index 5676990..2539ff3 100644 --- a/SolarPower/Controllers/AnalysisInverterController.cs +++ b/SolarPower/Controllers/AnalysisInverterController.cs @@ -914,7 +914,14 @@ namespace SolarPower.Controllers } catch (Exception exception) { - apiResult.Code = "9999"; + if(exception.Message == "Fatal error encountered during command execution.") + { + apiResult.Code = "9984"; + } + else + { + apiResult.Code = "9999"; + } Logger.LogError("【" + controllerName + "/" + actionName + "】"); Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); } diff --git a/SolarPower/Controllers/ElectricitySoldRecordController.cs b/SolarPower/Controllers/ElectricitySoldRecordController.cs index 0349c60..7d5b574 100644 --- a/SolarPower/Controllers/ElectricitySoldRecordController.cs +++ b/SolarPower/Controllers/ElectricitySoldRecordController.cs @@ -46,7 +46,7 @@ namespace SolarPower.Controllers where_entities.Add("Filter", filter); } - //抓出 除了自建自用 + var temp_solarType_where = $@" ps.SolarType != 2"; where.Add(temp_solarType_where); diff --git a/SolarPower/Controllers/MyBaseController.cs b/SolarPower/Controllers/MyBaseController.cs index 31afcb1..8556edb 100644 --- a/SolarPower/Controllers/MyBaseController.cs +++ b/SolarPower/Controllers/MyBaseController.cs @@ -177,7 +177,7 @@ namespace SolarPower.Controllers myUser.myPowerStationGroupByCities = myPowerStations; ViewBag.myPowerStationGroupByCities = myPowerStations; - if (controllerName == "PowerStation" && actionName == "Edit") + if (controllerName == "StationOverview" && actionName == "Info") { //電站資訊的各電站 string stationId_param = filterContext.HttpContext.Request.Query["stationId"]; diff --git a/SolarPower/Controllers/OperationController.cs b/SolarPower/Controllers/OperationController.cs index 33bc534..88ca4a2 100644 --- a/SolarPower/Controllers/OperationController.cs +++ b/SolarPower/Controllers/OperationController.cs @@ -643,7 +643,7 @@ namespace SolarPower.Controllers OperationRecordPersonnel operationRecordPersonnel = new OperationRecordPersonnel(); operationRecordPersonnel.OperationRecordId = id; operationRecordPersonnel.UserId = op; - + operationRecordPersonnel.CreatedBy = myUser.Id; insertOperationRecordPersonnels.Add(operationRecordPersonnel); } @@ -651,6 +651,7 @@ namespace SolarPower.Controllers { "OperationRecordId", "UserId", + "CreatedBy" }; await operationRepository.AddOperationRecordPersonnelAsync(insertOperationRecordPersonnels, operationRecordPersonnelProperties); @@ -658,82 +659,83 @@ namespace SolarPower.Controllers } - if (post.WorkPersonIds != null) + if(post.Emailcheck == 1) { - var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId); - List noticeSchedules = new List(); - foreach (var person in post.WorkPersonIds) + if (post.WorkPersonIds != null) { - var fixtype = post.WorkType switch + var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId); + List noticeSchedules = new List(); + foreach (var person in post.WorkPersonIds) + { + var fixtype = post.WorkType switch + { + 0 => "清洗", + 1 => "巡檢", + 2 => "維修", + _ => "" + }; + var user = await userRepository.GetOneAsync(person); + NoticeSchedule schedule = new NoticeSchedule() + { + EmailType = 3, + Type = 1, + UserId = person, + RecipientName = user.Name, + RecipientEmail = user.Email, + Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime, + Content = "維修項目" + post.FixDo + "
注意事項 :" + post.Notice, + }; + noticeSchedules.Add(schedule); + } + properties = new List() + { + "UserId", + "EmailType", + "RecipientEmail", + "Subject", + "Content", + "RecipientName", + "Type", + "ExceptionId" + }; + await noticeScheduleRepository.AddAnyThing>(noticeSchedules, properties, "notice_schedule"); + } + + if (post.FixFirm != 0) + { + var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId); + var fixtype = operationRecord.WorkType switch { 0 => "清洗", 1 => "巡檢", 2 => "維修", _ => "" }; - var user = await userRepository.GetOneAsync(person); + var powerstation = await powerStationRepository.GetOneAsync(post.PowerStationId); + var firm = await operationRepository.GetOneWithCustomDBNameAndTableAsync(post.FixFirm, powerstations.SiteDB, "operation_firm"); NoticeSchedule schedule = new NoticeSchedule() { EmailType = 3, Type = 1, - UserId = person, - RecipientName = user.Name, - RecipientEmail = user.Email, + RecipientName = firm.Name, + RecipientEmail = firm.Email, Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime, Content = "維修項目" + post.FixDo + "
注意事項 :" + post.Notice, }; - noticeSchedules.Add(schedule); + properties = new List() + { + "UserId", + "EmailType", + "RecipientEmail", + "Subject", + "Content", + "RecipientName", + "Type", + "ExceptionId" + }; + await noticeScheduleRepository.AddAnyThing(schedule, properties, "notice_schedule"); } - properties = new List() - { - "UserId", - "EmailType", - "RecipientEmail", - "Subject", - "Content", - "RecipientName", - "Type", - "ExceptionId" - }; - await noticeScheduleRepository.AddAnyThing>(noticeSchedules, properties, "notice_schedule"); } - - if (post.FixFirm != 0) - { - var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId); - var fixtype = operationRecord.WorkType switch - { - 0 => "清洗", - 1 => "巡檢", - 2 => "維修", - _ => "" - }; - var powerstation = await powerStationRepository.GetOneAsync(post.PowerStationId); - var firm = await operationRepository.GetOneWithCustomDBNameAndTableAsync(post.FixFirm, powerstations.SiteDB, "operation_firm"); - NoticeSchedule schedule = new NoticeSchedule() - { - EmailType = 3, - Type = 1, - RecipientName = firm.Name, - RecipientEmail = firm.Email, - Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime, - Content = "維修項目" + post.FixDo + "
注意事項 :" + post.Notice, - }; - properties = new List() - { - "UserId", - "EmailType", - "RecipientEmail", - "Subject", - "Content", - "RecipientName", - "Type", - "ExceptionId" - }; - await noticeScheduleRepository.AddAnyThing(schedule, properties, "notice_schedule"); - } - - //using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Suppress)) //{ @@ -879,83 +881,89 @@ namespace SolarPower.Controllers } #endregion - - if (post.WorkPersonIds != null) + if (post.Emailcheck == 1) { - var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId); - List noticeSchedules = new List(); - foreach (var person in post.WorkPersonIds) + if (post.WorkPersonIds != null) { - var fixtype = operationRecord.WorkType switch + var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId); + List noticeSchedules = new List(); + foreach (var person in post.WorkPersonIds) + { + var fixtype = operationRecord.WorkType switch + { + 0 => "清洗", + 1 => "巡檢", + 2 => "維修", + _ => "" + }; + var user = await userRepository.GetOneAsync(person); + NoticeSchedule schedule = new NoticeSchedule() + { + EmailType = 3, + Type = 1, + UserId = person, + RecipientName = user.Name, + RecipientEmail = user.Email, + Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime, + Content = "維修項目:" + post.FixDo + "
注意事項 :" + post.Notice, + }; + noticeSchedules.Add(schedule); + } + properties = new List() + { + "UserId", + "EmailType", + "RecipientEmail", + "Subject", + "Content", + "RecipientName", + "Type", + "ExceptionId" + }; + await noticeScheduleRepository.AddAnyThing>(noticeSchedules, properties, "notice_schedule"); + } + if (post.FixFirm != 0) + { + var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId); + var fixtype = post.WorkType switch { 0 => "清洗", 1 => "巡檢", 2 => "維修", _ => "" }; - var user = await userRepository.GetOneAsync(person); + var powerstation = await powerStationRepository.GetOneAsync(post.PowerStationId); + var firm = await operationRepository.GetOneWithCustomDBNameAndTableAsync(post.FixFirm, powerstations.SiteDB, "operation_firm"); NoticeSchedule schedule = new NoticeSchedule() { EmailType = 3, Type = 1, - UserId = person, - RecipientName = user.Name, - RecipientEmail = user.Email, + RecipientName = firm.Name, + RecipientEmail = firm.Email, Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime, Content = "維修項目:" + post.FixDo + "
注意事項 :" + post.Notice, }; - noticeSchedules.Add(schedule); + properties = new List() + { + "UserId", + "EmailType", + "RecipientEmail", + "Subject", + "Content", + "RecipientName", + "Type", + "ExceptionId" + }; + await noticeScheduleRepository.AddAnyThing(schedule, properties, "notice_schedule"); + + + } - properties = new List() - { - "UserId", - "EmailType", - "RecipientEmail", - "Subject", - "Content", - "RecipientName", - "Type", - "ExceptionId" - }; - await noticeScheduleRepository.AddAnyThing>(noticeSchedules, properties, "notice_schedule"); } - if (post.FixFirm != 0) - { - var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId); - var fixtype = post.WorkType switch - { - 0 => "清洗", - 1 => "巡檢", - 2 => "維修", - _ => "" - }; - var powerstation = await powerStationRepository.GetOneAsync(post.PowerStationId); - var firm = await operationRepository.GetOneWithCustomDBNameAndTableAsync(post.FixFirm, powerstations.SiteDB, "operation_firm"); - NoticeSchedule schedule = new NoticeSchedule() - { - EmailType = 3, - Type = 1, - RecipientName = firm.Name, - RecipientEmail = firm.Email, - Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime, - Content = "維修項目:" + post.FixDo + "
注意事項 :" + post.Notice, - }; - properties = new List() - { - "UserId", - "EmailType", - "RecipientEmail", - "Subject", - "Content", - "RecipientName", - "Type", - "ExceptionId" - }; - await noticeScheduleRepository.AddAnyThing(schedule, properties, "notice_schedule"); - } + #endregion diff --git a/SolarPower/Controllers/PowerGenerationController.cs b/SolarPower/Controllers/PowerGenerationController.cs index 86c1cca..8afaaf4 100644 --- a/SolarPower/Controllers/PowerGenerationController.cs +++ b/SolarPower/Controllers/PowerGenerationController.cs @@ -47,7 +47,7 @@ namespace SolarPower.Controllers where_entities.Add("Filter", filter); } - var temp_solartype_where = @" ps.SolarType = 0"; + var temp_solartype_where = @" ps.SolarType != 2"; where.Add(temp_solartype_where); var powerStations = myPowerStationService.GetMyPowerStations(myUser, 1, null, where, where_entities); diff --git a/SolarPower/Controllers/StationReportController.cs b/SolarPower/Controllers/StationReportController.cs index 755f851..b5d7f5a 100644 --- a/SolarPower/Controllers/StationReportController.cs +++ b/SolarPower/Controllers/StationReportController.cs @@ -420,7 +420,7 @@ namespace SolarPower.Controllers "日發電量(kWh)", "日發電量百分比(%)", "日照小時(hr)", - "kWH/kWP", + "有效發電小時", "PR%", "日平均日照度(W/㎡)", "日平均模組溫度(°C)" @@ -518,7 +518,7 @@ namespace SolarPower.Controllers cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); - cell.SetCellValue("kWH/kWP平均(日)"); + cell.SetCellValue("平均有效發電小時(日)"); cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); @@ -666,7 +666,7 @@ namespace SolarPower.Controllers "月發電量(kWh)", "月發電量百分比(%)", "日照小時(hr)", - "kWH/kWP", + "有效發電小時", "PR%", "月平均日照度(W/㎡)", "月平均模組溫度(°C)" @@ -764,7 +764,7 @@ namespace SolarPower.Controllers cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); - cell.SetCellValue("kWH/kWP平均(月)"); + cell.SetCellValue("平均有效發電小時(月)"); cell.CellStyle = styleLine12; index++; cell = row.CreateCell(index); @@ -1141,7 +1141,7 @@ namespace SolarPower.Controllers index = 0; row = sheet.CreateRow(RowPosition); cell = row.CreateCell(index); - cell.SetCellValue("kWH/kWP:"); + cell.SetCellValue("有效發電小時:"); cell.CellStyle = styleLine12; cell = row.CreateCell(1); cell.SetCellValue(!string.IsNullOrEmpty(kWhkwp) ? Convert.ToDouble(kWhkwp) : 0); @@ -1220,7 +1220,7 @@ namespace SolarPower.Controllers "日發電量(kWh)", "日發電量百分比(%)", "日照小時(hr)", - "kWH/kWP", + "有效發電小時", "PR%", "日平均日照度(W/㎡)", "日平均模組溫度(°C)" @@ -1574,7 +1574,7 @@ namespace SolarPower.Controllers index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(form.SolarHour,2)); + cell.SetCellValue(Math.Round(form.AvgKWHKWP,2)); cell.CellStyle = styleLine12; index++; @@ -1634,7 +1634,8 @@ namespace SolarPower.Controllers City = form.CityName, Count = 1, Kwh = form.Kwh, - SolarHour = form.SolarHour + SolarHour = form.SolarHour, + Kwhkwp = form.AvgKWHKWP }; if( cityArrays.Where(a=>a.City == form.CityName).Count() > 0) { @@ -1642,6 +1643,7 @@ namespace SolarPower.Controllers city.Count += cityinfo.Count; city.Kwh += cityinfo.Kwh; city.SolarHour += cityinfo.SolarHour; + city.Kwhkwp += cityinfo.Kwhkwp; } else { @@ -1659,7 +1661,7 @@ namespace SolarPower.Controllers "區域", "電站名稱", "發電量", - "發電小時", + "有效發電小時", "平均日照", "PR" }; @@ -1708,7 +1710,7 @@ namespace SolarPower.Controllers index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round((cityArray.SolarHour / cityArray.Count), 2)); + cell.SetCellValue(Math.Round((cityArray.Kwhkwp / cityArray.Count), 2)); cell.CellStyle = styleLine12; region = new CellRangeAddress(cityRowPosition, cityRowPosition, index, index + 1); sheet.AddMergedRegion(region); @@ -1742,7 +1744,7 @@ namespace SolarPower.Controllers index++; cell = row.CreateCell(index); - cell.SetCellValue("發電時間(小時)"); + cell.SetCellValue("有效發電小時"); cell.CellStyle = styleLine12; region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1); sheet.AddMergedRegion(region); @@ -1919,7 +1921,7 @@ namespace SolarPower.Controllers index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round(form.SolarHour, 2)); + cell.SetCellValue(Math.Round(form.AvgKWHKWP, 2)); cell.CellStyle = styleLine12; index++; @@ -1979,7 +1981,8 @@ namespace SolarPower.Controllers City = form.CityName, Count = 1, Kwh = form.Kwh, - SolarHour = form.SolarHour + SolarHour = form.SolarHour, + Kwhkwp = form.AvgKWHKWP }; if (cityArrays.Where(a => a.City == form.CityName).Count() > 0) { @@ -1987,6 +1990,7 @@ namespace SolarPower.Controllers city.Count += cityinfo.Count; city.Kwh += cityinfo.Kwh; city.SolarHour += cityinfo.SolarHour; + city.Kwhkwp += cityinfo.Kwhkwp; } else { @@ -2004,7 +2008,7 @@ namespace SolarPower.Controllers "區域", "電站名稱", "發電量", - "發電小時", + "有效發電小時", "平均日照", "PR" }; @@ -2053,7 +2057,7 @@ namespace SolarPower.Controllers index++; cell = row.CreateCell(index); - cell.SetCellValue(Math.Round((cityArray.SolarHour / cityArray.Count), 2)); + cell.SetCellValue(Math.Round((cityArray.Kwhkwp / cityArray.Count), 2)); cell.CellStyle = styleLine12; region = new CellRangeAddress(cityRowPosition, cityRowPosition, index, index + 1); sheet.AddMergedRegion(region); @@ -2087,7 +2091,7 @@ namespace SolarPower.Controllers index++; cell = row.CreateCell(index); - cell.SetCellValue("發電時間(小時)"); + cell.SetCellValue("有效發電小時"); cell.CellStyle = styleLine12; region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1); sheet.AddMergedRegion(region); @@ -2182,6 +2186,46 @@ namespace SolarPower.Controllers return Path.Combine("\\" + "upload", "report", Datename, "FIC太陽能監控平台" + "_" + "綜合報表" + "_" + postObject.Userid + Datename + ".xlsx"); } - + public async Task>> CheckExcel(Select_table2 post) + { + var ApiResult = new ApiResult>(); + var ErrorMessage = new List(); + foreach (var station in post.PowerStation) + { + var Id = Convert.ToInt32(station.Value); + var table = new Select_table() + { + FormType = post.FormType, + SearchType = post.SearchType, + PowerStation = Id, + Time = post.Time, + Userid = post.Userid + }; + var checkinv = await stationReportRepository.Findhaveinv(table); + var getinvsql = checkinv[0] as IDictionary; + if (getinvsql["mySelect"] == null) + { + ErrorMessage.Add(station.Name + "此時段無逆變器資料"); + } + else + { + var cid = await stationReportRepository.CheckExcelAsync(table); + if (cid == 0) + { + ErrorMessage.Add(station.Name + "此時段資料未建立"); + } + } + } + if(ErrorMessage.Count > 0) + { + ApiResult.Code = "9999"; + ApiResult.Data = ErrorMessage; + } + else + { + ApiResult.Code = "0000"; + } + return ApiResult; + } } } diff --git a/SolarPower/Models/AnalysisStationCombine.cs b/SolarPower/Models/AnalysisStationCombine.cs index d78b9f0..174d1b3 100644 --- a/SolarPower/Models/AnalysisStationCombine.cs +++ b/SolarPower/Models/AnalysisStationCombine.cs @@ -17,6 +17,8 @@ namespace SolarPower.Models public double All_PR { get; set; }//總平均PR public double Now_Carbon { get; set; }//現減炭 public double All_Carbon { get; set; }//總減炭 + public double All_irradiance { get; set; } + public double Now_irradiance { get; set; } } public class ChartInput { diff --git a/SolarPower/Models/ErrorCode.cs b/SolarPower/Models/ErrorCode.cs index bb221c5..3b83845 100644 --- a/SolarPower/Models/ErrorCode.cs +++ b/SolarPower/Models/ErrorCode.cs @@ -17,10 +17,11 @@ namespace SolarPower.Models { { "0000", "OK" }, { "0001", "傳入參數錯誤。" }, - { "0002","請先刪除相關逆變器"}, - { "0003","請先刪除相關設備"}, - { "0004","請先移除相關逆變器綁定"}, - { "9985","該電站尚無逆變器資料"}, + { "0002", "請先刪除相關逆變器"}, + { "0003", "請先刪除相關設備"}, + { "0004", "請先移除相關逆變器綁定"}, + { "9984", "連線逾時"}, + { "9985", "該電站尚無逆變器資料"}, { "9986", "該帳號已被註冊,請重新輸入"}, { "9987", "查無該運維作業記錄檔案"}, { "9988", "查無該資料紀錄"}, diff --git a/SolarPower/Models/Operation.cs b/SolarPower/Models/Operation.cs index f10b710..a251c26 100644 --- a/SolarPower/Models/Operation.cs +++ b/SolarPower/Models/Operation.cs @@ -293,6 +293,7 @@ namespace SolarPower.Models public string Notice { get; set; } public string Description { get; set; } public IFormFile[] RecordFiles { get; set; } + public byte Emailcheck { get; set; } } public class UpdateOperationRecord : Updated diff --git a/SolarPower/Models/Overview.cs b/SolarPower/Models/Overview.cs index 7e12750..5c19206 100644 --- a/SolarPower/Models/Overview.cs +++ b/SolarPower/Models/Overview.cs @@ -199,7 +199,8 @@ namespace SolarPower.Models public string errMsg { get; set; }//錯誤原因 public string PowerStationName { get; set; }//電站名稱 public int PowerStationId { get; set; }//電站流水號 - public string normalTime { get; set; } + public string normalTime { get; set; }//賦歸時間 + public string errMsgT { get; set; } //errMsgType } public class UserPowerStationTo diff --git a/SolarPower/Models/StationReport.cs b/SolarPower/Models/StationReport.cs index f540ad3..55a57a1 100644 --- a/SolarPower/Models/StationReport.cs +++ b/SolarPower/Models/StationReport.cs @@ -106,6 +106,7 @@ namespace SolarPower.Models public double Kwh { get; set; } public double SolarHour { get; set; } public int Count { get; set; } + public double Kwhkwp { get; set; } } diff --git a/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs b/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs index aff119a..06398f5 100644 --- a/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs +++ b/SolarPower/Quartz/Jobs/CalcAvgPowerStationJob.cs @@ -8,6 +8,7 @@ using SolarPower.Models.PowerStation; using SolarPower.Repository.Interface; using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Net.Http; using System.Threading.Tasks; @@ -870,40 +871,83 @@ namespace SolarPower.Quartz.Jobs #region 寄送日月報 var users = userRepository.GetAllAsync(); + var ttt = new List() { + "s506488@gmail.com", + "cesarliuc@gmail.com" + }; foreach (var user in users.Result) { - List powerstations = new List(); - powerstations = await noticeScheduleRepository.GetPowerStationOperationPersonnel(user.Id); - if (powerstations.Count == 0) + try { - continue; - } - List sentdaypowerstations = powerstations.Where(x => x.EmailDayReport == 1).Select(a => new Excelpowerstation { Name = a.Name, Value = a.PowerStationId.ToString() }).ToList(); - List sentMaxpowerstations = powerstations.Where(x => x.EmailComplexReport == 1).Select(a => new Excelpowerstation { Name = a.Name, Value = a.PowerStationId.ToString() }).ToList(); + logger.LogInformation("【CalcAvgPowerStationJob】【開始產生使用者[{0}({1})]的日月報】", user.Account, user.Name); - Controllers.StationReportController stationReportController = new Controllers.StationReportController(powerStationRepository, stationReportRepository); - //日報表 - if (sentdaypowerstations.Count != 0) - { - Excel dayexcel = new Excel() + List powerstations = new List(); + powerstations = await noticeScheduleRepository.GetPowerStationOperationPersonnel(user.Id); + if (powerstations.Count == 0) { - FormType = 0, - PowerStation = sentdaypowerstations, - SearchType = 0, - Time = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"), - Userid = user.Id - }; - var stationReportName = stationReportController.ExportExcelBackDownload(JsonConvert.SerializeObject(dayexcel, Formatting.Indented)); - if (stationReportName != "") + continue; + } + List sentdaypowerstations = powerstations.Where(x => x.EmailDayReport == 1).Select(a => new Excelpowerstation { Name = a.Name, Value = a.PowerStationId.ToString() }).ToList(); + List sentMaxpowerstations = powerstations.Where(x => x.EmailComplexReport == 1).Select(a => new Excelpowerstation { Name = a.Name, Value = a.PowerStationId.ToString() }).ToList(); + + Controllers.StationReportController stationReportController = new Controllers.StationReportController(powerStationRepository, stationReportRepository); + //日報表 + if (sentdaypowerstations.Count != 0) { - NoticeSchedule DaySchedule = new NoticeSchedule() + Excel dayexcel = new Excel() + { + FormType = 0, + PowerStation = sentdaypowerstations, + SearchType = 0, + Time = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"), + Userid = user.Id + }; + var stationReportName = stationReportController.ExportExcelBackDownload(JsonConvert.SerializeObject(dayexcel, Formatting.Indented)); + if (stationReportName != "") + { + NoticeSchedule DaySchedule = new NoticeSchedule() + { + UserId = user.Id, + EmailType = 0, + RecipientEmail = user.Email, + Subject = "日報表", + Attachment = stationReportName, + RecipientName = user.Name, + Type = 1 + }; + List properties = new List() + { + "UserId", + "EmailType", + "RecipientEmail", + "Subject", + "Attachment", + "RecipientName", + "Type" + }; + await noticeScheduleRepository.AddOneAsync(DaySchedule, properties); + } + } + //綜合報表 每日 + if (sentMaxpowerstations.Count != 0) + { + Select_table2 maxdayexcel = new Select_table2() + { + FormType = 0, + PowerStation = sentMaxpowerstations, + SearchType = 0, + Time = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"), + Userid = user.Id + }; + var stationMaxReportName = stationReportController.ExportExcelmaxtableBackDownload(JsonConvert.SerializeObject(maxdayexcel, Formatting.Indented)); + NoticeSchedule MaxSchedule = new NoticeSchedule() { UserId = user.Id, - EmailType = 0, + EmailType = 2, RecipientEmail = user.Email, - Subject = "日報表", - Attachment = stationReportName, + Subject = "綜合報表", + Attachment = stationMaxReportName, RecipientName = user.Name, Type = 1 }; @@ -917,120 +961,100 @@ namespace SolarPower.Quartz.Jobs "RecipientName", "Type" }; - await noticeScheduleRepository.AddOneAsync(DaySchedule, properties); + await noticeScheduleRepository.AddOneAsync(MaxSchedule, properties); + + if (DateTime.Now.ToString("dd") == "01") + { + Select_table2 maxmonthexcel = new Select_table2() + { + FormType = 0, + PowerStation = sentMaxpowerstations, + SearchType = 0, + Time = DateTime.Now.AddDays(-1).ToString("yyyy-MM"), + Userid = user.Id + }; + var stationReportmaxmonthName = stationReportController.ExportExcelBackDownload(JsonConvert.SerializeObject(maxmonthexcel, Formatting.Indented)); + NoticeSchedule MaxmonthSchedule = new NoticeSchedule() + { + RecipientEmail = user.Email, + Subject = "綜合報表", + Attachment = stationReportmaxmonthName, + RecipientName = user.Name, + Type = 1, + UserId = user.Id, + EmailType = 2 + }; + List properties2 = new List() + { + "UserId", + "EmailType", + "RecipientEmail", + "Subject", + "Attachment", + "RecipientName", + "Type" + }; + await noticeScheduleRepository.AddOneAsync(MaxmonthSchedule, properties2); + } + } - } - //綜合報表 每日 - if (sentMaxpowerstations.Count != 0) - { - Select_table2 maxdayexcel = new Select_table2() - { - FormType = 0, - PowerStation = sentMaxpowerstations, - SearchType = 0, - Time = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"), - Userid = user.Id - }; - var stationMaxReportName = stationReportController.ExportExcelmaxtableBackDownload(JsonConvert.SerializeObject(maxdayexcel, Formatting.Indented)); - NoticeSchedule MaxSchedule = new NoticeSchedule() - { - UserId = user.Id, - EmailType = 2, - RecipientEmail = user.Email, - Subject = "綜合報表", - Attachment = stationMaxReportName, - RecipientName = user.Name, - Type = 1 - }; - List properties = new List() - { - "UserId", - "EmailType", - "RecipientEmail", - "Subject", - "Attachment", - "RecipientName", - "Type" - }; - await noticeScheduleRepository.AddOneAsync(MaxSchedule, properties); if (DateTime.Now.ToString("dd") == "01") { - Select_table2 maxmonthexcel = new Select_table2() + List sentmonthpowerstations = powerstations.Where(x => x.EmailMonthReport == 1).Select(a => new Excelpowerstation { Name = a.Name, Value = a.PowerStationId.ToString() }).ToList(); + if (sentmonthpowerstations.Count == 0) { - FormType = 0, - PowerStation = sentMaxpowerstations, - SearchType = 0, + break; + } + Excel monthexcel = new Excel() + { + FormType = 1, + PowerStation = sentmonthpowerstations, + SearchType = 2, Time = DateTime.Now.AddDays(-1).ToString("yyyy-MM"), Userid = user.Id }; - var stationReportmaxmonthName = stationReportController.ExportExcelBackDownload(JsonConvert.SerializeObject(maxmonthexcel, Formatting.Indented)); - NoticeSchedule MaxmonthSchedule = new NoticeSchedule() + var stationReportmonthName = stationReportController.ExportExcelBackDownload(JsonConvert.SerializeObject(monthexcel, Formatting.Indented)); + if (stationReportmonthName != "") { - RecipientEmail = user.Email, - Subject = "綜合報表", - Attachment = stationReportmaxmonthName, - RecipientName = user.Name, - Type = 1, - UserId = user.Id, - EmailType = 2 - }; - List properties2 = new List() - { - "UserId", - "EmailType", - "RecipientEmail", - "Subject", - "Attachment", - "RecipientName", - "Type" - }; - await noticeScheduleRepository.AddOneAsync(MaxmonthSchedule, properties2); + NoticeSchedule MonthSchedule = new NoticeSchedule() + { + RecipientEmail = user.Email, + Subject = "月報表", + Attachment = stationReportmonthName, + RecipientName = user.Name, + Type = 1, + UserId = user.Id, + EmailType = 1 + }; + List properties2 = new List() + { + "UserId", + "EmailType", + "RecipientEmail", + "Subject", + "Attachment", + "RecipientName", + "Type" + }; + await noticeScheduleRepository.AddOneAsync(MonthSchedule, properties2); + } + } + logger.LogInformation("【CalcAvgPowerStationJob】【產生完成使用者[{0}({1})]的日月報】", user.Account, user.Name); } - - if (DateTime.Now.ToString("dd") == "01") + catch (Exception exception) { - List sentmonthpowerstations = powerstations.Where(x => x.EmailMonthReport == 1).Select(a => new Excelpowerstation { Name = a.Name, Value = a.PowerStationId.ToString() }).ToList(); - if (sentmonthpowerstations.Count == 0) + logger.LogError("【CalcAvgPowerStationJob】【產生失敗使用者[{0}({1})]的日月報】", user.Account, user.Name); + logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message); + if (exception.InnerException != null) { - break; - } - Excel monthexcel = new Excel() - { - FormType = 1, - PowerStation = sentmonthpowerstations, - SearchType = 2, - Time = DateTime.Now.AddDays(-1).ToString("yyyy-MM"), - Userid = user.Id - }; - var stationReportmonthName = stationReportController.ExportExcelBackDownload(JsonConvert.SerializeObject(monthexcel, Formatting.Indented)); - if (stationReportmonthName != "") - { - NoticeSchedule MonthSchedule = new NoticeSchedule() - { - RecipientEmail = user.Email, - Subject = "月報表", - Attachment = stationReportmonthName, - RecipientName = user.Name, - Type = 1, - UserId = user.Id, - EmailType = 1 - }; - List properties2 = new List() - { - "UserId", - "EmailType", - "RecipientEmail", - "Subject", - "Attachment", - "RecipientName", - "Type" - }; - await noticeScheduleRepository.AddOneAsync(MonthSchedule, properties2); + logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message); } + var line = new StackTrace(exception, true).GetFrame(0).GetFileLineNumber(); + logger.LogError("【CalcAvgPowerStationJob】[錯誤行數] - {0}", line); } } diff --git a/SolarPower/Quartz/Jobs/CalcInverter15minJob.cs b/SolarPower/Quartz/Jobs/CalcInverter15minJob.cs index 279746a..9a49fb4 100644 --- a/SolarPower/Quartz/Jobs/CalcInverter15minJob.cs +++ b/SolarPower/Quartz/Jobs/CalcInverter15minJob.cs @@ -162,7 +162,7 @@ namespace SolarPower.Quartz.Jobs await powerStationRepository.UpdateInvStatus(update_invStatusErr.Key, null, update_invStatusErr.Select(x => x.InverterId).ToList(), 2); } - logger.LogError("【CalcInverter15minJob】檢測完成逆變器狀態"); + logger.LogInformation("【CalcInverter15minJob】檢測完成逆變器狀態"); } catch(Exception exception) { diff --git a/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs b/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs index 23ddf88..b62c84c 100644 --- a/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs +++ b/SolarPower/Quartz/Jobs/CalcPowerStationJob.cs @@ -84,8 +84,6 @@ namespace SolarPower.Quartz.Jobs logger.LogError("【{0}】{1}", "CalcPowerStationJob", ex.Message); observation = null; } - - #endregion #region step2. 從電站的DB及電站編號找出該電站的控制器 @@ -103,7 +101,7 @@ namespace SolarPower.Quartz.Jobs if (string.IsNullOrEmpty(exist)) { - logger.LogError("【CalcPowerStationJob】【查無電站[{0}]的s{0}01_station資料表】", powerStation.Code); + logger.LogError($"【CalcPowerStationJob】【查無電站[{powerStation.Code}]的s{powerStation.Code}01_station資料表】"); } else { @@ -133,30 +131,32 @@ namespace SolarPower.Quartz.Jobs #region 發電金額 history.MONEY = history.KWH * powerStation.PowerRate; + history.TODAYMONEY = history.TodayKWh * powerStation.PowerRate; + history.TOTALMONEY = history.TotalKWH * powerStation.PowerRate; //即時發電金額 switch (powerStation.SolarType) { case (int)SolarTypeEnum.SelfSold: //自建躉售 - if (lastmoneyhistorybyhour != null) - { - history.TODAYMONEY = lastmoneyhistorybyhour.TODAYMONEY + history.KWH * powerStation.PowerRate; - history.TOTALMONEY = lastmoneyhistorybyhour.TOTALMONEY + history.KWH * powerStation.PowerRate; - } - else - { - history.TODAYMONEY = history.KWH * powerStation.PowerRate; - history.TOTALMONEY = history.KWH * powerStation.PowerRate; - } + //if (lastmoneyhistorybyhour != null) + //{ + // history.TODAYMONEY = lastmoneyhistorybyhour.TODAYMONEY + history.KWH * powerStation.PowerRate; + // history.TOTALMONEY = lastmoneyhistorybyhour.TOTALMONEY + history.KWH * powerStation.PowerRate; + //} + //else + //{ + // history.TODAYMONEY = history.KWH * powerStation.PowerRate; + // history.TOTALMONEY = history.KWH * powerStation.PowerRate; + //} - //今日發電金額 計算方式:todaykWh * 授電費率,如有上筆資料,需累加 上一筆金額 - //calcPowerStation.Today_Money = history.TodayKWh * powerStation.PowerRate; - calcPowerStation.Today_Money = history.TODAYMONEY; + //今日發電金額 計算方式:todaykWh * 授電費率 + calcPowerStation.Today_Money = history.TodayKWh * powerStation.PowerRate; + //calcPowerStation.Today_Money = history.TODAYMONEY; - ////總發電金額 計算方式:totalkWh * 授電費率,如有上筆資料,需累加 上一筆金額 - //calcPowerStation.Total_Money = history.TotalKWH * powerStation.PowerRate; - calcPowerStation.Total_Money = history.TOTALMONEY; + ////總發電金額 計算方式:totalkWh * 授電費率 + calcPowerStation.Total_Money = history.TotalKWH * powerStation.PowerRate; + //calcPowerStation.Total_Money = history.TOTALMONEY; break; case (int)SolarTypeEnum.HireSold: //租建躉售 //找出該電站的所有土地房屋資訊 @@ -170,43 +170,49 @@ namespace SolarPower.Quartz.Jobs } //avgLeaseRate = sumLeaseRate / landBuildings.Count(); - if (lastmoneyhistorybyhour != null) - { - history.TODAYMONEY = lastmoneyhistorybyhour.TODAYMONEY + history.KWH * powerStation.PowerRate; - history.TOTALMONEY = lastmoneyhistorybyhour.TOTALMONEY + history.KWH * powerStation.PowerRate; + //if (lastmoneyhistorybyhour != null) + //{ + // history.TODAYMONEY = lastmoneyhistorybyhour.TODAYMONEY + history.KWH * powerStation.PowerRate; + // history.TOTALMONEY = lastmoneyhistorybyhour.TOTALMONEY + history.KWH * powerStation.PowerRate; - //今日發電金額計算方式:todaykWh * 出借費率(各個土地房屋租借比率平均) - calcPowerStation.Today_Money = lastmoneyhistorybyhour.TODAYMONEY + (history.KWH * powerStation.PowerRate * sumLeaseRate); - //總發電金額 計算方式:totalkWh * 授電費率 - calcPowerStation.Total_Money = lastmoneyhistorybyhour.TOTALMONEY + (history.KWH * powerStation.PowerRate * sumLeaseRate); - } - else - { - history.TODAYMONEY = history.KWH * powerStation.PowerRate; - history.TOTALMONEY = history.KWH * powerStation.PowerRate; + // //今日發電金額計算方式:todaykWh * 出借費率(各個土地房屋租借比率平均) + // calcPowerStation.Today_Money = lastmoneyhistorybyhour.TODAYMONEY + (history.KWH * powerStation.PowerRate * sumLeaseRate); + // //總發電金額 計算方式:totalkWh * 授電費率 + // calcPowerStation.Total_Money = lastmoneyhistorybyhour.TOTALMONEY + (history.KWH * powerStation.PowerRate * sumLeaseRate); + //} + //else + //{ + // history.TODAYMONEY = history.KWH * powerStation.PowerRate; + // history.TOTALMONEY = history.KWH * powerStation.PowerRate; + + // calcPowerStation.Today_Money = history.KWH * powerStation.PowerRate * sumLeaseRate; + // calcPowerStation.Total_Money = history.KWH * powerStation.PowerRate * sumLeaseRate; + //} + + calcPowerStation.Today_Money = history.TodayKWh * powerStation.PowerRate * sumLeaseRate / 100; + calcPowerStation.Total_Money = history.TotalKWH * powerStation.PowerRate * sumLeaseRate / 100; - calcPowerStation.Today_Money = history.KWH * powerStation.PowerRate * sumLeaseRate; - calcPowerStation.Total_Money = history.KWH * powerStation.PowerRate * sumLeaseRate; - } break; case (int)SolarTypeEnum.SelfUse: //自建自用 - if (lastmoneyhistorybyhour != null) - { - history.TODAYMONEY = lastmoneyhistorybyhour.TODAYMONEY + history.KWH * powerStation.PowerRate; - history.TOTALMONEY = lastmoneyhistorybyhour.TOTALMONEY + history.KWH * powerStation.PowerRate; - } - else - { - history.TODAYMONEY = history.KWH * powerStation.PowerRate; - history.TOTALMONEY = history.KWH * powerStation.PowerRate; - } + //if (lastmoneyhistorybyhour != null) + //{ + // history.TODAYMONEY = lastmoneyhistorybyhour.TODAYMONEY + history.KWH * powerStation.PowerRate; + // history.TOTALMONEY = lastmoneyhistorybyhour.TOTALMONEY + history.KWH * powerStation.PowerRate; + //} + //else + //{ + // history.TODAYMONEY = history.KWH * powerStation.PowerRate; + // history.TOTALMONEY = history.KWH * powerStation.PowerRate; + //} //今日發電金額 計算方式:todaykWh * 授電費率 - calcPowerStation.Today_Money = history.TODAYMONEY; + //calcPowerStation.Today_Money = history.TODAYMONEY; + calcPowerStation.Today_Money = history.TodayKWh * powerStation.PowerRate; //總發電金額 計算方式:totalkWh * 授電費率 - calcPowerStation.Total_Money = history.TOTALMONEY; + //calcPowerStation.Total_Money = history.TOTALMONEY; + calcPowerStation.Total_Money = history.TotalKWH * powerStation.PowerRate; break; } #endregion @@ -225,29 +231,26 @@ namespace SolarPower.Quartz.Jobs carbonRate = Convert.ToDouble(await powerStationRepository.GetOneVariableByName("CarbonRate")); history.CARBON = history.KWH * carbonRate; - if (lastmoneyhistorybyhour != null) - { - history.TODAYCARBON = lastmoneyhistorybyhour.TODAYCARBON + history.KWH * carbonRate; - history.TOTALCARBON = lastmoneyhistorybyhour.TOTALCARBON + history.KWH * carbonRate; + history.TODAYCARBON = history.TodayKWh * carbonRate; + history.TOTALCARBON = history.TotalKWH * carbonRate; + //if (lastmoneyhistorybyhour != null) + //{ + // history.TODAYCARBON = lastmoneyhistorybyhour.TODAYCARBON + history.KWH * carbonRate; + // history.TOTALCARBON = lastmoneyhistorybyhour.TOTALCARBON + history.KWH * carbonRate; + //} + //else + //{ + // history.TODAYCARBON = history.KWH * carbonRate; + // history.TOTALCARBON = history.KWH * carbonRate; + //} - //今日減碳量( 今日發電量 * (0.554/1000)[抓資料庫值] - calcPowerStation.Today_Carbon = history.TODAYCARBON; + //今日減碳量( 今日發電量 * (0.554/1000)[抓資料庫值] + //calcPowerStation.Today_Carbon = history.TODAYCARBON; + calcPowerStation.Today_Carbon = history.TodayKWh * carbonRate; - //總減碳量(總發電量 * (0.554/1000)[抓資料庫值] - calcPowerStation.Total_Carbon = history.TOTALCARBON; - } - else - { - history.TODAYCARBON = history.KWH * carbonRate; - history.TOTALCARBON = history.KWH * carbonRate; - - //今日減碳量( 今日發電量 * (0.554/1000)[抓資料庫值] - calcPowerStation.Today_Carbon = history.TODAYCARBON; - - history.CARBON = history.KWH * carbonRate; - //總減碳量(總發電量 * (0.554/1000)[抓資料庫值] - calcPowerStation.Total_Carbon = history.TotalKWH * carbonRate; - } + //總減碳量(總發電量 * (0.554/1000)[抓資料庫值] + //calcPowerStation.Total_Carbon = history.TotalKWH * carbonRate; + calcPowerStation.Total_Carbon = history.TotalKWH * carbonRate; #endregion @@ -269,7 +272,7 @@ namespace SolarPower.Quartz.Jobs var sensoravg_table_exist = await powerStationRepository.ExistTable(powerStation.SiteDB, sensoravg_table_name); if (string.IsNullOrEmpty(sensoravg_table_exist)) { - logger.LogError("【CalcPowerStationJob】【查無電站[0]的s{0}01_sensoravg資料表】", powerStation.Code); + logger.LogError($"【CalcPowerStationJob】【查無電站[{powerStation.Code}]的s{powerStation.Code}01_sensoravg資料表】"); } else { @@ -534,7 +537,7 @@ namespace SolarPower.Quartz.Jobs var exist_meter_table = await powerStationRepository.ExistTable(powerStation.SiteDB, meter_table_name); if (string.IsNullOrEmpty(exist_meter_table)) { - logger.LogError("【CalcPowerStationJob】【查無電站[{0}]的s{0}01_meter資料表】", powerStation.Code); + logger.LogError($"【CalcPowerStationJob】【查無電站[{powerStation.Code}]的s{powerStation.Code}01_meter資料表】"); } else { diff --git a/SolarPower/Quartz/Jobs/ExceptionSchedule.cs b/SolarPower/Quartz/Jobs/ExceptionSchedule.cs index 80f7107..79a6381 100644 --- a/SolarPower/Quartz/Jobs/ExceptionSchedule.cs +++ b/SolarPower/Quartz/Jobs/ExceptionSchedule.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; using Newtonsoft.Json.Linq; using Quartz; using SolarPower.Models; @@ -21,38 +22,45 @@ namespace SolarPower.Quartz.Jobs private readonly INoticeScheduleRepository noticeScheduleRepository; private readonly IUserRepository userRepository; private readonly IPowerStationRepository powerStationRepository; + private readonly IConfiguration Configuration; - public ExceptionSchedule(ILogger logger, IOverviewRepository overviewRepository,INoticeScheduleRepository noticeScheduleRepository,IUserRepository userRepository,IPowerStationRepository powerStationRepository) + public ExceptionSchedule(ILogger logger, IOverviewRepository overviewRepository,INoticeScheduleRepository noticeScheduleRepository,IUserRepository userRepository,IPowerStationRepository powerStationRepository, IConfiguration Configuration) { this.logger = logger; this.overviewRepository = overviewRepository; this.noticeScheduleRepository = noticeScheduleRepository; this.userRepository = userRepository; this.powerStationRepository = powerStationRepository; + this.Configuration = Configuration; } public async Task Execute(IJobExecutionContext context) { try { + var ExceptionTimes = this.Configuration.GetValue("ExceptionTimes"); var ExceptionList = await overviewRepository.GetEmailExceptionList(); if(ExceptionList.Count > 0 ) { - var ExceptionListex = ExceptionList.Where(x => x.normalTime == "1970-01-01 08:00:00" && DateTime.Now.Subtract(DateTime.Parse(x.dev_time)).Hours >= 4).ToList(); + var ExceptionListex = ExceptionList.Where(x => x.normalTime == "1970-01-01 08:00:00" && DateTime.Now.Subtract(DateTime.Parse(x.dev_time)).Minutes >= ExceptionTimes).ToList(); foreach (var Exception in ExceptionListex) { var UserListWithPowerstation = await overviewRepository.GetUserListWithPowerstation(Exception.PowerStationId); - foreach (var user in UserListWithPowerstation) - { - var Content = $"電站名稱:{Exception.PowerStationName}" + "
" + + var Content = $"電站名稱:{Exception.PowerStationName}" + "
" + $"設備編號:{Exception.errDevice}" + "
" + $"異常ID編號:{Exception.id}" + "
" + $"異常類別:{Exception.alarmClassName}" + "
" + - $"設備訊息:{Exception.errMsg}" + "
" + - $"發生時間:{Exception.dev_time}" ; + $"設備訊息:{Exception.errMsg}" + "
"; + if(Exception.errMsgT == "d") + { + Content += $"當前數值:{Exception.errValue}" + "
"; + } + Content += $"發生時間:{Exception.dev_time}"; + foreach (var user in UserListWithPowerstation) + { NoticeSchedule DaySchedule = new NoticeSchedule() { UserId = user.Id, @@ -77,11 +85,14 @@ namespace SolarPower.Quartz.Jobs }; await noticeScheduleRepository.AddOneAsync(DaySchedule, properties); - var powerstation = await powerStationRepository.GetOneAsync(Exception.PowerStationId); - if(powerstation.line_token != null) - { - CallLineToken(Content, powerstation.line_token); - } + + } + + var powerstation = await powerStationRepository.GetOneAsync(Exception.PowerStationId); + if (powerstation.line_token != null) + { + Content = " %0D%0A " + Content.Replace("
", " %0D%0A "); + CallLineToken(Content, powerstation.line_token); } } } diff --git a/SolarPower/Repository/Implement/AnalysisStationCombineRepository.cs b/SolarPower/Repository/Implement/AnalysisStationCombineRepository.cs index 3ebd463..d6e6847 100644 --- a/SolarPower/Repository/Implement/AnalysisStationCombineRepository.cs +++ b/SolarPower/Repository/Implement/AnalysisStationCombineRepository.cs @@ -17,6 +17,8 @@ namespace SolarPower.Repository.Implement tableName = "power_station"; } + + public async Task GetPowerStationInfoList(ChartInput post) { var a = new AnalysisStationCombine(); @@ -32,14 +34,33 @@ namespace SolarPower.Repository.Implement { case 0: string timerange = Convert.ToDateTime(post.Timerange).ToString("yyyy-MM-dd"); - sql = $@"SELECT m.*,n.*,o.* FROM + var today = ""; + if(timerange == DateTime.Now.ToString("yyyy-MM-dd")) + { + today = @$" SELECT + AVG(a.today_irradiance) AS Now_irradiance + FROM + power_station a + WHERE a.Id IN @ids "; + } + else + { + today = $@" SELECT + AVG(a.Irradiance) AS Now_irradiance + FROM + sensor_history_day a + WHERE a.PowerStationId IN @ids AND DATE_FORMAT(a.TIMESTAMP,'%Y-%m-%d') = '{timerange}'"; + } + + + sql = $@"SELECT m.*,n.*,o.*,p.* FROM ( SELECT SUM(TOTALMONEY) AS All_money, SUM(TOTALKWH) AS All_kwh, SUM(TOTALCARBON) AS All_Carbon - from power_station_history_month - WHERE PowerStationId IN @ids + from (SELECT psm.PowerStationId, max(psm.TIMESTAMP) AS TIMESTAMP FROM power_station_history_month psm WHERE PowerStationId IN @ids GROUP BY PowerStationId) a + LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP ) AS m, ( @@ -60,22 +81,47 @@ namespace SolarPower.Repository.Implement ( SELECT AVG(avg_kwhkwp) AS All_KWH_KWP, - AVG(avg_PR) AS All_PR + AVG(avg_PR) AS All_PR, + AVG(avg_irradiance) as All_irradiance from power_station WHERE Id IN @ids ) - AS o"; + AS o, + ( + {today} + ) AS p"; break; case 1: var time = post.Timerange.Split('-'); - sql = $@"SELECT m.*,n.*,o.* FROM + var ttot = ""; + if(time[1].Replace(" ","") == DateTime.Now.ToString("yyyy/MM/dd")) + { + ttot = @$"SELECT + AVG(c.Now_irradiance) AS Now_irradiance + FROM + (SELECT AVG(a.today_irradiance) AS Now_irradiance FROM power_station a WHERE a.Id IN (1) + UNION + SELECT AVG(b.Irradiance) AS Now_irradiance FROM sensor_history_day b + WHERE b.PowerStationId IN (1) AND DATE_FORMAT(b.TIMESTAMP, '%Y/%m/%d') BETWEEN '{time[0].Replace(" ", "")}' AND '{Convert.ToDateTime(time[1].Replace(" ", "")).AddDays(-1).ToString("yyyy/MM/dd")}') c"; + } + else + { + ttot = @$" SELECT + AVG(a.Irradiance) AS Now_irradiance + FROM + sensor_history_day a + WHERE a.PowerStationId IN @ids AND DATE_FORMAT(a.TIMESTAMP, '%Y/%m/%d') BETWEEN '{time[0].Replace(" ", "")}' AND '{time[1].Replace(" ", "")}'"; + } + + + sql = $@"SELECT m.*,n.*,o.*,p.* FROM ( SELECT SUM(TOTALMONEY) AS All_money, SUM(TOTALKWH) AS All_kwh, SUM(TOTALCARBON) AS All_Carbon - from power_station_history_month - WHERE PowerStationId IN @ids + from (SELECT psm.PowerStationId, max(psm.TIMESTAMP) AS TIMESTAMP FROM power_station_history_month psm WHERE PowerStationId IN @ids GROUP BY PowerStationId) a + LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP ) AS m, ( @@ -92,21 +138,25 @@ namespace SolarPower.Repository.Implement ( SELECT AVG(avg_kwhkwp) AS All_KWH_KWP, - AVG(avg_PR) AS All_PR + AVG(avg_PR) AS All_PR, + AVG(avg_irradiance) as All_irradiance from power_station WHERE Id IN @ids ) - AS o"; + AS o, + ( + {ttot} + ) AS p"; break; case 2: - sql = $@"SELECT m.*,n.*,o.* FROM + sql = $@"SELECT m.*,n.*,o.*,p.* FROM ( SELECT SUM(TOTALMONEY) AS All_money, SUM(TOTALKWH) AS All_kwh, SUM(TOTALCARBON) AS All_Carbon - from power_station_history_month - WHERE PowerStationId IN @ids + from (SELECT psm.PowerStationId, max(psm.TIMESTAMP) AS TIMESTAMP FROM power_station_history_month psm WHERE PowerStationId IN @ids GROUP BY PowerStationId) a + LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP ) AS m, ( @@ -123,21 +173,28 @@ namespace SolarPower.Repository.Implement ( SELECT AVG(avg_kwhkwp) AS All_KWH_KWP, - AVG(avg_PR) AS All_PR + AVG(avg_PR) AS All_PR, + AVG(avg_irradiance) as All_irradiance from power_station WHERE Id IN @ids ) - AS o"; + AS o, + ( + SELECT + AVG(a.Irradiance) AS Now_irradiance + from sensor_history_month a + WHERE PowerStationId IN @ids AND DATE_FORMAT(TIMESTAMP, '%Y-%m') = '{post.Timerange}' + ) AS p"; break; case 3: - sql = $@"SELECT m.*,n.*,o.* FROM + sql = $@"SELECT m.*,n.*,o.*,p.* FROM ( SELECT SUM(TOTALMONEY) AS All_money, SUM(TOTALKWH) AS All_kwh, SUM(TOTALCARBON) AS All_Carbon - from power_station_history_month - WHERE PowerStationId IN @ids + from (SELECT psm.PowerStationId, max(psm.TIMESTAMP) AS TIMESTAMP FROM power_station_history_month psm WHERE PowerStationId IN @ids GROUP BY PowerStationId) a + LEFT JOIN power_station_history_month psm ON a.PowerStationId = psm.PowerStationId AND a.TIMESTAMP = psm.TIMESTAMP ) AS m, ( @@ -155,11 +212,18 @@ namespace SolarPower.Repository.Implement ( SELECT AVG(avg_kwhkwp) AS All_KWH_KWP, - AVG(avg_PR) AS All_PR + AVG(avg_PR) AS All_PR, + AVG(avg_irradiance) as All_irradiance from power_station WHERE Id IN @ids ) - AS o"; + AS o, + ( + SELECT + AVG(a.Irradiance) AS Now_irradiance + from sensor_history_month a + WHERE PowerStationId IN @ids AND DATE_FORMAT(TIMESTAMP, '%Y') = '{post.Timerange}' + ) AS p"; break; } @@ -192,57 +256,51 @@ namespace SolarPower.Repository.Implement switch (post.SeacrhType) { case 0: - sql = $@"SELECT DATE_FORMAT(ps.TIMESTAMP,'%h %p') AS `Time`, - SUM(ps.KWH) AS KWH, - SUM(sh.Irradiance) AS Irradiance, - AVG(sh.Temperature) AS Temperature - FROM power_station_history_hour ps - LEFT JOIN sensor_history_hour sh - ON sh.TIMESTAMP = ps.TIMESTAMP AND sh.PowerStationId = ps.PowerStationId - WHERE ps.PowerStationId IN @ids AND DATE_FORMAT(sh.TIMESTAMP,'%Y-%m-%d') = '{post.Timerange}' - GROUP BY ps.TIMESTAMP"; + sql = $@"SELECT DATE_FORMAT(p.TIMESTAMP,'%h %p') AS `Time`, + SUM(p.KWH) AS KWH, + SUM(s.Irradiance) AS Irradiance, + AVG(s.Temperature) AS Temperature + FROM (SELECT * FROM power_station_history_hour ps WHERE ps.PowerStationId IN @ids AND DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') = '{post.Timerange}') p + LEFT JOIN (SELECT * FROM sensor_history_hour sh WHERE sh.PowerStationId IN @ids AND DATE_FORMAT(sh.TIMESTAMP,'%Y-%m-%d') = '{post.Timerange}') s + ON p.TIMESTAMP = s.TIMESTAMP AND p.PowerStationId = s.PowerStationId + GROUP BY p.TIMESTAMP"; break; case 1: var time = post.Timerange.Replace(" ","").Split('-'); sql = $@"SELECT - DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') AS `Time`, - SUM(ps.TODAYKWH) AS KWH, - SUM(sh.Irradiance) AS Irradiance, - AVG(sh.Temperature) AS Temperature - FROM power_station_history_day ps - LEFT JOIN sensor_history_day sh - ON sh.TIMESTAMP = ps.TIMESTAMP - WHERE ps.PowerStationId IN @ids AND DATE_FORMAT(sh.TIMESTAMP,'%Y-%m-%d') BETWEEN '{time[0].Replace('/', '-')}' AND '{time[1].Replace('/', '-')}' - GROUP BY ps.TIMESTAMP"; + DATE_FORMAT(p.TIMESTAMP,'%Y-%m-%d') AS `Time`, + SUM(p.TODAYKWH) AS KWH, + SUM(s.Irradiance) AS Irradiance, + AVG(s.Temperature) AS Temperature + FROM (SELECT * FROM power_station_history_day ps WHERE ps.PowerStationId IN @ids AND DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') BETWEEN '{time[0].Replace('/', '-')}' AND '{time[1].Replace('/', '-')}') p + LEFT JOIN (SELECT * FROM sensor_history_day sh WHERE sh.PowerStationId IN @ids AND DATE_FORMAT(sh.TIMESTAMP,'%Y-%m-%d') BETWEEN '{time[0].Replace('/', '-')}' AND '{time[1].Replace('/', '-')}') s + ON s.TIMESTAMP = p.TIMESTAMP AND p.PowerStationId = s.PowerStationId + GROUP BY p.TIMESTAMP"; break; case 2: sql = $@"SELECT - DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d') AS `Time`, - SUM(ps.TODAYKWH) AS KWH, - SUM(sh.Irradiance) AS Irradiance, - AVG(sh.Temperature) AS Temperature - FROM power_station_history_day ps - LEFT JOIN sensor_history_day sh - ON sh.TIMESTAMP = ps.TIMESTAMP - WHERE ps.PowerStationId IN @ids AND DATE_FORMAT(sh.TIMESTAMP,'%Y-%m') = '{post.Timerange}' - GROUP BY ps.TIMESTAMP"; + DATE_FORMAT(p.TIMESTAMP,'%Y-%m-%d') AS `Time`, + SUM(p.TODAYKWH) AS KWH, + SUM(s.Irradiance) AS Irradiance, + AVG(s.Temperature) AS Temperature + FROM (SELECT * FROM power_station_history_day ps WHERE ps.PowerStationId IN @ids AND DATE_FORMAT(ps.TIMESTAMP,'%Y-%m') = '{post.Timerange}') p + LEFT JOIN (SELECT * FROM sensor_history_day sh WHERE sh.PowerStationId IN @ids AND DATE_FORMAT(sh.TIMESTAMP,'%Y-%m') = '{post.Timerange}') s + ON s.TIMESTAMP = p.TIMESTAMP AND p.PowerStationId = s.PowerStationId + GROUP BY p.TIMESTAMP"; break; case 3: sql = $@"SELECT - DATE_FORMAT(ps.TIMESTAMP,'%Y-%m') AS `Time`, - SUM(ps.MONTHKWH) AS KWH, - SUM(sh.Irradiance) AS Irradiance, - AVG(sh.Temperature) AS Temperature - FROM power_station_history_month ps - LEFT JOIN sensor_history_month sh - ON sh.TIMESTAMP = ps.TIMESTAMP - WHERE ps.PowerStationId IN @ids AND DATE_FORMAT(sh.TIMESTAMP,'%Y') = '{post.Timerange}' - GROUP BY ps.TIMESTAMP"; + DATE_FORMAT(p.TIMESTAMP,'%Y-%m') AS `Time`, + SUM(p.MONTHKWH) AS KWH, + SUM(s.Irradiance) AS Irradiance, + AVG(s.Temperature) AS Temperature + FROM (SELECT * FROM power_station_history_month ps WHERE ps.PowerStationId IN @ids AND DATE_FORMAT(ps.TIMESTAMP,'%Y') = '{post.Timerange}') p + LEFT JOIN (SELECT * FROM sensor_history_month sh WHERE sh.PowerStationId IN @ids AND DATE_FORMAT(sh.TIMESTAMP,'%Y') = '{post.Timerange}') s + ON s.TIMESTAMP = p.TIMESTAMP AND p.PowerStationId = s.PowerStationId + GROUP BY p.TIMESTAMP"; break; } a = (await conn.QueryAsync(sql,new { ids = post.StationIds})).ToList(); - - } catch (Exception exception) { diff --git a/SolarPower/Repository/Implement/ElectricitySoldRecordRepository.cs b/SolarPower/Repository/Implement/ElectricitySoldRecordRepository.cs index 5573c76..8865c1b 100644 --- a/SolarPower/Repository/Implement/ElectricitySoldRecordRepository.cs +++ b/SolarPower/Repository/Implement/ElectricitySoldRecordRepository.cs @@ -122,7 +122,7 @@ namespace SolarPower.Repository.Implement var sql = @$"SELECT aa.StartAt,aa.EndAt,aa.Kwh actualkwh,aa.Money actualMoney,SUM(pd.TODAYKWH) realKWH,SUM(pd.MONEY) realMoney,ps.Estimate_kwh CBAkwh,ps.EstimateEfficacy CBAeff ,ps.GeneratingCapacity capacity ,ps.PowerRate rate FROM power_station_history_day pd - LEFT JOIN ( SELECT er.* FROM electricity_sold_record er WHERE {sqlwhere} AND er.Deleted = 0 ) aa + LEFT JOIN ( SELECT er.* FROM electricity_sold_record er WHERE {sqlwhere} AND er.Deleted = 0 AND er.PowerstationId = {info.PowerstationId}) aa ON aa.PowerstationId = pd.PowerStationId LEFT JOIN power_station ps ON ps.Id = pd.PowerStationId WHERE pd.TIMESTAMP BETWEEN aa.StartAt AND aa.EndAt AND ps.Id = {info.PowerstationId} GROUP BY aa.Id"; diff --git a/SolarPower/Repository/Implement/OperationRepository.cs b/SolarPower/Repository/Implement/OperationRepository.cs index 0e6435c..6ade5ac 100644 --- a/SolarPower/Repository/Implement/OperationRepository.cs +++ b/SolarPower/Repository/Implement/OperationRepository.cs @@ -625,7 +625,7 @@ namespace SolarPower.Repository.Implement { try { - var sql = @$"SELECT us.* FROM power_station_operation_personnel ps LEFT JOIN user us ON ps.UserId = us.Id WHERE PowerStationId = {PowerStationId}"; + var sql = @$"SELECT us.* FROM power_station_operation_personnel ps LEFT JOIN user us ON ps.UserId = us.Id WHERE ps.PowerStationId = {PowerStationId} and ps.Deleted = 0 AND us.Deleted = 0"; result = (await conn.QueryAsync(sql)).ToList(); } catch (Exception exception) diff --git a/SolarPower/Repository/Implement/OverviewRepository.cs b/SolarPower/Repository/Implement/OverviewRepository.cs index f314d9f..7e13d05 100644 --- a/SolarPower/Repository/Implement/OverviewRepository.cs +++ b/SolarPower/Repository/Implement/OverviewRepository.cs @@ -663,7 +663,7 @@ namespace SolarPower.Repository.Implement select a.id, site_id, `timestamp`, FROM_UNIXTIME((`timestamp` / 1000), '%Y-%m-%d %H:%i:%s') dev_time , a.sourceState err_status, FROM_UNIXTIME( (a.normalTime / 1000), '%Y-%m-%d %H:%i:%s') normalTime, a.alarmClass, b.alarmClass as alarmClassName,ps.Name as PowerStationName,ps.Id as PowerStationId, errDevice, err_valueKind, errValue, FROM_UNIXTIME( (a.lastUpdate / 1000), '%Y-%m-%d %H:%i:%s') lastUpdate, - case when c.errMsg_tw is null then d.errMsg_tw else c.errMsg_tw end errMsg + case when c.errMsg_tw is null then d.errMsg_tw else c.errMsg_tw end errMsg ,case when c.errMsg is null then d.errMsg else c.errMsg end errMsgT from err_main a join alarmorion_orionalarmclass b on a.alarmclass = b.id left join ref_err_device c on trim(b.alarmClass) = c.deviceType diff --git a/SolarPower/Repository/Implement/PowerStationRepository.cs b/SolarPower/Repository/Implement/PowerStationRepository.cs index cb93614..1e91b32 100644 --- a/SolarPower/Repository/Implement/PowerStationRepository.cs +++ b/SolarPower/Repository/Implement/PowerStationRepository.cs @@ -4473,9 +4473,9 @@ namespace SolarPower.Repository.Implement sql_perSiteDB.Add(temp_sql); } - sql = string.Join(" UNION ", sql_perSiteDB); + sql = "SELECT * FROM (" + string.Join(" UNION ", sql_perSiteDB) + ") a ORDER BY a.TIMESTAMP ASC"; - result = (await conn.QueryAsync(sql, new { NowDay = nowDay })).ToList(); + result = (await conn.QueryAsync(sql, new { NowDay = nowDay }, commandTimeout: 300)).ToList(); } catch (Exception exception) { @@ -4504,7 +4504,7 @@ namespace SolarPower.Repository.Implement var temp_sql = $@"SELECT DATE_FORMAT(inv.TIMESTAMP, '%Y-%m-%d') AS TIMESTAMP, - INVERTERID, + inv.INVERTERID, i.InverterName AS INVERTERName, inv.Irradiance, inv.KWH, @@ -4523,7 +4523,7 @@ namespace SolarPower.Repository.Implement sql_perSiteDB.Add(temp_sql); } - sql = string.Join(" UNION ", sql_perSiteDB); + sql = "SELECT * FROM (" + string.Join(" UNION ", sql_perSiteDB) + ") a ORDER BY a.TIMESTAMP ASC"; result = (await conn.QueryAsync(sql, new { StartDay = startDay, EndDay = endDay })).ToList(); } @@ -4554,7 +4554,7 @@ namespace SolarPower.Repository.Implement var temp_sql = $@"SELECT DATE_FORMAT(inv.TIMESTAMP, '%Y-%m-%d') AS TIMESTAMP, - INVERTERID, + inv.INVERTERID, i.InverterName AS INVERTERName, inv.KWH, inv.TODAYKWH, @@ -5338,7 +5338,7 @@ namespace SolarPower.Repository.Implement SELECT api.Item, api.ItemName FROM apicall api LEFT join - (SELECT * FROM {dbname}.power_station_exception ex WHERE ex.Deleted = 0) a + (SELECT * FROM {dbname}.power_station_exception ex WHERE ex.Deleted = 0 AND ex.PowerStationId = {powerStationId}) a ON a.`Type` = api.Item WHERE api.PowerStationId = {powerStationId} AND ISNULL(a.Id) diff --git a/SolarPower/Repository/Implement/StationReportRepository.cs b/SolarPower/Repository/Implement/StationReportRepository.cs index 8f12dc9..00adb1f 100644 --- a/SolarPower/Repository/Implement/StationReportRepository.cs +++ b/SolarPower/Repository/Implement/StationReportRepository.cs @@ -243,7 +243,7 @@ namespace SolarPower.Repository.Implement break; } - a = await conn.QueryAsync(sql); + a = await conn.QueryAsync(sql, commandTimeout: 300); } catch (Exception exception) { @@ -257,6 +257,52 @@ namespace SolarPower.Repository.Implement } } + public async Task CheckExcelAsync(Select_table post) + { + using (IDbConnection conn = _databaseHelper.GetConnection()) + { + int a; + conn.Open(); + try + { + string sql = ""; + switch ( post.FormType ) + { + case 0: + sql = @$"select Id from power_station_history_day where powerstationid = {post.PowerStation} and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = '{post.Time}'"; + break; + case 1: + if(post.SearchType == 2) + { + sql = @$"select Id from power_station_history_month where powerstationid = {post.PowerStation} and DATE_FORMAT(`TIMESTAMP`,'%Y-%m') = '{post.Time}'"; + } + else + { + var times = post.Time.Replace('-', 'a').Replace('/', '-').Replace(" ", "").Split('a'); + sql = @$"select Id from power_station_history_day where powerstationid = {post.PowerStation} and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') BETWEEN '{times[0]}' AND '{times[1]}'"; + } + break; + case 3: + 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); + } + catch (Exception exception) + { + throw exception; + } + finally + { + conn.Close(); + } + return a; + } + } + + + + public async Task> GetHire (PsIdAndSiteDB post) { List result = new List(); diff --git a/SolarPower/Repository/Interface/IStationReportRepository.cs b/SolarPower/Repository/Interface/IStationReportRepository.cs index c3f1f8a..3edc23f 100644 --- a/SolarPower/Repository/Interface/IStationReportRepository.cs +++ b/SolarPower/Repository/Interface/IStationReportRepository.cs @@ -13,5 +13,6 @@ namespace SolarPower.Repository.Interface Task> GetHire(PsIdAndSiteDB post); Task> GetMaxtablebody(Select_table2 post); Task Findhaveinv(Select_table post); + Task CheckExcelAsync(Select_table post); } } diff --git a/SolarPower/Views/AnalysisStationCombine/Index.cshtml b/SolarPower/Views/AnalysisStationCombine/Index.cshtml index 5a5907b..bcde727 100644 --- a/SolarPower/Views/AnalysisStationCombine/Index.cshtml +++ b/SolarPower/Views/AnalysisStationCombine/Index.cshtml @@ -111,6 +111,25 @@ } + else + { +
+
+

日照度

+
k W/m2
+
+
+
+

當日日照度

+

0.00

+
+
+

平均日照度(30天)

+

0.00

+
+
+
+ }

PR值

@@ -309,7 +328,7 @@ $("#today_kwhkwp_label").html(timename + "有效日照時數"); $("#today_PR_label").html(timename + "PR值"); $("#today_carbon_label").html(timename + "減碳量"); - + $("#today_irradiance_label").html(timename + "日照度"); if (type == 1) { timerange = $('#DateGettext').val(); @@ -411,7 +430,7 @@ $('#total_kwhkwp').html(rel.data.all_KWH_KWP.toFixed(2)); $('#total_PR').html(rel.data.all_PR.toFixed(2)); $('#total_carbon').html(rel.data.all_Carbon.toFixed(2)); - $('#total_irradiance').html(rel.data.all_Carbon.toFixed(2)); + $('#total_irradiance').html(rel.data.all_irradiance.toFixed(2)); $('#today_kwh').html(rel.data.now_kwh.toFixed(2)); @@ -419,7 +438,7 @@ $('#today_kwhkwp').html(rel.data.now_KWH_KWP.toFixed(2)); $('#today_PR').html(rel.data.now_PR.toFixed(2)); $('#today_carbon').html(rel.data.now_Carbon.toFixed(2)); - $('#today_irradiance').html(rel.data.now_Carbon.toFixed(2)); + $('#today_irradiance').html(rel.data.now_irradiance.toFixed(2)); chart(); }) diff --git a/SolarPower/Views/Company/Index.cshtml b/SolarPower/Views/Company/Index.cshtml index d46f785..3aee15d 100644 --- a/SolarPower/Views/Company/Index.cshtml +++ b/SolarPower/Views/Company/Index.cshtml @@ -250,6 +250,9 @@ 'render': function (data, type, full, meta) { return ''; } + },{ + 'targets': 8, + 'visible': false }], "language": { "emptyTable": "查無資料", diff --git a/SolarPower/Views/MapOverview/Index.cshtml b/SolarPower/Views/MapOverview/Index.cshtml index 95e0bcb..3af9f0e 100644 --- a/SolarPower/Views/MapOverview/Index.cshtml +++ b/SolarPower/Views/MapOverview/Index.cshtml @@ -20,7 +20,7 @@
-

即時總發電量

+

今日總發電量

0.00

@@ -36,7 +36,7 @@
-

即時平均日照度

+

今日日照度

0.00

@@ -52,7 +52,7 @@
-

即時平均 PR 值

+

今日 PR 值

0.00

@@ -68,7 +68,7 @@
-

即時平均有效日照時數

+

今日有效日照時數(kwh/kwp)

0.00

@@ -171,7 +171,8 @@ @section Scripts{ - + @**@ +