From 2404d5dfffa74c08552dc058e32aa8af3944d609 Mon Sep 17 00:00:00 2001 From: SoulStar Date: Thu, 9 Jan 2025 20:27:07 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E5=8E=BB=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RFIDSocket/LogControl.cs | 4 + RFIDSocket/RFIDLog.Designer.cs | 130 +++++++++------ RFIDSocket/RFIDLog.cs | 65 +++++--- RFIDSocket/RFIDSocket.Designer.cs | 258 +++++++++++++++--------------- RFIDSocket/RFIDSocket.cs | 3 +- RFIDSocket/RFIDSocket.resx | 6 +- RFIDSocket/ServerDataAnalysis.cs | 20 ++- 7 files changed, 275 insertions(+), 211 deletions(-) diff --git a/RFIDSocket/LogControl.cs b/RFIDSocket/LogControl.cs index 368cd72..9d9a7c3 100644 --- a/RFIDSocket/LogControl.cs +++ b/RFIDSocket/LogControl.cs @@ -17,6 +17,10 @@ namespace RFIDSocket public static List LogReadKindSelect(List lists, string readKind) { + if (string.IsNullOrEmpty(readKind)) + { + return lists; + } return lists.Where(x => x.ReadKind == readKind).ToList(); } diff --git a/RFIDSocket/RFIDLog.Designer.cs b/RFIDSocket/RFIDLog.Designer.cs index 516524c..e30204e 100644 --- a/RFIDSocket/RFIDLog.Designer.cs +++ b/RFIDSocket/RFIDLog.Designer.cs @@ -40,11 +40,6 @@ this.DeviceNo = new System.Windows.Forms.TextBox(); this.DeviceNoSelect = new System.Windows.Forms.Button(); this.LogContent = new System.Windows.Forms.DataGridView(); - this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.deviceNoDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.readKindDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.contentDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.logTimeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.rFIDContentBindingSource = new System.Windows.Forms.BindingSource(this.components); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.Content = new System.Windows.Forms.TextBox(); @@ -62,6 +57,13 @@ this.label9 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); + this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.deviceNoDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.readKindDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.contentDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.logTimeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.TotalReadCount = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); @@ -189,41 +191,6 @@ this.LogContent.Size = new System.Drawing.Size(669, 899); this.LogContent.TabIndex = 7; // - // ID - // - this.ID.DataPropertyName = "ID"; - this.ID.HeaderText = "ID"; - this.ID.Name = "ID"; - this.ID.Width = 40; - // - // deviceNoDataGridViewTextBoxColumn - // - this.deviceNoDataGridViewTextBoxColumn.DataPropertyName = "DeviceNo"; - this.deviceNoDataGridViewTextBoxColumn.HeaderText = "格口"; - this.deviceNoDataGridViewTextBoxColumn.Name = "deviceNoDataGridViewTextBoxColumn"; - this.deviceNoDataGridViewTextBoxColumn.Width = 40; - // - // readKindDataGridViewTextBoxColumn - // - this.readKindDataGridViewTextBoxColumn.DataPropertyName = "ReadKind"; - this.readKindDataGridViewTextBoxColumn.HeaderText = "读码结果"; - this.readKindDataGridViewTextBoxColumn.Name = "readKindDataGridViewTextBoxColumn"; - this.readKindDataGridViewTextBoxColumn.Width = 60; - // - // contentDataGridViewTextBoxColumn - // - this.contentDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.contentDataGridViewTextBoxColumn.DataPropertyName = "Content"; - this.contentDataGridViewTextBoxColumn.HeaderText = "条码内容"; - this.contentDataGridViewTextBoxColumn.Name = "contentDataGridViewTextBoxColumn"; - // - // logTimeDataGridViewTextBoxColumn - // - this.logTimeDataGridViewTextBoxColumn.DataPropertyName = "LogTime"; - this.logTimeDataGridViewTextBoxColumn.HeaderText = "日志时间"; - this.logTimeDataGridViewTextBoxColumn.Name = "logTimeDataGridViewTextBoxColumn"; - this.logTimeDataGridViewTextBoxColumn.Width = 105; - // // rFIDContentBindingSource // this.rFIDContentBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDContent); @@ -317,7 +284,7 @@ // this.ReadSuccessPercent.AutoSize = true; this.ReadSuccessPercent.Font = new System.Drawing.Font("宋体", 12F); - this.ReadSuccessPercent.Location = new System.Drawing.Point(132, 836); + this.ReadSuccessPercent.Location = new System.Drawing.Point(132, 869); this.ReadSuccessPercent.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); this.ReadSuccessPercent.Name = "ReadSuccessPercent"; this.ReadSuccessPercent.Size = new System.Drawing.Size(31, 16); @@ -328,7 +295,7 @@ // this.ErrorReadNum.AutoSize = true; this.ErrorReadNum.Font = new System.Drawing.Font("宋体", 12F); - this.ErrorReadNum.Location = new System.Drawing.Point(132, 802); + this.ErrorReadNum.Location = new System.Drawing.Point(132, 835); this.ErrorReadNum.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); this.ErrorReadNum.Name = "ErrorReadNum"; this.ErrorReadNum.Size = new System.Drawing.Size(31, 16); @@ -339,7 +306,7 @@ // this.NormalReadNum.AutoSize = true; this.NormalReadNum.Font = new System.Drawing.Font("宋体", 12F); - this.NormalReadNum.Location = new System.Drawing.Point(132, 768); + this.NormalReadNum.Location = new System.Drawing.Point(132, 801); this.NormalReadNum.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); this.NormalReadNum.Name = "NormalReadNum"; this.NormalReadNum.Size = new System.Drawing.Size(31, 16); @@ -350,7 +317,7 @@ // this.label9.AutoSize = true; this.label9.Font = new System.Drawing.Font("宋体", 12F); - this.label9.Location = new System.Drawing.Point(11, 768); + this.label9.Location = new System.Drawing.Point(11, 801); this.label9.Margin = new System.Windows.Forms.Padding(15, 15, 15, 3); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(119, 16); @@ -361,7 +328,7 @@ // this.label8.AutoSize = true; this.label8.Font = new System.Drawing.Font("宋体", 12F); - this.label8.Location = new System.Drawing.Point(11, 802); + this.label8.Location = new System.Drawing.Point(11, 835); this.label8.Margin = new System.Windows.Forms.Padding(15, 15, 15, 3); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(119, 16); @@ -372,18 +339,77 @@ // this.label7.AutoSize = true; this.label7.Font = new System.Drawing.Font("宋体", 12F); - this.label7.Location = new System.Drawing.Point(11, 836); + this.label7.Location = new System.Drawing.Point(11, 869); this.label7.Margin = new System.Windows.Forms.Padding(15, 15, 15, 3); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(103, 16); this.label7.TabIndex = 13; this.label7.Text = "读码成功率:"; // + // ID + // + this.ID.DataPropertyName = "ID"; + this.ID.HeaderText = "编号"; + this.ID.Name = "ID"; + this.ID.Width = 40; + // + // deviceNoDataGridViewTextBoxColumn + // + this.deviceNoDataGridViewTextBoxColumn.DataPropertyName = "DeviceNo"; + this.deviceNoDataGridViewTextBoxColumn.HeaderText = "格口"; + this.deviceNoDataGridViewTextBoxColumn.Name = "deviceNoDataGridViewTextBoxColumn"; + this.deviceNoDataGridViewTextBoxColumn.Width = 40; + // + // readKindDataGridViewTextBoxColumn + // + this.readKindDataGridViewTextBoxColumn.DataPropertyName = "ReadKind"; + this.readKindDataGridViewTextBoxColumn.HeaderText = "读码结果"; + this.readKindDataGridViewTextBoxColumn.Name = "readKindDataGridViewTextBoxColumn"; + this.readKindDataGridViewTextBoxColumn.Width = 60; + // + // contentDataGridViewTextBoxColumn + // + this.contentDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.contentDataGridViewTextBoxColumn.DataPropertyName = "Content"; + this.contentDataGridViewTextBoxColumn.HeaderText = "条码内容"; + this.contentDataGridViewTextBoxColumn.Name = "contentDataGridViewTextBoxColumn"; + // + // logTimeDataGridViewTextBoxColumn + // + this.logTimeDataGridViewTextBoxColumn.DataPropertyName = "LogTime"; + this.logTimeDataGridViewTextBoxColumn.HeaderText = "日志时间"; + this.logTimeDataGridViewTextBoxColumn.Name = "logTimeDataGridViewTextBoxColumn"; + this.logTimeDataGridViewTextBoxColumn.Width = 105; + // + // TotalReadCount + // + this.TotalReadCount.AutoSize = true; + this.TotalReadCount.Font = new System.Drawing.Font("宋体", 12F); + this.TotalReadCount.Location = new System.Drawing.Point(132, 767); + this.TotalReadCount.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); + this.TotalReadCount.Name = "TotalReadCount"; + this.TotalReadCount.Size = new System.Drawing.Size(31, 16); + this.TotalReadCount.TabIndex = 20; + this.TotalReadCount.Text = "N/A"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("宋体", 12F); + this.label4.Location = new System.Drawing.Point(11, 767); + this.label4.Margin = new System.Windows.Forms.Padding(15, 15, 15, 3); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(103, 16); + this.label4.TabIndex = 19; + this.label4.Text = "总读码数量:"; + // // RFIDLog // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(907, 923); + this.Controls.Add(this.TotalReadCount); + this.Controls.Add(this.label4); this.Controls.Add(this.ReadSuccessPercent); this.Controls.Add(this.ErrorReadNum); this.Controls.Add(this.NormalReadNum); @@ -434,11 +460,6 @@ private System.Windows.Forms.TextBox Content; private System.Windows.Forms.Button ContentSelect; private System.Windows.Forms.Button SelectAll; - private System.Windows.Forms.DataGridViewTextBoxColumn ID; - private System.Windows.Forms.DataGridViewTextBoxColumn deviceNoDataGridViewTextBoxColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn readKindDataGridViewTextBoxColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn contentDataGridViewTextBoxColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn logTimeDataGridViewTextBoxColumn; private System.Windows.Forms.Button ExcelOutPut; private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; private System.Windows.Forms.TextBox txtPath; @@ -451,5 +472,12 @@ private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label7; + private System.Windows.Forms.DataGridViewTextBoxColumn ID; + private System.Windows.Forms.DataGridViewTextBoxColumn deviceNoDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn readKindDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn contentDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn logTimeDataGridViewTextBoxColumn; + private System.Windows.Forms.Label TotalReadCount; + private System.Windows.Forms.Label label4; } } \ No newline at end of file diff --git a/RFIDSocket/RFIDLog.cs b/RFIDSocket/RFIDLog.cs index a997ed4..7783bd7 100644 --- a/RFIDSocket/RFIDLog.cs +++ b/RFIDSocket/RFIDLog.cs @@ -23,14 +23,18 @@ namespace RFIDSocket { InitializeComponent(); StartTime.Value = DateTime.Now.AddDays(-3); - List list = new List + Dictionary dict = new Dictionary() { - "", - "NB", - "GR", - "MR" + { "", "" }, + { "正常", "GR" }, + { "无读", "NB" }, + { "多标签", "MR" }, }; - ReadKind.DataSource = list; + BindingSource bs = new BindingSource(); + bs.DataSource = dict; + ReadKind.DataSource = bs; + ReadKind.DisplayMember = "Key"; + ReadKind.ValueMember = "Value"; txtPath.Text = Environment.CurrentDirectory.ToString(); Init(); } @@ -44,20 +48,22 @@ namespace RFIDSocket { if (LogContent != null) { + var list = LogControl.LogTimeSelect(rFIDContents, StartTime.Value, EndTime.Value); LogContent.DataSource = null; - LogContent.DataSource = LogControl.LogTimeSelect(rFIDContents, StartTime.Value, EndTime.Value); + LogContent.DataSource = ServerDataAnalysis.ChangeReadResult(list); + NumCount(list); } - NumCount(); } private void ReadKindSelect_Click(object sender, EventArgs e) { if (LogContent != null) { + var list = LogControl.LogReadKindSelect(rFIDContents, ReadKind.SelectedValue.ToString()); LogContent.DataSource = null; - LogContent.DataSource = LogControl.LogReadKindSelect(rFIDContents, ReadKind.Text); + LogContent.DataSource = ServerDataAnalysis.ChangeReadResult(list); + NumCount(list); } - NumCount(); } private void DeviceNoSelect_Click(object sender, EventArgs e) @@ -69,20 +75,22 @@ namespace RFIDSocket } if (LogContent != null) { + var list = LogControl.LogDeviceNoSelect(rFIDContents, no); LogContent.DataSource = null; - LogContent.DataSource = LogControl.LogDeviceNoSelect(rFIDContents, no); + LogContent.DataSource = ServerDataAnalysis.ChangeReadResult(list); + NumCount(list); } - NumCount(); } private void ContentSelect_Click(object sender, EventArgs e) { if (LogContent != null) { + var list = LogControl.LogContentSelect(rFIDContents, Content.Text); LogContent.DataSource = null; - LogContent.DataSource = LogControl.LogContentSelect(rFIDContents, Content.Text); + LogContent.DataSource = ServerDataAnalysis.ChangeReadResult(list); + NumCount(list); } - NumCount(); } private void SelectAll_Click(object sender, EventArgs e) @@ -92,34 +100,39 @@ namespace RFIDSocket MessageBox.Show("设备编号格式不正确"); return; } + if (LogContent != null) { - LogContent.DataSource = null; - LogContent.DataSource = LogControl.LogTimeSelect( + var list = LogControl.LogTimeSelect( LogControl.LogReadKindSelect( LogControl.LogDeviceNoSelect( - LogControl.LogContentSelect(rFIDContents, - Content.Text), - no), - ReadKind.Text), + LogControl.LogContentSelect(rFIDContents, + Content.Text), + no), + ReadKind.SelectedValue.ToString()), StartTime.Value, EndTime.Value); + LogContent.DataSource = null; + LogContent.DataSource = ServerDataAnalysis.ChangeReadResult(list); + NumCount(list); } - NumCount(); } - private void NumCount() + private void NumCount(List list) { - int normalCount = rFIDContents.Where(x => x.ReadKind == "GR").Count(); - int errorCount = rFIDContents.Where(x => x.ReadKind == "MR" || x.ReadKind == "NB").Count(); + int normalCount = list.Where(x => x.ReadKind == "正常").Count(); + int totalCount = list.Count(); + TotalReadCount.Text = totalCount.ToString(); NormalReadNum.Text = normalCount.ToString(); - ErrorReadNum.Text = errorCount.ToString(); + ErrorReadNum.Text = (totalCount - normalCount).ToString(); //算比例 - float percent = (float)normalCount / (float)rFIDContents.Count; + float percent = (float)normalCount / (float)list.Count; percent *= 100f; ReadSuccessPercent.Text = $"%{percent}"; + + rFIDContents = sql.GetContentInfos(); } /// diff --git a/RFIDSocket/RFIDSocket.Designer.cs b/RFIDSocket/RFIDSocket.Designer.cs index 56a5c60..13a99bd 100644 --- a/RFIDSocket/RFIDSocket.Designer.cs +++ b/RFIDSocket/RFIDSocket.Designer.cs @@ -30,11 +30,6 @@ { this.components = new System.ComponentModel.Container(); this.CotentData = new System.Windows.Forms.DataGridView(); - this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.deviceNoDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.readKindDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.contentDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.logTimeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.rFIDContentBindingSource = new System.Windows.Forms.BindingSource(this.components); this.IPText = new System.Windows.Forms.TextBox(); this.SetAddress = new System.Windows.Forms.Button(); @@ -60,20 +55,25 @@ this.panel1 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.ReadSuccessPercent = new System.Windows.Forms.Label(); + this.ErrorReadNum = new System.Windows.Forms.Label(); + this.NormalReadNum = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.ErrorCountDataGridView = new System.Windows.Forms.DataGridView(); + this.BinNo = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ErrorCount = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.label10 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); - this.label11 = new System.Windows.Forms.Label(); - this.NormalReadNum = new System.Windows.Forms.Label(); - this.ErrorReadNum = new System.Windows.Forms.Label(); - this.ReadSuccessPercent = new System.Windows.Forms.Label(); - this.ErrorCountDataGridView = new System.Windows.Forms.DataGridView(); - this.BinNo = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ErrorCount = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.deviceNoDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.readKindDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.contentDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.logTimeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.CotentData)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.rFIDContentBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.rFIDStateBindingSource)).BeginInit(); @@ -113,50 +113,6 @@ this.CotentData.Size = new System.Drawing.Size(775, 703); this.CotentData.TabIndex = 0; // - // ID - // - this.ID.DataPropertyName = "ID"; - this.ID.HeaderText = "ID"; - this.ID.Name = "ID"; - this.ID.ReadOnly = true; - this.ID.Width = 40; - // - // deviceNoDataGridViewTextBoxColumn - // - this.deviceNoDataGridViewTextBoxColumn.DataPropertyName = "DeviceNo"; - this.deviceNoDataGridViewTextBoxColumn.HeaderText = "格口"; - this.deviceNoDataGridViewTextBoxColumn.MinimumWidth = 6; - this.deviceNoDataGridViewTextBoxColumn.Name = "deviceNoDataGridViewTextBoxColumn"; - this.deviceNoDataGridViewTextBoxColumn.ReadOnly = true; - this.deviceNoDataGridViewTextBoxColumn.Width = 40; - // - // readKindDataGridViewTextBoxColumn - // - this.readKindDataGridViewTextBoxColumn.DataPropertyName = "ReadKind"; - this.readKindDataGridViewTextBoxColumn.HeaderText = "读码结果"; - this.readKindDataGridViewTextBoxColumn.MinimumWidth = 6; - this.readKindDataGridViewTextBoxColumn.Name = "readKindDataGridViewTextBoxColumn"; - this.readKindDataGridViewTextBoxColumn.ReadOnly = true; - this.readKindDataGridViewTextBoxColumn.Width = 60; - // - // contentDataGridViewTextBoxColumn - // - this.contentDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.contentDataGridViewTextBoxColumn.DataPropertyName = "Content"; - this.contentDataGridViewTextBoxColumn.HeaderText = "条码内容"; - this.contentDataGridViewTextBoxColumn.MinimumWidth = 6; - this.contentDataGridViewTextBoxColumn.Name = "contentDataGridViewTextBoxColumn"; - this.contentDataGridViewTextBoxColumn.ReadOnly = true; - // - // logTimeDataGridViewTextBoxColumn - // - this.logTimeDataGridViewTextBoxColumn.DataPropertyName = "LogTime"; - this.logTimeDataGridViewTextBoxColumn.HeaderText = "读取时间"; - this.logTimeDataGridViewTextBoxColumn.MinimumWidth = 6; - this.logTimeDataGridViewTextBoxColumn.Name = "logTimeDataGridViewTextBoxColumn"; - this.logTimeDataGridViewTextBoxColumn.ReadOnly = true; - this.logTimeDataGridViewTextBoxColumn.Width = 105; - // // rFIDContentBindingSource // this.rFIDContentBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDContent); @@ -373,7 +329,7 @@ this.MainReadGroupBox.Size = new System.Drawing.Size(781, 723); this.MainReadGroupBox.TabIndex = 18; this.MainReadGroupBox.TabStop = false; - this.MainReadGroupBox.Text = "数据监控"; + this.MainReadGroupBox.Text = "数据监控(此界面做多200条,全部数据在日志查询中查询)"; // // PageGroupBox // @@ -430,6 +386,50 @@ this.groupBox1.TabStop = false; this.groupBox1.Text = "状态面板"; // + // ReadSuccessPercent + // + this.ReadSuccessPercent.AutoSize = true; + this.ReadSuccessPercent.Font = new System.Drawing.Font("宋体", 12F); + this.ReadSuccessPercent.Location = new System.Drawing.Point(125, 168); + this.ReadSuccessPercent.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); + this.ReadSuccessPercent.Name = "ReadSuccessPercent"; + this.ReadSuccessPercent.Size = new System.Drawing.Size(31, 16); + this.ReadSuccessPercent.TabIndex = 11; + this.ReadSuccessPercent.Text = "N/A"; + // + // ErrorReadNum + // + this.ErrorReadNum.AutoSize = true; + this.ErrorReadNum.Font = new System.Drawing.Font("宋体", 12F); + this.ErrorReadNum.Location = new System.Drawing.Point(139, 134); + this.ErrorReadNum.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); + this.ErrorReadNum.Name = "ErrorReadNum"; + this.ErrorReadNum.Size = new System.Drawing.Size(31, 16); + this.ErrorReadNum.TabIndex = 10; + this.ErrorReadNum.Text = "N/A"; + // + // NormalReadNum + // + this.NormalReadNum.AutoSize = true; + this.NormalReadNum.Font = new System.Drawing.Font("宋体", 12F); + this.NormalReadNum.Location = new System.Drawing.Point(139, 100); + this.NormalReadNum.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); + this.NormalReadNum.Name = "NormalReadNum"; + this.NormalReadNum.Size = new System.Drawing.Size(31, 16); + this.NormalReadNum.TabIndex = 9; + this.NormalReadNum.Text = "N/A"; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Font = new System.Drawing.Font("宋体", 12F); + this.label11.Location = new System.Drawing.Point(103, 66); + this.label11.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(39, 16); + this.label11.TabIndex = 8; + this.label11.Text = "正常"; + // // label6 // this.label6.AutoSize = true; @@ -455,6 +455,39 @@ this.groupBox3.TabStop = false; this.groupBox3.Text = "异常统计(最近200条)"; // + // ErrorCountDataGridView + // + this.ErrorCountDataGridView.AllowUserToAddRows = false; + this.ErrorCountDataGridView.AllowUserToDeleteRows = false; + this.ErrorCountDataGridView.AllowUserToResizeRows = false; + this.ErrorCountDataGridView.ColumnHeadersHeight = 20; + this.ErrorCountDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.BinNo, + this.ErrorCount}); + this.ErrorCountDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; + this.ErrorCountDataGridView.Location = new System.Drawing.Point(3, 17); + this.ErrorCountDataGridView.Name = "ErrorCountDataGridView"; + this.ErrorCountDataGridView.ReadOnly = true; + this.ErrorCountDataGridView.RowHeadersVisible = false; + this.ErrorCountDataGridView.RowTemplate.Height = 17; + this.ErrorCountDataGridView.Size = new System.Drawing.Size(357, 403); + this.ErrorCountDataGridView.TabIndex = 0; + // + // BinNo + // + this.BinNo.DataPropertyName = "BinNo"; + this.BinNo.HeaderText = "格口号"; + this.BinNo.Name = "BinNo"; + this.BinNo.ReadOnly = true; + // + // ErrorCount + // + this.ErrorCount.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.ErrorCount.DataPropertyName = "ErrorCount"; + this.ErrorCount.HeaderText = "异常读码次数"; + this.ErrorCount.Name = "ErrorCount"; + this.ErrorCount.ReadOnly = true; + // // label10 // this.label10.AutoSize = true; @@ -510,82 +543,49 @@ this.label5.TabIndex = 0; this.label5.Text = "工作状态:"; // - // label11 + // ID // - this.label11.AutoSize = true; - this.label11.Font = new System.Drawing.Font("宋体", 12F); - this.label11.Location = new System.Drawing.Point(103, 66); - this.label11.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(39, 16); - this.label11.TabIndex = 8; - this.label11.Text = "正常"; + this.ID.DataPropertyName = "ID"; + this.ID.HeaderText = "编号"; + this.ID.Name = "ID"; + this.ID.ReadOnly = true; + this.ID.Width = 40; // - // NormalReadNum + // deviceNoDataGridViewTextBoxColumn // - this.NormalReadNum.AutoSize = true; - this.NormalReadNum.Font = new System.Drawing.Font("宋体", 12F); - this.NormalReadNum.Location = new System.Drawing.Point(139, 100); - this.NormalReadNum.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); - this.NormalReadNum.Name = "NormalReadNum"; - this.NormalReadNum.Size = new System.Drawing.Size(31, 16); - this.NormalReadNum.TabIndex = 9; - this.NormalReadNum.Text = "N/A"; + this.deviceNoDataGridViewTextBoxColumn.DataPropertyName = "DeviceNo"; + this.deviceNoDataGridViewTextBoxColumn.HeaderText = "格口"; + this.deviceNoDataGridViewTextBoxColumn.MinimumWidth = 6; + this.deviceNoDataGridViewTextBoxColumn.Name = "deviceNoDataGridViewTextBoxColumn"; + this.deviceNoDataGridViewTextBoxColumn.ReadOnly = true; + this.deviceNoDataGridViewTextBoxColumn.Width = 40; // - // ErrorReadNum + // readKindDataGridViewTextBoxColumn // - this.ErrorReadNum.AutoSize = true; - this.ErrorReadNum.Font = new System.Drawing.Font("宋体", 12F); - this.ErrorReadNum.Location = new System.Drawing.Point(139, 134); - this.ErrorReadNum.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); - this.ErrorReadNum.Name = "ErrorReadNum"; - this.ErrorReadNum.Size = new System.Drawing.Size(31, 16); - this.ErrorReadNum.TabIndex = 10; - this.ErrorReadNum.Text = "N/A"; + this.readKindDataGridViewTextBoxColumn.DataPropertyName = "ReadKind"; + this.readKindDataGridViewTextBoxColumn.HeaderText = "读码结果"; + this.readKindDataGridViewTextBoxColumn.MinimumWidth = 6; + this.readKindDataGridViewTextBoxColumn.Name = "readKindDataGridViewTextBoxColumn"; + this.readKindDataGridViewTextBoxColumn.ReadOnly = true; + this.readKindDataGridViewTextBoxColumn.Width = 60; // - // ReadSuccessPercent + // contentDataGridViewTextBoxColumn // - this.ReadSuccessPercent.AutoSize = true; - this.ReadSuccessPercent.Font = new System.Drawing.Font("宋体", 12F); - this.ReadSuccessPercent.Location = new System.Drawing.Point(125, 168); - this.ReadSuccessPercent.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); - this.ReadSuccessPercent.Name = "ReadSuccessPercent"; - this.ReadSuccessPercent.Size = new System.Drawing.Size(31, 16); - this.ReadSuccessPercent.TabIndex = 11; - this.ReadSuccessPercent.Text = "N/A"; + this.contentDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.contentDataGridViewTextBoxColumn.DataPropertyName = "Content"; + this.contentDataGridViewTextBoxColumn.HeaderText = "条码内容"; + this.contentDataGridViewTextBoxColumn.MinimumWidth = 6; + this.contentDataGridViewTextBoxColumn.Name = "contentDataGridViewTextBoxColumn"; + this.contentDataGridViewTextBoxColumn.ReadOnly = true; // - // ErrorCountDataGridView + // logTimeDataGridViewTextBoxColumn // - this.ErrorCountDataGridView.AllowUserToAddRows = false; - this.ErrorCountDataGridView.AllowUserToDeleteRows = false; - this.ErrorCountDataGridView.AllowUserToResizeRows = false; - this.ErrorCountDataGridView.ColumnHeadersHeight = 20; - this.ErrorCountDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.BinNo, - this.ErrorCount}); - this.ErrorCountDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; - this.ErrorCountDataGridView.Location = new System.Drawing.Point(3, 17); - this.ErrorCountDataGridView.Name = "ErrorCountDataGridView"; - this.ErrorCountDataGridView.ReadOnly = true; - this.ErrorCountDataGridView.RowHeadersVisible = false; - this.ErrorCountDataGridView.RowTemplate.Height = 17; - this.ErrorCountDataGridView.Size = new System.Drawing.Size(357, 403); - this.ErrorCountDataGridView.TabIndex = 0; - // - // BinNo - // - this.BinNo.DataPropertyName = "BinNo"; - this.BinNo.HeaderText = "格口号"; - this.BinNo.Name = "BinNo"; - this.BinNo.ReadOnly = true; - // - // ErrorCount - // - this.ErrorCount.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.ErrorCount.DataPropertyName = "ErrorCount"; - this.ErrorCount.HeaderText = "异常读码次数"; - this.ErrorCount.Name = "ErrorCount"; - this.ErrorCount.ReadOnly = true; + this.logTimeDataGridViewTextBoxColumn.DataPropertyName = "LogTime"; + this.logTimeDataGridViewTextBoxColumn.HeaderText = "读取时间"; + this.logTimeDataGridViewTextBoxColumn.MinimumWidth = 6; + this.logTimeDataGridViewTextBoxColumn.Name = "logTimeDataGridViewTextBoxColumn"; + this.logTimeDataGridViewTextBoxColumn.ReadOnly = true; + this.logTimeDataGridViewTextBoxColumn.Width = 105; // // RFIDSocket // @@ -648,11 +648,6 @@ private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label ConnectCountLabel; - private System.Windows.Forms.DataGridViewTextBoxColumn ID; - private System.Windows.Forms.DataGridViewTextBoxColumn deviceNoDataGridViewTextBoxColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn readKindDataGridViewTextBoxColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn contentDataGridViewTextBoxColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn logTimeDataGridViewTextBoxColumn; private System.Windows.Forms.Button BinAudlt; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Label label10; @@ -669,6 +664,11 @@ private System.Windows.Forms.DataGridView ErrorCountDataGridView; private System.Windows.Forms.DataGridViewTextBoxColumn BinNo; private System.Windows.Forms.DataGridViewTextBoxColumn ErrorCount; + private System.Windows.Forms.DataGridViewTextBoxColumn ID; + private System.Windows.Forms.DataGridViewTextBoxColumn deviceNoDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn readKindDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn contentDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn logTimeDataGridViewTextBoxColumn; } } diff --git a/RFIDSocket/RFIDSocket.cs b/RFIDSocket/RFIDSocket.cs index ac4fac7..d589d98 100644 --- a/RFIDSocket/RFIDSocket.cs +++ b/RFIDSocket/RFIDSocket.cs @@ -198,8 +198,9 @@ namespace RFIDSocket /// private void ContentPages() { + var list = RFIDData.rFIDContents.Skip((PageNo - 1) * 50).Take(50).ToList(); CotentData.DataSource = null; - CotentData.DataSource = RFIDData.rFIDContents.Skip((PageNo - 1) * 50).Take(50).ToList(); + CotentData.DataSource = ServerDataAnalysis.ChangeReadResult(list); PageRange.Text = $"{((PageNo - 1) * 50) + 1} - {PageNo * 50}"; } diff --git a/RFIDSocket/RFIDSocket.resx b/RFIDSocket/RFIDSocket.resx index 7842a63..2883d33 100644 --- a/RFIDSocket/RFIDSocket.resx +++ b/RFIDSocket/RFIDSocket.resx @@ -123,9 +123,6 @@ 159, 17 - - True - 159, 17 @@ -150,4 +147,7 @@ True + + True + \ No newline at end of file diff --git a/RFIDSocket/ServerDataAnalysis.cs b/RFIDSocket/ServerDataAnalysis.cs index ee85b7c..4202726 100644 --- a/RFIDSocket/ServerDataAnalysis.cs +++ b/RFIDSocket/ServerDataAnalysis.cs @@ -97,6 +97,24 @@ namespace RFIDSocket return m.ToString("00") + " 分 " + s.ToString("00") + " 秒"; } - + public static List ChangeReadResult(List list) + { + foreach (var item in list) + { + if (item.ReadKind == "GR") + { + item.ReadKind = "正常"; + } + else if (item.ReadKind == "MR") + { + item.ReadKind = "多标签"; + } + else if (item.ReadKind == "NB") + { + item.ReadKind = "无读"; + } + } + return list; + } } }