debug : inv_hour insert double

This commit is contained in:
JiaHao Liu 2022-01-24 19:14:56 +08:00
parent dcf25a88b3
commit 003e678a5b

View File

@ -65,7 +65,15 @@ namespace solarApp.Service
delete from inverter_history_hour where powerstationID = @powerStationID and CrdDate = @date1; delete from inverter_history_hour where powerstationID = @powerStationID and CrdDate = @date1;
delete from inverter_history_day where powerstationID = @powerStationID and CrdDate = @date1; delete from inverter_history_day where powerstationID = @powerStationID and CrdDate = @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 });
MySqlCommand cmd = new MySqlCommand();
cmd.Connection = conn;
cmd.CommandTimeout = 360;
cmd.Parameters.AddWithValue("@date1", _date1);
cmd.Parameters.AddWithValue("@PowerStationID", _powerStationID);
cmd.CommandText = sql;
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
if (_logger != null) if (_logger != null)
{ {
@ -194,7 +202,7 @@ namespace solarApp.Service
//int ct = conn.Execute(sql, new { date1 = _date1 }); //int ct = conn.Execute(sql, new { date1 = _date1 });
MySqlCommand cmd = new MySqlCommand(); MySqlCommand cmd = new MySqlCommand();
cmd.Connection = conn; cmd.Connection = conn;
cmd.CommandTimeout = 180; cmd.CommandTimeout = 360;
cmd.Parameters.AddWithValue("@date1", _date1); cmd.Parameters.AddWithValue("@date1", _date1);
cmd.CommandText = sql; cmd.CommandText = sql;
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
@ -365,7 +373,7 @@ namespace solarApp.Service
//int ct = conn.Execute(sql, new { date1 = _date1 }); //int ct = conn.Execute(sql, new { date1 = _date1 });
MySqlCommand cmd = new MySqlCommand(); MySqlCommand cmd = new MySqlCommand();
cmd.Connection = conn; cmd.Connection = conn;
cmd.CommandTimeout = 180; cmd.CommandTimeout = 360;
cmd.Parameters.AddWithValue("@date1", _date1); cmd.Parameters.AddWithValue("@date1", _date1);
cmd.Parameters.AddWithValue("@PowerStationID", _powerStationID); cmd.Parameters.AddWithValue("@PowerStationID", _powerStationID);
cmd.CommandText = sql; cmd.CommandText = sql;
@ -390,7 +398,7 @@ namespace solarApp.Service
if (_logger != null) if (_logger != null)
_logger.LogInformation("【ProcInvSvc】執行完成[{0}]在{1}逆變器hour補償", _siteID, _date1); _logger.LogInformation("【ProcInvSvc】執行完成[{0}]在{1}逆變器hour補償", _siteID, _date1);
ss = @$"DROP TABLE IF EXISTS del_Inv_day_" + _powerStationID + @"_s1; "; sql = @$"DROP TABLE IF EXISTS del_Inv_day_" + _powerStationID + @"_s1; ";
//conn.Execute(ss); //conn.Execute(ss);
cmd.CommandText = sql; cmd.CommandText = sql;
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
@ -586,7 +594,7 @@ ALTER TABLE `temp_invDay{_powerStationID}_s1` ADD INDEX `temp_indexs1` (report_d
//conn.Execute(ss); //conn.Execute(ss);
MySqlCommand cmd = new MySqlCommand(); MySqlCommand cmd = new MySqlCommand();
cmd.Connection = conn; cmd.Connection = conn;
cmd.CommandTimeout = 180; cmd.CommandTimeout = 360;
cmd.CommandText = sql; cmd.CommandText = sql;
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
#endregion #endregion