Ver Fonte

轮询优化

章政 há 7 anos atrás
pai
commit
8a176ac81c

+ 11 - 11
UAS_DeviceMonitor/Device/Information/DeviceDetailInfo.Designer.cs

@@ -79,7 +79,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             // dnc_type
             // 
             this.dnc_type.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.dnc_type.Location = new System.Drawing.Point(71, 204);
+            this.dnc_type.Location = new System.Drawing.Point(79, 164);
             this.dnc_type.Name = "dnc_type";
             this.dnc_type.Size = new System.Drawing.Size(0, 16);
             this.dnc_type.TabIndex = 23;
@@ -87,7 +87,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             // dnc_upperip
             // 
             this.dnc_upperip.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.dnc_upperip.Location = new System.Drawing.Point(71, 171);
+            this.dnc_upperip.Location = new System.Drawing.Point(79, 194);
             this.dnc_upperip.Name = "dnc_upperip";
             this.dnc_upperip.Size = new System.Drawing.Size(0, 16);
             this.dnc_upperip.TabIndex = 22;
@@ -95,7 +95,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             // dnc_type_label
             // 
             this.dnc_type_label.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.dnc_type_label.Location = new System.Drawing.Point(13, 204);
+            this.dnc_type_label.Location = new System.Drawing.Point(13, 164);
             this.dnc_type_label.Name = "dnc_type_label";
             this.dnc_type_label.Size = new System.Drawing.Size(32, 16);
             this.dnc_type_label.TabIndex = 21;
@@ -104,7 +104,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             // dnc_upperip_label
             // 
             this.dnc_upperip_label.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.dnc_upperip_label.Location = new System.Drawing.Point(13, 171);
+            this.dnc_upperip_label.Location = new System.Drawing.Point(13, 194);
             this.dnc_upperip_label.Name = "dnc_upperip_label";
             this.dnc_upperip_label.Size = new System.Drawing.Size(48, 16);
             this.dnc_upperip_label.TabIndex = 20;
@@ -113,7 +113,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             // dnc_mac
             // 
             this.dnc_mac.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.dnc_mac.Location = new System.Drawing.Point(71, 140);
+            this.dnc_mac.Location = new System.Drawing.Point(79, 71);
             this.dnc_mac.Name = "dnc_mac";
             this.dnc_mac.Size = new System.Drawing.Size(0, 16);
             this.dnc_mac.TabIndex = 19;
@@ -121,7 +121,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             // dnc_gateway
             // 
             this.dnc_gateway.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.dnc_gateway.Location = new System.Drawing.Point(71, 106);
+            this.dnc_gateway.Location = new System.Drawing.Point(79, 132);
             this.dnc_gateway.Name = "dnc_gateway";
             this.dnc_gateway.Size = new System.Drawing.Size(0, 16);
             this.dnc_gateway.TabIndex = 18;
@@ -129,7 +129,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             // dnc_mac_label
             // 
             this.dnc_mac_label.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.dnc_mac_label.Location = new System.Drawing.Point(13, 140);
+            this.dnc_mac_label.Location = new System.Drawing.Point(13, 71);
             this.dnc_mac_label.Name = "dnc_mac_label";
             this.dnc_mac_label.Size = new System.Drawing.Size(24, 16);
             this.dnc_mac_label.TabIndex = 6;
@@ -138,7 +138,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             // dnc_port
             // 
             this.dnc_port.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.dnc_port.Location = new System.Drawing.Point(71, 74);
+            this.dnc_port.Location = new System.Drawing.Point(79, 100);
             this.dnc_port.Name = "dnc_port";
             this.dnc_port.Size = new System.Drawing.Size(0, 16);
             this.dnc_port.TabIndex = 17;
@@ -146,7 +146,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             // dnc_gateway_label
             // 
             this.dnc_gateway_label.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.dnc_gateway_label.Location = new System.Drawing.Point(13, 106);
+            this.dnc_gateway_label.Location = new System.Drawing.Point(13, 132);
             this.dnc_gateway_label.Name = "dnc_gateway_label";
             this.dnc_gateway_label.Size = new System.Drawing.Size(32, 16);
             this.dnc_gateway_label.TabIndex = 5;
@@ -155,7 +155,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             // dnc_ip
             // 
             this.dnc_ip.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.dnc_ip.Location = new System.Drawing.Point(71, 41);
+            this.dnc_ip.Location = new System.Drawing.Point(79, 41);
             this.dnc_ip.Name = "dnc_ip";
             this.dnc_ip.Size = new System.Drawing.Size(0, 16);
             this.dnc_ip.TabIndex = 16;
@@ -163,7 +163,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             // dnc_port_label
             // 
             this.dnc_port_label.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.dnc_port_label.Location = new System.Drawing.Point(13, 74);
+            this.dnc_port_label.Location = new System.Drawing.Point(13, 100);
             this.dnc_port_label.Name = "dnc_port_label";
             this.dnc_port_label.Size = new System.Drawing.Size(32, 16);
             this.dnc_port_label.TabIndex = 4;

+ 11 - 4
UAS_DeviceMonitor/Device/Information/DeviceDetailInfo.cs

@@ -21,6 +21,13 @@ namespace UAS_DeviceMonitor.Device.Infomation
         {
             InitializeComponent();
             repositoryItemCheckEdit1.QueryCheckStateByValue += RepositoryItemCheckEdit1_QueryCheckStateByValue;
+            KeyDown += DeviceDetailInfo_KeyDown;
+        }
+
+        private void DeviceDetailInfo_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.KeyCode == Keys.Escape)
+                Close();
         }
 
         private void RepositoryItemCheckEdit1_QueryCheckStateByValue(object sender, DevExpress.XtraEditors.Controls.QueryCheckStateByValueEventArgs e)
@@ -39,15 +46,15 @@ namespace UAS_DeviceMonitor.Device.Infomation
                 case "TRUE":
                 case "YES":
                 case "1":
-                    e.CheckState = System.Windows.Forms.CheckState.Checked;
+                    e.CheckState = CheckState.Checked;
                     break;
                 case "FALSE":
                 case "NO":
                 case "0":
-                    e.CheckState = System.Windows.Forms.CheckState.Unchecked;
+                    e.CheckState = CheckState.Unchecked;
                     break;
                 default:
-                    e.CheckState = System.Windows.Forms.CheckState.Checked;
+                    e.CheckState = CheckState.Checked;
                     break;
             }
             e.Handled = true;
@@ -67,7 +74,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             {
                 BaseUtil.SetFormValue(Controls, dt);
             }
-            dt = (DataTable)dh.ExecuteSql("SELECT DC_CODE,DC_NAME,to_char(DPC_ENABLE)DPC_ENABLE  FROM DEVICEPOLLINGCONFIG LEFT JOIN DEVICECOMMAND ON DPC_DCCODE=DC_CODE WHERE DPC_DECODE='" + de_code + "'", "select");
+            dt = (DataTable)dh.ExecuteSql("SELECT DC_CODE,DC_NAME,to_char(DPC_ENABLE)DPC_ENABLE FROM DEVICEPOLLINGCONFIG LEFT JOIN DEVICECOMMAND ON DPC_DCCODE=DC_CODE WHERE DPC_DECODE='" + de_code + "'", "select");
             GridDeviceDetailInfo.DataSource = dt;
         }
 

+ 0 - 2
UAS_DeviceMonitor/Device/Information/DeviceStatusInfo.cs

@@ -49,9 +49,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
         private void DeviceStatusInfo_KeyDown(object sender, KeyEventArgs e)
         {
             if (e.KeyCode == Keys.Escape)
-            {
                 Close();
-            }
         }
     }
 }

+ 1 - 1
UAS_DeviceMonitor/Main.Designer.cs

@@ -941,7 +941,7 @@ namespace UAS_DeviceMonitor
             // 
             // dpc_interval
             // 
-            this.dpc_interval.Caption = "轮询间隔";
+            this.dpc_interval.Caption = "轮询间隔(秒)";
             this.dpc_interval.FieldName = "DPC_INTERVAL";
             this.dpc_interval.Name = "dpc_interval";
             this.dpc_interval.Visible = true;

+ 18 - 10
UAS_DeviceMonitor/Main.cs

@@ -177,15 +177,15 @@ namespace UAS_DeviceMonitor
                 case "TRUE":
                 case "YES":
                 case "1":
-                    e.CheckState = System.Windows.Forms.CheckState.Checked;
+                    e.CheckState = CheckState.Checked;
                     break;
                 case "FALSE":
                 case "NO":
                 case "0":
-                    e.CheckState = System.Windows.Forms.CheckState.Unchecked;
+                    e.CheckState = CheckState.Unchecked;
                     break;
                 default:
-                    e.CheckState = System.Windows.Forms.CheckState.Checked;
+                    e.CheckState = CheckState.Checked;
                     break;
             }
             e.Handled = true;
@@ -213,6 +213,7 @@ namespace UAS_DeviceMonitor
         {
             if (PageCommandSet.PageVisible)
             {
+    
                 DataTable dt = (DataTable)SystemInf.dh.ExecuteSql("select * from devicebrand", "select");
                 BaseUtil.FillComBoxEditWidthDataTable(Brand, "db_name", "db_code", dt);
                 GridCommandSetting.Condition = " where dc_debrand='" + BaseUtil.GetComboxEditValue(Brand) + "' order by dc_id";
@@ -238,7 +239,7 @@ namespace UAS_DeviceMonitor
         private void ButtonStartPolling_Click(object sender, EventArgs e)
         {
             GridView grid = GridViewPollSetting;
-            mbt.Open();
+
             for (int i = 0; i < GridPollingSetting.RowCount; i++)
             {
                 Polling pl = new Polling();
@@ -338,14 +339,16 @@ namespace UAS_DeviceMonitor
                     //更新轮询状态
                     sql.Clear();
                     sql.Append("update DEVICEPOLLINGCONFIG set dpc_status='Running' where dpc_decode='" + Decode + "' and dpc_dccode='" + Dccode + "'");
-                    SQL.Add(sql.ToString());
+                    dh.ExecuteSql(sql.ToString(), "update");
+                    //SQL.Add(sql.ToString());
                     //更新轮询日志状态
                     sql.Clear();
                     sql.Append("update DEVICEPOLLINGLOG set dpg_status='Running',dpg_senddatasize=nvl(dpg_senddatasize,0)+" + SendCommandByteSize);
                     sql.Append(",dpg_receivedatasize=nvl(dpg_receivedatasize,0)+" + ReceiveCommandByteSize + ",dpg_count=nvl(dpg_count,0)+1 ");
                     sql.Append(" where dpg_id=(select max(dpg_id) from DEVICEPOLLINGLOG where dpg_decode='" + Decode + "')");
-                    SQL.Add(sql.ToString());
-                    dh.ExecuteSQLTran(SQL.ToArray());
+                    //SQL.Add(sql.ToString());
+                    dh.ExecuteSql(sql.ToString(), "update");
+                    //dh.ExecuteSQLTran(SQL.ToArray());
                 }
                 else
                 {
@@ -353,14 +356,16 @@ namespace UAS_DeviceMonitor
                     //更新轮询状态
                     sql.Clear();
                     sql.Append("update DEVICEPOLLINGCONFIG set dpc_status='Stop' where dpc_decode='" + Decode + "' and dpc_dccode='" + Dccode + "'");
-                    SQL.Add(sql.ToString());
+                    //SQL.Add(sql.ToString());
+                    dh.ExecuteSql(sql.ToString(), "update");
                     //更新轮询日志状态
                     sql.Clear();
                     sql.Append("update DEVICEPOLLINGLOG set dpg_status='Running',dpg_senddatasize=nvl(dpg_senddatasize,0)+");
                     sql.Append(SendCommandByteSize + ",dpg_count=nvl(dpg_count,0)+1 ");
                     sql.Append("where dpg_id=(select max(dpg_id) from DEVICEPOLLINGLOG where dpg_decode='" + Decode + "')");
-                    SQL.Add(sql.ToString());
-                    dh.ExecuteSQLTran(SQL.ToArray());
+                    //SQL.Add(sql.ToString());
+                    dh.ExecuteSql(sql.ToString(), "update");
+                    //dh.ExecuteSQLTran(SQL.ToArray());
                 }
             }
         }
@@ -420,6 +425,9 @@ namespace UAS_DeviceMonitor
         {
             if (PagePollingSetting.PageVisible)
             {
+                //如果未开启则进行开启
+                if (!mbt.IsOpen)
+                    mbt.Open();
                 DataTable dt = (DataTable)SystemInf.dh.ExecuteSql("SELECT DC_CODE,DC_NAME,DC_REMARK FROM DEVICECOMMAND", "select");
                 PollSettingItemSearchLookUpEdit.DataSource = dt;
                 PollSettingItemSearchLookUpEdit.DisplayMember = "DC_CODE";