網頁: 累積日照量差,修正半夜12的值會是負數問題

This commit is contained in:
wanling040@gmail.com 2022-08-14 00:24:49 +08:00
parent 8bcdd703a2
commit 1735aca3ed

View File

@ -53,7 +53,7 @@ namespace SolarPower.Quartz.Jobs
logger.LogInformation("【CalcPowerStationJob】【開始取得電站資料】");
var powerStations = await powerStationRepository.GetAllAsync();
logger.LogInformation("【CalcPowerStationJob】【取得成功電站資料】");
logger.LogInformation("【CalcPowerStationJob】【電站資料】 - {0}", System.Text.Json.JsonSerializer.Serialize(powerStations));
logger.LogInformation("【CalcPowerStationJob】【電站資料");
#endregion
List<PowerStationHistory> powerStationHistoriesHour = new List<PowerStationHistory>();
@ -610,12 +610,29 @@ namespace SolarPower.Quartz.Jobs
logger.LogInformation("【CalcPowerStationJob】【開始計算電站[{0}]在{1}的相減的累計日照量】", powerStation.Code, dateTime);
var twoHourAgoIrrDay = await powerStationRepository.CalcIrrDayHistoryPerTwoHour(dateTime, powerStation.Id);
if (twoHourAgoIrrDay != null)
{
if (DateTimeNow.AddHours(-1).Hour == 0)//半夜12點的值
{
sensorHistory.IrrDayHour = 0;
}
else
{
sensorHistory.IrrDayHour = sensorHistory.IrrDay - double.Parse(twoHourAgoIrrDay);// 前一小時的IrrDay - 前兩小時的IrrDay
}
logger.LogInformation("【CalcPowerStationJob】【計算完成電站[{0}]在{1}的相減的累計日照量】", powerStation.Code, dateTime);
}
else
{
sensorHistory.IrrDayHour = 0;
}
}
else
{
sensorHistory.IrrDay = 0;
sensorHistory.IrrDayHour = 0;
}
}
}
catch (Exception ex)