debug 系統更新 - 累計日照相減
This commit is contained in:
parent
6179d549a4
commit
995f7dc499
@ -42,10 +42,10 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
|
|
||||||
Root2 observation = null;
|
Root2 observation = null;
|
||||||
|
|
||||||
if (this.environment.IsDevelopment())
|
//if (this.environment.IsDevelopment())
|
||||||
{
|
//{
|
||||||
dateTime = "2022-08-04 18";
|
// dateTime = "2022-08-04 18";
|
||||||
}
|
//}
|
||||||
|
|
||||||
logger.LogInformation("【CalcPowerStationJob】【任務開始】");
|
logger.LogInformation("【CalcPowerStationJob】【任務開始】");
|
||||||
|
|
||||||
@ -492,10 +492,10 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
sensorHistory.IrrDay = TPYHistory.IrrDay;
|
sensorHistory.IrrDay = TPYHistory.IrrDay;
|
||||||
logger.LogInformation("【CalcPowerStationJob】【計算完成電站[{0}]在{1}的累計日照量的平均值】", powerStation.Code, dateTime);
|
logger.LogInformation("【CalcPowerStationJob】【計算完成電站[{0}]在{1}的累計日照量的平均值】", powerStation.Code, dateTime);
|
||||||
logger.LogInformation("【CalcPowerStationJob】【開始計算電站[{0}]在{1}的相減的累計日照量】", powerStation.Code, dateTime);
|
logger.LogInformation("【CalcPowerStationJob】【開始計算電站[{0}]在{1}的相減的累計日照量】", powerStation.Code, dateTime);
|
||||||
TPYHistory = await powerStationRepository.CalcIrrDayHourHistoryPerHour(dateTime, powerStation.Id);
|
var ss = await powerStationRepository.CalcIrrDayHourHistoryPerHour(dateTime, powerStation.Id);
|
||||||
if (TPYHistory != null)
|
if (ss != null)
|
||||||
{
|
{
|
||||||
sensorHistory.IrrDayHour = TPYHistory.IrrDayHour;
|
sensorHistory.IrrDayHour = double.Parse( ss);
|
||||||
logger.LogInformation("【CalcPowerStationJob】【計算完成電站[{0}]在{1}的相減的累計日照量】", powerStation.Code, dateTime);
|
logger.LogInformation("【CalcPowerStationJob】【計算完成電站[{0}]在{1}的相減的累計日照量】", powerStation.Code, dateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -773,6 +773,7 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
"Dust",
|
"Dust",
|
||||||
"WingDirection",
|
"WingDirection",
|
||||||
"IrrDay",
|
"IrrDay",
|
||||||
|
"IrrDayHour"
|
||||||
};
|
};
|
||||||
|
|
||||||
await powerStationRepository.AddSensorHistoryHour(sensorHistoriesHour, sensor_history_properties);
|
await powerStationRepository.AddSensorHistoryHour(sensorHistoriesHour, sensor_history_properties);
|
||||||
|
|||||||
@ -6418,9 +6418,9 @@ namespace SolarPower.Repository.Implement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<PyrheliometerHistory> CalcIrrDayHourHistoryPerHour(string dateTime, int powerStationId)
|
public async Task<string> CalcIrrDayHourHistoryPerHour(string dateTime, int powerStationId)
|
||||||
{
|
{
|
||||||
PyrheliometerHistory result;
|
string result;
|
||||||
using (IDbConnection conn = this._databaseHelper.GetConnection())
|
using (IDbConnection conn = this._databaseHelper.GetConnection())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -6434,16 +6434,21 @@ namespace SolarPower.Repository.Implement
|
|||||||
// ) b on a.powerstationID = b.powerstationID and a.`TIMESTAMP` = b.`TIMESTAMP`
|
// ) b on a.powerstationID = b.powerstationID and a.`TIMESTAMP` = b.`TIMESTAMP`
|
||||||
// Set a.irrdayhour = b.irrdayhour where a.powerstationID = {powerStationId}";
|
// Set a.irrdayhour = b.irrdayhour where a.powerstationID = {powerStationId}";
|
||||||
string d1 = dateTime + ":00:00";
|
string d1 = dateTime + ":00:00";
|
||||||
string sql = $@"update sensor_history_hour a join
|
//string sql = $@"update sensor_history_hour a join
|
||||||
(
|
// (
|
||||||
select powerstationID, `TIMESTAMP`, irrday -
|
// select powerstationID, `TIMESTAMP`, irrday -
|
||||||
(select irrday from sensor_history_hour where powerstationID = {powerStationId} and LEFT(`TIMESTAMP`, 13 ) = '{Convert.ToDateTime(d1).AddHours(-1).ToString("yyyy-MM-dd HH")}' limit 1) irrdayhour
|
// (select irrday from sensor_history_hour where powerstationID = {powerStationId} and LEFT(`TIMESTAMP`, 13 ) = '{Convert.ToDateTime(d1).AddHours(-1).ToString("yyyy-MM-dd HH")}' limit 1) irrdayhour
|
||||||
from sensor_history_hour z
|
// from sensor_history_hour z
|
||||||
where powerstationID = {powerStationId} and LEFT(z.`TIMESTAMP`, 13 ) = '{dateTime}'
|
// where powerstationID = {powerStationId} and LEFT(z.`TIMESTAMP`, 13 ) = '{dateTime}'
|
||||||
) b on a.powerstationID = b.powerstationID and a.`TIMESTAMP` = b.`TIMESTAMP`
|
// ) b on a.powerstationID = b.powerstationID and a.`TIMESTAMP` = b.`TIMESTAMP`
|
||||||
Set a.irrdayhour = case when b.irrdayhour < 0 then 0 else b.irrdayhour end
|
// Set a.irrdayhour = case when b.irrdayhour < 0 then 0 else b.irrdayhour end
|
||||||
where a.powerstationID = {powerStationId}";
|
// where a.powerstationID = {powerStationId}";
|
||||||
result = await conn.QueryFirstOrDefaultAsync<PyrheliometerHistory>(sql, commandTimeout: 600);
|
//result = await conn.QueryFirstOrDefaultAsync<PyrheliometerHistory>(sql, commandTimeout: 600);
|
||||||
|
string sql = $@" select irrday -
|
||||||
|
(select irrday from sensor_history_hour where powerstationID = {powerStationId} and LEFT(`TIMESTAMP`, 13 ) = '{Convert.ToDateTime(d1).AddHours(-1).ToString("yyyy-MM-dd HH")}' limit 1) irrdayhour
|
||||||
|
from sensor_history_hour z
|
||||||
|
where powerstationID = {powerStationId} and LEFT(z.`TIMESTAMP`, 13 ) = '{dateTime}' ";
|
||||||
|
result = await conn.QueryFirstOrDefaultAsync<string>(sql, commandTimeout: 600);
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -632,6 +632,6 @@ namespace SolarPower.Repository.Interface
|
|||||||
Task AlertColStationTableColumn(string dbname, string code);
|
Task AlertColStationTableColumn(string dbname, string code);
|
||||||
|
|
||||||
Task<List<PowerStation>> GetAllNoStatusAsync();
|
Task<List<PowerStation>> GetAllNoStatusAsync();
|
||||||
Task<PyrheliometerHistory> CalcIrrDayHourHistoryPerHour(string dateTime, int powerStationId);
|
Task<string> CalcIrrDayHourHistoryPerHour(string dateTime, int powerStationId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,7 +95,8 @@ namespace SolarPower
|
|||||||
|
|
||||||
#region 加入背景執行
|
#region 加入背景執行
|
||||||
//services.AddHostedService<OperationScheduleBackgroundService>();
|
//services.AddHostedService<OperationScheduleBackgroundService>();
|
||||||
if (envName == "Production")
|
//if (envName == "Production")
|
||||||
|
if (!envName != "Production")
|
||||||
{
|
{
|
||||||
////添加Quartz服務
|
////添加Quartz服務
|
||||||
services.AddSingleton<IJobFactory, SingletonJobFactory>();
|
services.AddSingleton<IJobFactory, SingletonJobFactory>();
|
||||||
|
|||||||
3
solarApp/fmArchive.Designer.cs
generated
3
solarApp/fmArchive.Designer.cs
generated
@ -176,7 +176,6 @@ namespace solarApp
|
|||||||
this.label2.Size = new System.Drawing.Size(42, 19);
|
this.label2.Size = new System.Drawing.Size(42, 19);
|
||||||
this.label2.TabIndex = 19;
|
this.label2.TabIndex = 19;
|
||||||
this.label2.Text = "小時:";
|
this.label2.Text = "小時:";
|
||||||
this.label2.Visible = false;
|
|
||||||
//
|
//
|
||||||
// textBox1
|
// textBox1
|
||||||
//
|
//
|
||||||
@ -184,7 +183,6 @@ namespace solarApp
|
|||||||
this.textBox1.Name = "textBox1";
|
this.textBox1.Name = "textBox1";
|
||||||
this.textBox1.Size = new System.Drawing.Size(125, 27);
|
this.textBox1.Size = new System.Drawing.Size(125, 27);
|
||||||
this.textBox1.TabIndex = 18;
|
this.textBox1.TabIndex = 18;
|
||||||
this.textBox1.Visible = false;
|
|
||||||
//
|
//
|
||||||
// button2
|
// button2
|
||||||
//
|
//
|
||||||
@ -195,7 +193,6 @@ namespace solarApp
|
|||||||
this.button2.TabIndex = 17;
|
this.button2.TabIndex = 17;
|
||||||
this.button2.Text = "測試當下 irrdayHour";
|
this.button2.Text = "測試當下 irrdayHour";
|
||||||
this.button2.UseVisualStyleBackColor = true;
|
this.button2.UseVisualStyleBackColor = true;
|
||||||
this.button2.Visible = false;
|
|
||||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||||
//
|
//
|
||||||
// bt_archive_One
|
// bt_archive_One
|
||||||
|
|||||||
@ -111,15 +111,15 @@ namespace solarApp
|
|||||||
}
|
}
|
||||||
|
|
||||||
//臨時的 累計日照
|
//臨時的 累計日照
|
||||||
//if (DateTime.Now.Minute == 39 && (DateTime.Now.Second >= 0 && DateTime.Now.Second <= 10) && autoTask == false)
|
if (DateTime.Now.Minute == 30 && (DateTime.Now.Second >= 0 && DateTime.Now.Second <= 10) && autoTask == false)
|
||||||
//{
|
{
|
||||||
// //MessageBox.Show("ok");
|
//MessageBox.Show("ok");
|
||||||
// autoTask = true;
|
autoTask = true;
|
||||||
// lbMsgTitle.Text = DateTime.Now.ToString() + " 臨時的 累計日照 start";
|
lbMsgTitle.Text = DateTime.Now.ToString() + " 臨時的 累計日照 start";
|
||||||
|
|
||||||
// button2.PerformClick();
|
button2.PerformClick();
|
||||||
// //bt_archive_Click.PerformClick();
|
//bt_archive_Click.PerformClick();
|
||||||
//}
|
}
|
||||||
|
|
||||||
|
|
||||||
//水位管理
|
//水位管理
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user