debug 單一 inv 日報表 SQL 語法問題

This commit is contained in:
cesar liu 2022-06-21 10:40:18 +08:00
parent 6e5b27c709
commit 008c98feec
2 changed files with 34 additions and 20 deletions

View File

@ -723,9 +723,12 @@ set a.inv_02 = b.inv_02 ");
try try
{ {
cmd.CommandText = sql; int rowCT = 0;
int rowCT = cmd.ExecuteNonQuery(); if (!String.IsNullOrEmpty(sql))
{
cmd.CommandText = sql;
rowCT = cmd.ExecuteNonQuery();
}
sql = @$"DROP TABLE IF EXISTS temp_invDay{_powerStationID}_s1; "; sql = @$"DROP TABLE IF EXISTS temp_invDay{_powerStationID}_s1; ";
//conn.Execute(ss); //conn.Execute(ss);
cmd.CommandText = sql; cmd.CommandText = sql;

View File

@ -49,7 +49,8 @@ namespace solarApp
//sensorSvc._date2 = date1; //sensorSvc._date2 = date1;
//sensorSvc.archiveData(); //sensorSvc.archiveData();
MessageBox.Show("OK"); //MessageBox.Show("OK");
lbMsgTitle.Text = DateTime.Now.ToString() + " sensor OK";
} }
private void fmArchive_Load(object sender, EventArgs e) private void fmArchive_Load(object sender, EventArgs e)
@ -95,9 +96,10 @@ namespace solarApp
private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) 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); dtSelect1.Value = System.DateTime.Now.AddDays(-1);
dtSelect2.Value = System.DateTime.Now.AddDays(-1); dtSelect2.Value = System.DateTime.Now.AddDays(-1);
bt_archive.PerformClick(); bt_archive.PerformClick();
@ -153,7 +155,8 @@ namespace solarApp
invSvc.archiveData(lbSiteID_sensor.Text.Substring(0, 9), day.ToString("yyyy-MM-dd")); invSvc.archiveData(lbSiteID_sensor.Text.Substring(0, 9), day.ToString("yyyy-MM-dd"));
} }
//sensorSvc.archiveData(); //sensorSvc.archiveData();
MessageBox.Show("OK"); //MessageBox.Show("OK");
lbMsgTitle.Text = DateTime.Now.ToString() + " Inv OK";
} }
private void dtSelect_ValueChanged(object sender, EventArgs e) private void dtSelect_ValueChanged(object sender, EventArgs e)
@ -178,7 +181,8 @@ namespace solarApp
//invSvc._date2 = date1; //invSvc._date2 = date1;
invSvc.clearData(); invSvc.clearData();
//sensorSvc.archiveData(); //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) private void bt_clear_station_Click(object sender, EventArgs e)
@ -193,7 +197,8 @@ namespace solarApp
//siteSvc._date2 = date1; //siteSvc._date2 = date1;
siteSvc.clearData(); siteSvc.clearData();
//sensorSvc.archiveData(); //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) private void bt_site_Click(object sender, EventArgs e)
@ -213,7 +218,8 @@ namespace solarApp
siteSvc.archiveData(lbSiteID_sensor.Text.Substring(0, 9), day.ToString("yyyy-MM-dd")); siteSvc.archiveData(lbSiteID_sensor.Text.Substring(0, 9), day.ToString("yyyy-MM-dd"));
} }
//sensorSvc.archiveData(); //sensorSvc.archiveData();
MessageBox.Show("OK"); //MessageBox.Show("OK");
lbMsgTitle.Text = DateTime.Now.ToString() + " site OK";
} }
private void bt_archive_Click(object sender, EventArgs e) private void bt_archive_Click(object sender, EventArgs e)
@ -261,7 +267,8 @@ namespace solarApp
//sensorSvc._date2 = date1; //sensorSvc._date2 = date1;
sensorSvc.clearData(); sensorSvc.clearData();
//sensorSvc.archiveData(); //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) private void lbSiteDB_sensor_Click(object sender, EventArgs e)
@ -277,7 +284,8 @@ namespace solarApp
procSensorSvc sensorSvc = new procSensorSvc(); procSensorSvc sensorSvc = new procSensorSvc();
sensorSvc.archiveMeterData(lbSiteID_sensor.Text.Substring(0, 9), date1); sensorSvc.archiveMeterData(lbSiteID_sensor.Text.Substring(0, 9), date1);
MessageBox.Show("OK"); //MessageBox.Show("OK");
lbMsgTitle.Text = DateTime.Now.ToString() + " meter OK";
} }
/// <summary> /// <summary>
@ -296,7 +304,8 @@ namespace solarApp
invSvc.report_invDay(lbSiteID_sensor.Text.Substring(0, 9), day.ToString("yyyy-MM-dd")); 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) private void bt_invDay_Click(object sender, EventArgs e)
@ -426,7 +435,8 @@ namespace solarApp
} }
i++; i++;
} }
MessageBox.Show("OK"); // MessageBox.Show("OK");
lbMsgTitle.Text = DateTime.Now.ToString() + " sensor_lackData OK";
} }
private void bt_lackStation_Click(object sender, EventArgs e) 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")); // 補日報表 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) private void bt_updateInstantValue_Click(object sender, EventArgs e)