Browse Source

添加展示设备明细窗体

章政 7 years ago
parent
commit
08548c443c

+ 0 - 2
UAS_DeviceMonitor/CustomerControl/PictureEditWithText/PictureEditWithText.cs

@@ -52,8 +52,6 @@ namespace UAS_DeviceMonitor.CustomerControl.PictureEditWithText
             }
         }
 
-        private string deviceName;
-
         public PictureEditWithText()
         {
             InitializeComponent();

+ 36 - 0
UAS_DeviceMonitor/CustomerControl/ValueLabel/ValueLabel.Designer.cs

@@ -0,0 +1,36 @@
+namespace UAS_DeviceMonitor.CustomerControl.ValueLabel
+{
+    partial class ValueLabel
+    {
+        /// <summary> 
+        /// 必需的设计器变量。
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary> 
+        /// 清理所有正在使用的资源。
+        /// </summary>
+        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region 组件设计器生成的代码
+
+        /// <summary> 
+        /// 设计器支持所需的方法 - 不要修改
+        /// 使用代码编辑器修改此方法的内容。
+        /// </summary>
+        private void InitializeComponent()
+        {
+            components = new System.ComponentModel.Container();
+        }
+
+        #endregion
+    }
+}

+ 19 - 0
UAS_DeviceMonitor/CustomerControl/ValueLabel/ValueLabel.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace UAS_DeviceMonitor.CustomerControl.ValueLabel
+{
+    public partial class ValueLabel : DevExpress.XtraEditors.LabelControl
+    {
+        public ValueLabel()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 301 - 0
UAS_DeviceMonitor/Device/Information/DeviceStatusInfo.Designer.cs

@@ -0,0 +1,301 @@
+using UAS_DeviceMonitor.CustomerControl.ValueLabel;
+
+namespace UAS_DeviceMonitor.Device.Infomation
+{
+    partial class DeviceStatusInfo
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        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.de_wccode = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
+            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.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.labelControl11 = new DevExpress.XtraEditors.LabelControl();
+            this.labelControl12 = new DevExpress.XtraEditors.LabelControl();
+            this.labelControl14 = new DevExpress.XtraEditors.LabelControl();
+            ((System.ComponentModel.ISupportInitialize)(this.groupControl1)).BeginInit();
+            this.groupControl1.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.groupControl2)).BeginInit();
+            this.groupControl2.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.groupControl3)).BeginInit();
+            this.groupControl3.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // 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.de_wccode);
+            this.groupControl1.Controls.Add(this.de_name);
+            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.Name = "de_linecode";
+            this.de_linecode.Size = new System.Drawing.Size(0, 16);
+            this.de_linecode.TabIndex = 3;
+            // 
+            // 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.Name = "de_address";
+            this.de_address.Size = new System.Drawing.Size(0, 16);
+            this.de_address.TabIndex = 2;
+            // 
+            // 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.Name = "de_wccode";
+            this.de_wccode.Size = new System.Drawing.Size(0, 16);
+            this.de_wccode.TabIndex = 1;
+            // 
+            // 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.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 = "设备";
+            // 
+            // labelControl2
+            // 
+            this.labelControl2.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.labelControl2.Location = new System.Drawing.Point(13, 74);
+            this.labelControl2.Name = "labelControl2";
+            this.labelControl2.Size = new System.Drawing.Size(32, 16);
+            this.labelControl2.TabIndex = 4;
+            this.labelControl2.Text = "车间";
+            // 
+            // 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 = "区域";
+            // 
+            // 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 = "线体";
+            // 
+            // labelControl5
+            // 
+            this.labelControl5.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.labelControl5.Location = new System.Drawing.Point(13, 128);
+            this.labelControl5.Name = "labelControl5";
+            this.labelControl5.Size = new System.Drawing.Size(32, 16);
+            this.labelControl5.TabIndex = 10;
+            this.labelControl5.Text = "数量";
+            // 
+            // labelControl6
+            // 
+            this.labelControl6.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.labelControl6.Location = new System.Drawing.Point(13, 97);
+            this.labelControl6.Name = "labelControl6";
+            this.labelControl6.Size = new System.Drawing.Size(32, 16);
+            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);
+            this.labelControl8.Location = new System.Drawing.Point(13, 32);
+            this.labelControl8.Name = "labelControl8";
+            this.labelControl8.Size = new System.Drawing.Size(32, 16);
+            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
+            // 
+            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 = "发送字节";
+            // 
+            // labelControl11
+            // 
+            this.labelControl11.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.labelControl11.Location = new System.Drawing.Point(21, 41);
+            this.labelControl11.Name = "labelControl11";
+            this.labelControl11.Size = new System.Drawing.Size(64, 16);
+            this.labelControl11.TabIndex = 11;
+            this.labelControl11.Text = "开始时间";
+            // 
+            // labelControl12
+            // 
+            this.labelControl12.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.labelControl12.Location = new System.Drawing.Point(21, 74);
+            this.labelControl12.Name = "labelControl12";
+            this.labelControl12.Size = new System.Drawing.Size(64, 16);
+            this.labelControl12.TabIndex = 12;
+            this.labelControl12.Text = "持续时长";
+            // 
+            // labelControl14
+            // 
+            this.labelControl14.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.labelControl14.Location = new System.Drawing.Point(21, 172);
+            this.labelControl14.Name = "labelControl14";
+            this.labelControl14.Size = new System.Drawing.Size(64, 16);
+            this.labelControl14.TabIndex = 15;
+            this.labelControl14.Text = "轮询次数";
+            // 
+            // DeviceStatusInfo
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(478, 373);
+            this.Controls.Add(this.groupControl3);
+            this.Controls.Add(this.groupControl2);
+            this.Controls.Add(this.groupControl1);
+            this.FormBorderEffect = DevExpress.XtraEditors.FormBorderEffect.None;
+            this.Name = "DeviceStatusInfo";
+            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);
+            ((System.ComponentModel.ISupportInitialize)(this.groupControl1)).EndInit();
+            this.groupControl1.ResumeLayout(false);
+            this.groupControl1.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.groupControl2)).EndInit();
+            this.groupControl2.ResumeLayout(false);
+            this.groupControl2.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.groupControl3)).EndInit();
+            this.groupControl3.ResumeLayout(false);
+            this.groupControl3.PerformLayout();
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        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;
+        private DevExpress.XtraEditors.LabelControl labelControl1;
+        private DevExpress.XtraEditors.LabelControl labelControl5;
+        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;
+    }
+}

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

@@ -0,0 +1,47 @@
+using System;
+using DevExpress.XtraEditors;
+using UAS_DeviceMonitor.DataOperate;
+using UAS_DeviceMonitor.Entity;
+using System.Data;
+using System.Text;
+using UAS_DeviceMonitor.PublicMethod;
+
+namespace UAS_DeviceMonitor.Device.Infomation
+{
+    public partial class DeviceStatusInfo : XtraForm
+    {
+        DataHelper dh = SystemInf.dh;
+
+        StringBuilder sql = new StringBuilder();
+
+        string de_code = "";
+
+        public DeviceStatusInfo()
+        {
+            InitializeComponent();
+        }
+
+        public DeviceStatusInfo(string DevcieCode)
+        {
+            InitializeComponent();
+            de_code = DevcieCode;
+        }
+
+        private void DeviceStatusInfo_Load(object sender, EventArgs e)
+        {
+            sql.Clear();
+            sql.Append("select de_linecode,de_wccode,de_name,de_address from device ");
+            sql.Append("where de_code='" + de_code + "'");
+            DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+            if (dt.Rows.Count > 0)
+            {
+                BaseUtil.SetFormValue(Controls, dt);
+            }
+        }
+
+        private void DeviceStatusInfo_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
+        {
+
+        }
+    }
+}

+ 120 - 0
UAS_DeviceMonitor/Device/Information/DeviceStatusInfo.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 18 - 14
UAS_DeviceMonitor/Main.cs

@@ -14,6 +14,7 @@ using UAS_DeviceMonitor.CustomerControl.PictureEditWithText;
 using System.Windows.Forms;
 using DevExpress.XtraEditors.Controls;
 using DevExpress.XtraEditors;
+using UAS_DeviceMonitor.Device.Infomation;
 
 namespace UAS_DeviceMonitor
 {
@@ -562,20 +563,23 @@ namespace UAS_DeviceMonitor
         private void Pic_MouseHover(object sender, EventArgs e)
         {
             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);
-            }
+            DeviceStatusInfo dsi = new DeviceStatusInfo(pic.Name);
+            dsi.Show();
+            //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);
+            //}
         }
 
         //重新展示设备图像界面

+ 104 - 0
UAS_DeviceMonitor/PublicMethod/BaseUtil.cs

@@ -7,6 +7,7 @@ using System.Text;
 using System.Windows.Forms;
 using UAS_DeviceMonitor.DataOperate;
 using DevExpress.Utils;
+using UAS_DeviceMonitor.CustomerControl.ValueLabel;
 
 namespace UAS_DeviceMonitor.PublicMethod
 {
@@ -165,5 +166,108 @@ namespace UAS_DeviceMonitor.PublicMethod
 
             }
         }
+
+        /// <summary>
+        ///  传入控件的集合和DataTable,通过判断控件的名称和数据源的列的描述来匹配,支持单层的GroupBox和Panel
+        /// </summary>
+        /// <param name="collection"></param>
+        /// <param name="dt"></param>
+        public static void SetFormValue(Control.ControlCollection collection, DataTable dt)
+        {
+            //DataTable存在数据才进行赋值操作
+            if (dt.Rows.Count > 0)
+            {
+                for (int i = 0; i < collection.Count; i++)
+                {
+                    //如果含有子控件则进行递归调用
+                    if (collection[i].Controls.Count > 0)
+                        SetFormValue(collection[i].Controls, dt);
+                    string controlName = collection[i].Name;
+                    string controlsTag = collection[i].Tag == null ? "" : collection[i].Tag.ToString();
+                    //默认给TextBox和Label赋值
+                    if (collection[i] is TextBox || collection[i] is ValueLabel || collection[i] is NumericUpDown)
+                    {
+                        for (int j = 0; j < dt.Columns.Count; j++)
+                        {
+                            if (controlName.ToUpper() == dt.Columns[j].Caption.ToUpper() || controlsTag.ToUpper() == dt.Columns[j].Caption.ToUpper())
+                            {
+                                //字段含有Status内容的才进行转换
+                                if (controlName.ToUpper().Contains("STATUS") || controlsTag.ToUpper().Contains("STATUS"))
+                                {
+                                    //对审批状态进行判断
+                                    switch (dt.Rows[0][j].ToString().ToUpper())
+                                    {
+                                        case "ENTERING":
+                                            collection[i].Text = "在录入";
+                                            break;
+                                        case "UNAPPROVED":
+                                            collection[i].Text = "未批准";
+                                            break;
+                                        case "COMMITED":
+                                            collection[i].Text = "已提交";
+                                            break;
+                                        case "APPROVE":
+                                            collection[i].Text = "已批准";
+                                            break;
+                                        case "AUDITED":
+                                            collection[i].Text = "已审核";
+                                            break;
+                                        case "STARTED":
+                                            collection[i].Text = "已下放";
+                                            break;
+                                        case "UNCHECK":
+                                            collection[i].Text = "待检验";
+                                            break;
+                                        case "CHECKING":
+                                            collection[i].Text = "检验中";
+                                            break;
+                                        default:
+                                            collection[i].Text = dt.Rows[0][j].ToString();
+                                            break;
+                                    }
+                                }
+                                else
+                                    collection[i].Text = dt.Rows[0][j].ToString();
+                            }
+                        }
+                    }
+                    //对封装在GroupBox的和Panel的控件进行批量赋值
+                    if (collection[i] is GroupControl || collection[i] is Panel)
+                    {
+                        for (int j = 0; j < collection[i].Controls.Count; j++)
+                        {
+                            controlName = collection[i].Controls[j].Name;
+                            if (collection[i].Controls[j] is TextBox || collection[i].Controls[j] is ValueLabel)
+                            {
+                                for (int k = 0; k < dt.Columns.Count; k++)
+                                {
+                                    if (controlName.ToUpper() == dt.Columns[k].Caption.ToUpper())
+                                    {
+                                        collection[i].Controls[j].Text = dt.Rows[0][k].ToString();
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            //如果没有记录的话,将dt中含有的列的对应值设置为空
+            else
+            {
+                for (int i = 0; i < collection.Count; i++)
+                {
+                    if (collection[i] is TextBox || collection[i] is ValueLabel)
+                    {
+                        for (int j = 0; j < dt.Columns.Count; j++)
+                        {
+                            if (collection[i].Name.ToUpper() == dt.Columns[j].Caption.ToUpper())
+                            {
+                                collection[i].Text = "";
+                            }
+                        }
+                    }
+                }
+            }
+        }
     }
 }

+ 15 - 1
UAS_DeviceMonitor/UAS_DeviceMonitor.csproj

@@ -198,6 +198,12 @@
     <Compile Include="CustomerControl\PictureEditWithText\PictureEditWithText.Designer.cs">
       <DependentUpon>PictureEditWithText.cs</DependentUpon>
     </Compile>
+    <Compile Include="CustomerControl\ValueLabel\ValueLabel.cs">
+      <SubType>Component</SubType>
+    </Compile>
+    <Compile Include="CustomerControl\ValueLabel\ValueLabel.Designer.cs">
+      <DependentUpon>ValueLabel.cs</DependentUpon>
+    </Compile>
     <Compile Include="DataOperate\ComboBoxData.cs" />
     <Compile Include="DataOperate\DataHelper.cs" />
     <Compile Include="Device\Command\FormNewCommand.cs">
@@ -206,6 +212,12 @@
     <Compile Include="Device\Command\FormNewCommand.Designer.cs">
       <DependentUpon>FormNewCommand.cs</DependentUpon>
     </Compile>
+    <Compile Include="Device\Information\DeviceStatusInfo.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Device\Information\DeviceStatusInfo.Designer.cs">
+      <DependentUpon>DeviceStatusInfo.cs</DependentUpon>
+    </Compile>
     <Compile Include="Entity\Polling.cs" />
     <Compile Include="Entity\SocketObject.cs" />
     <Compile Include="Entity\SystemInf.cs" />
@@ -248,6 +260,9 @@
     <EmbeddedResource Include="Device\Command\FormNewCommand.resx">
       <DependentUpon>FormNewCommand.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="Device\Information\DeviceStatusInfo.resx">
+      <DependentUpon>DeviceStatusInfo.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Main.resx">
       <DependentUpon>Main.cs</DependentUpon>
     </EmbeddedResource>
@@ -289,7 +304,6 @@
     <Content Include="Tool\Oracle.ManagedDataAccess.dll" />
   </ItemGroup>
   <ItemGroup>
-    <Folder Include="Device\Information\" />
     <Folder Include="Device\Transfer\" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />