Browse Source

设备状态调整

章政 7 years ago
parent
commit
8e9993d9e6

+ 2 - 2
PLCDataReader/Device/Information/DeviceStatusInfo.Designer.cs

@@ -449,7 +449,7 @@ namespace UAS_PLCDataReader.Device.Infomation
             this.drr_commandfrom.Name = "drr_commandfrom";
             this.drr_commandfrom.OptionsColumn.AllowEdit = false;
             this.drr_commandfrom.Visible = true;
-            this.drr_commandfrom.VisibleIndex = 1;
+            this.drr_commandfrom.VisibleIndex = 0;
             // 
             // drr_command
             // 
@@ -458,7 +458,7 @@ namespace UAS_PLCDataReader.Device.Infomation
             this.drr_command.Name = "drr_command";
             this.drr_command.OptionsColumn.AllowEdit = false;
             this.drr_command.Visible = true;
-            this.drr_command.VisibleIndex = 0;
+            this.drr_command.VisibleIndex = 1;
             // 
             // DeviceStatusInfo
             // 

+ 1 - 0
PLCDataReader/Device/Information/DeviceStatusInfo.cs

@@ -53,6 +53,7 @@ namespace UAS_PLCDataReader.Device.Infomation
             //查询设备运行日志
             sql.Append("select * from DEVICERUNRECORD where drr_decode='" + de_code + "'");
             GridDeviceRunLog.DataSource = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+            GridViewDeviceRunLog.BestFitColumns();
             sql.Clear();
             sql.Append("select '接收'||nvl(dpg_receivedatasize,0)||'字节' dpg_receivedatasize,'发送'||nvl(dpg_senddatasize,0)||'字节' dpg_senddatasize");
             sql.Append(",dpg_onlinetime,dpg_offlinetime,'IP:'||dnc_ip dnc_ip,'端口:'|| dnc_port||',间隔'||dpg_interval||'S' dnc_port,");

+ 5 - 5
PLCDataReader/Main.Designer.cs

@@ -33,7 +33,6 @@ namespace UAS_PLCDataReader
         /// </summary>
         private void InitializeComponent()
         {
-            this.components = new System.ComponentModel.Container();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
             this.RibbonNav = new DevExpress.XtraBars.Ribbon.RibbonControl();
             this.ButtonDeviceList = new DevExpress.XtraBars.BarButtonItem();
@@ -199,10 +198,10 @@ namespace UAS_PLCDataReader
             this.ButtonSaveClientParam = new DevExpress.XtraEditors.SimpleButton();
             this.UpdateTimeSpan = new System.Windows.Forms.NumericUpDown();
             this.label1 = new System.Windows.Forms.Label();
-            this.TimerDeviceStatus = new System.Windows.Forms.Timer(this.components);
-            this.CommonTipController = new DevExpress.Utils.ToolTipController(this.components);
-            this.TimerUpdateDevice = new System.Windows.Forms.Timer(this.components);
-            this.TimerUpdateSQL = new System.Windows.Forms.Timer(this.components);
+            this.TimerDeviceStatus = new System.Windows.Forms.Timer();
+            this.CommonTipController = new DevExpress.Utils.ToolTipController();
+            this.TimerUpdateDevice = new System.Windows.Forms.Timer();
+            this.TimerUpdateSQL = new System.Windows.Forms.Timer();
             ((System.ComponentModel.ISupportInitialize)(this.RibbonNav)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.MainTabControl)).BeginInit();
             this.MainTabControl.SuspendLayout();
@@ -2009,6 +2008,7 @@ namespace UAS_PLCDataReader
             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();

+ 6 - 1
PLCDataReader/Main.cs

@@ -585,10 +585,10 @@ namespace UAS_PLCDataReader
                         //检测键值对是否发生变化,发生变化时赋予新值并上传信息
                         if (BaseUtil.CheckDicDiff(ReturnData[Decode].ItemData, ItemData))
                         {
-                            ReturnData[Decode].ItemData = ItemData;
                             LogicHandler.UpdateDeviceData(Decode, ItemData);
                             LogicHandler.DoDeviceDataDiffLog(pl.DeviceCode, pl.DeviceName, Command, pl.CommandCode, User.UserName);
                         }
+                        ReturnData[Decode].ItemData = ItemData;
                     }
                     client[DpcID].Returnvalue.Remove(IP);
                 }
@@ -948,5 +948,10 @@ namespace UAS_PLCDataReader
             }
         }
         #endregion
+
+        private void Main_FormClosing(object sender, FormClosingEventArgs e)
+        {
+            dh.ExecuteSql("update devicerunstatus set dr_runstatus='disconnected'", "update");
+        }
     }
 }