From b5f5fad0b6381d448797fe1fc491b2349e8d8169 Mon Sep 17 00:00:00 2001 From: SoulStar Date: Mon, 13 Jan 2025 10:19:55 +0800 Subject: [PATCH] =?UTF-8?q?debug=20-=20=E9=AA=8C=E6=94=B6=E6=9C=80?= =?UTF-8?q?=E7=BB=88=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RFIDSocket/LogControl.cs | 4 + RFIDSocket/RFIDLog.Designer.cs | 341 +++++++++++++++++---------------- RFIDSocket/RFIDLog.cs | 20 +- RFIDSocket/RFIDLog.resx | 6 + 4 files changed, 204 insertions(+), 167 deletions(-) diff --git a/RFIDSocket/LogControl.cs b/RFIDSocket/LogControl.cs index 9d9a7c3..28163a2 100644 --- a/RFIDSocket/LogControl.cs +++ b/RFIDSocket/LogControl.cs @@ -26,6 +26,10 @@ namespace RFIDSocket public static List LogDeviceNoSelect(List lists, int deviceNo) { + if(deviceNo < 0) + { + return lists; + } return lists.Where(x => x.DeviceNo == deviceNo).ToList(); } diff --git a/RFIDSocket/RFIDLog.Designer.cs b/RFIDSocket/RFIDLog.Designer.cs index e30204e..0ddb05e 100644 --- a/RFIDSocket/RFIDLog.Designer.cs +++ b/RFIDSocket/RFIDLog.Designer.cs @@ -40,6 +40,11 @@ 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(); @@ -57,13 +62,9 @@ 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.label3 = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); @@ -84,7 +85,7 @@ // // StartTime // - this.StartTime.CustomFormat = "yyyy-MM-dd hh:mm:ss"; + this.StartTime.CustomFormat = "yyyy-MM-dd HH:mm:ss"; this.StartTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom; this.StartTime.Location = new System.Drawing.Point(25, 20); this.StartTime.Name = "StartTime"; @@ -105,7 +106,7 @@ // // EndTime // - this.EndTime.CustomFormat = "yyyy-MM-dd hh:mm:ss"; + this.EndTime.CustomFormat = "yyyy-MM-dd HH:mm:ss"; this.EndTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom; this.EndTime.Location = new System.Drawing.Point(25, 49); this.EndTime.Name = "EndTime"; @@ -191,161 +192,6 @@ this.LogContent.Size = new System.Drawing.Size(669, 899); this.LogContent.TabIndex = 7; // - // rFIDContentBindingSource - // - this.rFIDContentBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDContent); - // - // groupBox4 - // - this.groupBox4.Controls.Add(this.Content); - this.groupBox4.Controls.Add(this.ContentSelect); - this.groupBox4.Location = new System.Drawing.Point(12, 423); - this.groupBox4.Name = "groupBox4"; - this.groupBox4.Size = new System.Drawing.Size(208, 131); - this.groupBox4.TabIndex = 7; - this.groupBox4.TabStop = false; - this.groupBox4.Text = "条码内容查询"; - // - // Content - // - this.Content.Location = new System.Drawing.Point(42, 29); - this.Content.Name = "Content"; - this.Content.Size = new System.Drawing.Size(122, 21); - this.Content.TabIndex = 1; - // - // ContentSelect - // - this.ContentSelect.Location = new System.Drawing.Point(42, 65); - this.ContentSelect.Name = "ContentSelect"; - this.ContentSelect.Size = new System.Drawing.Size(122, 48); - this.ContentSelect.TabIndex = 0; - this.ContentSelect.Text = "条码内容查询"; - this.ContentSelect.UseVisualStyleBackColor = true; - this.ContentSelect.Click += new System.EventHandler(this.ContentSelect_Click); - // - // SelectAll - // - this.SelectAll.Location = new System.Drawing.Point(12, 560); - this.SelectAll.Name = "SelectAll"; - this.SelectAll.Size = new System.Drawing.Size(208, 48); - this.SelectAll.TabIndex = 2; - this.SelectAll.Text = "综合条件查询"; - this.SelectAll.UseVisualStyleBackColor = true; - this.SelectAll.Click += new System.EventHandler(this.SelectAll_Click); - // - // ExcelOutPut - // - this.ExcelOutPut.Location = new System.Drawing.Point(14, 672); - this.ExcelOutPut.Name = "ExcelOutPut"; - this.ExcelOutPut.Size = new System.Drawing.Size(203, 36); - this.ExcelOutPut.TabIndex = 8; - this.ExcelOutPut.Text = "查询内容导出Excel"; - this.ExcelOutPut.UseVisualStyleBackColor = true; - this.ExcelOutPut.Click += new System.EventHandler(this.ExcelOutPut_Click); - // - // txtPath - // - this.txtPath.Location = new System.Drawing.Point(14, 645); - this.txtPath.Name = "txtPath"; - this.txtPath.Size = new System.Drawing.Size(203, 21); - this.txtPath.TabIndex = 9; - // - // Label1 - // - this.Label1.AutoSize = true; - this.Label1.Location = new System.Drawing.Point(18, 611); - this.Label1.Name = "Label1"; - this.Label1.Size = new System.Drawing.Size(197, 12); - this.Label1.TabIndex = 10; - this.Label1.Text = "——————文件导出——————"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.BackColor = System.Drawing.Color.Silver; - this.label2.Location = new System.Drawing.Point(12, 630); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(53, 12); - this.label2.TabIndex = 11; - this.label2.Text = "地址选择"; - this.label2.Click += new System.EventHandler(this.label2_Click); - // - // button1 - // - this.button1.Location = new System.Drawing.Point(14, 714); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(203, 36); - this.button1.TabIndex = 12; - this.button1.Text = "全部内容导出Excel"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // ReadSuccessPercent - // - this.ReadSuccessPercent.AutoSize = true; - this.ReadSuccessPercent.Font = new System.Drawing.Font("宋体", 12F); - 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); - this.ReadSuccessPercent.TabIndex = 18; - 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(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); - this.ErrorReadNum.TabIndex = 17; - 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(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); - this.NormalReadNum.TabIndex = 16; - this.NormalReadNum.Text = "N/A"; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Font = new System.Drawing.Font("宋体", 12F); - 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); - this.label9.TabIndex = 15; - this.label9.Text = "正常读码数量:"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Font = new System.Drawing.Font("宋体", 12F); - 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); - this.label8.TabIndex = 14; - this.label8.Text = "异常读码数量:"; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Font = new System.Drawing.Font("宋体", 12F); - 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"; @@ -381,11 +227,167 @@ this.logTimeDataGridViewTextBoxColumn.Name = "logTimeDataGridViewTextBoxColumn"; this.logTimeDataGridViewTextBoxColumn.Width = 105; // + // rFIDContentBindingSource + // + this.rFIDContentBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDContent); + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.Content); + this.groupBox4.Controls.Add(this.ContentSelect); + this.groupBox4.Location = new System.Drawing.Point(12, 423); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(208, 131); + this.groupBox4.TabIndex = 7; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "条码内容查询"; + // + // Content + // + this.Content.Location = new System.Drawing.Point(42, 29); + this.Content.Name = "Content"; + this.Content.Size = new System.Drawing.Size(122, 21); + this.Content.TabIndex = 1; + // + // ContentSelect + // + this.ContentSelect.Location = new System.Drawing.Point(42, 65); + this.ContentSelect.Name = "ContentSelect"; + this.ContentSelect.Size = new System.Drawing.Size(122, 48); + this.ContentSelect.TabIndex = 0; + this.ContentSelect.Text = "条码内容查询"; + this.ContentSelect.UseVisualStyleBackColor = true; + this.ContentSelect.Click += new System.EventHandler(this.ContentSelect_Click); + // + // SelectAll + // + this.SelectAll.Font = new System.Drawing.Font("宋体", 12F); + this.SelectAll.Location = new System.Drawing.Point(12, 560); + this.SelectAll.Name = "SelectAll"; + this.SelectAll.Size = new System.Drawing.Size(208, 48); + this.SelectAll.TabIndex = 2; + this.SelectAll.Text = "综合条件查询"; + this.SelectAll.UseVisualStyleBackColor = true; + this.SelectAll.Click += new System.EventHandler(this.SelectAll_Click); + // + // ExcelOutPut + // + this.ExcelOutPut.Location = new System.Drawing.Point(14, 696); + this.ExcelOutPut.Name = "ExcelOutPut"; + this.ExcelOutPut.Size = new System.Drawing.Size(203, 36); + this.ExcelOutPut.TabIndex = 8; + this.ExcelOutPut.Text = "查询内容导出Excel"; + this.ExcelOutPut.UseVisualStyleBackColor = true; + this.ExcelOutPut.Click += new System.EventHandler(this.ExcelOutPut_Click); + // + // txtPath + // + this.txtPath.Location = new System.Drawing.Point(14, 669); + this.txtPath.Name = "txtPath"; + this.txtPath.Size = new System.Drawing.Size(203, 21); + this.txtPath.TabIndex = 9; + // + // Label1 + // + this.Label1.AutoSize = true; + this.Label1.Location = new System.Drawing.Point(18, 635); + this.Label1.Name = "Label1"; + this.Label1.Size = new System.Drawing.Size(197, 12); + this.Label1.TabIndex = 10; + this.Label1.Text = "——————文件导出——————"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.BackColor = System.Drawing.Color.Silver; + this.label2.Location = new System.Drawing.Point(12, 654); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(53, 12); + this.label2.TabIndex = 11; + this.label2.Text = "地址选择"; + this.label2.Click += new System.EventHandler(this.label2_Click); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(14, 738); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(203, 36); + this.button1.TabIndex = 12; + this.button1.Text = "全部内容导出Excel"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // ReadSuccessPercent + // + this.ReadSuccessPercent.AutoSize = true; + this.ReadSuccessPercent.Font = new System.Drawing.Font("宋体", 12F); + this.ReadSuccessPercent.Location = new System.Drawing.Point(132, 893); + 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 = 18; + 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(132, 859); + 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 = 17; + 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(132, 825); + 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 = 16; + this.NormalReadNum.Text = "N/A"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("宋体", 12F); + this.label9.Location = new System.Drawing.Point(11, 825); + 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); + this.label9.TabIndex = 15; + this.label9.Text = "正常读码数量:"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("宋体", 12F); + this.label8.Location = new System.Drawing.Point(11, 859); + 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); + this.label8.TabIndex = 14; + this.label8.Text = "异常读码数量:"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("宋体", 12F); + this.label7.Location = new System.Drawing.Point(11, 893); + 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 = "读码成功率:"; + // // TotalReadCount // this.TotalReadCount.AutoSize = true; this.TotalReadCount.Font = new System.Drawing.Font("宋体", 12F); - this.TotalReadCount.Location = new System.Drawing.Point(132, 767); + this.TotalReadCount.Location = new System.Drawing.Point(132, 791); 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); @@ -396,18 +398,28 @@ // this.label4.AutoSize = true; this.label4.Font = new System.Drawing.Font("宋体", 12F); - this.label4.Location = new System.Drawing.Point(11, 767); + this.label4.Location = new System.Drawing.Point(11, 791); 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 = "总读码数量:"; // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(18, 611); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(149, 12); + this.label3.TabIndex = 21; + this.label3.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.label3); this.Controls.Add(this.TotalReadCount); this.Controls.Add(this.label4); this.Controls.Add(this.ReadSuccessPercent); @@ -479,5 +491,6 @@ private System.Windows.Forms.DataGridViewTextBoxColumn logTimeDataGridViewTextBoxColumn; private System.Windows.Forms.Label TotalReadCount; private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label3; } } \ No newline at end of file diff --git a/RFIDSocket/RFIDLog.cs b/RFIDSocket/RFIDLog.cs index 7783bd7..d10dc06 100644 --- a/RFIDSocket/RFIDLog.cs +++ b/RFIDSocket/RFIDLog.cs @@ -68,13 +68,21 @@ namespace RFIDSocket private void DeviceNoSelect_Click(object sender, EventArgs e) { - if(!int.TryParse(DeviceNo.Text, out int no)) + int no; + if (string.IsNullOrEmpty(DeviceNo.Text)) + { + no = -1; + goto next; + } + if(!int.TryParse(DeviceNo.Text, out no)) { MessageBox.Show("设备编号格式不正确"); return; } + next: if (LogContent != null) { + var list = LogControl.LogDeviceNoSelect(rFIDContents, no); LogContent.DataSource = null; LogContent.DataSource = ServerDataAnalysis.ChangeReadResult(list); @@ -95,12 +103,18 @@ namespace RFIDSocket private void SelectAll_Click(object sender, EventArgs e) { - if (!int.TryParse(DeviceNo.Text, out int no)) + int no; + if (string.IsNullOrEmpty(DeviceNo.Text)) + { + no = -1; + goto next; + } + if (!int.TryParse(DeviceNo.Text, out no)) { MessageBox.Show("设备编号格式不正确"); return; } - + next: if (LogContent != null) { var list = LogControl.LogTimeSelect( diff --git a/RFIDSocket/RFIDLog.resx b/RFIDSocket/RFIDLog.resx index 77d971d..e2f1b13 100644 --- a/RFIDSocket/RFIDLog.resx +++ b/RFIDSocket/RFIDLog.resx @@ -123,6 +123,12 @@ 17, 17 + + True + + + 17, 17 + 225, 17