Merge branch 'master' into Willy

This commit is contained in:
b110212000 2021-07-07 19:04:15 +08:00
commit a9265f301d
5 changed files with 464 additions and 58 deletions

View File

@ -123,6 +123,8 @@ namespace SolarPower.Models.PowerStation
public double Avg_PR { get; set; }
public double Today_Carbon { get; set; } //今日減碳量
public double Total_Carbon { get; set; } //總減碳量
public double Today_irradiance { get; set; } //即時平均日照度
public double Avg_irradiance { get; set; } //平均日照度(30天)
public double SolarHour { get; set; } //總運轉小時
public string SiteDB { get; set; } //電站 DB name: solar_com
public string TodayWeather { get; set; } //今日天氣
@ -572,7 +574,7 @@ namespace SolarPower.Models.PowerStation
public class PowerStationHistory
{
public int PowerStationId { get; set; }
public Int64 Timestamp { get; set; }
public string Timestamp { get; set; }
public string SITEID { get; set; }
public string SiteType { get; set; }
public double KWH { get; set; }
@ -589,7 +591,6 @@ namespace SolarPower.Models.PowerStation
public int PowerStationId { get; set; }
public double AvgKWHKWP { get; set; }
public double AvgPR { get; set; }
}
public class PowerStationHistoryDay
@ -620,6 +621,24 @@ namespace SolarPower.Models.PowerStation
public double SolarHour { get; set; }
}
public class PyrheliometerHistory
{
public int PowerStationId { get; set; }
public string Timestamp { get; set; }
public double Irradiance { get; set; }
}
public class AvgPyrheliometerHistory
{
public int PowerStationId { get; set; }
public double AvgIrradiance { get; set; }
}
public class PyrheliometerHistoryDay
{
public int PowerStationId { get; set; }
public string Timestamp { get; set; }
public double Irradiance { get; set; }
}
}

View File

@ -29,31 +29,33 @@ namespace SolarPower.Quartz.Jobs
var powerStations = await powerStationRepository.GetAllAsync();
#endregion
List<PowerStationHistoryDay> powerStationHistoryDays = new List<PowerStationHistoryDay>();
List<PowerStation> calcAvgPowerStations = new List<PowerStation>();
List<PowerStationHistoryDay> powerStationHistoryDays = new List<PowerStationHistoryDay>();
List<PowerStationHistoryMonth> insertPowerStationHistoryMonths = new List<PowerStationHistoryMonth>();
List<PowerStationHistoryMonth> updatePowerStationHistoryMonths = new List<PowerStationHistoryMonth>();
List<PyrheliometerHistory> pyrheliometerHistoryDays = new List<PyrheliometerHistory>();
List<PyrheliometerHistory> insertPyrheliometerHistoryMonths = new List<PyrheliometerHistory>();
List<PyrheliometerHistory> updatePyrheliometerHistoryMonths = new List<PyrheliometerHistory>();
var DateTimeNow = DateTime.Now;
#region step2. DB及電站編號找出該電站的控制器
foreach (var powerStation in powerStations)
{
#region step2-1. 30
var table_name = String.Format("`{0}`.`{1}01_ficstationhistory`", powerStation.SiteDB, powerStation.Code);
var calcPowerStation = new PowerStation();
calcPowerStation.Id = powerStation.Id;
var dateNowDay = DateTimeNow.AddDays(-1).ToString("yyyy-MM-dd");
dateNowDay = "2021-06-24";
var history = await powerStationRepository.GetAvgPowerStationHistory30day(dateNowDay, table_name);
#region step2-1. 30
var table_name = String.Format("`{0}`.`{1}01_station`", powerStation.SiteDB, powerStation.Code);
var history = await powerStationRepository.CalcAvgPowerStationHistory30day(dateNowDay, table_name);
if (history != null)
{
history.PowerStationId = powerStation.Id;
#region 30 kWh/kWp PR
var calcPowerStation = new PowerStation();
calcPowerStation.Id = powerStation.Id;
#region kWh/kWp
//直接填寫
@ -65,32 +67,46 @@ namespace SolarPower.Quartz.Jobs
calcPowerStation.Avg_PR = history.AvgPR;
#endregion
#endregion
calcAvgPowerStations.Add(calcPowerStation);
}
#endregion
#region step2-2.
#region step2-2 30
var avgPyrheliometerHistory = await powerStationRepository.CalcAvgPyrheliometerHistory30day(dateNowDay, powerStation.Id);
if (avgPyrheliometerHistory != null)
{
calcPowerStation.Avg_irradiance = avgPyrheliometerHistory.AvgIrradiance;
}
calcAvgPowerStations.Add(calcPowerStation);
#endregion
#region step2-3.
var historyDay = await powerStationRepository.GetLastOnePowerStationHistoryByDay(dateNowDay, table_name);
if (historyDay != null)
{
historyDay.PowerStationId = powerStation.Id;
powerStationHistoryDays.Add(historyDay);
}
var pyrheliometerHistorDay = await powerStationRepository.CalcPyrheliometerHistoryDayDataByPowerStationId(dateNowDay, powerStation.Id);
if (pyrheliometerHistorDay != null)
{
pyrheliometerHistoryDays.Add(pyrheliometerHistorDay);
}
#endregion
#region step2-3.
#region step2-4.
//判斷這個月是否已存在
var dateNowMonth = DateTimeNow.ToString("yyyy-MM");
dateNowMonth = "2021-06";
var exist = await powerStationRepository.GetOnePowerStationHistoryByPowerStationIdAndMonth(powerStation.Id, dateNowMonth);
if (exist == null)
//電站該月份的歷史資料
var exist_history = await powerStationRepository.GetOnePowerStationHistoryByPowerStationIdAndMonth(powerStation.Id, dateNowMonth);
if (exist_history == null)
{ //新增
var historyMonth = await powerStationRepository.GetPowerStationHistoryMonthDataByPowerStationId(powerStation.Id, dateNowMonth);
var historyMonth = await powerStationRepository.ClacPowerStationHistoryMonthDataByPowerStationId(powerStation.Id, dateNowMonth);
if (historyMonth != null)
{
historyMonth.Timestamp = Convert.ToDateTime(historyMonth.Timestamp).ToString("yyyy-MM-dd");
@ -100,29 +116,49 @@ namespace SolarPower.Quartz.Jobs
}
else
{ //修改
var historyMonth = await powerStationRepository.GetPowerStationHistoryMonthDataByPowerStationId(powerStation.Id, dateNowMonth);
var historyMonth = await powerStationRepository.ClacPowerStationHistoryMonthDataByPowerStationId(powerStation.Id, dateNowMonth);
if (historyMonth != null)
{
updatePowerStationHistoryMonths.Add(historyMonth);
}
}
//電站該月份的的日照度歷史資料
var exist_pyrheliometer_history = await powerStationRepository.GetOnePyrheliometerHistoryByMonth(dateNowMonth, powerStation.Id);
if (exist_pyrheliometer_history == null)
{ //新增
var pyrheliometerHistoryMonth = await powerStationRepository.CalcPyrheliometerHistoryMonthDataByPowerStationId(dateNowMonth, powerStation.Id);
if (pyrheliometerHistoryMonth != null)
{
pyrheliometerHistoryMonth.Timestamp = Convert.ToDateTime(pyrheliometerHistoryMonth.Timestamp).ToString("yyyy-MM-dd");
insertPyrheliometerHistoryMonths.Add(pyrheliometerHistoryMonth);
}
}
else
{ //修改
var pyrheliometerHistoryMonth = await powerStationRepository.CalcPyrheliometerHistoryMonthDataByPowerStationId(dateNowMonth, powerStation.Id);
if (pyrheliometerHistoryMonth != null)
{
updatePyrheliometerHistoryMonths.Add(pyrheliometerHistoryMonth);
}
}
#endregion
}
#endregion
//TODO 日照
#region step3. calcPowerStations UPDATE power_station
List<string> power_station_properties = new List<string>()
{
"Id",
"avg_kwhkwp",
"avg_PR",
"avg_irradiance"
};
await powerStationRepository.UpdateList(calcAvgPowerStations, power_station_properties);
#endregion
#region step4. insert or update
#region step4. insert or update
//每日
List<string> history_properties_day = new List<string>()
{
@ -140,6 +176,7 @@ namespace SolarPower.Quartz.Jobs
await powerStationRepository.AddPowerStationHistoryDayList(powerStationHistoryDays, history_properties_day);
//每月
List<string> history_properties_month = new List<string>()
{
"PowerStationId",
@ -165,6 +202,28 @@ namespace SolarPower.Quartz.Jobs
}
#endregion
#region step5. insert or update
List<string> pyrheliometer_history_properties = new List<string>()
{
"PowerStationId",
"Timestamp",
"Irradiance"
};
//每日
await powerStationRepository.AddPyrheliometerHistoryDayList(pyrheliometerHistoryDays, pyrheliometer_history_properties);
//每月
if (insertPowerStationHistoryMonths.Count > 0)
{
await powerStationRepository.AddPowerStationHistoryMonthList(insertPowerStationHistoryMonths, history_properties_month);
}
if (updatePowerStationHistoryMonths.Count > 0)
{
await powerStationRepository.UpdatePowerStationHistoryMonthList(updatePowerStationHistoryMonths);
}
#endregion
}
catch (Exception exception)
{

View File

@ -32,48 +32,40 @@ namespace SolarPower.Quartz.Jobs
#endregion
List<PowerStationHistory> powerStationHistoriesHour = new List<PowerStationHistory>();
List<PyrheliometerHistory> pyrheliometerHistoriesHour = new List<PyrheliometerHistory>();
List<PowerStation> calcPowerStations = new List<PowerStation>();
var DateTimeNow = DateTime.Now;
#region step2. DB及電站編號找出該電站的控制器
var count = 0;
foreach (var powerStation in powerStations)
{
if(count > 0)
{
break;
}
#region step2-1.
var table_name = String.Format("`{0}`.{1}01_ficstationhistory", powerStation.SiteDB, powerStation.Code);
var dateTime = DateTimeNow.AddHours(-1).ToString("yyyy-MM-dd HH");
dateTime = "2021-06-24 18";
var history = await powerStationRepository.GetPowerStationHistoryPerHour(dateTime, table_name);
if (history != null)
{
history.PowerStationId = powerStation.Id;
#region
var calcPowerStation = new PowerStation();
calcPowerStation.Id = powerStation.Id;
calcPowerStation.kwh = history.KWH;
var dateTime = DateTimeNow.AddHours(-1).ToString("yyyy-MM-dd HH");
dateTime = "2021-06-24 18";
#region step2-1.
var table_name = String.Format("`{0}`.{1}01_station", powerStation.SiteDB, powerStation.Code);
var history = await powerStationRepository.GetPowerStationHistoryPerHour(dateTime, table_name);
if (history != null)
{
history.PowerStationId = powerStation.Id;
history.Timestamp = Convert.ToDateTime(history.Timestamp).ToString("yyyy-MM-dd HH:mm:ss");
#region
#region
//每小時發電量(直接填寫
calcPowerStation.kwh = history.KWH;
//今日發電量(直接填寫
calcPowerStation.Today_kWh = history.TodayKWh;
//總發電量(直接填寫
calcPowerStation.Total_kWh = history.TotalKWH;
#endregion
//TODO
#region
//1. 找出該電站所有日照計設備(包還共享
//2. 透過該DB、col取得到是哪一個sensor
#endregion
#region
//發電金額
switch (powerStation.SolarType)
@ -135,16 +127,32 @@ namespace SolarPower.Quartz.Jobs
#endregion
powerStationHistoriesHour.Add(history);
}
#endregion
#region step2-2.
//1. 找出該電站所有日照計設備(包還共享
var deviceInfos = await powerStationRepository.GetListPyrheliometerByPowerStationId(powerStation.Id, powerStation.SiteDB);
if (deviceInfos != null)
{
//2. 計算該電站所有日照計設的每小時的平均在依照日照計數量平均
var pyrheliometerHistory = await powerStationRepository.GetPyrheliometerHistoryPerHour(dateTime, deviceInfos);
if (pyrheliometerHistory != null)
{
calcPowerStation.Today_irradiance = pyrheliometerHistory.Irradiance;
pyrheliometerHistory.Timestamp = Convert.ToDateTime(pyrheliometerHistory.Timestamp).ToString("yyyy-MM-dd HH:mm:ss");
pyrheliometerHistoriesHour.Add(pyrheliometerHistory);
}
}
#endregion
calcPowerStations.Add(calcPowerStation);
}
#endregion
count++;
}
#endregion
#region step3. historiers INSERT power_station_history_hour
List<string> history_properties = new List<string>()
{
"PowerStationId",
@ -163,8 +171,18 @@ namespace SolarPower.Quartz.Jobs
await powerStationRepository.AddPowerStationHistory(powerStationHistoriesHour, history_properties);
#endregion
//TODO 日照
#region step4. calcPowerStations UPDATE power_station
#region step4. Pyrheliometer History INSERT pyrheliometer_history_hour
List<string> pyrheliometer_history_properties = new List<string>()
{
"PowerStationId",
"TIMESTAMP",
"Irradiance"
};
await powerStationRepository.AddPyrheliometerHistory(pyrheliometerHistoriesHour, pyrheliometer_history_properties);
#endregion
#region step5. calcPowerStations UPDATE power_station
List<string> power_station_properties = new List<string>()
{
"Id",
@ -177,6 +195,7 @@ namespace SolarPower.Quartz.Jobs
"today_PR",
"today_carbon",
"total_carbon",
"today_irradiance"
};
await powerStationRepository.UpdateList(calcPowerStations, power_station_properties);

View File

@ -1822,7 +1822,18 @@ namespace SolarPower.Repository.Implement
try
{
var sql = $@"
SELECT * FROM {table_name} WHERE DATE_FORMAT(FROM_UNIXTIME(timestamp / 1000), '%Y-%m-%d %H') = @DateTime
SELECT
DATE_FORMAT(FROM_UNIXTIME(timestamp / 1000), '%Y-%m-%d %H') AS TIMESTAMP,
SITEID,
SiteType,
KWH,
TodayKWh,
TotalKWH,
KWHKWP,
PR,
MP,
SolarHour
FROM {table_name} WHERE DATE_FORMAT(FROM_UNIXTIME(timestamp / 1000), '%Y-%m-%d %H') = @DateTime
";
result = await conn.QueryFirstOrDefaultAsync<PowerStationHistory>(sql, new { DateTime = dateTime });
@ -1835,7 +1846,7 @@ namespace SolarPower.Repository.Implement
}
}
public async Task<AvgPowerStationHistory> GetAvgPowerStationHistory30day(string nowDay, string table_name)
public async Task<AvgPowerStationHistory> CalcAvgPowerStationHistory30day(string nowDay, string table_name)
{
AvgPowerStationHistory result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
@ -2023,7 +2034,7 @@ namespace SolarPower.Repository.Implement
}
}
public async Task<PowerStationHistoryMonth> GetPowerStationHistoryMonthDataByPowerStationId(int powerStationId, string month)
public async Task<PowerStationHistoryMonth> ClacPowerStationHistoryMonthDataByPowerStationId(int powerStationId, string month)
{
PowerStationHistoryMonth result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
@ -2165,6 +2176,294 @@ namespace SolarPower.Repository.Implement
}
}
public async Task<List<DeviceInfo>> GetListPyrheliometerByPowerStationId(int powerStationId, string db_name)
{
List<DeviceInfo> result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
try
{
var sql = $@"SELECT *
FROM {db_name}.device d
WHERE d.PowerStationId = @PowerStationId AND d.`Type` = 'PYR' AND d.Deleted = 0
UNION
SELECT d.*
FROM {db_name}.sharedevice sd
LEFT JOIN {db_name}.device d ON sd.DeviceId = d.Id
WHERE sd.PowerStationId = @PowerStationId AND d.`Type` = 'PYR' AND d.Deleted = 0
";
result = (await conn.QueryAsync<DeviceInfo>(sql, new { PowerStationId = powerStationId })).ToList();
}
catch (Exception exception)
{
throw exception;
}
return result;
}
}
public async Task<PyrheliometerHistory> GetPyrheliometerHistoryPerHour(string dateTime, List<DeviceInfo> deviceInfos)
{
PyrheliometerHistory result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
try
{
List<string> sql_per_device = new List<string>();
foreach(var device in deviceInfos)
{
var str = @$"SELECT DATE_FORMAT(FROM_UNIXTIME(s.TIMESTAMP/ 1000), '%Y-%m-%d %H') AS TIMESTAMP, s.SITEID, AVG(s.{device.ColName}) AS SENSOR
FROM {device.DBName}.{device.TableName} s
WHERE DATE_FORMAT(FROM_UNIXTIME(s.TIMESTAMP/ 1000), '%Y-%m-%d %H') = @DateTime
GROUP BY DATE_FORMAT(FROM_UNIXTIME(s.TIMESTAMP/ 1000), '%Y-%m-%d %H')";
sql_per_device.Add(str);
}
var sql = @"SELCET TIMESTAMP, AVG(SENSOR) AS Irradiance FROM(" + string.Join(" UNION ", sql_per_device) + @") GORUP BY TIMESTAMP";
result = await conn.QueryFirstOrDefaultAsync<PyrheliometerHistory>(sql, new { DateTime = dateTime });
}
catch (Exception exception)
{
throw exception;
}
return result;
}
}
public async Task<int> AddPyrheliometerHistory(List<PyrheliometerHistory> entity, List<string> properties)
{
int count;
using (IDbConnection conn = _databaseHelper.GetConnection())
{
conn.Open();
using (var trans = conn.BeginTransaction())
{
try
{
string sql = GenerateInsertQueryWithCustomTable(properties, "pyrheliometer_history_hour");
count = await conn.ExecuteAsync(sql, entity, trans);
trans.Commit();
}
catch (Exception exception)
{
trans.Rollback();
throw exception;
}
finally
{
conn.Close();
}
}
return count;
}
}
public async Task<AvgPyrheliometerHistory> CalcAvgPyrheliometerHistory30day(string nowDay, int powerStationId)
{
AvgPyrheliometerHistory result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
try
{
var startDay = Convert.ToDateTime(nowDay).AddDays(-30).ToString("yyyy-MM-dd");
var sql = $@"SELECT AVG(p.Irradiance) AS AvgIrradiance
FROM pyrheliometer_history_hour p
WHERE DATE_FORMAT(p.TIMESTAMP, '%Y-%m-%d') BETWEEN @StartDay AND @EndDay
AND p.Irradiance != 0
AND PowerStationId = @PowerStationId
GROUP BY DATE_FORMAT(p.TIMESTAMP, '%Y-%m-%d')
";
result = await conn.QueryFirstOrDefaultAsync<AvgPyrheliometerHistory>(sql, new { StartDay = startDay, EndDay = nowDay, PowerStationId = powerStationId });
}
catch (Exception exception)
{
throw exception;
}
return result;
}
}
public async Task<PyrheliometerHistory> CalcPyrheliometerHistoryDayDataByPowerStationId(string nowDay, int powerStationId)
{
PyrheliometerHistory result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
try
{
var sql = $@"SELECT
PowerStationId,
DATE_FORMAT(p.TIMESTAMP, '%Y-%m-%d'),
AVG(p.Irradiance) AS AvgIrradiance
FROM pyrheliometer_history_hour p
WHERE DATE_FORMAT(p.TIMESTAMP, '%Y-%m-%d') = @NowDay
AND p.Irradiance != 0
AND PowerStationId = @PowerStationId
GROUP BY DATE_FORMAT(p.TIMESTAMP, '%Y-%m-%d')
";
result = await conn.QueryFirstOrDefaultAsync<PyrheliometerHistory>(sql, new { NowDay = nowDay, PowerStationId = powerStationId });
}
catch (Exception exception)
{
throw exception;
}
return result;
}
}
public async Task<int> AddPyrheliometerHistoryDayList(List<PyrheliometerHistory> entity, List<string> properties)
{
int count;
using (IDbConnection conn = _databaseHelper.GetConnection())
{
conn.Open();
using (var trans = conn.BeginTransaction())
{
try
{
string sql = GenerateInsertQueryWithCustomTable(properties, "pyrheliometer_history_day");
count = await conn.ExecuteAsync(sql, entity, trans);
trans.Commit();
}
catch (Exception exception)
{
trans.Rollback();
throw exception;
}
finally
{
conn.Close();
}
}
return count;
}
}
public async Task<PyrheliometerHistory> CalcPyrheliometerHistoryMonthDataByPowerStationId(string month, int powerStationId)
{
PyrheliometerHistory result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
try
{
var sql = $@"SELECT
PowerStationId,
DATE_FORMAT(p.TIMESTAMP, '%Y-%m'),
AVG(p.Irradiance) AS AvgIrradiance
FROM pyrheliometer_history_hour p
WHERE DATE_FORMAT(p.TIMESTAMP, '%Y-%m') = @Month
AND p.Irradiance != 0
AND PowerStationId = @PowerStationId
GROUP BY DATE_FORMAT(p.TIMESTAMP, '%Y-%m')
";
result = await conn.QueryFirstOrDefaultAsync<PyrheliometerHistory>(sql, new { Month = month, PowerStationId = powerStationId });
}
catch (Exception exception)
{
throw exception;
}
return result;
}
}
public async Task<PyrheliometerHistory> GetOnePyrheliometerHistoryByMonth(string month, int powerStationId)
{
PyrheliometerHistory result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
try
{
var sql = $@"SELECT * FROM pyrheliometer_history_month WHERE DATE_FORMAT(p.TIMESTAMP, '%Y-%m') = @Month AND PowerStationId = @PowerStationId";
result = await conn.QueryFirstOrDefaultAsync<PyrheliometerHistory>(sql, new { Month = month, PowerStationId = powerStationId });
}
catch (Exception exception)
{
throw exception;
}
return result;
}
}
public async Task<int> AddPyrheliometerHistoryMonthList(List<PyrheliometerHistory> entity, List<string> properties)
{
int count;
using (IDbConnection conn = _databaseHelper.GetConnection())
{
conn.Open();
using (var trans = conn.BeginTransaction())
{
try
{
string sql = GenerateInsertQueryWithCustomTable(properties, "pyrheliometer_history_month");
count = await conn.ExecuteAsync(sql, entity, trans);
trans.Commit();
}
catch (Exception exception)
{
trans.Rollback();
throw exception;
}
finally
{
conn.Close();
}
}
return count;
}
}
public async Task<int> UpdatePyrheliometerHistoryMonthList(List<PyrheliometerHistory> entity)
{
int count;
using (IDbConnection conn = _databaseHelper.GetConnection())
{
conn.Open();
using (var trans = conn.BeginTransaction())
{
try
{
string sql = @"UPDATE pyrheliometer_history_month SET
Irradiance=@Irradiance,
WHERE PowerStationId = @PowerStationId
AND TIMESTAMP LIKE CONCAT(@TIMESTAMP, '%')
";
count = await conn.ExecuteAsync(sql, entity, trans);
trans.Commit();
}
catch (Exception exception)
{
trans.Rollback();
throw exception;
}
finally
{
conn.Close();
}
}
return count;
}
}
public async Task<A> Getonediv<A>(string where, string db_name, string table_name)
{
A result;

View File

@ -27,8 +27,6 @@ namespace SolarPower.Repository.Interface
Task<List<OperationPersonnelSelectItemList>> GetOperationPersonnelSelectOptionListAsync(int powerStationId);
/// <summary>
/// 透過編號取得,縣市資訊
/// </summary>
@ -442,12 +440,12 @@ namespace SolarPower.Repository.Interface
Task<PowerStationHistory> GetPowerStationHistoryPerHour(string dateTime, string table_name);
/// <summary>
/// 透過當前日期,取得往前推算30天的平均值
/// 透過當前日期,計算往前推算30天的平均值
/// </summary>
/// <param name="nowDay"></param>
/// <param name="table_name"></param>
/// <returns></returns>
Task<AvgPowerStationHistory> GetAvgPowerStationHistory30day(string nowDay, string table_name);
Task<AvgPowerStationHistory> CalcAvgPowerStationHistory30day(string nowDay, string table_name);
Task<int> AddPowerStationHistory(List<PowerStationHistory> entity, List<string> properties);
@ -478,12 +476,12 @@ namespace SolarPower.Repository.Interface
Task<PowerStationHistoryMonth> GetOnePowerStationHistoryByPowerStationIdAndMonth(int powerStationId, string month);
/// <summary>
/// 透過電站編號、月份,取得該月份資訊
/// 透過電站編號、月份,計算該月份資訊
/// </summary>
/// <param name="day"></param>
/// <param name="table_name"></param>
/// <returns></returns>
Task<PowerStationHistoryMonth> GetPowerStationHistoryMonthDataByPowerStationId(int powerStationId, string month);
Task<PowerStationHistoryMonth> ClacPowerStationHistoryMonthDataByPowerStationId(int powerStationId, string month);
Task<int> AddPowerStationHistoryMonthList(List<PowerStationHistoryMonth> entity, List<string> properties);
Task<int> UpdatePowerStationHistoryMonthList(List<PowerStationHistoryMonth> entity);
@ -495,6 +493,18 @@ namespace SolarPower.Repository.Interface
/// <returns></returns>
Task<List<PowerstationOption>> GetPowerstationPyrheliometerAsync(string db_name, int stationId);
Task<List<DeviceInfo>> GetListPyrheliometerByPowerStationId(int powerStationId, string db_name);
Task<PyrheliometerHistory> GetPyrheliometerHistoryPerHour(string dateTime, List<DeviceInfo> deviceInfos);
Task<int> AddPyrheliometerHistory(List<PyrheliometerHistory> entity, List<string> properties);
Task<AvgPyrheliometerHistory> CalcAvgPyrheliometerHistory30day(string nowDay, int powerStationId);
Task<PyrheliometerHistory> CalcPyrheliometerHistoryDayDataByPowerStationId(string nowDay, int powerStationId);
Task<int> AddPyrheliometerHistoryDayList(List<PyrheliometerHistory> entity, List<string> properties);
Task<PyrheliometerHistory> CalcPyrheliometerHistoryMonthDataByPowerStationId(string month, int powerStationId);
Task<PyrheliometerHistory> GetOnePyrheliometerHistoryByMonth(string month, int powerStationId);
Task<int> AddPyrheliometerHistoryMonthList(List<PyrheliometerHistory> entity, List<string> properties);
Task<int> UpdatePyrheliometerHistoryMonthList(List<PyrheliometerHistory> entity);
Task<int> UpdateInverter(Inverter entity, List<string> properties, string db_name);
Task<A> Getonediv<A>(string where, string db_name, string table_name);