Browse Source

添加指令明细显示

章政 7 years ago
parent
commit
3527d3fe8d

+ 17 - 1
UAS_DeviceMonitor/Device/Information/DeviceDetailInfo.Designer.cs

@@ -48,10 +48,12 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.DC_CODE = new DevExpress.XtraGrid.Columns.GridColumn();
             this.DC_NAME = new DevExpress.XtraGrid.Columns.GridColumn();
             this.DPC_ENABLE = new DevExpress.XtraGrid.Columns.GridColumn();
+            this.repositoryItemCheckEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit();
             ((System.ComponentModel.ISupportInitialize)(this.groupControl1)).BeginInit();
             this.groupControl1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.GridDeviceDetailInfo)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.GridViewDeviceDetailInfo)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.repositoryItemCheckEdit1)).BeginInit();
             this.SuspendLayout();
             // 
             // groupControl1
@@ -181,6 +183,8 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.GridDeviceDetailInfo.Location = new System.Drawing.Point(310, 12);
             this.GridDeviceDetailInfo.MainView = this.GridViewDeviceDetailInfo;
             this.GridDeviceDetailInfo.Name = "GridDeviceDetailInfo";
+            this.GridDeviceDetailInfo.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] {
+            this.repositoryItemCheckEdit1});
             this.GridDeviceDetailInfo.Size = new System.Drawing.Size(431, 349);
             this.GridDeviceDetailInfo.TabIndex = 2;
             this.GridDeviceDetailInfo.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
@@ -216,12 +220,22 @@ namespace UAS_DeviceMonitor.Device.Infomation
             // DPC_ENABLE
             // 
             this.DPC_ENABLE.Caption = "是否启用";
+            this.DPC_ENABLE.ColumnEdit = this.repositoryItemCheckEdit1;
             this.DPC_ENABLE.FieldName = "DPC_ENABLE";
-            this.DPC_ENABLE.Name = "DPC_ENABLE";
             this.DPC_ENABLE.OptionsColumn.AllowEdit = false;
+            this.DPC_ENABLE.Name = "DPC_ENABLE";
             this.DPC_ENABLE.Visible = true;
             this.DPC_ENABLE.VisibleIndex = 2;
             // 
+            // repositoryItemCheckEdit1
+            // 
+            this.repositoryItemCheckEdit1.AutoHeight = false;
+            this.repositoryItemCheckEdit1.Name = "repositoryItemCheckEdit1";
+            this.repositoryItemCheckEdit1.NullStyle = DevExpress.XtraEditors.Controls.StyleIndeterminate.Unchecked;
+            this.repositoryItemCheckEdit1.NullText = "0";
+            this.repositoryItemCheckEdit1.ValueChecked = "-1";
+            this.repositoryItemCheckEdit1.ValueUnchecked = "0";
+            // 
             // DeviceDetailInfo
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
@@ -241,6 +255,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.groupControl1.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.GridDeviceDetailInfo)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.GridViewDeviceDetailInfo)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.repositoryItemCheckEdit1)).EndInit();
             this.ResumeLayout(false);
 
         }
@@ -265,5 +280,6 @@ namespace UAS_DeviceMonitor.Device.Infomation
         private DevExpress.XtraGrid.Columns.GridColumn DC_CODE;
         private DevExpress.XtraGrid.Columns.GridColumn DC_NAME;
         private DevExpress.XtraGrid.Columns.GridColumn DPC_ENABLE;
+        private DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit repositoryItemCheckEdit1;
     }
 }

+ 32 - 1
UAS_DeviceMonitor/Device/Information/DeviceDetailInfo.cs

@@ -20,6 +20,37 @@ namespace UAS_DeviceMonitor.Device.Infomation
         public DeviceDetailInfo()
         {
             InitializeComponent();
+            repositoryItemCheckEdit1.QueryCheckStateByValue += RepositoryItemCheckEdit1_QueryCheckStateByValue;
+        }
+
+        private void RepositoryItemCheckEdit1_QueryCheckStateByValue(object sender, DevExpress.XtraEditors.Controls.QueryCheckStateByValueEventArgs e)
+        {
+            string val = "";
+            if (e.Value != null)
+            {
+                val = e.Value.ToString();
+            }
+            else
+            {
+                val = "FALSE";//默认为不选   
+            }
+            switch (val.ToUpper())
+            {
+                case "TRUE":
+                case "YES":
+                case "1":
+                    e.CheckState = System.Windows.Forms.CheckState.Checked;
+                    break;
+                case "FALSE":
+                case "NO":
+                case "0":
+                    e.CheckState = System.Windows.Forms.CheckState.Unchecked;
+                    break;
+                default:
+                    e.CheckState = System.Windows.Forms.CheckState.Checked;
+                    break;
+            }
+            e.Handled = true;
         }
 
         public DeviceDetailInfo(string DevcieCode)
@@ -36,7 +67,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             {
                 BaseUtil.SetFormValue(Controls, dt);
             }
-            dt = (DataTable)dh.ExecuteSql("select dc_code,dc_name,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;
         }