水位管理 v0.9
This commit is contained in:
parent
2db530de20
commit
439b46ff96
@ -39,7 +39,10 @@ namespace solarApp.Service
|
|||||||
//_date1 = date1;
|
//_date1 = date1;
|
||||||
get_siteInfo();
|
get_siteInfo();
|
||||||
checkTable();
|
checkTable();
|
||||||
moveData();
|
|
||||||
|
moveData_station();
|
||||||
|
moveData_inv();
|
||||||
|
moveData_sensor();
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -277,63 +280,138 @@ namespace solarApp.Service
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool moveData()
|
bool moveData_station()
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
procArchiveLog arclog = new procArchiveLog();
|
||||||
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
|
DateTime dt_start1 = DateTime.Now;
|
||||||
|
var dateTime = DateTime.Now.ToString("yyyy-MM-dd HH");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var dateTime = DateTime.Now.ToString("yyyy-MM-dd HH");
|
|
||||||
|
|
||||||
#region station搬移
|
#region station搬移
|
||||||
System.Diagnostics.Debug.WriteLine($"【ArchiveRowData】開始執行[{_siteDB}.s{_siteID}_station]的資料表向[{_siteDB}_history.s{_siteID}_station]搬移");
|
//System.Diagnostics.Debug.WriteLine($"【ArchiveRowData】開始執行[{_siteDB}.s{_siteID}_station]的資料表向[{_siteDB}_history.s{_siteID}_station]搬移");
|
||||||
string for_insert_station = $@"INSERT {_siteDB}_history.s{_siteID01}_station
|
string for_insert_station = $@"INSERT {_siteDB}_history.s{_siteID01}_station(`ID`, `TIMESTAMP`, `SITEID`, `SITETYPE`, `CONTROLLERID`, `KWH`, `TODAYKWH`, `TOTALKWH`, `KWHKWP`, `PR`, `MP`, `SOLARHOUR`, `insertTime`)
|
||||||
SELECT * FROM {_siteDB}.s{_siteID01}_station
|
SELECT `ID`, `TIMESTAMP`, `SITEID`, `SITETYPE`, `CONTROLLERID`, `KWH`, `TODAYKWH`, `TOTALKWH`, `KWHKWP`, `PR`, `MP`, `SOLARHOUR`, `insertTime` FROM {_siteDB}.s{_siteID01}_station
|
||||||
WHERE FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') < '2022-07'";
|
WHERE FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') < '2022-07'";
|
||||||
int insert_station = conn.Execute(for_insert_station, commandTimeout : 600);
|
int rowCT = conn.Execute(for_insert_station, commandTimeout : 600);
|
||||||
System.Diagnostics.Debug.WriteLine($"【ArchiveRowData】{_siteDB}.s{_siteID}_station的七月前資料寫入至{_siteDB}_history.s{_siteID}_station【寫入成功】於{dateTime}");
|
// System.Diagnostics.Debug.WriteLine($"【ArchiveRowData】{_siteDB}.s{_siteID}_station的七月前資料寫入至{_siteDB}_history.s{_siteID}_station【寫入成功】於{dateTime}");
|
||||||
|
|
||||||
|
// log
|
||||||
|
TimeSpan duration = DateTime.Now - dt_start1;
|
||||||
|
arclog.insert_log(_powerStationID, "move raw s1", duration.TotalSeconds, $"{_siteDB}.s{_siteID}_station", $"{_siteDB}_history.s{_siteID}_station", "0", "", rowCT.ToString(), conn, null);
|
||||||
|
dt_start1 = DateTime.Now;
|
||||||
|
|
||||||
//刪除原本的資料
|
//刪除原本的資料
|
||||||
string for_delete_station = $@"DELETE FROM {_siteDB}.s{_siteID01}_station
|
string for_delete_station = $@"DELETE FROM {_siteDB}.s{_siteID01}_station
|
||||||
WHERE FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') < '2022-07'";
|
WHERE FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') < '2022-07'";
|
||||||
int delete_station = conn.Execute(for_delete_station, commandTimeout: 600);
|
rowCT = conn.Execute(for_delete_station, commandTimeout: 600);
|
||||||
System.Diagnostics.Debug.WriteLine($"【ArchiveRowData】{_siteDB}.s{_siteID}_sensoravg搬移至{_siteDB}_history.s{_siteID}_sensoravg【搬移資料成功】於{dateTime} 共 {delete_station.ToString()} 筆");
|
//System.Diagnostics.Debug.WriteLine($"【ArchiveRowData】{_siteDB}.s{_siteID}_sensoravg搬移至{_siteDB}_history.s{_siteID}_sensoravg【搬移資料成功】於{dateTime} 共 {delete_station.ToString()} 筆");
|
||||||
|
duration = DateTime.Now - dt_start1;
|
||||||
|
arclog.insert_log(_powerStationID, "delete raw s2", duration.TotalSeconds, $"{_siteDB}.s{_siteID}_station", "", "0", "", rowCT.ToString(), conn, null);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region inv搬移
|
|
||||||
System.Diagnostics.Debug.WriteLine($"【ArchiveRowData】開始執行[{_siteDB}.s{_siteID}_inv]的資料表向[{_siteDB}_history.s{_siteID}_inv]搬移");
|
|
||||||
string for_insert_inv = $@"INSERT {_siteDB}_history.s{_siteID01}_inv
|
|
||||||
SELECT * FROM {_siteDB}.s{_siteID01}_inv
|
|
||||||
WHERE LEFT(crdTime, 7) < '2022-07'";
|
|
||||||
int insert_inv = conn.Execute(for_insert_inv, commandTimeout : 600);
|
|
||||||
System.Diagnostics.Debug.WriteLine($"【ArchiveRowData】{_siteDB}.s{_siteID}_inv的七月前資料寫入至{_siteDB}_history.s{_siteID}_inv【寫入成功】於{dateTime}");
|
|
||||||
|
|
||||||
string for_delete_inv = $@"DELETE FROM {_siteDB}.s{_siteID01}_inv
|
|
||||||
WHERE LEFT(crdTime, 7) < '2022-07'";
|
|
||||||
int delete_inv = conn.Execute(for_delete_inv, commandTimeout: 6000);
|
|
||||||
System.Diagnostics.Debug.WriteLine($"【ArchiveRowData】{_siteDB}.s{_siteID}_sensoravg搬移至{_siteDB}_history.s{_siteID}_sensoravg【搬移資料成功】於{dateTime} 共 {delete_inv.ToString()} 筆");
|
|
||||||
#endregion
|
|
||||||
#region sensoravg搬移
|
|
||||||
System.Diagnostics.Debug.WriteLine($"【ArchiveRowData】開始執行[{_siteDB}.s{_siteID}_sensoravg]的資料表向[{_siteDB}_history.s{_siteID}_sensoravg]搬移");
|
|
||||||
string for_insert_sensoravg = $@"INSERT {_siteDB}_history.s{_siteID01}_sensoravg
|
|
||||||
SELECT * FROM {_siteDB}.s{_siteID01}_sensoravg
|
|
||||||
WHERE LEFT(crdTime, 7) < '2022-07'";
|
|
||||||
int insert_sensoravg = conn.Execute(for_insert_sensoravg, commandTimeout : 600);
|
|
||||||
System.Diagnostics.Debug.WriteLine($"【ArchiveRowData】{_siteDB}.s{_siteID}_sensoravg的七月前資料寫入至{_siteDB}_history.s{_siteID}_sensoravg【寫入成功】於{dateTime}");
|
|
||||||
string for_delete_sensoravg = $@"DELETE FROM {_siteDB}.s{_siteID01}_sensoravg
|
|
||||||
WHERE LEFT(crdTime, 7) < '2022-07'";
|
|
||||||
int delete_sensoravg = conn.Execute(for_delete_sensoravg, commandTimeout: 600);
|
|
||||||
System.Diagnostics.Debug.WriteLine($"【ArchiveRowData】{_siteDB}.s{_siteID}_sensoravg搬移至{_siteDB}_history.s{_siteID}_sensoravg【搬移資料成功】於{dateTime} 共 {delete_sensoravg.ToString()} 筆");
|
|
||||||
#endregion
|
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
System.Diagnostics.Debug.WriteLine("【ArchiveRowData】[搬移資料失敗】");
|
//System.Diagnostics.Debug.WriteLine("【ArchiveRowData】[搬移資料失敗】");
|
||||||
|
TimeSpan duration = DateTime.Now - dt_start1;
|
||||||
|
arclog.insert_log(_powerStationID, "move raw s1", duration.TotalSeconds, $"{_siteDB}.s{_siteID}_station", $"{_siteDB}_history.s{_siteID}_station", "1", ex.Message, "0", conn, null);
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
|
||||||
|
conn.Close();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool moveData_inv()
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
procArchiveLog arclog = new procArchiveLog();
|
||||||
|
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
||||||
|
{
|
||||||
|
conn.Open();
|
||||||
|
DateTime dt_start1 = DateTime.Now;
|
||||||
|
var dateTime = DateTime.Now.ToString("yyyy-MM-dd HH");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
#region inv搬移
|
||||||
|
dt_start1 = DateTime.Now;
|
||||||
|
// System.Diagnostics.Debug.WriteLine($"【ArchiveRowData】開始執行[{_siteDB}.s{_siteID}_inv]的資料表向[{_siteDB}_history.s{_siteID}_inv]搬移");
|
||||||
|
string for_insert_inv = $@"INSERT {_siteDB}_history.s{_siteID01}_inv
|
||||||
|
SELECT * FROM {_siteDB}.s{_siteID01}_inv
|
||||||
|
WHERE LEFT(crdTime, 7) < '2022-07' ";
|
||||||
|
int rowCT = conn.Execute(for_insert_inv, commandTimeout: 6000);
|
||||||
|
//System.Diagnostics.Debug.WriteLine($"【ArchiveRowData】{_siteDB}.s{_siteID}_inv的七月前資料寫入至{_siteDB}_history.s{_siteID}_inv【寫入成功】於{dateTime}");
|
||||||
|
// log
|
||||||
|
TimeSpan duration = DateTime.Now - dt_start1;
|
||||||
|
arclog.insert_log(_powerStationID, "move raw s1", duration.TotalSeconds, $"{_siteDB}.s{_siteID01}_inv", $"{_siteDB}_history.s{_siteID01}_inv", "0", "", rowCT.ToString(), conn, null);
|
||||||
|
dt_start1 = DateTime.Now;
|
||||||
|
|
||||||
|
string for_delete_inv = $@"DELETE FROM {_siteDB}.s{_siteID01}_inv
|
||||||
|
WHERE LEFT(crdTime, 7) < '2022-07'";
|
||||||
|
rowCT = conn.Execute(for_delete_inv, commandTimeout: 6000);
|
||||||
|
//System.Diagnostics.Debug.WriteLine($"【ArchiveRowData】{_siteDB}.s{_siteID}_sensoravg搬移至{_siteDB}_history.s{_siteID}_sensoravg【搬移資料成功】於{dateTime} 共 {delete_inv.ToString()} 筆");
|
||||||
|
duration = DateTime.Now - dt_start1;
|
||||||
|
arclog.insert_log(_powerStationID, "delete raw s2", duration.TotalSeconds, $"{_siteDB}.s{_siteID01}_inv", "", "0", "", rowCT.ToString(), conn, null);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TimeSpan duration = DateTime.Now - dt_start1;
|
||||||
|
arclog.insert_log(_powerStationID, "move raw s1", duration.TotalSeconds, $"{_siteDB}.s{_siteID01}_station", $"{_siteDB}_history.s{_siteID01}_station", "1", ex.Message, "0", conn, null);
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
conn.Close();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool moveData_sensor() {
|
||||||
|
bool result = false;
|
||||||
|
procArchiveLog arclog = new procArchiveLog();
|
||||||
|
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
||||||
|
{
|
||||||
|
conn.Open();
|
||||||
|
DateTime dt_start1 = DateTime.Now;
|
||||||
|
var dateTime = DateTime.Now.ToString("yyyy-MM-dd HH");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
#region sensoravg搬移
|
||||||
|
dt_start1 = DateTime.Now;
|
||||||
|
//System.Diagnostics.Debug.WriteLine($"【ArchiveRowData】開始執行[{_siteDB}.s{_siteID}_sensoravg]的資料表向[{_siteDB}_history.s{_siteID}_sensoravg]搬移");
|
||||||
|
string for_insert_sensoravg = $@"INSERT {_siteDB}_history.s{_siteID01}_sensoravg
|
||||||
|
SELECT * FROM {_siteDB}.s{_siteID01}_sensoravg
|
||||||
|
WHERE LEFT(crdTime, 7) < '2022-07'";
|
||||||
|
int rowCT = conn.Execute(for_insert_sensoravg, commandTimeout: 600);
|
||||||
|
// log
|
||||||
|
TimeSpan duration = DateTime.Now - dt_start1;
|
||||||
|
arclog.insert_log(_powerStationID, "move raw s1", duration.TotalSeconds, $"{_siteDB}.s{_siteID01}_sensoravg", $"{_siteDB}_history.s{_siteID01}_sensoravg", "0", "", rowCT.ToString(), conn, null);
|
||||||
|
dt_start1 = DateTime.Now;
|
||||||
|
|
||||||
|
string for_delete_sensoravg = $@"DELETE FROM {_siteDB}.s{_siteID01}_sensoravg WHERE LEFT(crdTime, 7) < '2022-07'";
|
||||||
|
rowCT = conn.Execute(for_delete_sensoravg, commandTimeout: 600);
|
||||||
|
|
||||||
|
duration = DateTime.Now - dt_start1;
|
||||||
|
arclog.insert_log(_powerStationID, "delete raw s2", duration.TotalSeconds, $"{_siteDB}.s{_siteID01}_sensoravg", "", "0", "", rowCT.ToString(), conn, null);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TimeSpan duration = DateTime.Now - dt_start1;
|
||||||
|
arclog.insert_log(_powerStationID, "move raw s1", duration.TotalSeconds, $"{_siteDB}.s{_siteID01}_sensoravg", $"{_siteDB}_history.s{_siteID01}_sensoravg", "1", ex.Message, "0", conn, null);
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
conn.Close();
|
conn.Close();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@ -180,7 +180,8 @@ namespace solarApp.Service
|
|||||||
conn.Open(); // 01 控制器編號
|
conn.Open(); // 01 控制器編號
|
||||||
string sql = @" select id, CompanyId, `code` , SerialNumber, CONCAT(`code` ,'01') SiteID, SiteDB, `name` SiteName
|
string sql = @" select id, CompanyId, `code` , SerialNumber, CONCAT(`code` ,'01') SiteID, SiteDB, `name` SiteName
|
||||||
from power_station
|
from power_station
|
||||||
where deleted = 0 and `status`= 1";
|
where deleted = 0 and `status`= 1 ";
|
||||||
|
// id <> 14";and id > 24
|
||||||
List<station_list> ds = conn.Query<station_list>(sql).AsList<station_list>();
|
List<station_list> ds = conn.Query<station_list>(sql).AsList<station_list>();
|
||||||
conn.Close();
|
conn.Close();
|
||||||
return ds;
|
return ds;
|
||||||
|
|||||||
@ -17,16 +17,23 @@ namespace solarApp.Service
|
|||||||
/// <param name="errMessage">異常資訊</param>
|
/// <param name="errMessage">異常資訊</param>
|
||||||
/// <param name="myCon">連線資訊</param>
|
/// <param name="myCon">連線資訊</param>
|
||||||
/// <param name="cmd">command物件</param>
|
/// <param name="cmd">command物件</param>
|
||||||
public void insert_log(string power_stationID, string action_name, double duration_sec, string src_table, string dest_table, string procResult, string errMessage, string note, MySqlConnection myCon , MySqlCommand cmd) {
|
public void insert_log(string power_stationID, string action_name, double duration_sec, string src_table, string dest_table, string procResult, string errMessage, string note, MySqlConnection myCon , MySqlCommand cmd = null) {
|
||||||
|
|
||||||
|
MySqlCommand _cmd = new MySqlCommand();
|
||||||
|
if (cmd == null) {
|
||||||
|
_cmd.Connection = myCon;
|
||||||
|
_cmd.CommandTimeout = 720;
|
||||||
|
}
|
||||||
|
else _cmd = cmd;
|
||||||
|
|
||||||
string nowTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
string nowTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
//string procResult = (string.IsNullOrEmpty(errMessage)) ? "0" : "1";
|
//string procResult = (string.IsNullOrEmpty(errMessage)) ? "0" : "1";
|
||||||
string sql = @"INSERT INTO `solar_master`.`log_archive`(power_stationID, `action_name`, `action_time`, `duration_sec`, `src_table`, `dest_table`, `result`, `err_txt`, `note`)
|
string sql = @"INSERT INTO `solar_master`.`log_archive`(power_stationID, `action_name`, `action_time`, `duration_sec`, `src_table`, `dest_table`, `result`, `err_txt`, `note`)
|
||||||
VALUES ("+ power_stationID + ", '" + action_name + "', '" + nowTime + "', " + duration_sec + ", '" + // action_time, duration_sec
|
VALUES ("+ power_stationID + ", '" + action_name + "', '" + nowTime + "', " + duration_sec + ", '" + // action_time, duration_sec
|
||||||
src_table + "', '"+ dest_table + "', b'"+ procResult + "', '" + // src_table, dest_table, result
|
src_table + "', '"+ dest_table + "', b'"+ procResult + "', '" + // src_table, dest_table, result
|
||||||
errMessage + "', '"+ note +"');"; // err_txt
|
errMessage + "', '"+ note +"');"; // err_txt
|
||||||
cmd.CommandText = sql;
|
_cmd.CommandText = sql;
|
||||||
cmd.ExecuteNonQuery();
|
_cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
36
solarApp/fmArchive.Designer.cs
generated
36
solarApp/fmArchive.Designer.cs
generated
@ -30,11 +30,12 @@ namespace solarApp
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||||
|
this.button2 = new System.Windows.Forms.Button();
|
||||||
this.bt_archive_One = new System.Windows.Forms.Button();
|
this.bt_archive_One = new System.Windows.Forms.Button();
|
||||||
this.bt_lackStation = new System.Windows.Forms.Button();
|
this.bt_lackStation = new System.Windows.Forms.Button();
|
||||||
this.bt_sensor_lackData = new System.Windows.Forms.Button();
|
this.bt_sensor_lackData = new System.Windows.Forms.Button();
|
||||||
@ -83,7 +84,6 @@ namespace solarApp
|
|||||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||||
this.button1 = new System.Windows.Forms.Button();
|
this.button1 = new System.Windows.Forms.Button();
|
||||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||||
this.button2 = new System.Windows.Forms.Button();
|
|
||||||
this.tabControl1.SuspendLayout();
|
this.tabControl1.SuspendLayout();
|
||||||
this.tabPage1.SuspendLayout();
|
this.tabPage1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||||
@ -164,6 +164,17 @@ namespace solarApp
|
|||||||
this.splitContainer1.SplitterWidth = 10;
|
this.splitContainer1.SplitterWidth = 10;
|
||||||
this.splitContainer1.TabIndex = 0;
|
this.splitContainer1.TabIndex = 0;
|
||||||
//
|
//
|
||||||
|
// button2
|
||||||
|
//
|
||||||
|
this.button2.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.button2.Location = new System.Drawing.Point(170, 576);
|
||||||
|
this.button2.Name = "button2";
|
||||||
|
this.button2.Size = new System.Drawing.Size(135, 44);
|
||||||
|
this.button2.TabIndex = 17;
|
||||||
|
this.button2.Text = "Sensor 歸檔";
|
||||||
|
this.button2.UseVisualStyleBackColor = true;
|
||||||
|
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||||
|
//
|
||||||
// bt_archive_One
|
// bt_archive_One
|
||||||
//
|
//
|
||||||
this.bt_archive_One.Location = new System.Drawing.Point(10, 850);
|
this.bt_archive_One.Location = new System.Drawing.Point(10, 850);
|
||||||
@ -346,8 +357,8 @@ namespace solarApp
|
|||||||
//
|
//
|
||||||
this.gv_inv_detail.AllowUserToAddRows = false;
|
this.gv_inv_detail.AllowUserToAddRows = false;
|
||||||
this.gv_inv_detail.AllowUserToDeleteRows = false;
|
this.gv_inv_detail.AllowUserToDeleteRows = false;
|
||||||
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
dataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||||
this.gv_inv_detail.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
|
this.gv_inv_detail.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
|
||||||
this.gv_inv_detail.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
this.gv_inv_detail.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.gv_inv_detail.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.gv_inv_detail.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.gv_inv_detail.Location = new System.Drawing.Point(768, 75);
|
this.gv_inv_detail.Location = new System.Drawing.Point(768, 75);
|
||||||
@ -363,8 +374,8 @@ namespace solarApp
|
|||||||
//
|
//
|
||||||
this.gv_rpt_invDay.AllowUserToAddRows = false;
|
this.gv_rpt_invDay.AllowUserToAddRows = false;
|
||||||
this.gv_rpt_invDay.AllowUserToDeleteRows = false;
|
this.gv_rpt_invDay.AllowUserToDeleteRows = false;
|
||||||
dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||||
this.gv_rpt_invDay.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle2;
|
this.gv_rpt_invDay.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4;
|
||||||
this.gv_rpt_invDay.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
this.gv_rpt_invDay.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.gv_rpt_invDay.Dock = System.Windows.Forms.DockStyle.Left;
|
this.gv_rpt_invDay.Dock = System.Windows.Forms.DockStyle.Left;
|
||||||
this.gv_rpt_invDay.Location = new System.Drawing.Point(0, 75);
|
this.gv_rpt_invDay.Location = new System.Drawing.Point(0, 75);
|
||||||
@ -682,16 +693,9 @@ namespace solarApp
|
|||||||
this.button1.UseVisualStyleBackColor = true;
|
this.button1.UseVisualStyleBackColor = true;
|
||||||
this.button1.Click += new System.EventHandler(this.button1_Click_1);
|
this.button1.Click += new System.EventHandler(this.button1_Click_1);
|
||||||
//
|
//
|
||||||
// button2
|
// timer1
|
||||||
//
|
//
|
||||||
this.button2.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.timer1.Interval = 10000;
|
||||||
this.button2.Location = new System.Drawing.Point(170, 576);
|
|
||||||
this.button2.Name = "button2";
|
|
||||||
this.button2.Size = new System.Drawing.Size(135, 44);
|
|
||||||
this.button2.TabIndex = 17;
|
|
||||||
this.button2.Text = "Sensor 歸檔";
|
|
||||||
this.button2.UseVisualStyleBackColor = true;
|
|
||||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
|
||||||
//
|
//
|
||||||
// fmArchive
|
// fmArchive
|
||||||
//
|
//
|
||||||
|
|||||||
@ -97,6 +97,7 @@ 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 == 15)
|
if (System.DateTime.Now.Hour == 00 && DateTime.Now.Minute == 15)
|
||||||
{
|
{
|
||||||
//MessageBox.Show("ok");
|
//MessageBox.Show("ok");
|
||||||
@ -106,6 +107,23 @@ namespace solarApp
|
|||||||
bt_archive.PerformClick();
|
bt_archive.PerformClick();
|
||||||
//bt_archive_Click.PerformClick();
|
//bt_archive_Click.PerformClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//水位管理
|
||||||
|
if (System.DateTime.Now.Hour == 03 && DateTime.Now.Minute == 30 && DateTime.Now.Second == 00)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
var site_list = stationSvc.get_station_list();
|
||||||
|
|
||||||
|
archiveLowData archiveData = new archiveLowData();
|
||||||
|
|
||||||
|
foreach (var item in site_list)
|
||||||
|
{
|
||||||
|
archiveData.archiveData(item.SiteID.Substring(0, 9));
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
lbMsgTitle.Text = System.DateTime.Now.ToString() + " 水位管理 - 資料搬移完成!";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rb_site_CheckedChanged(object sender, EventArgs e)
|
private void rb_site_CheckedChanged(object sender, EventArgs e)
|
||||||
@ -637,9 +655,10 @@ namespace solarApp
|
|||||||
foreach (var item in site_list)
|
foreach (var item in site_list)
|
||||||
{
|
{
|
||||||
archiveData.archiveData(item.SiteID.Substring(0, 9));
|
archiveData.archiveData(item.SiteID.Substring(0, 9));
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
lbMsgTitle.Text = System.DateTime.Now.ToString() + " 完成!";
|
lbMsgTitle.Text = System.DateTime.Now.ToString() + " 水位管理 - 資料搬移完成!";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void button2_Click(object sender, EventArgs e)
|
private void button2_Click(object sender, EventArgs e)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user