Browse Source

添加参数查询

章政 7 years ago
parent
commit
3715fadb74

+ 71 - 23
PLCDataReader/Device/Information/DeviceStatusInfo.Designer.cs

@@ -40,6 +40,9 @@ namespace UAS_PLCDataReader.Device.Infomation
             this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
             this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
             this.groupControl2 = new DevExpress.XtraEditors.GroupControl();
+            this.OUTQTY = new UAS_PLCDataReader.CustomerControl.ValueLabel.ValueLabel();
+            this.INQTY = new UAS_PLCDataReader.CustomerControl.ValueLabel.ValueLabel();
+            this.labelControl13 = new DevExpress.XtraEditors.LabelControl();
             this.labelControl5 = new DevExpress.XtraEditors.LabelControl();
             this.labelControl6 = new DevExpress.XtraEditors.LabelControl();
             this.labelControl8 = new DevExpress.XtraEditors.LabelControl();
@@ -55,15 +58,18 @@ namespace UAS_PLCDataReader.Device.Infomation
             this.dpg_receivedatasize = new UAS_PLCDataReader.CustomerControl.ValueLabel.ValueLabel();
             this.dpg_senddatasize = new UAS_PLCDataReader.CustomerControl.ValueLabel.ValueLabel();
             this.dpg_starttime = new UAS_PLCDataReader.CustomerControl.ValueLabel.ValueLabel();
-            this.labelControl13 = new DevExpress.XtraEditors.LabelControl();
-            this.INQTY = new UAS_PLCDataReader.CustomerControl.ValueLabel.ValueLabel();
-            this.OUTQTY = new UAS_PLCDataReader.CustomerControl.ValueLabel.ValueLabel();
+            this.GridDeivceStatusInfo = new DevExpress.XtraGrid.GridControl();
+            this.GridViewDeviceStatusInfo = new DevExpress.XtraGrid.Views.Grid.GridView();
+            this.dc_name = new DevExpress.XtraGrid.Columns.GridColumn();
+            this.data = new DevExpress.XtraGrid.Columns.GridColumn();
             ((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();
+            ((System.ComponentModel.ISupportInitialize)(this.GridDeivceStatusInfo)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.GridViewDeviceStatusInfo)).BeginInit();
             this.SuspendLayout();
             // 
             // groupControl1
@@ -165,6 +171,31 @@ namespace UAS_PLCDataReader.Device.Infomation
             this.groupControl2.TabIndex = 1;
             this.groupControl2.Text = "生产信息";
             // 
+            // OUTQTY
+            // 
+            this.OUTQTY.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.OUTQTY.Location = new System.Drawing.Point(69, 156);
+            this.OUTQTY.Name = "OUTQTY";
+            this.OUTQTY.Size = new System.Drawing.Size(0, 16);
+            this.OUTQTY.TabIndex = 21;
+            // 
+            // INQTY
+            // 
+            this.INQTY.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.INQTY.Location = new System.Drawing.Point(69, 128);
+            this.INQTY.Name = "INQTY";
+            this.INQTY.Size = new System.Drawing.Size(0, 16);
+            this.INQTY.TabIndex = 20;
+            // 
+            // labelControl13
+            // 
+            this.labelControl13.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.labelControl13.Location = new System.Drawing.Point(13, 156);
+            this.labelControl13.Name = "labelControl13";
+            this.labelControl13.Size = new System.Drawing.Size(32, 16);
+            this.labelControl13.TabIndex = 11;
+            this.labelControl13.Text = "产出";
+            // 
             // labelControl5
             // 
             this.labelControl5.Appearance.Font = new System.Drawing.Font("黑体", 12F);
@@ -304,36 +335,47 @@ namespace UAS_PLCDataReader.Device.Infomation
             this.dpg_starttime.Size = new System.Drawing.Size(0, 16);
             this.dpg_starttime.TabIndex = 0;
             // 
-            // labelControl13
+            // GridDeivceStatusInfo
             // 
-            this.labelControl13.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.labelControl13.Location = new System.Drawing.Point(13, 156);
-            this.labelControl13.Name = "labelControl13";
-            this.labelControl13.Size = new System.Drawing.Size(32, 16);
-            this.labelControl13.TabIndex = 11;
-            this.labelControl13.Text = "产出";
+            this.GridDeivceStatusInfo.Location = new System.Drawing.Point(550, 12);
+            this.GridDeivceStatusInfo.MainView = this.GridViewDeviceStatusInfo;
+            this.GridDeivceStatusInfo.Name = "GridDeivceStatusInfo";
+            this.GridDeivceStatusInfo.Size = new System.Drawing.Size(207, 372);
+            this.GridDeivceStatusInfo.TabIndex = 3;
+            this.GridDeivceStatusInfo.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
+            this.GridViewDeviceStatusInfo});
             // 
-            // INQTY
+            // GridViewDeviceStatusInfo
             // 
-            this.INQTY.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.INQTY.Location = new System.Drawing.Point(69, 128);
-            this.INQTY.Name = "INQTY";
-            this.INQTY.Size = new System.Drawing.Size(0, 16);
-            this.INQTY.TabIndex = 20;
+            this.GridViewDeviceStatusInfo.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
+            this.dc_name,
+            this.data});
+            this.GridViewDeviceStatusInfo.GridControl = this.GridDeivceStatusInfo;
+            this.GridViewDeviceStatusInfo.Name = "GridViewDeviceStatusInfo";
+            this.GridViewDeviceStatusInfo.OptionsView.ShowGroupPanel = false;
             // 
-            // OUTQTY
+            // dc_name
             // 
-            this.OUTQTY.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.OUTQTY.Location = new System.Drawing.Point(69, 156);
-            this.OUTQTY.Name = "OUTQTY";
-            this.OUTQTY.Size = new System.Drawing.Size(0, 16);
-            this.OUTQTY.TabIndex = 21;
+            this.dc_name.Caption = "参数";
+            this.dc_name.FieldName = "DC_NAME";
+            this.dc_name.Name = "dc_name";
+            this.dc_name.Visible = true;
+            this.dc_name.VisibleIndex = 0;
+            // 
+            // data
+            // 
+            this.data.Caption = "上一次更新值";
+            this.data.FieldName = "DATA";
+            this.data.Name = "data";
+            this.data.Visible = true;
+            this.data.VisibleIndex = 1;
             // 
             // DeviceStatusInfo
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(556, 396);
+            this.ClientSize = new System.Drawing.Size(769, 396);
+            this.Controls.Add(this.GridDeivceStatusInfo);
             this.Controls.Add(this.groupControl3);
             this.Controls.Add(this.groupControl2);
             this.Controls.Add(this.groupControl1);
@@ -354,6 +396,8 @@ namespace UAS_PLCDataReader.Device.Infomation
             ((System.ComponentModel.ISupportInitialize)(this.groupControl3)).EndInit();
             this.groupControl3.ResumeLayout(false);
             this.groupControl3.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.GridDeivceStatusInfo)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.GridViewDeviceStatusInfo)).EndInit();
             this.ResumeLayout(false);
 
         }
@@ -388,5 +432,9 @@ namespace UAS_PLCDataReader.Device.Infomation
         private DevExpress.XtraEditors.LabelControl labelControl13;
         private ValueLabel OUTQTY;
         private ValueLabel INQTY;
+        private DevExpress.XtraGrid.GridControl GridDeivceStatusInfo;
+        private DevExpress.XtraGrid.Views.Grid.GridView GridViewDeviceStatusInfo;
+        private DevExpress.XtraGrid.Columns.GridColumn dc_name;
+        private DevExpress.XtraGrid.Columns.GridColumn data;
     }
 }

+ 5 - 5
PLCDataReader/Device/Information/DeviceStatusInfo.cs

@@ -40,6 +40,11 @@ namespace UAS_PLCDataReader.Device.Infomation
             {
                 BaseUtil.SetFormValue(Controls, dt);
             }
+            sql.Clear();
+            sql.Append("select dc_name,case when dc_type='INQTY' then dr_qty when dc_type='OUTQTY' then dr_okqty end data ");
+            sql.Append("from DEVICEPOLLINGCONFIG left join devicecommand on dpc_dccode = dc_code left join DEVICERUNSTATUS ");
+            sql.Append("on dpc_decode = dr_decode where dpc_decode = '" + de_code + "'");
+            GridDeivceStatusInfo.DataSource = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
             if (Main.ReturnData.ContainsKey(de_code))
             {
                 dpg_count.Text = Main.ReturnData[de_code].SendCount.ToString();
@@ -69,11 +74,6 @@ namespace UAS_PLCDataReader.Device.Infomation
                     }
                 }
             }
-            //dt = (DataTable)dh.ExecuteSql("select dpg_count,round((sysdate-dpg_starttime)*1440)||'分钟' dpg_runtime,dpg_starttime,dpg_senddatasize,dpg_receivedatasize from DEVICEPOLLINGLOG where dpg_id=(select max(dpg_id) from DEVICEPOLLINGLOG where dpg_decode='" + de_code + "') and dpg_status='Running'", "select");
-            //if (dt.Rows.Count > 0)
-            //{
-            //    BaseUtil.SetFormValue(Controls, dt);
-            //}
         }
 
         private void DeviceStatusInfo_KeyDown(object sender, KeyEventArgs e)