diff --git a/solarApp/Service/procInvSvc.cs b/solarApp/Service/procInvSvc.cs index 0450316..fab16bb 100644 --- a/solarApp/Service/procInvSvc.cs +++ b/solarApp/Service/procInvSvc.cs @@ -405,7 +405,7 @@ namespace solarApp.Service _logger.LogError("【ProcInvSvc】執行失敗[{0}]在{1}逆變器day補償 - [Exception]:{2}", _siteID, _date1, ex.ToString()); } //throw ex; - arclog.insert_log(_powerStationID, "inverter_history_day step1 ", 0, "inverter_history_day", "insert inverter_history_day error", "0", "", "", conn, cmd); + arclog.insert_log(_powerStationID, "inverter_history_day step1 ", 0, "inverter_history_day", "insert inverter_history_day error", "0", "", ex.Message, conn, cmd); } #endregion day @@ -470,7 +470,7 @@ namespace solarApp.Service _logger.LogError("【ProcInvSvc】執行失敗[{0}]在{1}逆變器month補償", _siteID, _date1); _logger.LogError("【ProcInvSvc】執行失敗[{0}]在{1}逆變器month補償 - [Exception]:{2}", _siteID, _date1, ex.ToString()); } - arclog.insert_log(_powerStationID, "inverter_history_month step1 ", 0, "inverter_history_month", "insert inverter_history_month error", "0", "", "", conn, cmd); + arclog.insert_log(_powerStationID, "inverter_history_month step1 ", 0, "inverter_history_month", "insert inverter_history_month error", "0", "", ex.Message, conn, cmd); // throw ex; } diff --git a/solarApp/Service/procSensorSvc.cs b/solarApp/Service/procSensorSvc.cs index 67d87c7..60ec67d 100644 --- a/solarApp/Service/procSensorSvc.cs +++ b/solarApp/Service/procSensorSvc.cs @@ -562,7 +562,7 @@ namespace solarApp.Service } catch (Exception ex) { - arclog.insert_log(_powerStationID, "sensor step1 ", 0, "sensor_history_", "insert sensor error", "err", "", "", conn, cmd); + arclog.insert_log(_powerStationID, "sensor step1 ", 0, "sensor_history_", "insert sensor error", "err", "", ex.Message, conn, cmd); //throw ex; } @@ -628,7 +628,7 @@ namespace solarApp.Service } catch (Exception ex) { - arclog.insert_log(_powerStationID, "sensor step1 irrDayHour", 0, "sensor_history_", "sensor_history_hour error", "err", "", "", conn, cmd); + arclog.insert_log(_powerStationID, "sensor step1 irrDayHour", 0, "sensor_history_", "sensor_history_hour error", "err", "", ex.Message, conn, cmd); //throw ex; } conn.Close(); @@ -716,7 +716,7 @@ namespace solarApp.Service catch (Exception ex) { //throw ex; - arclog.insert_log(_powerStationID, "sensor step1 meter_hour", 0, "meter_history_hour", "meter_history_hour error", "err", "", "", conn, null); + arclog.insert_log(_powerStationID, "sensor step1 meter_hour", 0, "meter_history_hour", "meter_history_hour error", "err", "", ex.Message, conn, null); } conn.Close(); } @@ -762,7 +762,7 @@ namespace solarApp.Service catch (Exception ex) { //throw ex; - arclog.insert_log(_powerStationID, "sensor step1 meter_hour", 0, "meter_history_hour", "meter_history_hour error", "0", "", "", conn, null); + arclog.insert_log(_powerStationID, "sensor step1 meter_hour", 0, "meter_history_hour", "meter_history_hour error", "0", "", ex.Message, conn, null); } conn.Close(); } @@ -1086,7 +1086,7 @@ namespace solarApp.Service } catch (Exception ex) { - arclog.insert_log(_powerStationID, "sensor step1 for irrDayHour", duration.TotalSeconds, "sensor_history_hour", "update sensor hour", "0", "", rowCT.ToString(), conn, cmd); + arclog.insert_log(_powerStationID, "sensor step1 for irrDayHour", duration.TotalSeconds, "sensor_history_hour", "update sensor hour", "0", "", ex.Message, conn, cmd); //throw ex; } diff --git a/solarApp/Service/procStationSvc.cs b/solarApp/Service/procStationSvc.cs index 110a9b2..32cf767 100644 --- a/solarApp/Service/procStationSvc.cs +++ b/solarApp/Service/procStationSvc.cs @@ -5,6 +5,7 @@ using MySql.Data.MySqlClient; using Dapper; using solarApp.Model; using System.Configuration; +//using Google.Protobuf.WellKnownTypes; namespace solarApp.Service { @@ -31,6 +32,7 @@ namespace solarApp.Service //public string _date2 { get; set; } public string _powerStationID { get; set; } + procArchiveLog arclog = new procArchiveLog(); public bool clearData() { @@ -71,7 +73,8 @@ namespace solarApp.Service } catch (Exception ex) { - throw ex; + arclog.insert_log(_powerStationID, "clearData procStation", 0, "sensor_history_hour", "update sensor hour", "0", "", ex.Message, null, null); + // throw ex; } return result; } @@ -365,8 +368,8 @@ namespace solarApp.Service } catch (Exception ex) { - throw ex; - arclog.insert_log(_powerStationID, "insert_station ", 0, "insert_station", "insert_station", "0", "", ex.Message, conn, cmd); + //throw ex; + arclog.insert_log(_powerStationID, "insert_station ", 0, "insert_station", "insert_station", "0", "", ex.Message, null, null); } return result; } @@ -389,8 +392,9 @@ namespace solarApp.Service } catch (Exception ex) { - throw ex; - } + arclog.insert_log(_powerStationID, "update_powerStationPerHour ", 0, table_name, "update_powerStationPerHour", "0", "", ex.Message, null, null); + + } //result = await conn.QueryFirstOrDefaultAsync(sql, new { DateTime = dateTime }); //string col = $@"select Id, kwh, Today_kwh, Total_kwh, today_kwhkwp, today_money, total_money, today_PR, today_carbon, total_carbon, today_irradiance, SolarHour";