1. 逆變器補償加入log
This commit is contained in:
parent
8c8a64bb39
commit
a16468f22c
@ -48,18 +48,35 @@ namespace solarApp.Service
|
|||||||
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
|
|
||||||
|
if (_logger != null)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("【ProcInvSvc】開始執行[{0}]在{1}逆變器清除資料表的資料", _siteID, _date1);
|
||||||
|
}
|
||||||
|
|
||||||
string sql = @"
|
string sql = @"
|
||||||
delete from inverter_history_15min where powerstationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = @date1;
|
delete from inverter_history_15min where powerstationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = @date1;
|
||||||
delete from inverter_history_hour where powerstationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = @date1;
|
delete from inverter_history_hour where powerstationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = @date1;
|
||||||
delete from inverter_history_day where powerstationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = @date1;
|
delete from inverter_history_day where powerstationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = @date1;
|
||||||
delete from inverter_history_month where powerstationID = @powerStationID and left(`TIMESTAMP`, 7) = left(@date1, 7) ;";
|
delete from inverter_history_month where powerstationID = @powerStationID and left(`TIMESTAMP`, 7) = left(@date1, 7) ;";
|
||||||
var ds = conn.Execute(sql, new { date1 = _date1, PowerStationID = _powerStationID });
|
var ds = conn.Execute(sql, new { date1 = _date1, PowerStationID = _powerStationID });
|
||||||
|
|
||||||
|
if (_logger != null)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("【ProcInvSvc】執行完成[{0}]在{1}逆變器清除資料表的資料", _siteID, _date1);
|
||||||
|
}
|
||||||
|
|
||||||
conn.Close();
|
conn.Close();
|
||||||
}
|
}
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
if (_logger != null)
|
||||||
|
{
|
||||||
|
_logger.LogError("【ProcInvSvc】執行失敗[{0}]在{1}逆變器清除資料表的資料", _siteID, _date1);
|
||||||
|
_logger.LogError("【ProcInvSvc】執行失敗[{0}]在{1}逆變器清除資料表的資料 - [Exception]:{2}", _siteID, _date1, ex.ToString());
|
||||||
|
}
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -91,6 +108,12 @@ namespace solarApp.Service
|
|||||||
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
|
|
||||||
|
if (_logger != null)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("【ProcInvSvc】開始執行[{0}]在{1}逆變器取得電站編號", _siteID, _date1);
|
||||||
|
}
|
||||||
|
|
||||||
#region 取得 PowerStationID
|
#region 取得 PowerStationID
|
||||||
string sql = @" select id , `code` siteID, siteDB, `name` siteName
|
string sql = @" select id , `code` siteID, siteDB, `name` siteName
|
||||||
from solar_master.power_station where `code` = @siteID";
|
from solar_master.power_station where `code` = @siteID";
|
||||||
@ -101,6 +124,12 @@ namespace solarApp.Service
|
|||||||
_siteDB = item.SiteDB;
|
_siteDB = item.SiteDB;
|
||||||
_siteID01 = item.SiteID + "01";
|
_siteID01 = item.SiteID + "01";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_logger != null)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("【ProcInvSvc】執行完成[{0}]在{1}逆變器取得電站編號 - {2}", _siteID, _date1, _powerStationID);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
conn.Close();
|
conn.Close();
|
||||||
}
|
}
|
||||||
@ -108,6 +137,12 @@ namespace solarApp.Service
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
if (_logger != null)
|
||||||
|
{
|
||||||
|
_logger.LogError("【ProcInvSvc】執行失敗[{0}]在{1}逆變器取得電站編號", _siteID, _date1);
|
||||||
|
_logger.LogError("【ProcInvSvc】執行失敗[{0}]在{1}逆變器取得電站編號 - [Exception]:{2}", _siteID, _date1, ex.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user