Browse Source

程序关闭之前离线所有设备

章政 7 years ago
parent
commit
0e35d6cf91

+ 1 - 1
UAS_DeviceMonitor/Device/Information/DeviceStatusInfo.cs

@@ -39,7 +39,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             {
                 BaseUtil.SetFormValue(Controls, dt);
             }
-            dt = (DataTable)dh.ExecuteSql("select dpg_count,round((sysdate-dpg_starttime)*1440)||'分钟' dpg_runtime,dpg_starttime,dpg_senddatasize,dpg_receivedatasize from DEVICEPOLLINGLOG where dpg_id=(select max(dpg_id) from DEVICEPOLLINGLOG where dpg_decode='" + de_code + "')", "select");
+            dt = (DataTable)dh.ExecuteSql("select dpg_count,round((sysdate-dpg_starttime)*1440)||'分钟' dpg_runtime,dpg_starttime,dpg_senddatasize,dpg_receivedatasize from DEVICEPOLLINGLOG where dpg_id=(select max(dpg_id) from DEVICEPOLLINGLOG where dpg_decode='" + de_code + "') and dpg_status='Running'", "select");
             if (dt.Rows.Count > 0)
             {
                 BaseUtil.SetFormValue(Controls, dt);

+ 1 - 1
UAS_DeviceMonitor/Main.Designer.cs

@@ -296,7 +296,6 @@ namespace UAS_DeviceMonitor
             // RibDeviceCommand
             // 
             this.RibDeviceCommand.ItemLinks.Add(this.ButtonDeviceStatus);
-            this.RibDeviceCommand.ItemLinks.Add(this.ButtonWorkCenterStatus);
             this.RibDeviceCommand.Name = "RibDeviceCommand";
             this.RibDeviceCommand.Text = "ribbonPageGroup3";
             // 
@@ -1338,6 +1337,7 @@ namespace UAS_DeviceMonitor
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
             this.Text = "设备监控管理平台";
             this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Main_FormClosing);
             this.Load += new System.EventHandler(this.Main_Load);
             ((System.ComponentModel.ISupportInitialize)(this.RibbonNav)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.MainTabControl)).EndInit();

+ 10 - 0
UAS_DeviceMonitor/Main.cs

@@ -118,6 +118,16 @@ namespace UAS_DeviceMonitor
 
             Ptime = new Dictionary<int, PollingTimer>();
         }
+        /// <summary>
+        /// 关闭前将所有设备离线,状态更新为离线
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void Main_FormClosing(object sender, FormClosingEventArgs e)
+        {
+            dh.ExecuteSql("update devicepollingconfig set dpc_status='Stop' where dpc_status='Running'", "update");
+            dh.ExecuteSql("update devicepollinglog set dpg_status='Stop' where dpg_status='Running'", "update");
+        }
         #endregion
 
         #region 设备列表界面