Merge branch 'master' of https://github.com/shanghohui-Company/SolarPower
This commit is contained in:
commit
5abdc961a1
@ -40,9 +40,11 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
var DateTimeNow = DateTime.Now;
|
var DateTimeNow = DateTime.Now;
|
||||||
var dateTime = DateTimeNow.AddHours(-1).ToString("yyyy-MM-dd HH");
|
var dateTime = DateTimeNow.AddHours(-1).ToString("yyyy-MM-dd HH");
|
||||||
|
|
||||||
|
Root2 observation = null;
|
||||||
|
|
||||||
if (this.environment.IsDevelopment())
|
if (this.environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
dateTime = "2021-08-09 10";
|
dateTime = "2021-08-16 09";
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.LogInformation("【CalcPowerStationJob】【任務開始】");
|
logger.LogInformation("【CalcPowerStationJob】【任務開始】");
|
||||||
@ -64,13 +66,23 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
List<WeatherObservation> weatherObservations = new List<WeatherObservation>();
|
List<WeatherObservation> weatherObservations = new List<WeatherObservation>();
|
||||||
|
|
||||||
#region 氣象觀測(取資料)
|
#region 氣象觀測(取資料)
|
||||||
logger.LogInformation("【CalcPowerStationJob】【開始取得氣象觀測】");
|
try
|
||||||
var client = new HttpClient();
|
{
|
||||||
var UVUri = "https://opendata.cwb.gov.tw/api/v1/rest/datastore/O-A0003-001?Authorization=CWB-EA24220B-DDCC-4188-84E5-AD37A0E03F80&elementName=TIME,TEMP";
|
logger.LogInformation("【CalcPowerStationJob】【開始取得氣象觀測】");
|
||||||
HttpResponseMessage response = client.GetAsync(UVUri).Result;
|
var client = new HttpClient();
|
||||||
String jsonUVs = response.Content.ReadAsStringAsync().Result.ToString();
|
var UVUri = "https://opendata.cwb.gov.tw/api/v1/rest/datastore/O-A0003-001?Authorization=CWB-EA24220B-DDCC-4188-84E5-AD37A0E03F80&elementName=TIME,TEMP";
|
||||||
Root2 observation = JsonConvert.DeserializeObject<Root2>(jsonUVs);
|
HttpResponseMessage response = client.GetAsync(UVUri).Result;
|
||||||
logger.LogInformation("【CalcPowerStationJob】【取得成功氣象觀測】");
|
String jsonUVs = response.Content.ReadAsStringAsync().Result.ToString();
|
||||||
|
observation = JsonConvert.DeserializeObject<Root2>(jsonUVs);
|
||||||
|
logger.LogInformation("【CalcPowerStationJob】【取得成功氣象觀測】");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError("【CalcPowerStationJob】【取得失敗氣象觀測】");
|
||||||
|
logger.LogError("【{0}】{1}", "CalcPowerStationJob", ex.Message);
|
||||||
|
observation = null;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region step2. 從電站的DB及電站編號找出該電站的控制器
|
#region step2. 從電站的DB及電站編號找出該電站的控制器
|
||||||
@ -195,7 +207,7 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
powerStationHistoriesHour.Add(history);
|
powerStationHistoriesHour.Add(history);
|
||||||
|
|
||||||
logger.LogInformation("【CalcPowerStationJob】【計算完成電站[{0}]在{1}的每小時歷史資料】", powerStation.Code, dateTime);
|
logger.LogInformation("【CalcPowerStationJob】【計算完成電站[{0}]在{1}的每小時歷史資料】", powerStation.Code, dateTime);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -353,7 +365,7 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
WeatherObservation weatherObservation = new WeatherObservation();
|
WeatherObservation weatherObservation = new WeatherObservation();
|
||||||
if (powerStation.WeathersStationId != null)
|
if (powerStation.WeathersStationId != null && observation != null)
|
||||||
{
|
{
|
||||||
foreach (var Location in observation.Records.Location)
|
foreach (var Location in observation.Records.Location)
|
||||||
{
|
{
|
||||||
@ -363,7 +375,7 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
calcPowerStation.TodayWeatherTemp = Convert.ToDouble(Location.WeatherElement[0].ElementValue);
|
calcPowerStation.TodayWeatherTemp = Convert.ToDouble(Location.WeatherElement[0].ElementValue);
|
||||||
weatherObservation.PowerStationId = powerStation.Id;
|
weatherObservation.PowerStationId = powerStation.Id;
|
||||||
weatherObservation.Temp = Convert.ToDouble(Location.WeatherElement[0].ElementValue);
|
weatherObservation.Temp = Convert.ToDouble(Location.WeatherElement[0].ElementValue);
|
||||||
weatherObservation.ObsTime = !string.IsNullOrEmpty(Location.Time.ObsTime)? Convert.ToInt32(Location.Time.ObsTime.Substring(0, 4)) >= 1971 ? Location.Time.ObsTime : DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") : DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
weatherObservation.ObsTime = !string.IsNullOrEmpty(Location.Time.ObsTime) ? Convert.ToInt32(Location.Time.ObsTime.Substring(0, 4)) >= 1971 ? Location.Time.ObsTime : DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") : DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
calcPowerStation.WeathersStationId = powerStation.WeathersStationId;
|
calcPowerStation.WeathersStationId = powerStation.WeathersStationId;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -380,8 +392,8 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
calcPowerStation.RateOfRain = weather.PoP;
|
calcPowerStation.RateOfRain = weather.PoP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -581,7 +593,7 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region step8. 將 meter INSERT 到 meter_history_hour 資料表
|
#region step8. 將 meter INSERT 到 meter_history_hour 資料表
|
||||||
List<string> memter_history_properties = new List<string>()
|
List<string> memter_history_properties = new List<string>()
|
||||||
{
|
{
|
||||||
"PowerStationId",
|
"PowerStationId",
|
||||||
"TIMESTAMP",
|
"TIMESTAMP",
|
||||||
|
|||||||
@ -106,6 +106,7 @@ namespace solarApp.Model
|
|||||||
public double TODAYKWH { get; set; }
|
public double TODAYKWH { get; set; }
|
||||||
public double TOTALKWH { get; set; }
|
public double TOTALKWH { get; set; }
|
||||||
public double PR { get; set; }
|
public double PR { get; set; }
|
||||||
|
public int count { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class web_inv_list
|
public class web_inv_list
|
||||||
|
|||||||
@ -36,6 +36,8 @@ namespace solarApp.Model
|
|||||||
public double humidityAvg { get; set; }
|
public double humidityAvg { get; set; }
|
||||||
public double windAvg { get; set; }
|
public double windAvg { get; set; }
|
||||||
public double dustAvg { get; set; }
|
public double dustAvg { get; set; }
|
||||||
|
|
||||||
|
public int count { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class sensor_hour
|
public class sensor_hour
|
||||||
|
|||||||
@ -56,7 +56,8 @@ namespace solarApp.Model
|
|||||||
public double TOTALKWH { get; set; }
|
public double TOTALKWH { get; set; }
|
||||||
public double PR { get; set; }
|
public double PR { get; set; }
|
||||||
public double SOLARHOUR { get; set; }
|
public double SOLARHOUR { get; set; }
|
||||||
public double kwhkwp { get; set; }
|
public double kwhkwp { get; set; }
|
||||||
|
public int count { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class station_list
|
public class station_list
|
||||||
|
|||||||
@ -25,7 +25,7 @@ namespace solarApp.Service
|
|||||||
conn.Open();
|
conn.Open();
|
||||||
//string sql = @"select ID, TIMESTAMP, SITEID, SITETYPE, CONTROLLERID, INVERTERID, SN, AC1V, AC1A, AC1W, AC1F, AC1WH, AC2V, AC2A, AC2W, AC2F, AC2WH, AC3V, AC3A, AC3W, AC3F, AC3WH, ACRUNTIME, DC1V, DC1A, DC1W, DC1WH, DC2V, DC2A, DC2W, DC2WH, DC3V, DC3A, DC3W, DC3WH, DC4V, DC4A, DC4W, DC4WH, DC5V, DC5A, DC5W, DC5WH, DCRUNTIME, WH, TODAYKWH, TOTALKWH, PR, RA1, RA2, RA3, RA4, RA5
|
//string sql = @"select ID, TIMESTAMP, SITEID, SITETYPE, CONTROLLERID, INVERTERID, SN, AC1V, AC1A, AC1W, AC1F, AC1WH, AC2V, AC2A, AC2W, AC2F, AC2WH, AC3V, AC3A, AC3W, AC3F, AC3WH, ACRUNTIME, DC1V, DC1A, DC1W, DC1WH, DC2V, DC2A, DC2W, DC2WH, DC3V, DC3A, DC3W, DC3WH, DC4V, DC4A, DC4W, DC4WH, DC5V, DC5A, DC5W, DC5WH, DCRUNTIME, WH, TODAYKWH, TOTALKWH, PR, RA1, RA2, RA3, RA4, RA5
|
||||||
// from solar_com0002.s02202000101_inv order by id desc limit 100; ";
|
// from solar_com0002.s02202000101_inv order by id desc limit 100; ";
|
||||||
string sql = @"select id , FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, inverterid, WH,round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH,round(PR, 2) PR, RA1
|
string sql = @"select id , FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, inverterid, WH, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH, round(PR, 2) PR, RA1
|
||||||
from " + siteDB + ".s" + siteID + @"_inv where left(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 10) = '" + reportDate + "' and inverterid = '" + invID + "'";
|
from " + siteDB + ".s" + siteID + @"_inv where left(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 10) = '" + reportDate + "' and inverterid = '" + invID + "'";
|
||||||
|
|
||||||
//List<raw_inv> ds = conn.Query<raw_inv>(sql, new { kind = kind }).ToList();
|
//List<raw_inv> ds = conn.Query<raw_inv>(sql, new { kind = kind }).ToList();
|
||||||
@ -49,18 +49,26 @@ namespace solarApp.Service
|
|||||||
// round(max(TOTALKWH), 2) TOTALKWH, round(max(PR), 2) PR, count(*) count
|
// round(max(TOTALKWH), 2) TOTALKWH, round(max(PR), 2) PR, count(*) count
|
||||||
// from v_inv_temp where left(reportdate, 10) = '" + reportDate + "' and inverterid = '" + invID + "' " +
|
// from v_inv_temp where left(reportdate, 10) = '" + reportDate + "' and inverterid = '" + invID + "' " +
|
||||||
// "group by left(reportdate, 13), inverterid"; //round(avg(PR), 2) PR,
|
// "group by left(reportdate, 13), inverterid"; //round(avg(PR), 2) PR,
|
||||||
string sql = @" select a.reportdate, a.inverterid, a.KWH, b.TODAYKWH, b.TOTALKWH, b.PR, a.count from
|
string sql = @"
|
||||||
(
|
select FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H')reportdate, inverterid ,round((sum(WH)/1000), 2) KWH,
|
||||||
select left(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 13)reportdate, inverterid
|
round(max(TODAYKWH), 2) TODAYKWH, round(max(TOTALKWH), 2) TOTALKWH, round(max(PR), 2) PR, count(*) count
|
||||||
,round((sum(WH)/1000), 2) KWH, count(*) count
|
from " + siteDB + ".s" + siteID + @"_inv
|
||||||
from " + siteDB + ".s" + siteID + @"_inv
|
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = '" + reportDate + "' and inverterid = '" + invID + @"'
|
||||||
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = '" + reportDate + "' and inverterid = '" + invID + @"'
|
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), inverterid
|
||||||
group by left(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i'), 13), inverterid
|
order by 1; ";
|
||||||
)a join (
|
|
||||||
select FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH, inverterid, round(PR, 2) PR
|
//select a.reportdate, a.inverterid, a.KWH, b.TODAYKWH, b.TOTALKWH, b.PR, a.count from
|
||||||
from " + siteDB + ".s" + siteID + @"_inv
|
// (
|
||||||
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = '" + reportDate + @"' and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i'), 2) = '55' and inverterid = '" + invID + @"'
|
// select left(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 13)reportdate, inverterid
|
||||||
)b on a.reportdate = left(b.reportdate, 13) and a.inverterid = b.inverterid ";
|
// ,round((sum(WH)/1000), 2) KWH, count(*) count
|
||||||
|
// from " + siteDB + ".s" + siteID + @"_inv
|
||||||
|
// where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = '" + reportDate + "' and inverterid = '" + invID + @"'
|
||||||
|
// group by left(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i'), 13), inverterid
|
||||||
|
// )a join (
|
||||||
|
// select FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH, inverterid, round(PR, 2) PR
|
||||||
|
// from " + siteDB + ".s" + siteID + @"_inv
|
||||||
|
// where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = '" + reportDate + @"' and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i'), 2) = '55' and inverterid = '" + invID + @"'
|
||||||
|
// )b on a.reportdate = left(b.reportdate, 13) and a.inverterid = b.inverterid ";
|
||||||
List<raw_inv_hour> ds = conn.Query<raw_inv_hour>(sql).AsList<raw_inv_hour>();
|
List<raw_inv_hour> ds = conn.Query<raw_inv_hour>(sql).AsList<raw_inv_hour>();
|
||||||
conn.Close();
|
conn.Close();
|
||||||
return ds;
|
return ds;
|
||||||
@ -106,8 +114,19 @@ namespace solarApp.Service
|
|||||||
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
string sql = @"select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, inverterid, round(KWH, 2) KWH, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH, round(PR, 2) PR
|
//string sql = @"select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, inverterid, round(KWH, 2) KWH, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH, round(PR, 2) PR
|
||||||
from inverter_history_day where left(`TIMESTAMP`, 10) between '" + date1 + "' and '"+ date2 +"' and inverterid = '" + invID + "' ";
|
// from inverter_history_day where left(`TIMESTAMP`, 10) between '" + date1 + "' and '"+ date2 +"' and inverterid = '" + invID + "' ";
|
||||||
|
string sql = @"
|
||||||
|
select DATE_FORMAT(a.`TIMESTAMP`,'%Y-%m-%d') reportdate, a.inverterid, round(a.KWH, 2) KWH, round(a.TODAYKWH, 2) TODAYKWH,
|
||||||
|
round(a.TOTALKWH, 2) TOTALKWH, round(a.PR, 2) PR, count
|
||||||
|
from inverter_history_day a join (
|
||||||
|
select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, inverterid, count(*) count
|
||||||
|
from inverter_history_hour
|
||||||
|
where left(`TIMESTAMP`, 10) between '" + date1 + "' and '" + date2 + @"' and inverterid = '" + invID + @"'
|
||||||
|
|
||||||
|
group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d'), inverterid
|
||||||
|
) b on a.inverterid = b.inverterid and DATE_FORMAT(a.`TIMESTAMP`,'%Y-%m-%d') = b.reportdate
|
||||||
|
where left(a.`TIMESTAMP`, 10) between '" + date1 + "' and '" + date2 + "' and a.inverterid = '" + invID + "' order by 1";
|
||||||
List<web_inv_hour> ds = conn.Query<web_inv_hour>(sql).AsList<web_inv_hour>();
|
List<web_inv_hour> ds = conn.Query<web_inv_hour>(sql).AsList<web_inv_hour>();
|
||||||
conn.Close();
|
conn.Close();
|
||||||
return ds;
|
return ds;
|
||||||
|
|||||||
@ -107,16 +107,16 @@ namespace solarApp.Service
|
|||||||
|
|
||||||
//電表
|
//電表
|
||||||
#endregion 獲取 Sensor 類別
|
#endregion 獲取 Sensor 類別
|
||||||
sql = @"select a.siteID, a.reportdate, a.modelTempAvg, ifnull(b.irrAvg, 0) irrAvg, a.envTempAvg, humidityAvg, windAvg, dustAvg from
|
sql = @"select a.siteID, a.reportdate, a.modelTempAvg, ifnull(b.irrAvg, 0) irrAvg, a.envTempAvg, humidityAvg, windAvg, dustAvg, count from
|
||||||
(
|
(
|
||||||
select @siteID siteID, FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, "+ modelTempCol+ @" modelTempAvg
|
select @siteID siteID, CONCAT( FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':00') reportdate, " + modelTempCol+ @" modelTempAvg
|
||||||
," + evnTempCol + @" envTempAvg, " + humCol + @" humidityAvg, " + windCol + @" windAvg, " + dustCol + @" dustAvg
|
," + evnTempCol + @" envTempAvg, " + humCol + @" humidityAvg, " + windCol + @" windAvg, " + dustCol + @" dustAvg, count(*) count
|
||||||
from " + siteDB + ".s" + siteID + @"_sensorAvg
|
from " + siteDB + ".s" + siteID + @"_sensorAvg
|
||||||
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @reportDate
|
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @reportDate
|
||||||
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H')
|
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H')
|
||||||
) a left join
|
) a left join
|
||||||
(
|
(
|
||||||
select FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate , " + irrCol + @" irrAvg
|
select CONCAT( FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':00') reportdate , " + irrCol + @" irrAvg
|
||||||
from " + siteDB + ".s" + siteID + @"_sensorAvg
|
from " + siteDB + ".s" + siteID + @"_sensorAvg
|
||||||
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @reportDate "+ irrNot0 + @" #需要過濾 0 的數值
|
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @reportDate "+ irrNot0 + @" #需要過濾 0 的數值
|
||||||
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H')
|
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H')
|
||||||
|
|||||||
@ -27,7 +27,7 @@ namespace solarApp.Service
|
|||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
string sql = @"select id , FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, siteid, round(KWH, 3) KWH, round(TODAYKWH, 3) TODAYKWH,
|
string sql = @"select id , FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, siteid, round(KWH, 3) KWH, round(TODAYKWH, 3) TODAYKWH,
|
||||||
round(TOTALKWH, 3)TOTALKWH, round(PR, 3) PR, round(TODAYKWH, 3)SOLARHOUR , round(kwhkwp, 3) kwhkwp
|
round(TOTALKWH, 3)TOTALKWH, round(PR, 3) PR, round(SOLARHOUR, 3) SOLARHOUR , round(kwhkwp, 3) kwhkwp
|
||||||
from " + siteDB + ".s" + siteID + @"_station
|
from " + siteDB + ".s" + siteID + @"_station
|
||||||
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @reportDate";
|
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @reportDate";
|
||||||
List<raw_statino> ds = conn.Query<raw_statino>(sql, new { reportDate = reportDate }).AsList<raw_statino>();
|
List<raw_statino> ds = conn.Query<raw_statino>(sql, new { reportDate = reportDate }).AsList<raw_statino>();
|
||||||
@ -92,9 +92,11 @@ namespace solarApp.Service
|
|||||||
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H') reportdate, siteid, round(KWH, 2) KWH, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH,
|
string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H') reportdate, siteid, round(KWH, 2) KWH,
|
||||||
round(PR, 3) PR, round(KWHKWP, 3) KWHKWP, round(money, 3) money, round(todaymoney, 3) todaymoney, round(totalmoney, 3) totalmoney,
|
round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH,
|
||||||
round(carbon, 3) carbon, round(todayCarbon, 3) todayCarbon, round(totalCarbon, 3) totalCarbon
|
round(PR, 3) PR, round(KWHKWP, 3) KWHKWP,
|
||||||
|
round(money, 3) money, round(todaymoney, 3) todaymoney, round(totalmoney, 3) totalmoney,
|
||||||
|
round(carbon, 3) carbon, round(todayCarbon, 3) todayCarbon, round(totalCarbon, 3) totalCarbon
|
||||||
from power_station_history_hour
|
from power_station_history_hour
|
||||||
where siteID = @siteID and left(`TIMESTAMP`, 10) = '" + reportDate + "' ";
|
where siteID = @siteID and left(`TIMESTAMP`, 10) = '" + reportDate + "' ";
|
||||||
List<web_station_hour> ds = conn.Query<web_station_hour>(sql, new { siteID = siteID.Substring(0, 9) }).AsList<web_station_hour>();
|
List<web_station_hour> ds = conn.Query<web_station_hour>(sql, new { siteID = siteID.Substring(0, 9) }).AsList<web_station_hour>();
|
||||||
@ -109,28 +111,41 @@ namespace solarApp.Service
|
|||||||
/// <param name="reportDate"></param>
|
/// <param name="reportDate"></param>
|
||||||
/// <param name="invID"></param>
|
/// <param name="invID"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<web_station_hour> get_web_station_day(string date1, string date2, string siteID)
|
public List<web_station_day> get_web_station_day(string date1, string date2, string siteID)
|
||||||
{
|
{
|
||||||
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, siteid, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH,
|
//string sql = @"
|
||||||
round(PR, 3) PR, round(KWHKWP, 3) KWHKWP, money
|
// select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, siteid, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH,
|
||||||
from power_station_history_day where left(`TIMESTAMP`, 10) between @date1 and @date2 and siteid = @siteID";
|
// round(PR, 3) PR, round(KWHKWP, 3) KWHKWP, money
|
||||||
List<web_station_hour> ds = conn.Query<web_station_hour>(sql, new { date1 = date1, date2 = date2 , siteID = siteID}).AsList<web_station_hour>();
|
// from power_station_history_day where left(`TIMESTAMP`, 10) between @date1 and @date2 and siteid = @siteID";
|
||||||
|
string sql = @"
|
||||||
|
select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, a.siteid, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH,
|
||||||
|
round(PR, 3) PR, round(KWHKWP, 3) KWHKWP, money, count
|
||||||
|
from power_station_history_day a join (
|
||||||
|
select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, SITEID, count(*) count
|
||||||
|
from power_station_history_hour
|
||||||
|
where siteid = @siteID and left(`TIMESTAMP`, 10) between @date1 and @date2
|
||||||
|
group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d'), SITEID
|
||||||
|
) b on a.SITEID = b.SITEID and DATE_FORMAT(a.`TIMESTAMP`,'%Y-%m-%d') = b.reportdate
|
||||||
|
where left(`TIMESTAMP`, 10) between @date1 and @date2 and a.siteid = @siteID
|
||||||
|
order by DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d')
|
||||||
|
";
|
||||||
|
List<web_station_day> ds = conn.Query<web_station_day>(sql, new { date1 = date1, date2 = date2 , siteID = siteID}).AsList<web_station_day>();
|
||||||
conn.Close();
|
conn.Close();
|
||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<web_station_hour> get_web_station_month(string date1, string date2, string siteID)
|
public List<web_station_day> get_web_station_month(string date1, string date2, string siteID)
|
||||||
{
|
{
|
||||||
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, siteid, round(TOTALKWH, 2) TOTALKWH, round(PR, 3) PR, round(KWHKWP, 3) KWHKWP, money
|
string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, siteid, round(TOTALKWH, 2) TOTALKWH, round(PR, 3) PR, round(KWHKWP, 3) KWHKWP, money
|
||||||
from power_station_history_month where left(`TIMESTAMP`, 7) between @date1 and @date2 and siteid = @siteID";
|
from power_station_history_month where left(`TIMESTAMP`, 7) between @date1 and @date2 and siteid = @siteID";
|
||||||
List<web_station_hour> ds = conn.Query<web_station_hour>(sql, new { date1 = date1, date2 = date2, siteID = siteID }).AsList<web_station_hour>();
|
List<web_station_day> ds = conn.Query<web_station_day>(sql, new { date1 = date1, date2 = date2, siteID = siteID }).AsList<web_station_day>();
|
||||||
conn.Close();
|
conn.Close();
|
||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
@ -147,7 +162,7 @@ namespace solarApp.Service
|
|||||||
conn.Open(); // 01 控制器編號
|
conn.Open(); // 01 控制器編號
|
||||||
string sql = @" select id, CompanyId, `code` , SerialNumber, CONCAT(`code` ,'01') SiteID, SiteDB, `name` SiteName
|
string sql = @" select id, CompanyId, `code` , SerialNumber, CONCAT(`code` ,'01') SiteID, SiteDB, `name` SiteName
|
||||||
from power_station
|
from power_station
|
||||||
where id in (1, 8)";
|
where id in (1, 8, 9)";
|
||||||
List<station_list> ds = conn.Query<station_list>(sql).AsList<station_list>();
|
List<station_list> ds = conn.Query<station_list>(sql).AsList<station_list>();
|
||||||
conn.Close();
|
conn.Close();
|
||||||
return ds;
|
return ds;
|
||||||
|
|||||||
@ -88,28 +88,28 @@ namespace solarApp.Service
|
|||||||
#region 15 min
|
#region 15 min
|
||||||
string sql = @"
|
string sql = @"
|
||||||
INSERT INTO solar_master.inverter_history_15min( PowerStationId, TIMESTAMP, INVERTERID, KWH, TODAYKWH, KWHKWP)
|
INSERT INTO solar_master.inverter_history_15min( PowerStationId, TIMESTAMP, INVERTERID, KWH, TODAYKWH, KWHKWP)
|
||||||
select PowerStationId, reportdate, a.inverterid, KWH, TODAYKWH, round((kwh/capacity), 3) kwpkwp from
|
select PowerStationId, reportdate, a.inverterid, KWH, TODAYKWH, (kwh/capacity) kwpkwp from
|
||||||
(
|
(
|
||||||
select @PowerStationId PowerStationId, CONCAT(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':00:00')reportdate, inverterid,
|
select @PowerStationId PowerStationId, CONCAT(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':00:00')reportdate, inverterid,
|
||||||
round((sum(WH)/1000), 3) KWH, round(max(TODAYKWH), 3) TODAYKWH
|
(sum(WH)/1000) KWH, max(TODAYKWH) TODAYKWH
|
||||||
from " + _siteDB + ".s" + _siteID01 + @"_inv
|
from " + _siteDB + ".s" + _siteID01 + @"_inv
|
||||||
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 2) between '00' and '10'
|
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 2) between '00' and '10'
|
||||||
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') , inverterid
|
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') , inverterid
|
||||||
union
|
union
|
||||||
select @PowerStationId PowerStationId, CONCAT(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':15:00')reportdate, inverterid,
|
select @PowerStationId PowerStationId, CONCAT(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':15:00')reportdate, inverterid,
|
||||||
round((sum(WH)/1000), 3) KWH, round(max(TODAYKWH), 3) TODAYKWH
|
(sum(WH)/1000) KWH, max(TODAYKWH) TODAYKWH
|
||||||
from " + _siteDB + ".s" + _siteID01 + @"_inv
|
from " + _siteDB + ".s" + _siteID01 + @"_inv
|
||||||
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 2) between '15' and '25'
|
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 2) between '15' and '25'
|
||||||
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') , inverterid
|
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') , inverterid
|
||||||
union
|
union
|
||||||
select @PowerStationId PowerStationId, CONCAT(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':30:00')reportdate, inverterid,
|
select @PowerStationId PowerStationId, CONCAT(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':30:00')reportdate, inverterid,
|
||||||
round((sum(WH)/1000), 3) KWH, round(max(TODAYKWH), 3) TODAYKWH
|
(sum(WH)/1000) KWH, max(TODAYKWH) TODAYKWH
|
||||||
from " + _siteDB + ".s" + _siteID01 + @"_inv
|
from " + _siteDB + ".s" + _siteID01 + @"_inv
|
||||||
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 2) between '30' and '40'
|
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 2) between '30' and '40'
|
||||||
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') , inverterid
|
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') , inverterid
|
||||||
union
|
union
|
||||||
select @PowerStationId PowerStationId, CONCAT(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':45:00')reportdate, inverterid,
|
select @PowerStationId PowerStationId, CONCAT(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':45:00')reportdate, inverterid,
|
||||||
round((sum(WH)/1000), 3) KWH, round(max(TODAYKWH), 3) TODAYKWH
|
(sum(WH)/1000) KWH, max(TODAYKWH) TODAYKWH
|
||||||
from " + _siteDB + ".s" + _siteID01 + @"_inv
|
from " + _siteDB + ".s" + _siteID01 + @"_inv
|
||||||
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 2) between '45' and '55'
|
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 2) between '45' and '55'
|
||||||
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') , inverterid
|
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') , inverterid
|
||||||
|
|||||||
@ -61,7 +61,7 @@ namespace solarApp.Service
|
|||||||
/// 清除指定期間、指定電站的 Sensor hour、day、month 資料
|
/// 清除指定期間、指定電站的 Sensor hour、day、month 資料
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private bool clearData()
|
public bool clearData()
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
try
|
try
|
||||||
@ -185,9 +185,9 @@ namespace solarApp.Service
|
|||||||
sql = @"insert into sensor_history_hour( `PowerStationId`, `TIMESTAMP`, `Irradiance`, `Temperature`)
|
sql = @"insert into sensor_history_hour( `PowerStationId`, `TIMESTAMP`, `Irradiance`, `Temperature`)
|
||||||
select a.powerstationID, a.reportdate, ifnull(b.irrAvg, 0) irrAvg, a.modelTempAvg from
|
select a.powerstationID, a.reportdate, ifnull(b.irrAvg, 0) irrAvg, a.modelTempAvg from
|
||||||
(
|
(
|
||||||
select @powerStationID powerstationID, FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, round(avg(" + modelTempCol + @"), 2) modelTempAvg,
|
select @powerStationID powerstationID, FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, avg(" + modelTempCol + @") modelTempAvg,
|
||||||
round(avg(" + evnTempCol + @"), 2) envTempAvg, round(avg(" + humCol + @"), 2) humidityAvg, round(avg(" + windCol + @"), 2) windAvg,
|
avg(" + evnTempCol + @") envTempAvg, avg(" + humCol + @") humidityAvg, avg(" + windCol + @") windAvg,
|
||||||
round(avg(" + dustCol + @"), 2) dustAvg
|
avg(" + dustCol + @") dustAvg
|
||||||
from " + _siteDB + ".s" + _siteID01 + @"_sensorAvg
|
from " + _siteDB + ".s" + _siteID01 + @"_sensorAvg
|
||||||
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') between @date1 and @date2
|
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') between @date1 and @date2
|
||||||
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H')
|
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H')
|
||||||
|
|||||||
35
solarApp/fmArchive.Designer.cs
generated
35
solarApp/fmArchive.Designer.cs
generated
@ -32,6 +32,8 @@ namespace solarApp
|
|||||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||||
|
this.bt_archive = new System.Windows.Forms.Button();
|
||||||
|
this.bt_clear_sensor = new System.Windows.Forms.Button();
|
||||||
this.bt_clear_station = new System.Windows.Forms.Button();
|
this.bt_clear_station = new System.Windows.Forms.Button();
|
||||||
this.bt_clear_inv = new System.Windows.Forms.Button();
|
this.bt_clear_inv = new System.Windows.Forms.Button();
|
||||||
this.fp_site = new System.Windows.Forms.FlowLayoutPanel();
|
this.fp_site = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
@ -88,6 +90,8 @@ namespace solarApp
|
|||||||
// splitContainer1.Panel1
|
// splitContainer1.Panel1
|
||||||
//
|
//
|
||||||
this.splitContainer1.Panel1.BackColor = System.Drawing.SystemColors.ActiveCaption;
|
this.splitContainer1.Panel1.BackColor = System.Drawing.SystemColors.ActiveCaption;
|
||||||
|
this.splitContainer1.Panel1.Controls.Add(this.bt_archive);
|
||||||
|
this.splitContainer1.Panel1.Controls.Add(this.bt_clear_sensor);
|
||||||
this.splitContainer1.Panel1.Controls.Add(this.bt_clear_station);
|
this.splitContainer1.Panel1.Controls.Add(this.bt_clear_station);
|
||||||
this.splitContainer1.Panel1.Controls.Add(this.bt_clear_inv);
|
this.splitContainer1.Panel1.Controls.Add(this.bt_clear_inv);
|
||||||
this.splitContainer1.Panel1.Controls.Add(this.fp_site);
|
this.splitContainer1.Panel1.Controls.Add(this.fp_site);
|
||||||
@ -105,6 +109,29 @@ namespace solarApp
|
|||||||
this.splitContainer1.SplitterWidth = 10;
|
this.splitContainer1.SplitterWidth = 10;
|
||||||
this.splitContainer1.TabIndex = 0;
|
this.splitContainer1.TabIndex = 0;
|
||||||
//
|
//
|
||||||
|
// bt_archive
|
||||||
|
//
|
||||||
|
this.bt_archive.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.bt_archive.Location = new System.Drawing.Point(5, 528);
|
||||||
|
this.bt_archive.Name = "bt_archive";
|
||||||
|
this.bt_archive.Size = new System.Drawing.Size(282, 100);
|
||||||
|
this.bt_archive.TabIndex = 8;
|
||||||
|
this.bt_archive.Text = "單日歸檔";
|
||||||
|
this.bt_archive.UseVisualStyleBackColor = true;
|
||||||
|
this.bt_archive.Click += new System.EventHandler(this.bt_archive_Click);
|
||||||
|
//
|
||||||
|
// bt_clear_sensor
|
||||||
|
//
|
||||||
|
this.bt_clear_sensor.Enabled = false;
|
||||||
|
this.bt_clear_sensor.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.bt_clear_sensor.Location = new System.Drawing.Point(5, 256);
|
||||||
|
this.bt_clear_sensor.Name = "bt_clear_sensor";
|
||||||
|
this.bt_clear_sensor.Size = new System.Drawing.Size(135, 44);
|
||||||
|
this.bt_clear_sensor.TabIndex = 7;
|
||||||
|
this.bt_clear_sensor.Text = "clear data";
|
||||||
|
this.bt_clear_sensor.UseVisualStyleBackColor = true;
|
||||||
|
this.bt_clear_sensor.Click += new System.EventHandler(this.bt_clear_sensor_Click);
|
||||||
|
//
|
||||||
// bt_clear_station
|
// bt_clear_station
|
||||||
//
|
//
|
||||||
this.bt_clear_station.Enabled = false;
|
this.bt_clear_station.Enabled = false;
|
||||||
@ -134,12 +161,12 @@ namespace solarApp
|
|||||||
this.fp_site.Dock = System.Windows.Forms.DockStyle.Top;
|
this.fp_site.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
this.fp_site.Location = new System.Drawing.Point(0, 0);
|
this.fp_site.Location = new System.Drawing.Point(0, 0);
|
||||||
this.fp_site.Name = "fp_site";
|
this.fp_site.Name = "fp_site";
|
||||||
this.fp_site.Size = new System.Drawing.Size(300, 150);
|
this.fp_site.Size = new System.Drawing.Size(300, 176);
|
||||||
this.fp_site.TabIndex = 4;
|
this.fp_site.TabIndex = 4;
|
||||||
//
|
//
|
||||||
// dtSelect
|
// dtSelect
|
||||||
//
|
//
|
||||||
this.dtSelect.Location = new System.Drawing.Point(37, 156);
|
this.dtSelect.Location = new System.Drawing.Point(3, 193);
|
||||||
this.dtSelect.Name = "dtSelect";
|
this.dtSelect.Name = "dtSelect";
|
||||||
this.dtSelect.Size = new System.Drawing.Size(204, 27);
|
this.dtSelect.Size = new System.Drawing.Size(204, 27);
|
||||||
this.dtSelect.TabIndex = 3;
|
this.dtSelect.TabIndex = 3;
|
||||||
@ -217,7 +244,7 @@ namespace solarApp
|
|||||||
//
|
//
|
||||||
this.lbSiteDB_sensor.AutoSize = true;
|
this.lbSiteDB_sensor.AutoSize = true;
|
||||||
this.lbSiteDB_sensor.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.lbSiteDB_sensor.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.lbSiteDB_sensor.Location = new System.Drawing.Point(41, 19);
|
this.lbSiteDB_sensor.Location = new System.Drawing.Point(49, 19);
|
||||||
this.lbSiteDB_sensor.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
this.lbSiteDB_sensor.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.lbSiteDB_sensor.Name = "lbSiteDB_sensor";
|
this.lbSiteDB_sensor.Name = "lbSiteDB_sensor";
|
||||||
this.lbSiteDB_sensor.Size = new System.Drawing.Size(79, 24);
|
this.lbSiteDB_sensor.Size = new System.Drawing.Size(79, 24);
|
||||||
@ -298,5 +325,7 @@ namespace solarApp
|
|||||||
private System.Windows.Forms.Button btVerifyData;
|
private System.Windows.Forms.Button btVerifyData;
|
||||||
private System.Windows.Forms.Button bt_clear_inv;
|
private System.Windows.Forms.Button bt_clear_inv;
|
||||||
private System.Windows.Forms.Button bt_clear_station;
|
private System.Windows.Forms.Button bt_clear_station;
|
||||||
|
private System.Windows.Forms.Button bt_archive;
|
||||||
|
private System.Windows.Forms.Button bt_clear_sensor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,8 +101,10 @@ namespace solarApp
|
|||||||
{
|
{
|
||||||
bt_clear_inv.Enabled = true;
|
bt_clear_inv.Enabled = true;
|
||||||
bt_clear_station.Enabled = true;
|
bt_clear_station.Enabled = true;
|
||||||
|
bt_clear_sensor.Enabled = true;
|
||||||
bt_clear_inv.Text = "clear " + dtSelect.Value.ToString("MM-dd");
|
bt_clear_inv.Text = "clear " + dtSelect.Value.ToString("MM-dd");
|
||||||
bt_clear_station.Text = "clear " + dtSelect.Value.ToString("MM-dd");
|
bt_clear_station.Text = "clear " + dtSelect.Value.ToString("MM-dd");
|
||||||
|
bt_clear_sensor.Text = "clear " + dtSelect.Value.ToString("MM-dd");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bt_clear_inv_Click(object sender, EventArgs e)
|
private void bt_clear_inv_Click(object sender, EventArgs e)
|
||||||
@ -149,5 +151,27 @@ namespace solarApp
|
|||||||
//sensorSvc.archiveData();
|
//sensorSvc.archiveData();
|
||||||
MessageBox.Show("OK");
|
MessageBox.Show("OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void bt_archive_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
bt_Sensor.PerformClick();
|
||||||
|
bt_Inv.PerformClick();
|
||||||
|
bt_site.PerformClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void bt_clear_sensor_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string date1 = dtSelect.Value.ToString("yyyy-MM-dd");
|
||||||
|
//procSensorSvc sensorSvc = new procSensorSvc(lbSiteDB_sensor.Text, lbSiteID_sensor.Text, date1, date1);
|
||||||
|
procSensorSvc sensorSvc = new procSensorSvc();
|
||||||
|
sensorSvc._siteDB = lbSiteDB_sensor.Text;
|
||||||
|
sensorSvc._siteID = lbSiteID_sensor.Text.Substring(0, 9);
|
||||||
|
sensorSvc._siteID01 = lbSiteID_sensor.Text;
|
||||||
|
sensorSvc._date1 = date1;
|
||||||
|
sensorSvc._date2 = date1;
|
||||||
|
sensorSvc.clearData();
|
||||||
|
//sensorSvc.archiveData();
|
||||||
|
MessageBox.Show("OK");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
49
solarApp/fmMain.Designer.cs
generated
49
solarApp/fmMain.Designer.cs
generated
@ -109,11 +109,10 @@ namespace solarApp
|
|||||||
this.lb_raw_inv_hour = new System.Windows.Forms.Label();
|
this.lb_raw_inv_hour = new System.Windows.Forms.Label();
|
||||||
this.tb2 = new System.Windows.Forms.TabPage();
|
this.tb2 = new System.Windows.Forms.TabPage();
|
||||||
this.sp_main_station = new System.Windows.Forms.SplitContainer();
|
this.sp_main_station = new System.Windows.Forms.SplitContainer();
|
||||||
this.label13 = new System.Windows.Forms.Label();
|
this.fp_site = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
this.lbMsg_station = new System.Windows.Forms.Label();
|
this.lbMsg_station = new System.Windows.Forms.Label();
|
||||||
this.bt_find_station = new System.Windows.Forms.Button();
|
this.bt_find_station = new System.Windows.Forms.Button();
|
||||||
this.dtselect_station1 = new System.Windows.Forms.DateTimePicker();
|
this.dtselect_station1 = new System.Windows.Forms.DateTimePicker();
|
||||||
this.fp_site = new System.Windows.Forms.FlowLayoutPanel();
|
|
||||||
this.sp_child_station = new System.Windows.Forms.SplitContainer();
|
this.sp_child_station = new System.Windows.Forms.SplitContainer();
|
||||||
this.gv_web_station_month = new System.Windows.Forms.DataGridView();
|
this.gv_web_station_month = new System.Windows.Forms.DataGridView();
|
||||||
this.panel10 = new System.Windows.Forms.Panel();
|
this.panel10 = new System.Windows.Forms.Panel();
|
||||||
@ -499,6 +498,7 @@ namespace solarApp
|
|||||||
this.gv_web_inv_day.RowTemplate.Height = 25;
|
this.gv_web_inv_day.RowTemplate.Height = 25;
|
||||||
this.gv_web_inv_day.Size = new System.Drawing.Size(666, 270);
|
this.gv_web_inv_day.Size = new System.Drawing.Size(666, 270);
|
||||||
this.gv_web_inv_day.TabIndex = 4;
|
this.gv_web_inv_day.TabIndex = 4;
|
||||||
|
this.gv_web_inv_day.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.gv_web_inv_day_CellFormatting);
|
||||||
//
|
//
|
||||||
// panel8
|
// panel8
|
||||||
//
|
//
|
||||||
@ -751,11 +751,10 @@ namespace solarApp
|
|||||||
//
|
//
|
||||||
// sp_main_station.Panel1
|
// sp_main_station.Panel1
|
||||||
//
|
//
|
||||||
this.sp_main_station.Panel1.Controls.Add(this.label13);
|
this.sp_main_station.Panel1.Controls.Add(this.fp_site);
|
||||||
this.sp_main_station.Panel1.Controls.Add(this.lbMsg_station);
|
this.sp_main_station.Panel1.Controls.Add(this.lbMsg_station);
|
||||||
this.sp_main_station.Panel1.Controls.Add(this.bt_find_station);
|
this.sp_main_station.Panel1.Controls.Add(this.bt_find_station);
|
||||||
this.sp_main_station.Panel1.Controls.Add(this.dtselect_station1);
|
this.sp_main_station.Panel1.Controls.Add(this.dtselect_station1);
|
||||||
this.sp_main_station.Panel1.Controls.Add(this.fp_site);
|
|
||||||
//
|
//
|
||||||
// sp_main_station.Panel2
|
// sp_main_station.Panel2
|
||||||
//
|
//
|
||||||
@ -765,23 +764,22 @@ namespace solarApp
|
|||||||
this.sp_main_station.SplitterDistance = 257;
|
this.sp_main_station.SplitterDistance = 257;
|
||||||
this.sp_main_station.TabIndex = 0;
|
this.sp_main_station.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// label13
|
// fp_site
|
||||||
//
|
//
|
||||||
this.label13.AutoSize = true;
|
this.fp_site.BackColor = System.Drawing.Color.Azure;
|
||||||
this.label13.Dock = System.Windows.Forms.DockStyle.Bottom;
|
this.fp_site.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
this.label13.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.fp_site.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||||
this.label13.Location = new System.Drawing.Point(0, 367);
|
this.fp_site.Location = new System.Drawing.Point(0, 0);
|
||||||
this.label13.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
this.fp_site.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.label13.Name = "label13";
|
this.fp_site.Name = "fp_site";
|
||||||
this.label13.Size = new System.Drawing.Size(110, 24);
|
this.fp_site.Size = new System.Drawing.Size(257, 315);
|
||||||
this.label13.TabIndex = 13;
|
this.fp_site.TabIndex = 14;
|
||||||
this.label13.Text = "請選擇 電站";
|
|
||||||
//
|
//
|
||||||
// lbMsg_station
|
// lbMsg_station
|
||||||
//
|
//
|
||||||
this.lbMsg_station.AutoSize = true;
|
this.lbMsg_station.AutoSize = true;
|
||||||
this.lbMsg_station.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.lbMsg_station.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.lbMsg_station.Location = new System.Drawing.Point(30, 111);
|
this.lbMsg_station.Location = new System.Drawing.Point(23, 443);
|
||||||
this.lbMsg_station.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
this.lbMsg_station.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.lbMsg_station.Name = "lbMsg_station";
|
this.lbMsg_station.Name = "lbMsg_station";
|
||||||
this.lbMsg_station.Size = new System.Drawing.Size(22, 24);
|
this.lbMsg_station.Size = new System.Drawing.Size(22, 24);
|
||||||
@ -790,7 +788,7 @@ namespace solarApp
|
|||||||
//
|
//
|
||||||
// bt_find_station
|
// bt_find_station
|
||||||
//
|
//
|
||||||
this.bt_find_station.Location = new System.Drawing.Point(16, 73);
|
this.bt_find_station.Location = new System.Drawing.Point(9, 405);
|
||||||
this.bt_find_station.Name = "bt_find_station";
|
this.bt_find_station.Name = "bt_find_station";
|
||||||
this.bt_find_station.Size = new System.Drawing.Size(94, 29);
|
this.bt_find_station.Size = new System.Drawing.Size(94, 29);
|
||||||
this.bt_find_station.TabIndex = 7;
|
this.bt_find_station.TabIndex = 7;
|
||||||
@ -801,22 +799,11 @@ namespace solarApp
|
|||||||
// dtselect_station1
|
// dtselect_station1
|
||||||
//
|
//
|
||||||
this.dtselect_station1.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.dtselect_station1.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.dtselect_station1.Location = new System.Drawing.Point(14, 8);
|
this.dtselect_station1.Location = new System.Drawing.Point(5, 357);
|
||||||
this.dtselect_station1.Name = "dtselect_station1";
|
this.dtselect_station1.Name = "dtselect_station1";
|
||||||
this.dtselect_station1.Size = new System.Drawing.Size(234, 31);
|
this.dtselect_station1.Size = new System.Drawing.Size(234, 31);
|
||||||
this.dtselect_station1.TabIndex = 6;
|
this.dtselect_station1.TabIndex = 6;
|
||||||
//
|
//
|
||||||
// fp_site
|
|
||||||
//
|
|
||||||
this.fp_site.BackColor = System.Drawing.Color.Azure;
|
|
||||||
this.fp_site.Dock = System.Windows.Forms.DockStyle.Bottom;
|
|
||||||
this.fp_site.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
|
||||||
this.fp_site.Location = new System.Drawing.Point(0, 391);
|
|
||||||
this.fp_site.Margin = new System.Windows.Forms.Padding(4);
|
|
||||||
this.fp_site.Name = "fp_site";
|
|
||||||
this.fp_site.Size = new System.Drawing.Size(257, 645);
|
|
||||||
this.fp_site.TabIndex = 8;
|
|
||||||
//
|
|
||||||
// sp_child_station
|
// sp_child_station
|
||||||
//
|
//
|
||||||
this.sp_child_station.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.sp_child_station.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
@ -942,6 +929,7 @@ namespace solarApp
|
|||||||
this.gv_web_station_day.RowTemplate.Height = 25;
|
this.gv_web_station_day.RowTemplate.Height = 25;
|
||||||
this.gv_web_station_day.Size = new System.Drawing.Size(711, 292);
|
this.gv_web_station_day.Size = new System.Drawing.Size(711, 292);
|
||||||
this.gv_web_station_day.TabIndex = 3;
|
this.gv_web_station_day.TabIndex = 3;
|
||||||
|
this.gv_web_station_day.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.gv_web_station_day_CellFormatting);
|
||||||
//
|
//
|
||||||
// panel7
|
// panel7
|
||||||
//
|
//
|
||||||
@ -1074,6 +1062,7 @@ namespace solarApp
|
|||||||
this.gv_fic_station_day.RowTemplate.Height = 25;
|
this.gv_fic_station_day.RowTemplate.Height = 25;
|
||||||
this.gv_fic_station_day.Size = new System.Drawing.Size(744, 453);
|
this.gv_fic_station_day.Size = new System.Drawing.Size(744, 453);
|
||||||
this.gv_fic_station_day.TabIndex = 4;
|
this.gv_fic_station_day.TabIndex = 4;
|
||||||
|
this.gv_fic_station_day.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.gv_fic_station_day_CellFormatting);
|
||||||
//
|
//
|
||||||
// panel5
|
// panel5
|
||||||
//
|
//
|
||||||
@ -1563,6 +1552,7 @@ namespace solarApp
|
|||||||
this.gv_fic_sensor_hour.RowTemplate.Height = 25;
|
this.gv_fic_sensor_hour.RowTemplate.Height = 25;
|
||||||
this.gv_fic_sensor_hour.Size = new System.Drawing.Size(695, 453);
|
this.gv_fic_sensor_hour.Size = new System.Drawing.Size(695, 453);
|
||||||
this.gv_fic_sensor_hour.TabIndex = 4;
|
this.gv_fic_sensor_hour.TabIndex = 4;
|
||||||
|
this.gv_fic_sensor_hour.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.gv_fic_sensor_hour_CellFormatting);
|
||||||
//
|
//
|
||||||
// panel14
|
// panel14
|
||||||
//
|
//
|
||||||
@ -1789,7 +1779,6 @@ namespace solarApp
|
|||||||
private System.Windows.Forms.Label lbMsg_station;
|
private System.Windows.Forms.Label lbMsg_station;
|
||||||
private System.Windows.Forms.Button bt_find_station;
|
private System.Windows.Forms.Button bt_find_station;
|
||||||
private System.Windows.Forms.DateTimePicker dtselect_station;
|
private System.Windows.Forms.DateTimePicker dtselect_station;
|
||||||
private System.Windows.Forms.FlowLayoutPanel fp_site;
|
|
||||||
private System.Windows.Forms.Label lbMsg_inv;
|
private System.Windows.Forms.Label lbMsg_inv;
|
||||||
private System.Windows.Forms.DateTimePicker dateTimePicker1;
|
private System.Windows.Forms.DateTimePicker dateTimePicker1;
|
||||||
private System.Windows.Forms.DateTimePicker dtselect_station1;
|
private System.Windows.Forms.DateTimePicker dtselect_station1;
|
||||||
@ -1807,7 +1796,6 @@ namespace solarApp
|
|||||||
private System.Windows.Forms.DataGridView gv_web_station_month;
|
private System.Windows.Forms.DataGridView gv_web_station_month;
|
||||||
private System.Windows.Forms.Label lbSiteID_inv;
|
private System.Windows.Forms.Label lbSiteID_inv;
|
||||||
private System.Windows.Forms.Label lbSiteName_inv;
|
private System.Windows.Forms.Label lbSiteName_inv;
|
||||||
private System.Windows.Forms.Label label13;
|
|
||||||
private System.Windows.Forms.Label lbSiteDB_inv;
|
private System.Windows.Forms.Label lbSiteDB_inv;
|
||||||
private System.Windows.Forms.Label lbSiteRaw;
|
private System.Windows.Forms.Label lbSiteRaw;
|
||||||
private System.Windows.Forms.Label lbInvRaw;
|
private System.Windows.Forms.Label lbInvRaw;
|
||||||
@ -1847,5 +1835,6 @@ namespace solarApp
|
|||||||
private System.Windows.Forms.Button btSearch_sensor;
|
private System.Windows.Forms.Button btSearch_sensor;
|
||||||
private System.Windows.Forms.Button btSensor_switch;
|
private System.Windows.Forms.Button btSensor_switch;
|
||||||
private System.Windows.Forms.Button btInv_15min;
|
private System.Windows.Forms.Button btInv_15min;
|
||||||
|
private System.Windows.Forms.FlowLayoutPanel fp_site;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,5 +223,49 @@ namespace solarApp
|
|||||||
|
|
||||||
gv_web_sensor_month.DataSource = sensorSvc.get_web_sensor50_month(date1.Substring(0, 7), date2.Substring(0, 7), lbSiteID_inv.Text.Substring(0, 09));
|
gv_web_sensor_month.DataSource = sensorSvc.get_web_sensor50_month(date1.Substring(0, 7), date2.Substring(0, 7), lbSiteID_inv.Text.Substring(0, 09));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void gv_fic_sensor_hour_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||||
|
{
|
||||||
|
if (gv_fic_sensor_hour.Rows[e.RowIndex].Cells["count"].Value != null && !string.IsNullOrWhiteSpace(gv_fic_sensor_hour.Rows[e.RowIndex].Cells["count"].Value.ToString()))
|
||||||
|
{
|
||||||
|
if (gv_fic_sensor_hour.Rows[e.RowIndex].Cells["count"].Value.ToString() != "12")
|
||||||
|
{
|
||||||
|
gv_fic_sensor_hour.Rows[e.RowIndex].Cells["count"].Style = new DataGridViewCellStyle { ForeColor = Color.Red, BackColor = Color.White };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void gv_web_inv_day_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||||
|
{
|
||||||
|
if (gv_web_inv_day.Rows[e.RowIndex].Cells["count"].Value != null && !string.IsNullOrWhiteSpace(gv_web_inv_day.Rows[e.RowIndex].Cells["count"].Value.ToString()))
|
||||||
|
{
|
||||||
|
if (gv_web_inv_day.Rows[e.RowIndex].Cells["count"].Value.ToString() != "24")
|
||||||
|
{
|
||||||
|
gv_web_inv_day.Rows[e.RowIndex].Cells["count"].Style = new DataGridViewCellStyle { ForeColor = Color.Red, BackColor = Color.White };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void gv_fic_station_day_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||||
|
{
|
||||||
|
if (gv_fic_station_day.Rows[e.RowIndex].Cells["count"].Value != null && !string.IsNullOrWhiteSpace(gv_fic_station_day.Rows[e.RowIndex].Cells["count"].Value.ToString()))
|
||||||
|
{
|
||||||
|
if (gv_fic_station_day.Rows[e.RowIndex].Cells["count"].Value.ToString() != "24")
|
||||||
|
{
|
||||||
|
gv_fic_station_day.Rows[e.RowIndex].Cells["count"].Style = new DataGridViewCellStyle { ForeColor = Color.Red, BackColor = Color.White };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void gv_web_station_day_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||||
|
{
|
||||||
|
if (gv_web_station_day.Rows[e.RowIndex].Cells["count"].Value != null && !string.IsNullOrWhiteSpace(gv_web_station_day.Rows[e.RowIndex].Cells["count"].Value.ToString()))
|
||||||
|
{
|
||||||
|
if (gv_web_station_day.Rows[e.RowIndex].Cells["count"].Value.ToString() != "24")
|
||||||
|
{
|
||||||
|
gv_web_station_day.Rows[e.RowIndex].Cells["count"].Style = new DataGridViewCellStyle { ForeColor = Color.Red, BackColor = Color.White };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user