章政 7 жил өмнө
parent
commit
465b2b157d

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

@@ -302,7 +302,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
             this.Text = " ";
             this.Load += new System.EventHandler(this.DeviceStatusInfo_Load);
-            this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.DeviceStatusInfo_MouseMove);
+            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.DeviceStatusInfo_KeyDown);
             ((System.ComponentModel.ISupportInitialize)(this.groupControl1)).EndInit();
             this.groupControl1.ResumeLayout(false);
             this.groupControl1.PerformLayout();

+ 5 - 4
UAS_DeviceMonitor/Device/Information/DeviceStatusInfo.cs

@@ -6,7 +6,6 @@ using System.Data;
 using System.Text;
 using UAS_DeviceMonitor.PublicMethod;
 using System.Windows.Forms;
-using System.Drawing;
 
 namespace UAS_DeviceMonitor.Device.Infomation
 {
@@ -47,10 +46,12 @@ namespace UAS_DeviceMonitor.Device.Infomation
             }
         }
 
-        private void DeviceStatusInfo_MouseMove(object sender, MouseEventArgs e)
+        private void DeviceStatusInfo_KeyDown(object sender, KeyEventArgs e)
         {
-            Point p = ParentForm.PointToScreen(e.Location);
-            //Console.WriteLine(e.Location + " " + Top + " " + Right + " " + " " + Bottom + " " + Right);
+            if (e.KeyCode == Keys.Escape)
+            {
+                Close();
+            }
         }
     }
 }

+ 21 - 19
UAS_DeviceMonitor/Main.cs

@@ -498,10 +498,12 @@ namespace UAS_DeviceMonitor
             {
                 DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dpc_status,dpc_id from device left join ");
                 DeviceStatusQuerySQL.Append("DEVICEPOLLINGCONFIG on dpc_decode=de_code ");
-                if (WC != "全部")
+                if (WC != "全部" && LC != "全部")
+                    DeviceStatusQuerySQL.Append(" where de_wccode='" + WC + "' and de_linecode='" + LC + "' ");
+                if (WC == "全部" && LC != "全部")
+                    DeviceStatusQuerySQL.Append(" where de_linecode='" + LC + "' ");
+                if (WC != "全部" && LC == "全部")
                     DeviceStatusQuerySQL.Append(" where de_wccode='" + WC + "' ");
-                if (LC != "全部")
-                    DeviceStatusQuerySQL.Append(" and de_linecode='" + LC + "' ");
                 DeviceStatusQuerySQL.Append("order by de_code");
             }
             PaintDeviceStatusControl(DeviceStatusQuerySQL.ToString());
@@ -566,27 +568,27 @@ namespace UAS_DeviceMonitor
             PictureEdit pic = sender as PictureEdit;
             DeviceStatusInfo dsi = new DeviceStatusInfo(pic.Name);
             dsi.StartPosition = FormStartPosition.CenterScreen;
-            dsi.Show();
+            dsi.ShowDialog();
         }
 
         private void Pic_MouseHover(object sender, EventArgs e)
         {
             //使用Tip显示轮询数据
-            //PictureEdit pic = sender as PictureEdit;
-            //DataTable dt = (DataTable)dh.ExecuteSql("select * from DEVICEPOLLINGLOG where dpg_id=(select max(dpg_id) from DEVICEPOLLINGLOG where dpg_decode='" + pic.Name + "')", "select");
-            //if (dt.Rows.Count > 0)
-            //{
-            //    sql.Clear();
-            //    sql.Append("开始时间" + dt.Rows[0]["dpg_starttime"].ToString() + "\n");
-            //    sql.Append("发送数据大小" + dt.Rows[0]["dpg_senddatasize"].ToString() + "字节\n");
-            //    sql.Append("接收数据大小" + dt.Rows[0]["dpg_receivedatasize"].ToString() + "字节\n");
-            //    sql.Append("轮询次数" + dt.Rows[0]["dpg_count"].ToString() + "次\n");
-            //    CommonTipController.ShowHint(sql.ToString(), pic.Name);
-            //}
-            //else
-            //{
-            //    CommonTipController.ShowHint("暂无信息", pic.Name);
-            //}
+            PictureEdit pic = sender as PictureEdit;
+            DataTable dt = (DataTable)dh.ExecuteSql("select * from DEVICEPOLLINGLOG where dpg_id=(select max(dpg_id) from DEVICEPOLLINGLOG where dpg_decode='" + pic.Name + "')", "select");
+            if (dt.Rows.Count > 0)
+            {
+                sql.Clear();
+                sql.Append("开始时间" + dt.Rows[0]["dpg_starttime"].ToString() + "\n");
+                sql.Append("发送数据大小" + dt.Rows[0]["dpg_senddatasize"].ToString() + "字节\n");
+                sql.Append("接收数据大小" + dt.Rows[0]["dpg_receivedatasize"].ToString() + "字节\n");
+                sql.Append("轮询次数" + dt.Rows[0]["dpg_count"].ToString() + "次\n");
+                CommonTipController.ShowHint(sql.ToString(), pic.Name);
+            }
+            else
+            {
+                CommonTipController.ShowHint("暂无信息", pic.Name);
+            }
         }
 
         //重新展示设备图像界面