소스 검색

添加设备查看筛选功能

章政 7 년 전
부모
커밋
18eff636ed
3개의 변경된 파일210개의 추가작업 그리고 75개의 파일을 삭제
  1. 65 32
      UAS_DeviceMonitor/Main.Designer.cs
  2. 123 41
      UAS_DeviceMonitor/Main.cs
  3. 22 2
      UAS_DeviceMonitor/PublicMethod/BaseUtil.cs

+ 65 - 32
UAS_DeviceMonitor/Main.Designer.cs

@@ -133,16 +133,17 @@ namespace UAS_DeviceMonitor
             this.pl_dccode = new DevExpress.XtraGrid.Columns.GridColumn();
             this.pl_remark = new DevExpress.XtraGrid.Columns.GridColumn();
             this.PageDeviceStatus = new DevExpress.XtraTab.XtraTabPage();
+            this.ComboxDeviceStatusWC = new DevExpress.XtraEditors.ComboBoxEdit();
+            this.ComboxDeviceStatusLC = new DevExpress.XtraEditors.ComboBoxEdit();
+            this.CheckEditDeviceStatusEnable = new DevExpress.XtraEditors.CheckEdit();
+            this.ComboxDeviceStatusLC_label = new DevExpress.XtraEditors.LabelControl();
             this.ComboxDeviceStatusWC_label = new DevExpress.XtraEditors.LabelControl();
-            this.ComboxDeviceStatusWC = new System.Windows.Forms.ComboBox();
             this.PanelDeviceStatus = new DevExpress.XtraEditors.XtraScrollableControl();
             this.PageWorkCenterStatus = new DevExpress.XtraTab.XtraTabPage();
             this.GridWorkCenterStatus = new UAS_DeviceMonitor.CustomerControl.AutoDataGridControl.AutoDataGridControl();
             this.GridViewWorkCenterStatus = new UAS_DeviceMonitor.CustomerControl.GridViewWithSerialNum.GridViewWithSerialNum();
             this.TimerDeviceStatus = new System.Windows.Forms.Timer(this.components);
             this.CommonTipController = new DevExpress.Utils.ToolTipController(this.components);
-            this.ComboxDeviceStatusLC_label = new DevExpress.XtraEditors.LabelControl();
-            this.ComboxDeviceStatusLC = new System.Windows.Forms.ComboBox();
             ((System.ComponentModel.ISupportInitialize)(this.RibbonNav)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.MainTabControl)).BeginInit();
             this.MainTabControl.SuspendLayout();
@@ -169,6 +170,9 @@ namespace UAS_DeviceMonitor
             ((System.ComponentModel.ISupportInitialize)(this.GridPolling)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.GridViewPolling)).BeginInit();
             this.PageDeviceStatus.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.ComboxDeviceStatusWC.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.ComboxDeviceStatusLC.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.CheckEditDeviceStatusEnable.Properties)).BeginInit();
             this.PageWorkCenterStatus.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.GridWorkCenterStatus)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.GridViewWorkCenterStatus)).BeginInit();
@@ -1194,10 +1198,11 @@ namespace UAS_DeviceMonitor
             // 
             // PageDeviceStatus
             // 
-            this.PageDeviceStatus.Controls.Add(this.ComboxDeviceStatusLC_label);
+            this.PageDeviceStatus.Controls.Add(this.ComboxDeviceStatusWC);
             this.PageDeviceStatus.Controls.Add(this.ComboxDeviceStatusLC);
+            this.PageDeviceStatus.Controls.Add(this.CheckEditDeviceStatusEnable);
+            this.PageDeviceStatus.Controls.Add(this.ComboxDeviceStatusLC_label);
             this.PageDeviceStatus.Controls.Add(this.ComboxDeviceStatusWC_label);
-            this.PageDeviceStatus.Controls.Add(this.ComboxDeviceStatusWC);
             this.PageDeviceStatus.Controls.Add(this.PanelDeviceStatus);
             this.PageDeviceStatus.Name = "PageDeviceStatus";
             this.PageDeviceStatus.PageVisible = false;
@@ -1205,6 +1210,55 @@ namespace UAS_DeviceMonitor
             this.PageDeviceStatus.Text = "xtraTabPage1";
             this.PageDeviceStatus.VisibleChanged += new System.EventHandler(this.PageDeviceStatus_VisibleChanged);
             // 
+            // ComboxDeviceStatusWC
+            // 
+            this.ComboxDeviceStatusWC.Location = new System.Drawing.Point(50, 7);
+            this.ComboxDeviceStatusWC.MenuManager = this.RibbonNav;
+            this.ComboxDeviceStatusWC.Name = "ComboxDeviceStatusWC";
+            this.ComboxDeviceStatusWC.Properties.Appearance.Font = new System.Drawing.Font("黑体", 11F);
+            this.ComboxDeviceStatusWC.Properties.Appearance.Options.UseFont = true;
+            this.ComboxDeviceStatusWC.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.ComboxDeviceStatusWC.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
+            this.ComboxDeviceStatusWC.Size = new System.Drawing.Size(100, 22);
+            this.ComboxDeviceStatusWC.TabIndex = 0;
+            this.ComboxDeviceStatusWC.SelectedIndexChanged += new System.EventHandler(this.ComboxDeviceStatusWC_SelectedIndexChanged);
+            // 
+            // ComboxDeviceStatusLC
+            // 
+            this.ComboxDeviceStatusLC.Location = new System.Drawing.Point(202, 7);
+            this.ComboxDeviceStatusLC.MenuManager = this.RibbonNav;
+            this.ComboxDeviceStatusLC.Name = "ComboxDeviceStatusLC";
+            this.ComboxDeviceStatusLC.Properties.Appearance.Font = new System.Drawing.Font("黑体", 11F);
+            this.ComboxDeviceStatusLC.Properties.Appearance.Options.UseFont = true;
+            this.ComboxDeviceStatusLC.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.ComboxDeviceStatusLC.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
+            this.ComboxDeviceStatusLC.Size = new System.Drawing.Size(100, 22);
+            this.ComboxDeviceStatusLC.TabIndex = 0;
+            this.ComboxDeviceStatusLC.SelectedIndexChanged += new System.EventHandler(this.ComboxDeviceStatusLC_SelectedIndexChanged);
+            // 
+            // CheckEditDeviceStatusEnable
+            // 
+            this.CheckEditDeviceStatusEnable.Location = new System.Drawing.Point(321, 9);
+            this.CheckEditDeviceStatusEnable.MenuManager = this.RibbonNav;
+            this.CheckEditDeviceStatusEnable.Name = "CheckEditDeviceStatusEnable";
+            this.CheckEditDeviceStatusEnable.Properties.Appearance.Font = new System.Drawing.Font("黑体", 10F);
+            this.CheckEditDeviceStatusEnable.Properties.Appearance.Options.UseFont = true;
+            this.CheckEditDeviceStatusEnable.Properties.Caption = "只显示已启用设备";
+            this.CheckEditDeviceStatusEnable.Size = new System.Drawing.Size(142, 19);
+            this.CheckEditDeviceStatusEnable.TabIndex = 5;
+            this.CheckEditDeviceStatusEnable.CheckedChanged += new System.EventHandler(this.CheckEditDeviceStatusEnable_CheckedChanged);
+            // 
+            // ComboxDeviceStatusLC_label
+            // 
+            this.ComboxDeviceStatusLC_label.Appearance.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+            this.ComboxDeviceStatusLC_label.Location = new System.Drawing.Point(162, 10);
+            this.ComboxDeviceStatusLC_label.Name = "ComboxDeviceStatusLC_label";
+            this.ComboxDeviceStatusLC_label.Size = new System.Drawing.Size(32, 16);
+            this.ComboxDeviceStatusLC_label.TabIndex = 4;
+            this.ComboxDeviceStatusLC_label.Text = "线别";
+            // 
             // ComboxDeviceStatusWC_label
             // 
             this.ComboxDeviceStatusWC_label.Appearance.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@@ -1214,14 +1268,6 @@ namespace UAS_DeviceMonitor
             this.ComboxDeviceStatusWC_label.TabIndex = 2;
             this.ComboxDeviceStatusWC_label.Text = "车间";
             // 
-            // ComboxDeviceStatusWC
-            // 
-            this.ComboxDeviceStatusWC.FormattingEnabled = true;
-            this.ComboxDeviceStatusWC.Location = new System.Drawing.Point(51, 7);
-            this.ComboxDeviceStatusWC.Name = "ComboxDeviceStatusWC";
-            this.ComboxDeviceStatusWC.Size = new System.Drawing.Size(121, 22);
-            this.ComboxDeviceStatusWC.TabIndex = 1;
-            // 
             // PanelDeviceStatus
             // 
             this.PanelDeviceStatus.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
@@ -1276,23 +1322,6 @@ namespace UAS_DeviceMonitor
             // 
             this.CommonTipController.AutoPopDelay = 10000;
             // 
-            // ComboxDeviceStatusLC_label
-            // 
-            this.ComboxDeviceStatusLC_label.Appearance.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
-            this.ComboxDeviceStatusLC_label.Location = new System.Drawing.Point(189, 10);
-            this.ComboxDeviceStatusLC_label.Name = "ComboxDeviceStatusLC_label";
-            this.ComboxDeviceStatusLC_label.Size = new System.Drawing.Size(32, 16);
-            this.ComboxDeviceStatusLC_label.TabIndex = 4;
-            this.ComboxDeviceStatusLC_label.Text = "线别";
-            // 
-            // ComboxDeviceStatusLC
-            // 
-            this.ComboxDeviceStatusLC.FormattingEnabled = true;
-            this.ComboxDeviceStatusLC.Location = new System.Drawing.Point(229, 7);
-            this.ComboxDeviceStatusLC.Name = "ComboxDeviceStatusLC";
-            this.ComboxDeviceStatusLC.Size = new System.Drawing.Size(121, 22);
-            this.ComboxDeviceStatusLC.TabIndex = 3;
-            // 
             // Main
             // 
             this.AllowFormGlass = DevExpress.Utils.DefaultBoolean.False;
@@ -1337,6 +1366,9 @@ namespace UAS_DeviceMonitor
             ((System.ComponentModel.ISupportInitialize)(this.GridViewPolling)).EndInit();
             this.PageDeviceStatus.ResumeLayout(false);
             this.PageDeviceStatus.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.ComboxDeviceStatusWC.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.ComboxDeviceStatusLC.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.CheckEditDeviceStatusEnable.Properties)).EndInit();
             this.PageWorkCenterStatus.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.GridWorkCenterStatus)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.GridViewWorkCenterStatus)).EndInit();
@@ -1452,8 +1484,9 @@ namespace UAS_DeviceMonitor
         private XtraScrollableControl PanelDeviceStatus;
         private DevExpress.Utils.ToolTipController CommonTipController;
         private LabelControl ComboxDeviceStatusWC_label;
-        private System.Windows.Forms.ComboBox ComboxDeviceStatusWC;
         private LabelControl ComboxDeviceStatusLC_label;
-        private System.Windows.Forms.ComboBox ComboxDeviceStatusLC;
+        private CheckEdit CheckEditDeviceStatusEnable;
+        private ComboBoxEdit ComboxDeviceStatusLC;
+        private ComboBoxEdit ComboxDeviceStatusWC;
     }
 }

+ 123 - 41
UAS_DeviceMonitor/Main.cs

@@ -21,6 +21,8 @@ namespace UAS_DeviceMonitor
     {
 
         StringBuilder sql = new StringBuilder();
+
+        StringBuilder DeviceStatusQuerySQL = new StringBuilder();
         DataHelper dh;
         ModeBusTCPServer mbt = new ModeBusTCPServer();
         List<string> SQL = new List<string>();
@@ -420,54 +422,133 @@ namespace UAS_DeviceMonitor
         {
             if (PageDeviceStatus.PageVisible)
             {
-                DataTable dt = (DataTable)dh.ExecuteSql("select distinct de_code,de_name,dpc_status,dpc_id from device left join DEVICEPOLLINGCONFIG on dpc_decode=de_code order by de_code", "select");
-                //界面重新展示时如过数量不一致则重新绘制
-                if (PanelDeviceStatus.Controls.Count != dt.Rows.Count)
+                DeviceStatusQuerySQL.Clear();
+                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dpc_status,dpc_id from device left join DEVICEPOLLINGCONFIG on dpc_decode=de_code order by de_code");
+                PaintDeviceStatusControl(DeviceStatusQuerySQL.ToString());
+                //填充筛选条件,车间和线体
+                DataTable dt = (DataTable)dh.ExecuteSql("select wc_code,wc_name from workcenter", "select");
+                BaseUtil.FillComBoxEditWidthDataTable(ComboxDeviceStatusWC, "wc_name", "wc_code", dt, true);
+            }
+        }
+
+        private void CheckEditDeviceStatusEnable_CheckedChanged(object sender, EventArgs e)
+        {
+            DeviceStatusQuerySQL.Clear();
+            if (CheckEditDeviceStatusEnable.Checked)
+            {
+                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dpc_status,dpc_id from device left join DEVICEPOLLINGCONFIG ");
+                DeviceStatusQuerySQL.Append("on dpc_decode=de_code where nvl(dpc_enable,0)<>0 order by de_code");
+            }
+            else
+            {
+                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dpc_status,dpc_id from device left join DEVICEPOLLINGCONFIG ");
+                DeviceStatusQuerySQL.Append("on dpc_decode=de_code order by de_code");
+            }
+            PaintDeviceStatusControl(DeviceStatusQuerySQL.ToString());
+        }
+
+        private void ComboxDeviceStatusWC_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            DeviceStatusQuerySQL.Clear();
+            string WC = BaseUtil.GetComboxEditValue(ComboxDeviceStatusWC);
+            if (CheckEditDeviceStatusEnable.Checked)
+            {
+                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dpc_status,dpc_id from device left join DEVICEPOLLINGCONFIG ");
+                DeviceStatusQuerySQL.Append("on dpc_decode=de_code where nvl(dpc_enable,0)<>0 and de_wccode='" + WC + "' order by de_code");
+            }
+            else
+            {
+                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dpc_status,dpc_id from device left join DEVICEPOLLINGCONFIG ");
+                DeviceStatusQuerySQL.Append("on dpc_decode=de_code where de_wccode='" + WC + "' order by de_code");
+            }
+            PaintDeviceStatusControl(DeviceStatusQuerySQL.ToString());
+            sql.Clear();
+            if (WC == "全部")
+                sql.Append("select li_code,li_name from line");
+            else
+                sql.Append("select li_code,li_name from line where li_wccode='" + WC + "'");
+            DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
+            BaseUtil.FillComBoxEditWidthDataTable(ComboxDeviceStatusLC, "li_code", "li_name", dt, true);
+        }
+
+        private void ComboxDeviceStatusLC_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            DeviceStatusQuerySQL.Clear();
+            string WC = BaseUtil.GetComboxEditValue(ComboxDeviceStatusWC);
+            string LC = BaseUtil.GetComboxEditValue(ComboxDeviceStatusLC);
+            if (CheckEditDeviceStatusEnable.Checked)
+            {
+                DeviceStatusQuerySQL.Append("select distinct de_code,de_name,dpc_status,dpc_id from device left join ");
+                DeviceStatusQuerySQL.Append("DEVICEPOLLINGCONFIG on dpc_decode=de_code where nvl(dpc_enable,0)<>0");
+                if (WC != "全部")
+                    DeviceStatusQuerySQL.Append(" and de_wccode='" + WC + "' ");
+                if (LC != "全部")
+                    DeviceStatusQuerySQL.Append(" and de_linecode='"+LC+"' ");
+                DeviceStatusQuerySQL.Append(" order by de_code");
+            }
+            else
+            {
+                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 != "全部")
+                    DeviceStatusQuerySQL.Append(" where de_wccode='" + WC + "' ");
+                if (LC != "全部")
+                    DeviceStatusQuerySQL.Append(" and de_linecode='" + LC + "' ");
+                DeviceStatusQuerySQL.Append("order by de_code");
+            }
+            PaintDeviceStatusControl(DeviceStatusQuerySQL.ToString());
+        }
+
+        private void PaintDeviceStatusControl(string SQL)
+        {
+            DataTable dt = (DataTable)dh.ExecuteSql(SQL, "select");
+            //界面重新展示时如过数量不一致则重新绘制
+            if (PanelDeviceStatus.Controls.Count != dt.Rows.Count)
+            {
+                PanelDeviceStatus.Controls.Clear();
+                int CountPerRow = PanelDeviceStatus.Width / 110;
+                int RightPadding = PanelDeviceStatus.Width % 110;
+                int Count = dt.Rows.Count;
+                int RowCount = Count % CountPerRow == 0 ? Count / CountPerRow : Count / CountPerRow + 1;
+                int LastRowCount = 0;
+                for (int i = 0; i < PanelDeviceStatus.Controls.Count; i++)
+                {
+                    PanelDeviceStatus.Controls[i].Dispose();
+                }
+                for (int j = 0; j < RowCount; j++)
                 {
-                    int CountPerRow = PanelDeviceStatus.Width / 110;
-                    int RightPadding = PanelDeviceStatus.Width % 110;
-                    int Count = dt.Rows.Count;
-                    int RowCount = Count % CountPerRow == 0 ? Count / CountPerRow : Count / CountPerRow + 1;
-                    int LastRowCount = 0;
-                    for (int i = 0; i < PanelDeviceStatus.Controls.Count; i++)
+                    //如果是最后一行则循环尾数
+                    if (j == RowCount - 1)
                     {
-                        PanelDeviceStatus.Controls[i].Dispose();
+                        LastRowCount = Count % CountPerRow;
                     }
-                    for (int j = 0; j < RowCount; j++)
+                    for (int i = 0; i < (j == RowCount - 1 ? LastRowCount : CountPerRow); i++)
                     {
-                        //如果是最后一行则循环尾数
-                        if (j == RowCount - 1)
+                        PictureEditWithText pic = new PictureEditWithText();
+                        pic.DeviceName = dt.Rows[j * CountPerRow + i]["de_name"].ToString();
+                        pic.Picedit.ToolTipController = CommonTipController;
+                        pic.Name = dt.Rows[j * CountPerRow + i]["de_code"].ToString() + i + j;
+                        pic.Anchor = AnchorStyles.Left;
+                        pic.Anchor = AnchorStyles.Top;
+                        pic.Picedit.Name = dt.Rows[j * CountPerRow + i]["de_code"].ToString();
+                        pic.Picedit.MouseHover += Pic_MouseHover;
+                        pic.Picedit.Properties.SizeMode = PictureSizeMode.Squeeze;
+                        if (dt.Rows[j * CountPerRow + i]["dpc_status"].ToString() != "Running")
                         {
-                            LastRowCount = Count % CountPerRow;
+                            pic.Picedit.Image = Properties.Resources.network_offline;
                         }
-                        for (int i = 0; i < (j == RowCount - 1 ? LastRowCount : CountPerRow); i++)
+                        else
                         {
-                            PictureEditWithText pic = new PictureEditWithText();
-                            pic.DeviceName = dt.Rows[j * CountPerRow + i]["de_name"].ToString();
-                            pic.Picedit.ToolTipController = CommonTipController;
-                            pic.Name = dt.Rows[j * CountPerRow + i]["de_code"].ToString() + i + j;
-                            pic.Anchor = AnchorStyles.Left;
-                            pic.Anchor = AnchorStyles.Top;
-                            pic.Picedit.Name = dt.Rows[j * CountPerRow + i]["de_code"].ToString();
-                            pic.Picedit.MouseHover += Pic_MouseHover;
-                            pic.Picedit.Properties.SizeMode = PictureSizeMode.Squeeze;
-                            if (dt.Rows[j * CountPerRow + i]["dpc_status"].ToString() != "Running")
-                            {
-                                pic.Picedit.Image = Properties.Resources.network_offline;
-                            }
-                            else
-                            {
-                                pic.Picedit.Image = Properties.Resources.net_connected;
-                            }
-                            pic.Text = dt.Rows[j * CountPerRow + i]["de_code"].ToString();
-                            pic.Picedit.BorderStyle = BorderStyles.HotFlat;
-                            pic.Location = new Point((10 + RightPadding) / 2 + 110 * i, 10 + j * 150);
-                            PanelDeviceStatus.Controls.Add(pic);
+                            pic.Picedit.Image = Properties.Resources.net_connected;
                         }
+                        pic.Text = dt.Rows[j * CountPerRow + i]["de_code"].ToString();
+                        pic.Picedit.BorderStyle = BorderStyles.HotFlat;
+                        pic.Location = new Point((10 + RightPadding) / 2 + 110 * i, 10 + j * 150);
+                        PanelDeviceStatus.Controls.Add(pic);
                     }
-                    BaseUtil.CleanMemory();
-                    TimerDeviceStatus.Start();
                 }
+                BaseUtil.CleanMemory();
+                TimerDeviceStatus.Start();
             }
         }
 
@@ -479,9 +560,9 @@ namespace UAS_DeviceMonitor
             {
                 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_senddatasize"].ToString() + "字节\n");
                 sql.Append("接收数据大小" + dt.Rows[0]["dpg_receivedatasize"].ToString() + "字节\n");
-                sql.Append("轮询次数"+dt.Rows[0]["dpg_count"].ToString()+"次\n");
+                sql.Append("轮询次数" + dt.Rows[0]["dpg_count"].ToString() + "次\n");
                 CommonTipController.ShowHint(sql.ToString(), pic.Name);
             }
             else
@@ -493,7 +574,7 @@ namespace UAS_DeviceMonitor
         //重新展示设备图像界面
         private void ShowDeviceStatus()
         {
-            DataTable dt = (DataTable)dh.ExecuteSql("select distinct de_code,dpc_status,dpc_id from device left join DEVICEPOLLINGCONFIG on dpc_decode=de_code order by de_code", "select");
+            DataTable dt = (DataTable)dh.ExecuteSql(DeviceStatusQuerySQL.ToString(), "select");
             int CountPerRow = PanelDeviceStatus.Width / 110;
             int RightPadding = PanelDeviceStatus.Width % 110;
             int Count = dt.Rows.Count;
@@ -519,6 +600,7 @@ namespace UAS_DeviceMonitor
                     }
                 }
             }
+            BaseUtil.CleanMemory();
         }
 
         //刷新界面

+ 22 - 2
UAS_DeviceMonitor/PublicMethod/BaseUtil.cs

@@ -12,7 +12,7 @@ namespace UAS_DeviceMonitor.PublicMethod
 {
     class BaseUtil
     {
-    
+
 
         [DllImport("kernel32.dll", EntryPoint = "SetProcessWorkingSetSize")]
         public static extern int SetProcessWorkingSetSize(IntPtr process, int minSize, int maxSize);
@@ -42,6 +42,26 @@ namespace UAS_DeviceMonitor.PublicMethod
             combo.SelectedIndex = 0;
         }
 
+        public static void FillComBoxEditWidthDataTable(ComboBoxEdit combo, string TextField, string ValueField, DataTable dt, bool AddAll)
+        {
+            combo.Properties.Items.Clear();
+            if (AddAll)
+            {
+                ComboBoxData item = new ComboBoxData();
+                item.Value = "全部";
+                item.Text = "全部";
+                combo.Properties.Items.Add(item);
+            }
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                ComboBoxData item = new ComboBoxData();
+                item.Value = dt.Rows[i][ValueField].ToString();
+                item.Text = dt.Rows[i][TextField].ToString();
+                combo.Properties.Items.Add(item);
+            }
+            combo.SelectedIndex = 0;
+        }
+
         public static DataTable ToDataTable(DataRow[] rows)
         {
             if (rows == null || rows.Length == 0) return new DataTable();
@@ -142,7 +162,7 @@ namespace UAS_DeviceMonitor.PublicMethod
             }
             catch (Exception)
             {
-              
+
             }
         }
     }