diff --git a/solarApp/Service/procSensorSvc.cs b/solarApp/Service/procSensorSvc.cs index d7e4fdd..444e8a0 100644 --- a/solarApp/Service/procSensorSvc.cs +++ b/solarApp/Service/procSensorSvc.cs @@ -278,7 +278,22 @@ namespace solarApp.Service foreach (var item in ds_sensor) { tableName = item.TableName; - break; + sql = @"select count(*) ct from " + _siteDB + "." + tableName + @" + where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 "; + cmd.Connection = conn; + cmd.CommandTimeout = 720; + cmd.Parameters.AddWithValue("@date1", _date1); + cmd.CommandText = sql; + string CT = cmd.ExecuteScalar().ToString(); + cmd.Parameters.Clear(); + if (!string.IsNullOrEmpty(CT)) + { + if (int.Parse(CT) >0) + { + tableName = item.TableName; + break; + } + } } sql = @"insert into sensor_history_hour( `PowerStationId`, `TIMESTAMP`, Irradiance, Temperature, EnvTemperature, Humidity, Vane, Dust, WingDirection, irrDay, irrDayHour) diff --git a/solarApp/fmArchive.Designer.cs b/solarApp/fmArchive.Designer.cs index 2b3c518..8bac954 100644 --- a/solarApp/fmArchive.Designer.cs +++ b/solarApp/fmArchive.Designer.cs @@ -772,7 +772,7 @@ namespace solarApp ClientSize = new System.Drawing.Size(1782, 1026); Controls.Add(tabControl1); Name = "fmArchive"; - Text = "fmArchive 0918"; + Text = "fmArchive 1229"; Load += fmArchive_Load; tabControl1.ResumeLayout(false); tabPage1.ResumeLayout(false); diff --git a/solarApp/fmArchive.cs b/solarApp/fmArchive.cs index 9e54489..0a0d1e4 100644 --- a/solarApp/fmArchive.cs +++ b/solarApp/fmArchive.cs @@ -108,7 +108,7 @@ namespace solarApp f2.Dock = DockStyle.Fill; f2.Show(); #endregion - logger.Information("start winform process @" + System.DateTime.Now.ToString()); + logger.Information("start winform process @" + System.DateTime.Now.ToString()); } private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)