diff --git a/solarApp/Program.cs b/solarApp/Program.cs
index 5fdc6fb..782bb0f 100644
--- a/solarApp/Program.cs
+++ b/solarApp/Program.cs
@@ -17,8 +17,8 @@ namespace solarApp
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new fmExcel());
- //Application.Run(new fmArchive());
+ //Application.Run(new fmExcel());
+ Application.Run(new fmArchive());
//Application.Run(new fmMain());
}
}
diff --git a/solarApp/Service/getInvSvc.cs b/solarApp/Service/getInvSvc.cs
index 126edc2..9c71aa4 100644
--- a/solarApp/Service/getInvSvc.cs
+++ b/solarApp/Service/getInvSvc.cs
@@ -119,7 +119,7 @@ namespace solarApp.Service
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 (
+from inverter_history_day a left 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 + @"'
diff --git a/solarApp/Service/getSensorSvc.cs b/solarApp/Service/getSensorSvc.cs
index 1be0d83..db37c7a 100644
--- a/solarApp/Service/getSensorSvc.cs
+++ b/solarApp/Service/getSensorSvc.cs
@@ -156,7 +156,7 @@ namespace solarApp.Service
// where left(`TIMESTAMP`, 10) between '" + date1 + "' and '"+date2+"' and b.`code` = @siteID";
string sql = @"select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H') reportdate, b.`code` siteid, round(Irradiance, 2) irrAvg, round(Temperature, 2) modelTempAvg, c.count
from sensor_history_day a join power_station b on a.PowerStationId = b.id
- join (
+ left join (
select PowerStationId, left(a.`TIMESTAMP`, 10) reportDate, count(*) count from sensor_history_hour a join power_station b on a.PowerStationId = b.id
where b.`code` = @siteID and left(`TIMESTAMP`, 10) between '" + date1 + "' and '" + date2 + @"'
group by PowerStationId, left(a.`TIMESTAMP`, 10)
diff --git a/solarApp/Service/getStationSvc.cs b/solarApp/Service/getStationSvc.cs
index db8d4bd..39a78ad 100644
--- a/solarApp/Service/getStationSvc.cs
+++ b/solarApp/Service/getStationSvc.cs
@@ -23,15 +23,23 @@ namespace solarApp.Service
///
public List get_station_raw(string reportDate, string siteDB, string siteID)
{
+ List ds;
using (MySqlConnection conn = new MySqlConnection(Connection1))
{
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,
round(TOTALKWH, 3)TOTALKWH, round(PR, 3) PR, round(SOLARHOUR, 3) SOLARHOUR , round(kwhkwp, 3) kwhkwp
from " + siteDB + ".s" + siteID + @"_station
- where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @reportDate";
- List ds = conn.Query(sql, new { reportDate = reportDate }).AsList();
- conn.Close();
+ where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @reportDate";
+ try
+ {
+ ds = conn.Query(sql, new { reportDate = reportDate }).AsList();
+ conn.Close();
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
return ds;
}
}
@@ -61,6 +69,7 @@ namespace solarApp.Service
///
public List get_station_rawAvg(string date1, string date2, string siteDB, string siteID)
{
+ List ds;
using (MySqlConnection conn = new MySqlConnection(Connection1))
{
conn.Open();
@@ -74,8 +83,16 @@ namespace solarApp.Service
from " + siteDB+ ".s"+ siteID + @"_station
where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') between @date1 and @date2
group by siteid, FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d')";
- List ds = conn.Query(sql, new { date1 = date1, date2 = date2 }).AsList();
- conn.Close();
+ try
+ {
+ ds = conn.Query(sql, new { date1 = date1, date2 = date2 }).AsList();
+ conn.Close();
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+
return ds;
}
}
@@ -123,7 +140,7 @@ namespace solarApp.Service
string sql = @"
select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, a.siteid, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH, round(solarHour, 2) SOLARHOUR,
round(PR, 3) PR, round(KWHKWP, 3) KWHKWP, money, count
- from power_station_history_day a join (
+ from power_station_history_day a left 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
@@ -162,7 +179,7 @@ namespace solarApp.Service
conn.Open(); // 01 控制器編號
string sql = @" select id, CompanyId, `code` , SerialNumber, CONCAT(`code` ,'01') SiteID, SiteDB, `name` SiteName
from power_station
- where id in (1, 8, 9)";
+ where deleted = 0 ";
List ds = conn.Query(sql).AsList();
conn.Close();
return ds;
diff --git a/solarApp/Service/procInvSvc.cs b/solarApp/Service/procInvSvc.cs
index 3e9d7af..62079db 100644
--- a/solarApp/Service/procInvSvc.cs
+++ b/solarApp/Service/procInvSvc.cs
@@ -17,7 +17,7 @@ namespace solarApp.Service
public string _siteDB { get; set; }
public string _siteID01 { get; set; }
public string _date1 { get; set; }
- public string _date2 { get; set; }
+ //public string _date2 { get; set; }
public string _powerStationID { get; set; }
@@ -25,18 +25,7 @@ namespace solarApp.Service
{
bool result = false;
try
- {
- #region 取得 PowerStationID
- using (MySqlConnection conn = new MySqlConnection(Connection1))
- {
- conn.Open();
- string sql = @" select id as PowerStationID from solar_master.power_station where `code` = @siteID";
- var ds = conn.Query(sql, new { siteID = _siteID }).AsList();
- _powerStationID = (ds.Count > 0) ? ds[0][0].ToString() : "0";
- conn.Close();
- }
- #endregion
-
+ {
using (MySqlConnection conn = new MySqlConnection(Connection1))
{
conn.Open();
@@ -57,12 +46,14 @@ namespace solarApp.Service
return result;
}
- public bool archiveData()
- {
-
+ public bool archiveData(string siteID, string date1)
+ {
bool result = false;
try
{
+ _siteID = siteID;
+ _date1 = date1;
+ get_siteInfo();
clearData();
insert_inv();
result = true;
@@ -72,8 +63,36 @@ namespace solarApp.Service
throw ex;
}
return result;
- }
-
+ }
+ public bool get_siteInfo()
+ {
+ bool result = false;
+ try
+ {
+ using (MySqlConnection conn = new MySqlConnection(Connection1))
+ {
+ conn.Open();
+ #region 取得 PowerStationID
+ string sql = @" select id , `code` siteID, siteDB, `name` siteName
+ from solar_master.power_station where `code` = @siteID";
+ var ds = conn.Query(sql, new { siteID = _siteID }).AsList();
+ foreach (var item in ds)
+ {
+ _powerStationID = item.id;
+ _siteDB = item.SiteDB;
+ _siteID01 = item.SiteID + "01";
+ }
+ #endregion
+ conn.Close();
+ }
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ return result;
+ }
bool insert_inv()
{
bool result = false;
diff --git a/solarApp/Service/procSensorSvc.cs b/solarApp/Service/procSensorSvc.cs
index 1badfa8..af61447 100644
--- a/solarApp/Service/procSensorSvc.cs
+++ b/solarApp/Service/procSensorSvc.cs
@@ -17,7 +17,7 @@ namespace solarApp.Service
public string _siteDB { get; set; }
public string _siteID01 { get; set; }
public string _date1 { get; set; }
- public string _date2 { get; set; }
+ //public string _date2 { get; set; }
public string _powerStationID { get; set; }
//public procSensorSvc(string siteDB, string siteID, string date1, string date2)
@@ -41,11 +41,14 @@ namespace solarApp.Service
// archiveData();
//}
- public bool archiveData() {
+ public bool archiveData(string siteID, string date1) {
bool result = false;
try
{
+ _siteID = siteID;
+ _date1 = date1;
+ get_siteInfo();
clearData();
insert_sensor();
result = true;
@@ -65,28 +68,17 @@ namespace solarApp.Service
{
bool result = false;
try
- {
- #region 取得 PowerStationID
+ {
using (MySqlConnection conn = new MySqlConnection(Connection1))
{
conn.Open();
- string sql = @" select id as PowerStationID from solar_master.power_station where `code` = @siteID";
- var ds = conn.Query(sql, new { siteID = _siteID }).AsList();
- _powerStationID = (ds.Count > 0) ? ds[0][0].ToString() : "0";
- conn.Close();
- }
- #endregion
-
- using (MySqlConnection conn = new MySqlConnection(Connection1))
- {
- conn.Open();
- string sql = @"delete from sensor_history_hour where left(`TIMESTAMP`, 10) between @date1 and @date2 and PowerStationID = @powerStationID;
- delete from sensor_history_day where left(`TIMESTAMP`, 10) between @date1 and @date2 and PowerStationID = @powerStationID;
- delete from sensor_history_month where left(`TIMESTAMP`, 7) between left(@date1, 7) and left(@date2, 7) and PowerStationID = @powerStationID;
- delete from sensoravg_history_hour where left(`TIMESTAMP`, 10) between @date1 and @date2 and PowerStationID = @powerStationID;
- delete from sensoravg_history_day where left(`TIMESTAMP`, 10) between @date1 and @date2 and PowerStationID = @powerStationID;
- delete from sensoravg_history_month where left(`TIMESTAMP`, 7) between left(@date1, 7) and left(@date2, 7) and PowerStationID = @powerStationID;";
- var ds = conn.Execute(sql, new { date1 = _date1, date2 = _date2, PowerStationID = _powerStationID });
+ string sql = @"delete from sensor_history_hour where left(`TIMESTAMP`, 10) = @date1 and PowerStationID = @powerStationID;
+ delete from sensor_history_day where left(`TIMESTAMP`, 10) = @date1 and PowerStationID = @powerStationID;
+ delete from sensor_history_month where left(`TIMESTAMP`, 7) = left(@date1, 7) and PowerStationID = @powerStationID;
+ delete from sensoravg_history_hour where left(`TIMESTAMP`, 10) = @date1 and PowerStationID = @powerStationID;
+ delete from sensoravg_history_day where left(`TIMESTAMP`, 10) = @date1 and PowerStationID = @powerStationID;
+ delete from sensoravg_history_month where left(`TIMESTAMP`, 7) = left(@date1, 7) and PowerStationID = @powerStationID;";
+ var ds = conn.Execute(sql, new { date1 = _date1 , PowerStationID = _powerStationID });
conn.Close();
}
result = true;
@@ -98,6 +90,36 @@ namespace solarApp.Service
return result;
}
+ public bool get_siteInfo()
+ {
+ bool result = false;
+ try
+ {
+ using (MySqlConnection conn = new MySqlConnection(Connection1))
+ {
+ conn.Open();
+ #region 取得 PowerStationID
+ string sql = @" select id , `code` siteID, siteDB, `name` siteName
+ from solar_master.power_station where `code` = @siteID";
+ var ds = conn.Query(sql, new { siteID = _siteID }).AsList();
+ foreach (var item in ds)
+ {
+ _powerStationID = item.id;
+ _siteDB = item.SiteDB;
+ _siteID01 = item.SiteID + "01";
+ }
+ #endregion
+ conn.Close();
+ }
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ return result;
+ }
+
///
/// Sensor 欄位需要平均時 欄位串接 (s1 + s2) / 2
///
@@ -125,15 +147,10 @@ namespace solarApp.Service
using (MySqlConnection conn = new MySqlConnection(Connection1))
{
conn.Open();
- #region 取得 PowerStationID
- string sql = @" select id as PowerStationID from solar_master.power_station where `code` = @siteID";
- var ds = conn.Query(sql, new { siteID = _siteID }).AsList();
- _powerStationID = (ds.Count > 0) ? ds[0][0].ToString() : "0";
-
- #endregion
+ string sql;
// init 關閉 group full column
- string ss = @"SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY,',''));";
- conn.Execute(ss);
+ sql = @"SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY,',''));";
+ conn.Execute(sql);
#region 獲取 Sensor 類別
//沒有被刪除、啟用中、狀態正常的 才可列入計算
@@ -174,75 +191,75 @@ namespace solarApp.Service
}
#endregion
- //電表
+ //電表
#endregion 獲取 Sensor 類別
-
try
{
#region hour
sql = @"insert into sensor_history_hour( `PowerStationId`, `TIMESTAMP`, Irradiance, Temperature, EnvTemperature, Humidity, Vane, Dust)
- select a.powerstationID, a.reportdate, ifnull(b.irrAvg, 0) irrAvg, a.modelTempAvg, a.envTempAvg, a.humidityAvg, a.windAvg, a.dustAvg from
+ select a.powerstationID, a.reportdate, ifnull(b.irrAvg, 0) irrAvg, a.Temperature, a.envTemperature, a.humidity, a.Vane, a.Dust from
(
- select @powerStationID powerstationID, FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, avg(" + modelTempCol + @") modelTempAvg,
- avg(" + evnTempCol + @") envTempAvg, avg(" + humCol + @") humidityAvg, avg(" + windCol + @") windAvg,
- avg(" + dustCol + @") dustAvg
+ select @powerStationID powerstationID, FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, avg(" + modelTempCol + @") Temperature,
+ avg(" + evnTempCol + @") envTemperature, avg(" + humCol + @") humidity, avg(" + windCol + @") Vane, avg(" + dustCol + @") Dust
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') = @date1
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H')
) a left join
(
select concat(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':00') reportdate, round(avg(" + irrCol + @"), 2) irrAvg
from " + _siteDB + ".s" + _siteID01 + @"_sensorAvg
- where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') between @date1 and @date2 " + irrNot0 + @" #需要過濾 0 的數值
+ where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 " + irrNot0 + @" #需要過濾 0 的數值
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H')
)b on a.reportdate = b.reportdate";
//MySqlCommand cmd = new MySqlCommand(sql, conn);
//cmd.Parameters()
//cmd.ExecuteNonQuery();
- conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1, date2 = _date2 });
+ conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1 });
#endregion hour
#region day
- sql = @"insert into sensor_history_day( `PowerStationId`, `TIMESTAMP`, `Irradiance`, `Temperature`)
- select a.powerstationID, a.reportdate, ifnull(b.Irradiance, 0) irrAvg, a.modelTempAvg from
+ sql = @"insert into sensor_history_day( `PowerStationId`, `TIMESTAMP`, Irradiance, Temperature, EnvTemperature, Humidity, Vane, Dust)
+ select a.powerstationID, a.reportdate, ifnull(b.Irradiance, 0) irrAvg, a.Temperature, a.envTemperature, a.humidity, a.Vane, a.Dust from
(
- select powerStationID , concat(DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d'), ' 00:00') reportdate, round(avg(Temperature), 2) modelTempAvg
+ select powerStationID , concat(DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d'), ' 00:00') reportdate, round(avg(Temperature), 6) Temperature,
+ envTemperature, humidity, Vane, Dust
from solar_master.sensor_history_hour
- where powerstationID = @powerstationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') between @date1 and @date2
+ where powerstationID = @powerstationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = @date1
group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d')
) a left join
(
select concat(DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d'), ' 00:00') reportdate, round(avg(Irradiance), 2) Irradiance
from solar_master.sensor_history_hour
where powerstationID = @powerstationID
- and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') between @date1 and @date2 and Irradiance <> 0 #需要過濾 0 的數值
+ and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = @date1 and Irradiance <> 0 #需要過濾 0 的數值
group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d')
)b on a.reportdate = b.reportdate";
- conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1, date2 = _date2 });
+ conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1 });
#endregion day
#region month 如果跨月 會有2筆資料
sql = @"
- delete from sensor_history_month where left(`TIMESTAMP`, 7) between left(@date1, 7) and left(@date2, 7) and PowerStationID = @powerStationID;
+ delete from sensor_history_month where left(`TIMESTAMP`, 7) = @date1 and PowerStationID = @powerStationID;
- insert into sensor_history_month( `PowerStationId`, `TIMESTAMP`, `Irradiance`, `Temperature`)
- select a.powerstationID, a.reportdate, ifnull(b.Irradiance, 0) irrAvg, a.modelTempAvg from
+ insert into sensor_history_month( `PowerStationId`, `TIMESTAMP`, `Irradiance`, Temperature, EnvTemperature, Humidity, Vane, Dust)
+ select a.powerstationID, a.reportdate, ifnull(b.Irradiance, 0) irrAvg, a.Temperature, a.envTemperature, a.humidity, a.Vane, a.Dust from
(
- select powerStationID , concat(DATE_FORMAT(`TIMESTAMP`,'%Y-%m'), '-01 00:00') reportdate, round(avg(Temperature), 2) modelTempAvg
+ select powerStationID , concat(DATE_FORMAT(`TIMESTAMP`,'%Y-%m'), '-01 00:00') reportdate, round(avg(Temperature), 6) Temperature,
+ envTemperature, humidity, Vane, Dust
from solar_master.sensor_history_day
- where powerstationID = @powerstationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m') between @date1 and @date2
+ where powerstationID = @powerstationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m') = @date1
group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m')
) a left join
(
select concat(DATE_FORMAT(`TIMESTAMP`,'%Y-%m'), '-01 00:00') reportdate, round(avg(Irradiance), 2) Irradiance
from solar_master.sensor_history_day
where powerstationID = @powerstationID
- and DATE_FORMAT(`TIMESTAMP`,'%Y-%m') between @date1 and @date2 and Irradiance <> 0 #需要過濾 0 的數值
+ and DATE_FORMAT(`TIMESTAMP`,'%Y-%m') = @date1 and Irradiance <> 0 #需要過濾 0 的數值
group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m')
)b on a.reportdate = b.reportdate";
- conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1.Substring(0,7), date2 = _date2.Substring(0, 7) });
+ conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1.Substring(0,7) });
#endregion month
#region Sensor 1~50 hour
@@ -257,9 +274,9 @@ namespace solarApp.Service
avg(sensorAvg38), avg(sensorAvg39), avg(sensorAvg40), avg(sensorAvg41), avg(sensorAvg42), avg(sensorAvg43), avg(sensorAvg44),
avg(sensorAvg45), avg(sensorAvg46), avg(sensorAvg47), avg(sensorAvg48), avg(sensorAvg49), avg(sensorAvg50)
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') = @date1
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H');";
- conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1, date2 = _date2 });
+ conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1 });
//日照計 update
sql = string.Empty;
@@ -269,12 +286,12 @@ namespace solarApp.Service
(
select @powerstationID powerstationID, concat(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':00') reportdate, round(avg(" + item.colname + @"), 2) irrAvg
from " + _siteDB + ".s" + _siteID01 + @"_sensorAvg
- where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') between @date1 and @date2 and " + item.colname + @" <> 0 #需要過濾 0 的數值
+ where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and " + item.colname + @" <> 0 #需要過濾 0 的數值
group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H')
)b on a.powerStationID = b.powerStationID and DATE_FORMAT(a.`TIMESTAMP`,'%Y-%m-%d %H:%i') = b.reportdate
set a." + item.colname + " = b.irrAvg;";
}
- if (!string.IsNullOrEmpty(sql)) conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1, date2 = _date2 });
+ if (!string.IsNullOrEmpty(sql)) conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1 });
#endregion
@@ -290,9 +307,9 @@ namespace solarApp.Service
avg(sensorAvg38), avg(sensorAvg39), avg(sensorAvg40), avg(sensorAvg41), avg(sensorAvg42), avg(sensorAvg43), avg(sensorAvg44),
avg(sensorAvg45), avg(sensorAvg46), avg(sensorAvg47), avg(sensorAvg48), avg(sensorAvg49), avg(sensorAvg50)
from solar_master.sensoravg_history_hour
- where powerStationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') between @date1 and @date2
+ where powerStationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = @date1
group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d');";
- conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1, date2 = _date2 });
+ conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1 });
//日照計 update
sql = string.Empty;
@@ -302,18 +319,18 @@ namespace solarApp.Service
(
select @powerstationID powerstationID, concat(DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d'), ' 00:00') reportdate, round(avg(" + item.colname + @"), 2) irrAvg
from solar_master.sensoravg_history_hour
- where powerStationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') between @date1 and @date2 and " + item.colname + @" <> 0 #需要過濾 0 的數值
+ where powerStationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = @date1 and " + item.colname + @" <> 0 #需要過濾 0 的數值
group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d')
)b on a.powerStationID = b.powerStationID and DATE_FORMAT(a.`TIMESTAMP`,'%Y-%m-%d') = b.reportdate
set a." + item.colname + " = b.irrAvg;";
}
- if (!string.IsNullOrEmpty(sql)) conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1, date2 = _date2 });
+ if (!string.IsNullOrEmpty(sql)) conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1 });
#endregion
#region Sensor 1~50 month
sql = @"
- delete from sensoravg_history_month where left(`TIMESTAMP`, 7) between left(@date1, 7) and left(@date2, 7) and PowerStationID = @powerStationID;
+ delete from sensoravg_history_month where left(`TIMESTAMP`, 7) = @date1 and PowerStationID = @powerStationID;
INSERT INTO solar_master.sensoravg_history_month (PowerStationId, `TIMESTAMP`, SENSORAVG01, SENSORAVG02, SENSORAVG03, SENSORAVG04, SENSORAVG05, SENSORAVG06, SENSORAVG07, SENSORAVG08, SENSORAVG09, SENSORAVG10, SENSORAVG11, SENSORAVG12, SENSORAVG13, SENSORAVG14, SENSORAVG15, SENSORAVG16, SENSORAVG17, SENSORAVG18, SENSORAVG19, SENSORAVG20, SENSORAVG21, SENSORAVG22, SENSORAVG23, SENSORAVG24, SENSORAVG25, SENSORAVG26, SENSORAVG27, SENSORAVG28, SENSORAVG29, SENSORAVG30, SENSORAVG31, SENSORAVG32, SENSORAVG33, SENSORAVG34, SENSORAVG35, SENSORAVG36, SENSORAVG37, SENSORAVG38, SENSORAVG39, SENSORAVG40, SENSORAVG41, SENSORAVG42, SENSORAVG43, SENSORAVG44, SENSORAVG45, SENSORAVG46, SENSORAVG47, SENSORAVG48, SENSORAVG49, SENSORAVG50)
select @powerStationID powerstationID, concat(DATE_FORMAT(`TIMESTAMP`,'%Y-%m'), '-01 00:00') reportdate, avg(sensorAvg01), avg(sensorAvg02),
@@ -325,9 +342,9 @@ namespace solarApp.Service
avg(sensorAvg38), avg(sensorAvg39), avg(sensorAvg40), avg(sensorAvg41), avg(sensorAvg42), avg(sensorAvg43), avg(sensorAvg44),
avg(sensorAvg45), avg(sensorAvg46), avg(sensorAvg47), avg(sensorAvg48), avg(sensorAvg49), avg(sensorAvg50)
from solar_master.sensoravg_history_day
- where powerStationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m') between @date1 and @date2
+ where powerStationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m') = @date1
group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m');";
- conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1.Substring(0, 7), date2 = _date2.Substring(0, 7) });
+ conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1.Substring(0, 7) });
//日照計 update
sql = string.Empty;
@@ -337,12 +354,12 @@ namespace solarApp.Service
(
select @powerstationID powerstationID, concat( DATE_FORMAT(`TIMESTAMP`,'%Y-%m'), '-01 00:00') reportdate, round(avg(" + item.colname + @"), 2) irrAvg
from solar_master.sensoravg_history_day
- where powerStationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m') between @date1 and @date2 and " + item.colname + @" <> 0 #需要過濾 0 的數值
+ where powerStationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m') = @date1 and " + item.colname + @" <> 0 #需要過濾 0 的數值
group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d')
)b on a.powerStationID = b.powerStationID and DATE_FORMAT(a.`TIMESTAMP`,'%Y-%m') = b.reportdate
set a." + item.colname + " = b.irrAvg;";
}
- if (!string.IsNullOrEmpty(sql)) conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1.Substring(0, 7), date2 = _date2.Substring(0, 7) });
+ if (!string.IsNullOrEmpty(sql)) conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1.Substring(0, 7)});
#endregion
diff --git a/solarApp/Service/procStationSvc.cs b/solarApp/Service/procStationSvc.cs
index 5b60bd6..9e551ad 100644
--- a/solarApp/Service/procStationSvc.cs
+++ b/solarApp/Service/procStationSvc.cs
@@ -16,7 +16,7 @@ namespace solarApp.Service
public string _siteDB { get; set; }
public string _siteID01 { get; set; }
public string _date1 { get; set; }
- public string _date2 { get; set; }
+ //public string _date2 { get; set; }
public string _powerStationID { get; set; }
@@ -55,11 +55,15 @@ namespace solarApp.Service
return result;
}
- public bool archiveData()
- {
+ public bool archiveData(string siteID, string date1)
+ {
+
bool result = false;
try
{
+ _siteID = siteID;
+ _date1 = date1;
+ get_siteInfo();
clearData();
insert_station();
result = true;
@@ -71,6 +75,35 @@ namespace solarApp.Service
return result;
}
+ public bool get_siteInfo()
+ {
+ bool result = false;
+ try
+ {
+ using (MySqlConnection conn = new MySqlConnection(Connection1))
+ {
+ conn.Open();
+ #region 取得 PowerStationID
+ string sql = @" select id , `code` siteID, siteDB, `name` siteName
+ from solar_master.power_station where `code` = @siteID";
+ var ds = conn.Query(sql, new { siteID = _siteID }).AsList();
+ foreach (var item in ds)
+ {
+ _powerStationID = item.id;
+ _siteDB = item.SiteDB;
+ _siteID01 = item.SiteID + "01";
+ }
+ #endregion
+ conn.Close();
+ }
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ return result;
+ }
bool insert_station()
{
bool result = false;
diff --git a/solarApp/fmArchive.Designer.cs b/solarApp/fmArchive.Designer.cs
index a668d44..04e7211 100644
--- a/solarApp/fmArchive.Designer.cs
+++ b/solarApp/fmArchive.Designer.cs
@@ -112,7 +112,7 @@ namespace solarApp
// 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.Location = new System.Drawing.Point(15, 796);
this.bt_archive.Name = "bt_archive";
this.bt_archive.Size = new System.Drawing.Size(282, 100);
this.bt_archive.TabIndex = 8;
@@ -124,7 +124,7 @@ namespace solarApp
//
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.Location = new System.Drawing.Point(15, 634);
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;
@@ -136,7 +136,7 @@ namespace solarApp
//
this.bt_clear_station.Enabled = false;
this.bt_clear_station.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.bt_clear_station.Location = new System.Drawing.Point(3, 418);
+ this.bt_clear_station.Location = new System.Drawing.Point(15, 734);
this.bt_clear_station.Name = "bt_clear_station";
this.bt_clear_station.Size = new System.Drawing.Size(135, 44);
this.bt_clear_station.TabIndex = 6;
@@ -148,7 +148,7 @@ namespace solarApp
//
this.bt_clear_inv.Enabled = false;
this.bt_clear_inv.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.bt_clear_inv.Location = new System.Drawing.Point(5, 335);
+ this.bt_clear_inv.Location = new System.Drawing.Point(15, 684);
this.bt_clear_inv.Name = "bt_clear_inv";
this.bt_clear_inv.Size = new System.Drawing.Size(135, 44);
this.bt_clear_inv.TabIndex = 5;
@@ -161,12 +161,12 @@ namespace solarApp
this.fp_site.Dock = System.Windows.Forms.DockStyle.Top;
this.fp_site.Location = new System.Drawing.Point(0, 0);
this.fp_site.Name = "fp_site";
- this.fp_site.Size = new System.Drawing.Size(300, 176);
+ this.fp_site.Size = new System.Drawing.Size(300, 583);
this.fp_site.TabIndex = 4;
//
// dtSelect
//
- this.dtSelect.Location = new System.Drawing.Point(3, 193);
+ this.dtSelect.Location = new System.Drawing.Point(15, 601);
this.dtSelect.Name = "dtSelect";
this.dtSelect.Size = new System.Drawing.Size(204, 27);
this.dtSelect.TabIndex = 3;
@@ -175,7 +175,7 @@ namespace solarApp
// bt_site
//
this.bt_site.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.bt_site.Location = new System.Drawing.Point(152, 418);
+ this.bt_site.Location = new System.Drawing.Point(164, 734);
this.bt_site.Name = "bt_site";
this.bt_site.Size = new System.Drawing.Size(135, 44);
this.bt_site.TabIndex = 2;
@@ -186,7 +186,7 @@ namespace solarApp
// bt_Inv
//
this.bt_Inv.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.bt_Inv.Location = new System.Drawing.Point(152, 335);
+ this.bt_Inv.Location = new System.Drawing.Point(162, 684);
this.bt_Inv.Name = "bt_Inv";
this.bt_Inv.Size = new System.Drawing.Size(135, 44);
this.bt_Inv.TabIndex = 1;
@@ -197,7 +197,7 @@ namespace solarApp
// bt_Sensor
//
this.bt_Sensor.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.bt_Sensor.Location = new System.Drawing.Point(152, 256);
+ this.bt_Sensor.Location = new System.Drawing.Point(162, 634);
this.bt_Sensor.Name = "bt_Sensor";
this.bt_Sensor.Size = new System.Drawing.Size(135, 44);
this.bt_Sensor.TabIndex = 0;
diff --git a/solarApp/fmArchive.cs b/solarApp/fmArchive.cs
index ed6d17c..e4016a5 100644
--- a/solarApp/fmArchive.cs
+++ b/solarApp/fmArchive.cs
@@ -27,12 +27,12 @@ namespace solarApp
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.archiveData();
+ //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.archiveData(lbSiteID_sensor.Text.Substring(0, 9), date1);
//sensorSvc.archiveData();
MessageBox.Show("OK");
}
@@ -48,7 +48,7 @@ namespace solarApp
rb.Name = item.SiteID;
rb.Text = item.SiteName;
rb.Tag = item.SiteDB;
- rb.Font = new Font(Font.FontFamily, 22);
+ rb.Font = new Font(Font.FontFamily, 12);
rb.AutoSize = true;
rb.CheckedChanged += new EventHandler(rb_site_CheckedChanged);
fp_site.Controls.Add(rb);
@@ -87,12 +87,12 @@ namespace solarApp
string date1 = dtSelect.Value.ToString("yyyy-MM-dd");
//procSensorSvc sensorSvc = new procSensorSvc(lbSiteDB_sensor.Text, lbSiteID_sensor.Text, date1, date1);
procInvSvc invSvc = new procInvSvc();
- invSvc._siteDB = lbSiteDB_sensor.Text;
- invSvc._siteID = lbSiteID_sensor.Text.Substring(0, 9);
- invSvc._siteID01 = lbSiteID_sensor.Text;
- invSvc._date1 = date1;
- invSvc._date2 = date1;
- invSvc.archiveData();
+ //invSvc._siteDB = lbSiteDB_sensor.Text;
+ //invSvc._siteID = lbSiteID_sensor.Text.Substring(0, 9);
+ //invSvc._siteID01 = lbSiteID_sensor.Text;
+ //invSvc._date1 = date1;
+ //invSvc._date2 = date1;
+ invSvc.archiveData(lbSiteID_sensor.Text.Substring(0, 9), date1);
//sensorSvc.archiveData();
MessageBox.Show("OK");
}
@@ -116,7 +116,7 @@ namespace solarApp
invSvc._siteID = lbSiteID_sensor.Text.Substring(0, 9);
invSvc._siteID01 = lbSiteID_sensor.Text;
invSvc._date1 = date1;
- invSvc._date2 = date1;
+ //invSvc._date2 = date1;
invSvc.clearData();
//sensorSvc.archiveData();
MessageBox.Show("OK");
@@ -131,7 +131,7 @@ namespace solarApp
siteSvc._siteID = lbSiteID_sensor.Text.Substring(0, 9);
siteSvc._siteID01 = lbSiteID_sensor.Text;
siteSvc._date1 = date1;
- siteSvc._date2 = date1;
+ //siteSvc._date2 = date1;
siteSvc.clearData();
//sensorSvc.archiveData();
MessageBox.Show("OK");
@@ -142,12 +142,12 @@ namespace solarApp
string date1 = dtSelect.Value.ToString("yyyy-MM-dd");
//procSensorSvc sensorSvc = new procSensorSvc(lbSiteDB_sensor.Text, lbSiteID_sensor.Text, date1, date1);
procStationSvc siteSvc = new procStationSvc();
- siteSvc._siteDB = lbSiteDB_sensor.Text;
- siteSvc._siteID = lbSiteID_sensor.Text.Substring(0, 9);
- siteSvc._siteID01 = lbSiteID_sensor.Text;
- siteSvc._date1 = date1;
- siteSvc._date2 = date1;
- siteSvc.archiveData();
+ //siteSvc._siteDB = lbSiteDB_sensor.Text;
+ //siteSvc._siteID = lbSiteID_sensor.Text.Substring(0, 9);
+ //siteSvc._siteID01 = lbSiteID_sensor.Text;
+ //siteSvc._date1 = date1;
+ //siteSvc._date2 = date1;
+ siteSvc.archiveData(lbSiteID_sensor.Text.Substring(0, 9), date1);
//sensorSvc.archiveData();
MessageBox.Show("OK");
}
@@ -168,7 +168,7 @@ namespace solarApp
sensorSvc._siteID = lbSiteID_sensor.Text.Substring(0, 9);
sensorSvc._siteID01 = lbSiteID_sensor.Text;
sensorSvc._date1 = date1;
- sensorSvc._date2 = date1;
+ //sensorSvc._date2 = date1;
sensorSvc.clearData();
//sensorSvc.archiveData();
MessageBox.Show("OK");
diff --git a/solarApp/fmMain.Designer.cs b/solarApp/fmMain.Designer.cs
index 5fb95e8..5768b1c 100644
--- a/solarApp/fmMain.Designer.cs
+++ b/solarApp/fmMain.Designer.cs
@@ -772,14 +772,14 @@ namespace solarApp
this.fp_site.Location = new System.Drawing.Point(0, 0);
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, 545);
+ this.fp_site.Size = new System.Drawing.Size(257, 775);
this.fp_site.TabIndex = 14;
//
// lbMsg_station
//
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.Location = new System.Drawing.Point(28, 666);
+ this.lbMsg_station.Location = new System.Drawing.Point(23, 868);
this.lbMsg_station.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbMsg_station.Name = "lbMsg_station";
this.lbMsg_station.Size = new System.Drawing.Size(22, 24);
@@ -788,7 +788,7 @@ namespace solarApp
//
// bt_find_station
//
- this.bt_find_station.Location = new System.Drawing.Point(14, 628);
+ this.bt_find_station.Location = new System.Drawing.Point(9, 830);
this.bt_find_station.Name = "bt_find_station";
this.bt_find_station.Size = new System.Drawing.Size(94, 29);
this.bt_find_station.TabIndex = 7;
@@ -799,7 +799,7 @@ namespace solarApp
// 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.Location = new System.Drawing.Point(10, 580);
+ this.dtselect_station1.Location = new System.Drawing.Point(5, 782);
this.dtselect_station1.Name = "dtselect_station1";
this.dtselect_station1.Size = new System.Drawing.Size(234, 31);
this.dtselect_station1.TabIndex = 6;
diff --git a/solarApp/fmMain.cs b/solarApp/fmMain.cs
index 9dc3d64..0ea1ffc 100644
--- a/solarApp/fmMain.cs
+++ b/solarApp/fmMain.cs
@@ -27,11 +27,18 @@ namespace solarApp
string date2 = dtselect_inv.Value.ToString("yyyy-MM-dd");
//string date2 = dtSelect_sensor2.Value.ToString("yyyy-MM-dd");
string date1 = dtselect_inv.Value.AddDays(-7).ToString("yyyy-MM-dd");
+ gv_fic_inv_raw.DataSource = "";
+ gv_fic_inv_hour.DataSource = "";
+ try
+ {
+ gv_fic_inv_raw.DataSource = inv_svc.Get_rawInv(date2, lbInverterID.Text, lbSiteDB_inv.Text, lbSiteID_inv.Text);
-
- gv_fic_inv_raw.DataSource = inv_svc.Get_rawInv(date2, lbInverterID.Text, lbSiteDB_inv.Text, lbSiteID_inv.Text);
-
- gv_fic_inv_hour.DataSource = inv_svc.get_Inv_rawAvg(date2, lbInverterID.Text, lbSiteDB_inv.Text, lbSiteID_inv.Text);
+ gv_fic_inv_hour.DataSource = inv_svc.get_Inv_rawAvg(date2, lbInverterID.Text, lbSiteDB_inv.Text, lbSiteID_inv.Text);
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
gv_web_inv_hour.DataSource = inv_svc.get_web_Inv_hour(date2, lbInverterID.Text);
@@ -75,7 +82,7 @@ namespace solarApp
rb.Name = item.SiteID;
rb.Text = item.SiteName;
rb.Tag = item.SiteDB;
- rb.Font = new Font(Font.FontFamily, 22);
+ rb.Font = new Font(Font.FontFamily, 14);
rb.AutoSize = true;
rb.CheckedChanged += new EventHandler(rb_site_CheckedChanged);
fp_site.Controls.Add(rb);
@@ -180,11 +187,17 @@ namespace solarApp
string date2 = dtselect_station1.Value.ToString("yyyy-MM-dd");
//string date2 = dtselect_station2.Value.ToString("yyyy-MM-dd");
string date1 = dtselect_station1.Value.AddDays(-7).ToString("yyyy-MM-dd");
-
- gv_fic_station_raw.DataSource = stationSvc.get_station_raw(date2, lbSiteDB_inv.Text, lbSiteID_inv.Text);
-
- gv_fic_station_day.DataSource = stationSvc.get_station_rawAvg(date1, date2, lbSiteDB_inv.Text, lbSiteID_inv.Text);
-
+ gv_fic_station_raw.DataSource = "";
+ gv_fic_station_day.DataSource = "";
+ try
+ {
+ gv_fic_station_raw.DataSource = stationSvc.get_station_raw(date2, lbSiteDB_inv.Text, lbSiteID_inv.Text);
+ gv_fic_station_day.DataSource = stationSvc.get_station_rawAvg(date1, date2, lbSiteDB_inv.Text, lbSiteID_inv.Text);
+ }
+ catch (Exception ex )
+ {
+ MessageBox.Show( ex.Message);
+ }
gv_web_station_hour.DataSource = stationSvc.get_web_station_hour(date2, lbSiteID_inv.Text);
gv_web_station_day.DataSource = stationSvc.get_web_station_day(date1, date2, lbSiteID_inv.Text.Substring(0, 9));
@@ -199,11 +212,17 @@ namespace solarApp
string date2 = dtSelect_sensor1.Value.ToString("yyyy-MM-dd");
//string date2 = dtSelect_sensor2.Value.ToString("yyyy-MM-dd");
string date1 = dtSelect_sensor1.Value.AddDays(-7).ToString("yyyy-MM-dd");
-
- gv_fic_sensor_raw.DataSource = sensorSvc.get_sensor_raw(date2, lbSiteDB_inv.Text, lbSiteID_inv.Text);
-
- gv_fic_sensor_hour.DataSource = sensorSvc.get_sensor_raw_hour(date2, lbSiteDB_inv.Text, lbSiteID_inv.Text.Substring(0, 11));
-
+ gv_fic_sensor_raw.DataSource = "";
+ gv_fic_sensor_hour.DataSource = "";
+ try
+ {
+ gv_fic_sensor_raw.DataSource = sensorSvc.get_sensor_raw(date2, lbSiteDB_inv.Text, lbSiteID_inv.Text);
+ gv_fic_sensor_hour.DataSource = sensorSvc.get_sensor_raw_hour(date2, lbSiteDB_inv.Text, lbSiteID_inv.Text.Substring(0, 11));
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
gv_web_sensor_hour.DataSource = sensorSvc.get_web_sensor_hour(date2, lbSiteID_inv.Text.Substring(0, 09));
gv_web_sensor_day.DataSource = sensorSvc.get_web_sensor_day(date1, date2, lbSiteID_inv.Text.Substring(0, 09));