diff --git a/solarApp/Service/procInvSvc.cs b/solarApp/Service/procInvSvc.cs index dacc466..1348781 100644 --- a/solarApp/Service/procInvSvc.cs +++ b/solarApp/Service/procInvSvc.cs @@ -723,9 +723,12 @@ set a.inv_02 = b.inv_02 "); try { - cmd.CommandText = sql; - int rowCT = cmd.ExecuteNonQuery(); - + int rowCT = 0; + if (!String.IsNullOrEmpty(sql)) + { + cmd.CommandText = sql; + rowCT = cmd.ExecuteNonQuery(); + } sql = @$"DROP TABLE IF EXISTS temp_invDay{_powerStationID}_s1; "; //conn.Execute(ss); cmd.CommandText = sql; diff --git a/solarApp/fmArchive.cs b/solarApp/fmArchive.cs index 593d834..ef06a17 100644 --- a/solarApp/fmArchive.cs +++ b/solarApp/fmArchive.cs @@ -41,15 +41,16 @@ namespace solarApp { //string d1 = day.ToString("yyyy-MM-dd"); sensorSvc.archiveData(lbSiteID_sensor.Text.Substring(0, 9), day.ToString("yyyy-MM-dd")); - } + } //sensorSvc._siteDB = lbSiteDB_sensor.Text; //sensorSvc._siteID = lbSiteID_sensor.Text.Substring(0, 9); //sensorSvc._siteID01 = lbSiteID_sensor.Text; //sensorSvc._date1 = date1; //sensorSvc._date2 = date1; - + //sensorSvc.archiveData(); - MessageBox.Show("OK"); + //MessageBox.Show("OK"); + lbMsgTitle.Text = DateTime.Now.ToString() + " sensor OK"; } private void fmArchive_Load(object sender, EventArgs e) @@ -95,9 +96,10 @@ namespace solarApp private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { - if (System.DateTime.Now.Hour == 00 && DateTime.Now.Minute == 45) + if (System.DateTime.Now.Hour == 00 && DateTime.Now.Minute == 15) { - MessageBox.Show("ok"); + //MessageBox.Show("ok"); + lbMsgTitle.Text = DateTime.Now.ToString() + " timer start"; dtSelect1.Value = System.DateTime.Now.AddDays(-1); dtSelect2.Value = System.DateTime.Now.AddDays(-1); bt_archive.PerformClick(); @@ -151,9 +153,10 @@ namespace solarApp { //string d1 = day.ToString("yyyy-MM-dd"); invSvc.archiveData(lbSiteID_sensor.Text.Substring(0, 9), day.ToString("yyyy-MM-dd")); - } + } //sensorSvc.archiveData(); - MessageBox.Show("OK"); + //MessageBox.Show("OK"); + lbMsgTitle.Text = DateTime.Now.ToString() + " Inv OK"; } private void dtSelect_ValueChanged(object sender, EventArgs e) @@ -178,7 +181,8 @@ namespace solarApp //invSvc._date2 = date1; invSvc.clearData(); //sensorSvc.archiveData(); - MessageBox.Show("OK"); + //MessageBox.Show("OK"); + lbMsgTitle.Text = DateTime.Now.ToString() + " inv clear OK"; } private void bt_clear_station_Click(object sender, EventArgs e) @@ -193,7 +197,8 @@ namespace solarApp //siteSvc._date2 = date1; siteSvc.clearData(); //sensorSvc.archiveData(); - MessageBox.Show("OK"); + //MessageBox.Show("OK"); + lbMsgTitle.Text = DateTime.Now.ToString() + " clear station OK"; } private void bt_site_Click(object sender, EventArgs e) @@ -211,9 +216,10 @@ namespace solarApp { //string d1 = day.ToString("yyyy-MM-dd"); siteSvc.archiveData(lbSiteID_sensor.Text.Substring(0, 9), day.ToString("yyyy-MM-dd")); - } + } //sensorSvc.archiveData(); - MessageBox.Show("OK"); + //MessageBox.Show("OK"); + lbMsgTitle.Text = DateTime.Now.ToString() + " site OK"; } private void bt_archive_Click(object sender, EventArgs e) @@ -261,7 +267,8 @@ namespace solarApp //sensorSvc._date2 = date1; sensorSvc.clearData(); //sensorSvc.archiveData(); - MessageBox.Show("OK"); + //MessageBox.Show("OK"); + lbMsgTitle.Text = DateTime.Now.ToString() + " clear_sensor OK"; } private void lbSiteDB_sensor_Click(object sender, EventArgs e) @@ -277,7 +284,8 @@ namespace solarApp procSensorSvc sensorSvc = new procSensorSvc(); sensorSvc.archiveMeterData(lbSiteID_sensor.Text.Substring(0, 9), date1); - MessageBox.Show("OK"); + //MessageBox.Show("OK"); + lbMsgTitle.Text = DateTime.Now.ToString() + " meter OK"; } /// @@ -295,8 +303,9 @@ namespace solarApp { invSvc.report_invDay(lbSiteID_sensor.Text.Substring(0, 9), day.ToString("yyyy-MM-dd")); } - - MessageBox.Show("OK"); + + //MessageBox.Show("OK"); + lbMsgTitle.Text = DateTime.Now.ToString() + " 日報 OK"; } private void bt_invDay_Click(object sender, EventArgs e) @@ -426,7 +435,8 @@ namespace solarApp } i++; } - MessageBox.Show("OK"); + // MessageBox.Show("OK"); + lbMsgTitle.Text = DateTime.Now.ToString() + " sensor_lackData OK"; } private void bt_lackStation_Click(object sender, EventArgs e) @@ -443,7 +453,8 @@ namespace solarApp invSvc.report_invDay(item.SITEID, item.TIMESTAMP.ToString("yyyy-MM-dd")); // 補日報表 } - MessageBox.Show("OK"); + //MessageBox.Show("OK"); lackStation + lbMsgTitle.Text = DateTime.Now.ToString() + " lackStation OK"; } private void bt_updateInstantValue_Click(object sender, EventArgs e)