diff --git a/solarApp/Service/procInvSvc.cs b/solarApp/Service/procInvSvc.cs index c3241f2..d0ba854 100644 --- a/solarApp/Service/procInvSvc.cs +++ b/solarApp/Service/procInvSvc.cs @@ -65,7 +65,15 @@ namespace solarApp.Service 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_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) { @@ -194,7 +202,7 @@ namespace solarApp.Service //int ct = conn.Execute(sql, new { date1 = _date1 }); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; - cmd.CommandTimeout = 180; + cmd.CommandTimeout = 360; cmd.Parameters.AddWithValue("@date1", _date1); cmd.CommandText = sql; cmd.ExecuteNonQuery(); @@ -365,7 +373,7 @@ namespace solarApp.Service //int ct = conn.Execute(sql, new { date1 = _date1 }); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; - cmd.CommandTimeout = 180; + cmd.CommandTimeout = 360; cmd.Parameters.AddWithValue("@date1", _date1); cmd.Parameters.AddWithValue("@PowerStationID", _powerStationID); cmd.CommandText = sql; @@ -390,7 +398,7 @@ namespace solarApp.Service if (_logger != null) _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); cmd.CommandText = sql; cmd.ExecuteNonQuery(); @@ -586,7 +594,7 @@ ALTER TABLE `temp_invDay{_powerStationID}_s1` ADD INDEX `temp_indexs1` (report_d //conn.Execute(ss); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; - cmd.CommandTimeout = 180; + cmd.CommandTimeout = 360; cmd.CommandText = sql; cmd.ExecuteNonQuery(); #endregion