Selaa lähdekoodia

添加窗体点击事件

章政 7 vuotta sitten
vanhempi
commit
94756de7f7

+ 147 - 102
UAS_DeviceMonitor/Device/Information/DeviceStatusInfo.Designer.cs

@@ -31,25 +31,29 @@ namespace UAS_DeviceMonitor.Device.Infomation
         private void InitializeComponent()
         {
             this.groupControl1 = new DevExpress.XtraEditors.GroupControl();
-            this.groupControl2 = new DevExpress.XtraEditors.GroupControl();
-            this.groupControl3 = new DevExpress.XtraEditors.GroupControl();
             this.de_linecode = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
             this.de_address = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
+            this.labelControl4 = new DevExpress.XtraEditors.LabelControl();
             this.de_wccode = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
+            this.labelControl3 = new DevExpress.XtraEditors.LabelControl();
             this.de_name = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
-            this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
             this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
-            this.labelControl3 = new DevExpress.XtraEditors.LabelControl();
-            this.labelControl4 = new DevExpress.XtraEditors.LabelControl();
+            this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
+            this.groupControl2 = new DevExpress.XtraEditors.GroupControl();
             this.labelControl5 = new DevExpress.XtraEditors.LabelControl();
             this.labelControl6 = new DevExpress.XtraEditors.LabelControl();
-            this.labelControl7 = new DevExpress.XtraEditors.LabelControl();
             this.labelControl8 = new DevExpress.XtraEditors.LabelControl();
-            this.labelControl9 = new DevExpress.XtraEditors.LabelControl();
-            this.labelControl10 = new DevExpress.XtraEditors.LabelControl();
+            this.labelControl7 = new DevExpress.XtraEditors.LabelControl();
             this.labelControl11 = new DevExpress.XtraEditors.LabelControl();
             this.labelControl12 = new DevExpress.XtraEditors.LabelControl();
+            this.labelControl10 = new DevExpress.XtraEditors.LabelControl();
+            this.labelControl9 = new DevExpress.XtraEditors.LabelControl();
+            this.dpg_starttime = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
             this.labelControl14 = new DevExpress.XtraEditors.LabelControl();
+            this.dpg_senddatasize = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
+            this.dpg_receivedatasize = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
+            this.dpg_count = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
+            this.groupControl3 = new DevExpress.XtraEditors.GroupControl();
             ((System.ComponentModel.ISupportInitialize)(this.groupControl1)).BeginInit();
             this.groupControl1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.groupControl2)).BeginInit();
@@ -60,85 +64,69 @@ namespace UAS_DeviceMonitor.Device.Infomation
             // 
             // groupControl1
             // 
-            this.groupControl1.Controls.Add(this.labelControl4);
-            this.groupControl1.Controls.Add(this.labelControl3);
-            this.groupControl1.Controls.Add(this.labelControl2);
-            this.groupControl1.Controls.Add(this.labelControl1);
             this.groupControl1.Controls.Add(this.de_linecode);
             this.groupControl1.Controls.Add(this.de_address);
+            this.groupControl1.Controls.Add(this.labelControl4);
             this.groupControl1.Controls.Add(this.de_wccode);
+            this.groupControl1.Controls.Add(this.labelControl3);
             this.groupControl1.Controls.Add(this.de_name);
+            this.groupControl1.Controls.Add(this.labelControl2);
+            this.groupControl1.Controls.Add(this.labelControl1);
             this.groupControl1.Location = new System.Drawing.Point(12, 12);
             this.groupControl1.Name = "groupControl1";
             this.groupControl1.Size = new System.Drawing.Size(187, 175);
             this.groupControl1.TabIndex = 0;
             this.groupControl1.Text = "设备信息";
             // 
-            // groupControl2
-            // 
-            this.groupControl2.Controls.Add(this.labelControl5);
-            this.groupControl2.Controls.Add(this.labelControl6);
-            this.groupControl2.Controls.Add(this.labelControl8);
-            this.groupControl2.Controls.Add(this.labelControl7);
-            this.groupControl2.Location = new System.Drawing.Point(12, 202);
-            this.groupControl2.Name = "groupControl2";
-            this.groupControl2.Size = new System.Drawing.Size(187, 159);
-            this.groupControl2.TabIndex = 1;
-            this.groupControl2.Text = "生产信息";
-            // 
-            // groupControl3
-            // 
-            this.groupControl3.Controls.Add(this.labelControl14);
-            this.groupControl3.Controls.Add(this.labelControl9);
-            this.groupControl3.Controls.Add(this.labelControl10);
-            this.groupControl3.Controls.Add(this.labelControl12);
-            this.groupControl3.Controls.Add(this.labelControl11);
-            this.groupControl3.Location = new System.Drawing.Point(216, 12);
-            this.groupControl3.Name = "groupControl3";
-            this.groupControl3.Size = new System.Drawing.Size(250, 349);
-            this.groupControl3.TabIndex = 2;
-            this.groupControl3.Text = "运行信息";
-            // 
             // de_linecode
             // 
             this.de_linecode.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.de_linecode.Location = new System.Drawing.Point(64, 137);
+            this.de_linecode.Location = new System.Drawing.Point(70, 137);
             this.de_linecode.Name = "de_linecode";
             this.de_linecode.Size = new System.Drawing.Size(0, 16);
-            this.de_linecode.TabIndex = 3;
+            this.de_linecode.TabIndex = 19;
             // 
             // de_address
             // 
             this.de_address.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.de_address.Location = new System.Drawing.Point(64, 106);
+            this.de_address.Location = new System.Drawing.Point(70, 106);
             this.de_address.Name = "de_address";
             this.de_address.Size = new System.Drawing.Size(0, 16);
-            this.de_address.TabIndex = 2;
+            this.de_address.TabIndex = 18;
+            // 
+            // labelControl4
+            // 
+            this.labelControl4.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.labelControl4.Location = new System.Drawing.Point(13, 137);
+            this.labelControl4.Name = "labelControl4";
+            this.labelControl4.Size = new System.Drawing.Size(32, 16);
+            this.labelControl4.TabIndex = 6;
+            this.labelControl4.Text = "线体";
             // 
             // de_wccode
             // 
             this.de_wccode.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.de_wccode.Location = new System.Drawing.Point(64, 74);
+            this.de_wccode.Location = new System.Drawing.Point(70, 74);
             this.de_wccode.Name = "de_wccode";
             this.de_wccode.Size = new System.Drawing.Size(0, 16);
-            this.de_wccode.TabIndex = 1;
+            this.de_wccode.TabIndex = 17;
+            // 
+            // labelControl3
+            // 
+            this.labelControl3.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.labelControl3.Location = new System.Drawing.Point(13, 106);
+            this.labelControl3.Name = "labelControl3";
+            this.labelControl3.Size = new System.Drawing.Size(32, 16);
+            this.labelControl3.TabIndex = 5;
+            this.labelControl3.Text = "区域";
             // 
             // de_name
             // 
             this.de_name.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.de_name.Location = new System.Drawing.Point(64, 41);
+            this.de_name.Location = new System.Drawing.Point(70, 41);
             this.de_name.Name = "de_name";
             this.de_name.Size = new System.Drawing.Size(0, 16);
-            this.de_name.TabIndex = 0;
-            // 
-            // labelControl1
-            // 
-            this.labelControl1.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.labelControl1.Location = new System.Drawing.Point(13, 41);
-            this.labelControl1.Name = "labelControl1";
-            this.labelControl1.Size = new System.Drawing.Size(32, 16);
-            this.labelControl1.TabIndex = 0;
-            this.labelControl1.Text = "设备";
+            this.de_name.TabIndex = 16;
             // 
             // labelControl2
             // 
@@ -149,23 +137,26 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.labelControl2.TabIndex = 4;
             this.labelControl2.Text = "车间";
             // 
-            // labelControl3
+            // labelControl1
             // 
-            this.labelControl3.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.labelControl3.Location = new System.Drawing.Point(13, 106);
-            this.labelControl3.Name = "labelControl3";
-            this.labelControl3.Size = new System.Drawing.Size(32, 16);
-            this.labelControl3.TabIndex = 5;
-            this.labelControl3.Text = "区域";
+            this.labelControl1.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.labelControl1.Location = new System.Drawing.Point(13, 41);
+            this.labelControl1.Name = "labelControl1";
+            this.labelControl1.Size = new System.Drawing.Size(32, 16);
+            this.labelControl1.TabIndex = 0;
+            this.labelControl1.Text = "设备";
             // 
-            // labelControl4
+            // groupControl2
             // 
-            this.labelControl4.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.labelControl4.Location = new System.Drawing.Point(13, 137);
-            this.labelControl4.Name = "labelControl4";
-            this.labelControl4.Size = new System.Drawing.Size(32, 16);
-            this.labelControl4.TabIndex = 6;
-            this.labelControl4.Text = "线体";
+            this.groupControl2.Controls.Add(this.labelControl5);
+            this.groupControl2.Controls.Add(this.labelControl6);
+            this.groupControl2.Controls.Add(this.labelControl8);
+            this.groupControl2.Controls.Add(this.labelControl7);
+            this.groupControl2.Location = new System.Drawing.Point(12, 202);
+            this.groupControl2.Name = "groupControl2";
+            this.groupControl2.Size = new System.Drawing.Size(187, 159);
+            this.groupControl2.TabIndex = 1;
+            this.groupControl2.Text = "生产信息";
             // 
             // labelControl5
             // 
@@ -185,15 +176,6 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.labelControl6.TabIndex = 9;
             this.labelControl6.Text = "批次";
             // 
-            // labelControl7
-            // 
-            this.labelControl7.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.labelControl7.Location = new System.Drawing.Point(13, 65);
-            this.labelControl7.Name = "labelControl7";
-            this.labelControl7.Size = new System.Drawing.Size(32, 16);
-            this.labelControl7.TabIndex = 8;
-            this.labelControl7.Text = "产品";
-            // 
             // labelControl8
             // 
             this.labelControl8.Appearance.Font = new System.Drawing.Font("黑体", 12F);
@@ -203,23 +185,14 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.labelControl8.TabIndex = 7;
             this.labelControl8.Text = "工单";
             // 
-            // labelControl9
-            // 
-            this.labelControl9.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.labelControl9.Location = new System.Drawing.Point(21, 139);
-            this.labelControl9.Name = "labelControl9";
-            this.labelControl9.Size = new System.Drawing.Size(64, 16);
-            this.labelControl9.TabIndex = 14;
-            this.labelControl9.Text = "接收字节";
-            // 
-            // labelControl10
+            // labelControl7
             // 
-            this.labelControl10.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.labelControl10.Location = new System.Drawing.Point(21, 106);
-            this.labelControl10.Name = "labelControl10";
-            this.labelControl10.Size = new System.Drawing.Size(64, 16);
-            this.labelControl10.TabIndex = 13;
-            this.labelControl10.Text = "发送字节";
+            this.labelControl7.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.labelControl7.Location = new System.Drawing.Point(13, 65);
+            this.labelControl7.Name = "labelControl7";
+            this.labelControl7.Size = new System.Drawing.Size(32, 16);
+            this.labelControl7.TabIndex = 8;
+            this.labelControl7.Text = "产品";
             // 
             // labelControl11
             // 
@@ -239,6 +212,32 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.labelControl12.TabIndex = 12;
             this.labelControl12.Text = "持续时长";
             // 
+            // labelControl10
+            // 
+            this.labelControl10.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.labelControl10.Location = new System.Drawing.Point(21, 106);
+            this.labelControl10.Name = "labelControl10";
+            this.labelControl10.Size = new System.Drawing.Size(64, 16);
+            this.labelControl10.TabIndex = 13;
+            this.labelControl10.Text = "发送字节";
+            // 
+            // labelControl9
+            // 
+            this.labelControl9.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.labelControl9.Location = new System.Drawing.Point(21, 139);
+            this.labelControl9.Name = "labelControl9";
+            this.labelControl9.Size = new System.Drawing.Size(64, 16);
+            this.labelControl9.TabIndex = 14;
+            this.labelControl9.Text = "接收字节";
+            // 
+            // dpg_starttime
+            // 
+            this.dpg_starttime.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.dpg_starttime.Location = new System.Drawing.Point(101, 41);
+            this.dpg_starttime.Name = "dpg_starttime";
+            this.dpg_starttime.Size = new System.Drawing.Size(0, 16);
+            this.dpg_starttime.TabIndex = 0;
+            // 
             // labelControl14
             // 
             this.labelControl14.Appearance.Font = new System.Drawing.Font("黑体", 12F);
@@ -248,6 +247,47 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.labelControl14.TabIndex = 15;
             this.labelControl14.Text = "轮询次数";
             // 
+            // dpg_senddatasize
+            // 
+            this.dpg_senddatasize.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.dpg_senddatasize.Location = new System.Drawing.Point(101, 106);
+            this.dpg_senddatasize.Name = "dpg_senddatasize";
+            this.dpg_senddatasize.Size = new System.Drawing.Size(0, 16);
+            this.dpg_senddatasize.TabIndex = 1;
+            // 
+            // dpg_receivedatasize
+            // 
+            this.dpg_receivedatasize.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.dpg_receivedatasize.Location = new System.Drawing.Point(101, 139);
+            this.dpg_receivedatasize.Name = "dpg_receivedatasize";
+            this.dpg_receivedatasize.Size = new System.Drawing.Size(0, 16);
+            this.dpg_receivedatasize.TabIndex = 2;
+            // 
+            // dpg_count
+            // 
+            this.dpg_count.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.dpg_count.Location = new System.Drawing.Point(101, 172);
+            this.dpg_count.Name = "dpg_count";
+            this.dpg_count.Size = new System.Drawing.Size(0, 16);
+            this.dpg_count.TabIndex = 3;
+            // 
+            // groupControl3
+            // 
+            this.groupControl3.Controls.Add(this.dpg_count);
+            this.groupControl3.Controls.Add(this.dpg_receivedatasize);
+            this.groupControl3.Controls.Add(this.dpg_senddatasize);
+            this.groupControl3.Controls.Add(this.labelControl14);
+            this.groupControl3.Controls.Add(this.dpg_starttime);
+            this.groupControl3.Controls.Add(this.labelControl9);
+            this.groupControl3.Controls.Add(this.labelControl10);
+            this.groupControl3.Controls.Add(this.labelControl12);
+            this.groupControl3.Controls.Add(this.labelControl11);
+            this.groupControl3.Location = new System.Drawing.Point(216, 12);
+            this.groupControl3.Name = "groupControl3";
+            this.groupControl3.Size = new System.Drawing.Size(250, 349);
+            this.groupControl3.TabIndex = 2;
+            this.groupControl3.Text = "运行信息";
+            // 
             // DeviceStatusInfo
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
@@ -257,6 +297,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.Controls.Add(this.groupControl2);
             this.Controls.Add(this.groupControl1);
             this.FormBorderEffect = DevExpress.XtraEditors.FormBorderEffect.None;
+            this.MaximizeBox = false;
             this.Name = "DeviceStatusInfo";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
             this.Text = " ";
@@ -279,11 +320,6 @@ namespace UAS_DeviceMonitor.Device.Infomation
 
         private DevExpress.XtraEditors.GroupControl groupControl1;
         private DevExpress.XtraEditors.GroupControl groupControl2;
-        private DevExpress.XtraEditors.GroupControl groupControl3;
-        private ValueLabel de_name;
-        private ValueLabel de_linecode;
-        private ValueLabel de_address;
-        private ValueLabel de_wccode;
         private DevExpress.XtraEditors.LabelControl labelControl4;
         private DevExpress.XtraEditors.LabelControl labelControl3;
         private DevExpress.XtraEditors.LabelControl labelControl2;
@@ -292,10 +328,19 @@ namespace UAS_DeviceMonitor.Device.Infomation
         private DevExpress.XtraEditors.LabelControl labelControl6;
         private DevExpress.XtraEditors.LabelControl labelControl8;
         private DevExpress.XtraEditors.LabelControl labelControl7;
-        private DevExpress.XtraEditors.LabelControl labelControl14;
-        private DevExpress.XtraEditors.LabelControl labelControl9;
-        private DevExpress.XtraEditors.LabelControl labelControl10;
-        private DevExpress.XtraEditors.LabelControl labelControl12;
         private DevExpress.XtraEditors.LabelControl labelControl11;
+        private DevExpress.XtraEditors.LabelControl labelControl12;
+        private DevExpress.XtraEditors.LabelControl labelControl10;
+        private DevExpress.XtraEditors.LabelControl labelControl9;
+        private ValueLabel dpg_starttime;
+        private DevExpress.XtraEditors.LabelControl labelControl14;
+        private ValueLabel dpg_senddatasize;
+        private ValueLabel dpg_receivedatasize;
+        private ValueLabel dpg_count;
+        private DevExpress.XtraEditors.GroupControl groupControl3;
+        private ValueLabel de_linecode;
+        private ValueLabel de_address;
+        private ValueLabel de_wccode;
+        private ValueLabel de_name;
     }
 }

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

@@ -5,6 +5,8 @@ using UAS_DeviceMonitor.Entity;
 using System.Data;
 using System.Text;
 using UAS_DeviceMonitor.PublicMethod;
+using System.Windows.Forms;
+using System.Drawing;
 
 namespace UAS_DeviceMonitor.Device.Infomation
 {
@@ -25,6 +27,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
         {
             InitializeComponent();
             de_code = DevcieCode;
+            Text = DevcieCode;
         }
 
         private void DeviceStatusInfo_Load(object sender, EventArgs e)
@@ -37,11 +40,17 @@ namespace UAS_DeviceMonitor.Device.Infomation
             {
                 BaseUtil.SetFormValue(Controls, dt);
             }
+            dt = (DataTable)dh.ExecuteSql("select dpg_count,dpg_starttime,dpg_senddatasize,dpg_receivedatasize from DEVICEPOLLINGLOG where dpg_id=(select max(dpg_id) from DEVICEPOLLINGLOG where dpg_decode='" + de_code + "')", "select");
+            if (dt.Rows.Count > 0)
+            {
+                BaseUtil.SetFormValue(Controls, dt);
+            }
         }
 
-        private void DeviceStatusInfo_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
+        private void DeviceStatusInfo_MouseMove(object sender, MouseEventArgs e)
         {
-
+            Point p = ParentForm.PointToScreen(e.Location);
+            //Console.WriteLine(e.Location + " " + Top + " " + Right + " " + " " + Bottom + " " + Right);
         }
     }
 }

+ 9 - 2
UAS_DeviceMonitor/Main.cs

@@ -491,7 +491,7 @@ namespace UAS_DeviceMonitor
                 if (WC != "全部")
                     DeviceStatusQuerySQL.Append(" and de_wccode='" + WC + "' ");
                 if (LC != "全部")
-                    DeviceStatusQuerySQL.Append(" and de_linecode='"+LC+"' ");
+                    DeviceStatusQuerySQL.Append(" and de_linecode='" + LC + "' ");
                 DeviceStatusQuerySQL.Append(" order by de_code");
             }
             else
@@ -535,6 +535,7 @@ namespace UAS_DeviceMonitor
                         PictureEditWithText pic = new PictureEditWithText();
                         pic.DeviceName = dt.Rows[j * CountPerRow + i]["de_name"].ToString();
                         pic.Picedit.ToolTipController = CommonTipController;
+                        pic.Picedit.Click += Pic_Click;
                         pic.Name = dt.Rows[j * CountPerRow + i]["de_code"].ToString() + i + j;
                         pic.Anchor = AnchorStyles.Left;
                         pic.Anchor = AnchorStyles.Top;
@@ -560,11 +561,17 @@ namespace UAS_DeviceMonitor
             }
         }
 
-        private void Pic_MouseHover(object sender, EventArgs e)
+        private void Pic_Click(object sender, EventArgs e)
         {
             PictureEdit pic = sender as PictureEdit;
             DeviceStatusInfo dsi = new DeviceStatusInfo(pic.Name);
+            dsi.StartPosition = FormStartPosition.CenterScreen;
             dsi.Show();
+        }
+
+        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)