diff --git a/.vs/HighWayIot/v17/.suo b/.vs/HighWayIot/v17/.suo index e182b5f..e8b7740 100644 Binary files a/.vs/HighWayIot/v17/.suo and b/.vs/HighWayIot/v17/.suo differ diff --git a/HighWayIot.TouchSocket/RFIDTcpClient.cs b/HighWayIot.TouchSocket/RFIDTcpClient.cs index 9a3b4c8..22c8fc3 100644 --- a/HighWayIot.TouchSocket/RFIDTcpClient.cs +++ b/HighWayIot.TouchSocket/RFIDTcpClient.cs @@ -19,7 +19,6 @@ namespace HighWayIot.TouchSocket public bool State { get => client.Online; - private set => State = value; } global::TouchSocket.Sockets.TcpClient client = new global::TouchSocket.Sockets.TcpClient(); diff --git a/HighWayIot.TouchSocket/bin/Debug/HighWayIot.TouchSocket.dll b/HighWayIot.TouchSocket/bin/Debug/HighWayIot.TouchSocket.dll index da0afc9..8a7b686 100644 Binary files a/HighWayIot.TouchSocket/bin/Debug/HighWayIot.TouchSocket.dll and b/HighWayIot.TouchSocket/bin/Debug/HighWayIot.TouchSocket.dll differ diff --git a/HighWayIot.TouchSocket/bin/Debug/HighWayIot.TouchSocket.pdb b/HighWayIot.TouchSocket/bin/Debug/HighWayIot.TouchSocket.pdb index fa267a3..f232bf0 100644 Binary files a/HighWayIot.TouchSocket/bin/Debug/HighWayIot.TouchSocket.pdb and b/HighWayIot.TouchSocket/bin/Debug/HighWayIot.TouchSocket.pdb differ diff --git a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.dll b/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.dll index da0afc9..8a7b686 100644 Binary files a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.dll and b/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.dll differ diff --git a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.pdb b/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.pdb index fa267a3..f232bf0 100644 Binary files a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.pdb and b/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.pdb differ diff --git a/RFIDSocket/LogControl.cs b/RFIDSocket/LogControl.cs index 04e6f40..f94acb0 100644 --- a/RFIDSocket/LogControl.cs +++ b/RFIDSocket/LogControl.cs @@ -4,30 +4,82 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Forms; using System.Xml.Linq; +using TouchSocket.Core; namespace RFIDSocket { public class LogControl { - //public static List LogContentSelect(List lists, string content) - //{ - // return lists.Where(x => x.Content.Contains(content)).ToList(); - //} - - //public static List LogReadKindSelect(List lists, string readKind) - //{ - // return lists.Where(x => x.ReadKind == readKind).ToList(); - //} - - //public static List LogDeviceNoSelect(List lists, int deviceNo) - //{ - // return lists.Where(x => x.DeviceNo == deviceNo).ToList(); - //} - - //public static List LogTimeSelect(List lists, DateTime start, DateTime end) - //{ - // return lists.Where(x => x.LogTime >= start && x.LogTime <= end).ToList(); - //} + public static List LogIPSelect(List lists, string ip) + { + return lists.Where(x => x.IP == ip).ToList(); + } + + public static List LogTimeSelect(List lists, DateTime start, DateTime end) + { + return lists.Where(x => x.LogTime >= start && x.LogTime <= end).ToList(); + } + + public static List LogLengthSelect(List lists, int minLength, int maxLength) + { + if (minLength == -1 && maxLength == -1) + { + return lists; + } + else if (minLength == -1 && maxLength != -1) + { + return lists.Where(x => x.Length <= maxLength).ToList(); + } + else if (minLength != -1 && maxLength == -1) + { + return lists.Where(x => x.Length >= minLength).ToList(); + } + return lists.Where(x => x.Length >= minLength && x.Length <= maxLength).ToList(); + } + + public static List LogIntervalSelect(List lists, int minInterval, int maxInterval) + { + if (minInterval == -1 && maxInterval == -1) + { + return lists; + } + else if (minInterval == -1 && maxInterval != -1) + { + return lists.Where(x => x.Interval <= maxInterval).ToList(); + } + else if (minInterval != -1 && maxInterval == -1) + { + return lists.Where(x => x.Interval >= minInterval).ToList(); + } + + return lists.Where(x => x.Interval >= minInterval && x.Interval <= maxInterval).ToList(); + } + + public static List LogStatusSelect(List lists, string status) + { + if (status.IsNullOrEmpty()) return lists; + return lists.Where(x => x.Status == status).ToList(); + } + + public static List LogTipsSelect(List lists, string tips) + { + if (tips.IsNullOrEmpty()) return lists; + return lists.Where(x => x.Tips == tips).ToList(); + } + + public static List LogEPCSelect(List lists, string epc) + { + if (epc.IsNullOrEmpty()) return lists; + return lists.Where(x => x.EPC.Contains(epc)).ToList(); + } + + public static List LogSNSelect(List lists, string sn) + { + if (sn.IsNullOrEmpty()) return lists; + return lists.Where(x => x.SN.Contains(sn)).ToList(); + } + } } diff --git a/RFIDSocket/RFIDLog.Designer.cs b/RFIDSocket/RFIDLog.Designer.cs index b40aeed..d87003f 100644 --- a/RFIDSocket/RFIDLog.Designer.cs +++ b/RFIDSocket/RFIDLog.Designer.cs @@ -28,6 +28,9 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); this.TimeSelect = new System.Windows.Forms.Button(); this.StartTime = new System.Windows.Forms.DateTimePicker(); this.groupBox1 = new System.Windows.Forms.GroupBox(); @@ -52,31 +55,39 @@ this.pictureBox3 = new System.Windows.Forms.PictureBox(); this.label6 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.label1 = new System.Windows.Forms.Label(); - this.MinLength = new System.Windows.Forms.TextBox(); - this.MaxLength = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); + this.EPCText = new System.Windows.Forms.TextBox(); + this.label15 = new System.Windows.Forms.Label(); + this.SNText = new System.Windows.Forms.TextBox(); + this.label14 = new System.Windows.Forms.Label(); + this.TipsText = new System.Windows.Forms.ComboBox(); + this.label12 = new System.Windows.Forms.Label(); + this.StatusText = new System.Windows.Forms.ComboBox(); + this.label5 = new System.Windows.Forms.Label(); this.MaxInterval = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.MinInterval = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.StatusText = new System.Windows.Forms.ComboBox(); - this.TipsText = new System.Windows.Forms.ComboBox(); - this.label12 = new System.Windows.Forms.Label(); - this.SNText = new System.Windows.Forms.TextBox(); - this.label14 = new System.Windows.Forms.Label(); - this.EPCText = new System.Windows.Forms.TextBox(); - this.label15 = new System.Windows.Forms.Label(); + this.MaxLength = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.MinLength = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); this.SelectAll = new System.Windows.Forms.Button(); this.label16 = new System.Windows.Forms.Label(); - this.AllAddress = new System.Windows.Forms.ComboBox(); + this.AllIP = new System.Windows.Forms.ComboBox(); + this.rFIDContentBindingSource = new System.Windows.Forms.BindingSource(this.components); + this.sNDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.intervalDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.lengthDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ePCDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.tipsDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.logTimeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.LogContent)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); this.groupBox2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.rFIDContentBindingSource)).BeginInit(); this.SuspendLayout(); // // TimeSelect @@ -126,14 +137,24 @@ // // LogContent // + this.LogContent.AutoGenerateColumns = false; this.LogContent.ColumnHeadersHeight = 20; + this.LogContent.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.sNDataGridViewTextBoxColumn, + this.intervalDataGridViewTextBoxColumn, + this.lengthDataGridViewTextBoxColumn, + this.ePCDataGridViewTextBoxColumn, + this.tipsDataGridViewTextBoxColumn, + this.logTimeDataGridViewTextBoxColumn}); + this.LogContent.DataSource = this.rFIDContentBindingSource; this.LogContent.Location = new System.Drawing.Point(301, 15); this.LogContent.Margin = new System.Windows.Forms.Padding(4); this.LogContent.Name = "LogContent"; + this.LogContent.ReadOnly = true; this.LogContent.RowHeadersVisible = false; this.LogContent.RowHeadersWidth = 51; this.LogContent.RowTemplate.Height = 18; - this.LogContent.Size = new System.Drawing.Size(667, 1230); + this.LogContent.Size = new System.Drawing.Size(911, 1230); this.LogContent.TabIndex = 7; // // SelectByCondition @@ -145,7 +166,7 @@ this.SelectByCondition.TabIndex = 2; this.SelectByCondition.Text = "条件查询"; this.SelectByCondition.UseVisualStyleBackColor = true; - this.SelectByCondition.Click += new System.EventHandler(this.SelectAll_Click); + this.SelectByCondition.Click += new System.EventHandler(this.SelectByCondition_Click); // // ShortCount // @@ -343,37 +364,71 @@ this.groupBox2.TabStop = false; this.groupBox2.Text = "条件查询"; // - // label1 + // EPCText // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(6, 37); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(67, 15); - this.label1.TabIndex = 0; - this.label1.Text = "最小包长"; + this.EPCText.Location = new System.Drawing.Point(111, 188); + this.EPCText.Name = "EPCText"; + this.EPCText.Size = new System.Drawing.Size(121, 25); + this.EPCText.TabIndex = 15; // - // MinLength + // label15 // - this.MinLength.Location = new System.Drawing.Point(79, 32); - this.MinLength.Name = "MinLength"; - this.MinLength.Size = new System.Drawing.Size(52, 25); - this.MinLength.TabIndex = 1; + this.label15.AutoSize = true; + this.label15.Location = new System.Drawing.Point(40, 193); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(67, 15); + this.label15.TabIndex = 14; + this.label15.Text = "读码内容"; // - // MaxLength + // SNText // - this.MaxLength.Location = new System.Drawing.Point(216, 32); - this.MaxLength.Name = "MaxLength"; - this.MaxLength.Size = new System.Drawing.Size(52, 25); - this.MaxLength.TabIndex = 3; + this.SNText.Location = new System.Drawing.Point(111, 157); + this.SNText.Name = "SNText"; + this.SNText.Size = new System.Drawing.Size(121, 25); + this.SNText.TabIndex = 13; // - // label2 + // label14 // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(143, 37); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(67, 15); - this.label2.TabIndex = 2; - this.label2.Text = "最大包长"; + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(40, 162); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(52, 15); + this.label14.TabIndex = 12; + this.label14.Text = "包裹号"; + // + // TipsText + // + this.TipsText.FormattingEnabled = true; + this.TipsText.Location = new System.Drawing.Point(111, 123); + this.TipsText.Name = "TipsText"; + this.TipsText.Size = new System.Drawing.Size(121, 23); + this.TipsText.TabIndex = 11; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(38, 127); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(67, 15); + this.label12.TabIndex = 10; + this.label12.Text = "返回结果"; + // + // StatusText + // + this.StatusText.FormattingEnabled = true; + this.StatusText.Location = new System.Drawing.Point(111, 94); + this.StatusText.Name = "StatusText"; + this.StatusText.Size = new System.Drawing.Size(121, 23); + this.StatusText.TabIndex = 9; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(38, 98); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(67, 15); + this.label5.TabIndex = 8; + this.label5.Text = "读码结果"; // // MaxInterval // @@ -407,71 +462,37 @@ this.label4.TabIndex = 4; this.label4.Text = "最小间距"; // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(38, 98); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(67, 15); - this.label5.TabIndex = 8; - this.label5.Text = "读码结果"; - // - // StatusText - // - this.StatusText.FormattingEnabled = true; - this.StatusText.Location = new System.Drawing.Point(111, 94); - this.StatusText.Name = "StatusText"; - this.StatusText.Size = new System.Drawing.Size(121, 23); - this.StatusText.TabIndex = 9; - // - // TipsText - // - this.TipsText.FormattingEnabled = true; - this.TipsText.Location = new System.Drawing.Point(111, 123); - this.TipsText.Name = "TipsText"; - this.TipsText.Size = new System.Drawing.Size(121, 23); - this.TipsText.TabIndex = 11; - // - // label12 - // - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(38, 127); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(67, 15); - this.label12.TabIndex = 10; - this.label12.Text = "返回结果"; - // - // SNText + // MaxLength // - this.SNText.Location = new System.Drawing.Point(111, 157); - this.SNText.Name = "SNText"; - this.SNText.Size = new System.Drawing.Size(121, 25); - this.SNText.TabIndex = 13; + this.MaxLength.Location = new System.Drawing.Point(216, 32); + this.MaxLength.Name = "MaxLength"; + this.MaxLength.Size = new System.Drawing.Size(52, 25); + this.MaxLength.TabIndex = 3; // - // label14 + // label2 // - this.label14.AutoSize = true; - this.label14.Location = new System.Drawing.Point(40, 162); - this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size(52, 15); - this.label14.TabIndex = 12; - this.label14.Text = "包裹号"; + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(143, 37); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(67, 15); + this.label2.TabIndex = 2; + this.label2.Text = "最大包长"; // - // EPCText + // MinLength // - this.EPCText.Location = new System.Drawing.Point(111, 188); - this.EPCText.Name = "EPCText"; - this.EPCText.Size = new System.Drawing.Size(121, 25); - this.EPCText.TabIndex = 15; + this.MinLength.Location = new System.Drawing.Point(79, 32); + this.MinLength.Name = "MinLength"; + this.MinLength.Size = new System.Drawing.Size(52, 25); + this.MinLength.TabIndex = 1; // - // label15 + // label1 // - this.label15.AutoSize = true; - this.label15.Location = new System.Drawing.Point(40, 193); - this.label15.Name = "label15"; - this.label15.Size = new System.Drawing.Size(67, 15); - this.label15.TabIndex = 14; - this.label15.Text = "读码内容"; + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(6, 37); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(67, 15); + this.label1.TabIndex = 0; + this.label1.Text = "最小包长"; // // SelectAll // @@ -482,6 +503,7 @@ this.SelectAll.TabIndex = 16; this.SelectAll.Text = "综合条件查询"; this.SelectAll.UseVisualStyleBackColor = true; + this.SelectAll.Click += new System.EventHandler(this.SelectAll_Click); // // label16 // @@ -492,21 +514,85 @@ this.label16.TabIndex = 59; this.label16.Text = "选择查询地址"; // - // AllAddress - // - this.AllAddress.FormattingEnabled = true; - this.AllAddress.Location = new System.Drawing.Point(136, 25); - this.AllAddress.Name = "AllAddress"; - this.AllAddress.Size = new System.Drawing.Size(143, 23); - this.AllAddress.TabIndex = 58; + // AllIP + // + this.AllIP.FormattingEnabled = true; + this.AllIP.Location = new System.Drawing.Point(136, 25); + this.AllIP.Name = "AllIP"; + this.AllIP.Size = new System.Drawing.Size(143, 23); + this.AllIP.TabIndex = 58; + // + // rFIDContentBindingSource + // + this.rFIDContentBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDContent); + // + // sNDataGridViewTextBoxColumn + // + this.sNDataGridViewTextBoxColumn.DataPropertyName = "SN"; + dataGridViewCellStyle1.Format = "G"; + dataGridViewCellStyle1.NullValue = null; + this.sNDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle1; + this.sNDataGridViewTextBoxColumn.HeaderText = "包裹码"; + this.sNDataGridViewTextBoxColumn.MinimumWidth = 6; + this.sNDataGridViewTextBoxColumn.Name = "sNDataGridViewTextBoxColumn"; + this.sNDataGridViewTextBoxColumn.ReadOnly = true; + this.sNDataGridViewTextBoxColumn.Width = 60; + // + // intervalDataGridViewTextBoxColumn + // + this.intervalDataGridViewTextBoxColumn.DataPropertyName = "Interval"; + this.intervalDataGridViewTextBoxColumn.HeaderText = "间距"; + this.intervalDataGridViewTextBoxColumn.MinimumWidth = 6; + this.intervalDataGridViewTextBoxColumn.Name = "intervalDataGridViewTextBoxColumn"; + this.intervalDataGridViewTextBoxColumn.ReadOnly = true; + this.intervalDataGridViewTextBoxColumn.Width = 60; + // + // lengthDataGridViewTextBoxColumn + // + this.lengthDataGridViewTextBoxColumn.DataPropertyName = "Length"; + this.lengthDataGridViewTextBoxColumn.HeaderText = "包长"; + this.lengthDataGridViewTextBoxColumn.MinimumWidth = 6; + this.lengthDataGridViewTextBoxColumn.Name = "lengthDataGridViewTextBoxColumn"; + this.lengthDataGridViewTextBoxColumn.ReadOnly = true; + this.lengthDataGridViewTextBoxColumn.Width = 60; + // + // ePCDataGridViewTextBoxColumn + // + this.ePCDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.ePCDataGridViewTextBoxColumn.DataPropertyName = "EPC"; + this.ePCDataGridViewTextBoxColumn.HeaderText = "读取内容"; + this.ePCDataGridViewTextBoxColumn.MinimumWidth = 6; + this.ePCDataGridViewTextBoxColumn.Name = "ePCDataGridViewTextBoxColumn"; + this.ePCDataGridViewTextBoxColumn.ReadOnly = true; + // + // tipsDataGridViewTextBoxColumn + // + this.tipsDataGridViewTextBoxColumn.DataPropertyName = "Tips"; + this.tipsDataGridViewTextBoxColumn.HeaderText = "状态"; + this.tipsDataGridViewTextBoxColumn.MinimumWidth = 6; + this.tipsDataGridViewTextBoxColumn.Name = "tipsDataGridViewTextBoxColumn"; + this.tipsDataGridViewTextBoxColumn.ReadOnly = true; + this.tipsDataGridViewTextBoxColumn.Width = 80; + // + // logTimeDataGridViewTextBoxColumn + // + this.logTimeDataGridViewTextBoxColumn.DataPropertyName = "LogTime"; + dataGridViewCellStyle2.Format = "G"; + dataGridViewCellStyle2.NullValue = null; + this.logTimeDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle2; + this.logTimeDataGridViewTextBoxColumn.HeaderText = "记录时间"; + this.logTimeDataGridViewTextBoxColumn.MinimumWidth = 6; + this.logTimeDataGridViewTextBoxColumn.Name = "logTimeDataGridViewTextBoxColumn"; + this.logTimeDataGridViewTextBoxColumn.ReadOnly = true; + this.logTimeDataGridViewTextBoxColumn.Width = 125; // // RFIDLog // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(982, 1258); + this.ClientSize = new System.Drawing.Size(1226, 1258); this.Controls.Add(this.label16); - this.Controls.Add(this.AllAddress); + this.Controls.Add(this.AllIP); this.Controls.Add(this.SelectAll); this.Controls.Add(this.groupBox2); this.Controls.Add(this.ShortCount); @@ -538,6 +624,7 @@ ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.rFIDContentBindingSource)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -587,6 +674,13 @@ private System.Windows.Forms.Label label2; private System.Windows.Forms.Button SelectAll; private System.Windows.Forms.Label label16; - private System.Windows.Forms.ComboBox AllAddress; + private System.Windows.Forms.ComboBox AllIP; + private System.Windows.Forms.BindingSource rFIDContentBindingSource; + private System.Windows.Forms.DataGridViewTextBoxColumn sNDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn intervalDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn lengthDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn ePCDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn tipsDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn logTimeDataGridViewTextBoxColumn; } } \ No newline at end of file diff --git a/RFIDSocket/RFIDLog.cs b/RFIDSocket/RFIDLog.cs index 90792fb..8d0b353 100644 --- a/RFIDSocket/RFIDLog.cs +++ b/RFIDSocket/RFIDLog.cs @@ -16,48 +16,107 @@ namespace RFIDSocket { List rFIDContents = new List(); + List AfterSelect = new List(); BaseContentServiceImpl sql = new BaseContentServiceImpl(); - public RFIDLog() + + List listStatus = new List { - InitializeComponent(); - StartTime.Value = DateTime.Now.AddDays(-3); - List listStatus = new List - { - "", - "NR", - "GR", - }; + "", + "NR", + "GR", + }; - Dictionary listTips = new Dictionary - { - {"ok", "正常"}, - {"noread", "无读"}, - {"near", "近距离"}, - {"short", "包过短"}, - {"multi", "多标签"}, - }; + Dictionary listTips = new Dictionary + { + {"", ""}, + {"正常", "ok"}, + {"无读", "noread"}, + {"近距离", "near"}, + {"包过短", "short"}, + {"多标签", "multi"}, + }; + public RFIDLog() + { + InitializeComponent(); Init(); } private void Init() { rFIDContents = sql.GetContentInfos(); + StartTime.Value = DateTime.Now.AddDays(-3); + AllIP.DataSource = ServerConnect.Names; + StatusText.DataSource = listStatus; + TipsText.DataSource = listTips.Keys.ToArray(); } private void TimeSelect_Click(object sender, EventArgs e) { + rFIDContents = LogControl.LogIPSelect(sql.GetContentInfos(), ServerConnect.IPConfig[AllIP.Text]); + AfterSelect = LogControl.LogTimeSelect(rFIDContents, StartTime.Value, EndTime.Value); + DataCount(); + if (LogContent != null) + { + LogContent.DataSource = null; + LogContent.DataSource = AfterSelect; + } + } + + private void SelectByCondition_Click(object sender, EventArgs e) + { + rFIDContents = LogControl.LogIPSelect(sql.GetContentInfos(), ServerConnect.IPConfig[AllIP.Text]); + AfterSelect = SelectCondition(rFIDContents); + DataCount(); if (LogContent != null) { LogContent.DataSource = null; - //LogContent.DataSource = LogControl.LogTimeSelect(rFIDContents, StartTime.Value, EndTime.Value); + LogContent.DataSource = AfterSelect; } } - private void SelectAll_Click(object sender, EventArgs e) { - + rFIDContents = LogControl.LogIPSelect(sql.GetContentInfos(), ServerConnect.IPConfig[AllIP.Text]); + AfterSelect = LogControl.LogTimeSelect(SelectCondition(rFIDContents), + StartTime.Value, EndTime.Value); + DataCount(); + if (LogContent != null) + { + LogContent.DataSource = null; + LogContent.DataSource = AfterSelect; + } + } + + private List SelectCondition(List content) + { + AfterSelect = LogControl.LogLengthSelect( + LogControl.LogIntervalSelect( + LogControl.LogStatusSelect( + LogControl.LogTipsSelect( + LogControl.LogSNSelect( + LogControl.LogEPCSelect(content, + EPCText.Text), + SNText.Text), + listTips[TipsText.Text]), + StatusText.Text), + int.TryParse(MinInterval.Text, out int c) ? c : -1, + int.TryParse(MaxInterval.Text, out int d) ? d : -1), + int.TryParse(MinLength.Text, out int a) ? a : -1, + int.TryParse(MaxLength.Text, out int b) ? b : -1); + DataCount(); + return AfterSelect; + } + + private void DataCount() + { + TotalCount.Text = AfterSelect.Count.ToString(); + NormalCount.Text = AfterSelect.Where(x => x.Tips == "ok").Count().ToString(); + WarningCount.Text = AfterSelect.Where(x => x.Tips != "ok").Count().ToString(); + NoReadCount.Text = AfterSelect.Where(x => x.Tips == "noread").Count().ToString(); + NearCount.Text = AfterSelect.Where(x => x.Tips == "near").Count().ToString(); + ShortCount.Text = AfterSelect.Where(x => x.Tips == "short").Count().ToString(); + MultiCount.Text = AfterSelect.Where(x => x.Tips == "multi").Count().ToString(); } } diff --git a/RFIDSocket/RFIDLog.resx b/RFIDSocket/RFIDLog.resx index 1af7de1..ca21880 100644 --- a/RFIDSocket/RFIDLog.resx +++ b/RFIDSocket/RFIDLog.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/RFIDSocket/RFIDSocket.Designer.cs b/RFIDSocket/RFIDSocket.Designer.cs index daabc61..191bd8e 100644 --- a/RFIDSocket/RFIDSocket.Designer.cs +++ b/RFIDSocket/RFIDSocket.Designer.cs @@ -29,13 +29,9 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); this.CotentData = new System.Windows.Forms.DataGridView(); - this.sNDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.intervalDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.lengthDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ePCDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.tipsDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.logTimeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.rFIDContentBindingSource = new System.Windows.Forms.BindingSource(this.components); this.ClientIP = new System.Windows.Forms.TextBox(); this.SetAddress = new System.Windows.Forms.Button(); @@ -78,6 +74,12 @@ this.label14 = new System.Windows.Forms.Label(); this.ServerPort = new System.Windows.Forms.TextBox(); this.label15 = new System.Windows.Forms.Label(); + this.sNDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.intervalDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.lengthDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ePCDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.tipsDataGridViewTextBoxColumn = 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.pictureBox5)).BeginInit(); @@ -99,84 +101,36 @@ this.tipsDataGridViewTextBoxColumn, this.logTimeDataGridViewTextBoxColumn}); this.CotentData.DataSource = this.rFIDContentBindingSource; - this.CotentData.Location = new System.Drawing.Point(9, 103); - this.CotentData.Margin = new System.Windows.Forms.Padding(2); + this.CotentData.Location = new System.Drawing.Point(12, 129); + this.CotentData.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.CotentData.Name = "CotentData"; this.CotentData.RowHeadersVisible = false; this.CotentData.RowHeadersWidth = 51; this.CotentData.RowTemplate.Height = 17; this.CotentData.ScrollBars = System.Windows.Forms.ScrollBars.None; - this.CotentData.Size = new System.Drawing.Size(683, 870); + this.CotentData.Size = new System.Drawing.Size(911, 1088); this.CotentData.TabIndex = 0; // - // sNDataGridViewTextBoxColumn - // - this.sNDataGridViewTextBoxColumn.DataPropertyName = "SN"; - this.sNDataGridViewTextBoxColumn.HeaderText = "包裹码"; - this.sNDataGridViewTextBoxColumn.MinimumWidth = 6; - this.sNDataGridViewTextBoxColumn.Name = "sNDataGridViewTextBoxColumn"; - this.sNDataGridViewTextBoxColumn.Width = 60; - // - // intervalDataGridViewTextBoxColumn - // - this.intervalDataGridViewTextBoxColumn.DataPropertyName = "Interval"; - this.intervalDataGridViewTextBoxColumn.HeaderText = "间距"; - this.intervalDataGridViewTextBoxColumn.MinimumWidth = 6; - this.intervalDataGridViewTextBoxColumn.Name = "intervalDataGridViewTextBoxColumn"; - this.intervalDataGridViewTextBoxColumn.Width = 60; - // - // lengthDataGridViewTextBoxColumn - // - this.lengthDataGridViewTextBoxColumn.DataPropertyName = "Length"; - this.lengthDataGridViewTextBoxColumn.HeaderText = "包长"; - this.lengthDataGridViewTextBoxColumn.MinimumWidth = 6; - this.lengthDataGridViewTextBoxColumn.Name = "lengthDataGridViewTextBoxColumn"; - this.lengthDataGridViewTextBoxColumn.Width = 60; - // - // ePCDataGridViewTextBoxColumn - // - this.ePCDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.ePCDataGridViewTextBoxColumn.DataPropertyName = "EPC"; - this.ePCDataGridViewTextBoxColumn.HeaderText = "读取内容"; - this.ePCDataGridViewTextBoxColumn.MinimumWidth = 6; - this.ePCDataGridViewTextBoxColumn.Name = "ePCDataGridViewTextBoxColumn"; - // - // tipsDataGridViewTextBoxColumn - // - this.tipsDataGridViewTextBoxColumn.DataPropertyName = "Tips"; - this.tipsDataGridViewTextBoxColumn.HeaderText = "状态"; - this.tipsDataGridViewTextBoxColumn.MinimumWidth = 6; - this.tipsDataGridViewTextBoxColumn.Name = "tipsDataGridViewTextBoxColumn"; - this.tipsDataGridViewTextBoxColumn.Width = 80; - // - // logTimeDataGridViewTextBoxColumn - // - this.logTimeDataGridViewTextBoxColumn.DataPropertyName = "LogTime"; - this.logTimeDataGridViewTextBoxColumn.HeaderText = "记录时间"; - this.logTimeDataGridViewTextBoxColumn.MinimumWidth = 6; - this.logTimeDataGridViewTextBoxColumn.Name = "logTimeDataGridViewTextBoxColumn"; - this.logTimeDataGridViewTextBoxColumn.Width = 120; - // // rFIDContentBindingSource // this.rFIDContentBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDContent); // // ClientIP // - this.ClientIP.Location = new System.Drawing.Point(114, 22); - this.ClientIP.Margin = new System.Windows.Forms.Padding(2); + this.ClientIP.Location = new System.Drawing.Point(152, 28); + this.ClientIP.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.ClientIP.MaxLength = 6; this.ClientIP.Name = "ClientIP"; - this.ClientIP.Size = new System.Drawing.Size(98, 21); + this.ClientIP.Size = new System.Drawing.Size(129, 25); this.ClientIP.TabIndex = 7; this.ClientIP.Text = "127.0.0.1"; // // SetAddress // - this.SetAddress.Location = new System.Drawing.Point(265, 9); - this.SetAddress.Margin = new System.Windows.Forms.Padding(2); + this.SetAddress.Location = new System.Drawing.Point(353, 11); + this.SetAddress.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.SetAddress.Name = "SetAddress"; - this.SetAddress.Size = new System.Drawing.Size(120, 45); + this.SetAddress.Size = new System.Drawing.Size(160, 56); this.SetAddress.TabIndex = 6; this.SetAddress.Text = "确认客户端地址"; this.SetAddress.UseVisualStyleBackColor = true; @@ -185,29 +139,28 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(9, 26); - this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label1.Location = new System.Drawing.Point(12, 32); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(101, 12); + this.label1.Size = new System.Drawing.Size(128, 15); this.label1.TabIndex = 1; this.label1.Text = "客户端IP:端口号"; // // ClientPort // - this.ClientPort.Location = new System.Drawing.Point(216, 22); - this.ClientPort.Margin = new System.Windows.Forms.Padding(2); + this.ClientPort.Location = new System.Drawing.Point(288, 28); + this.ClientPort.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.ClientPort.MaxLength = 6; this.ClientPort.Name = "ClientPort"; - this.ClientPort.Size = new System.Drawing.Size(45, 21); + this.ClientPort.Size = new System.Drawing.Size(59, 25); this.ClientPort.TabIndex = 0; this.ClientPort.Text = "1234"; // // MonitorOnOff // - this.MonitorOnOff.Location = new System.Drawing.Point(696, 10); - this.MonitorOnOff.Margin = new System.Windows.Forms.Padding(2); + this.MonitorOnOff.Location = new System.Drawing.Point(928, 12); + this.MonitorOnOff.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.MonitorOnOff.Name = "MonitorOnOff"; - this.MonitorOnOff.Size = new System.Drawing.Size(83, 40); + this.MonitorOnOff.Size = new System.Drawing.Size(111, 50); this.MonitorOnOff.TabIndex = 7; this.MonitorOnOff.Text = "启动监听"; this.MonitorOnOff.UseVisualStyleBackColor = true; @@ -216,10 +169,9 @@ // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(791, 22); - this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label4.Location = new System.Drawing.Point(1055, 28); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(65, 12); + this.label4.Size = new System.Drawing.Size(82, 15); this.label4.TabIndex = 8; this.label4.Text = "监听状态:"; // @@ -227,10 +179,9 @@ // this.MonitorState.AutoSize = true; this.MonitorState.BackColor = System.Drawing.Color.Transparent; - this.MonitorState.Location = new System.Drawing.Point(860, 22); - this.MonitorState.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.MonitorState.Location = new System.Drawing.Point(1147, 28); this.MonitorState.Name = "MonitorState"; - this.MonitorState.Size = new System.Drawing.Size(17, 12); + this.MonitorState.Size = new System.Drawing.Size(22, 15); this.MonitorState.TabIndex = 9; this.MonitorState.Text = "关"; // @@ -242,10 +193,10 @@ // // PgUp // - this.PgUp.Location = new System.Drawing.Point(9, 59); - this.PgUp.Margin = new System.Windows.Forms.Padding(2); + this.PgUp.Location = new System.Drawing.Point(12, 74); + this.PgUp.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.PgUp.Name = "PgUp"; - this.PgUp.Size = new System.Drawing.Size(101, 40); + this.PgUp.Size = new System.Drawing.Size(135, 50); this.PgUp.TabIndex = 8; this.PgUp.Text = "上一页"; this.PgUp.UseVisualStyleBackColor = true; @@ -253,10 +204,10 @@ // // PgDn // - this.PgDn.Location = new System.Drawing.Point(591, 59); - this.PgDn.Margin = new System.Windows.Forms.Padding(2); + this.PgDn.Location = new System.Drawing.Point(788, 74); + this.PgDn.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.PgDn.Name = "PgDn"; - this.PgDn.Size = new System.Drawing.Size(101, 40); + this.PgDn.Size = new System.Drawing.Size(135, 50); this.PgDn.TabIndex = 13; this.PgDn.Text = "下一页"; this.PgDn.UseVisualStyleBackColor = true; @@ -267,10 +218,9 @@ this.PageRange.AutoSize = true; this.PageRange.BackColor = System.Drawing.Color.Transparent; this.PageRange.Font = new System.Drawing.Font("宋体", 12F); - this.PageRange.Location = new System.Drawing.Point(331, 70); - this.PageRange.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.PageRange.Location = new System.Drawing.Point(441, 88); this.PageRange.Name = "PageRange"; - this.PageRange.Size = new System.Drawing.Size(55, 16); + this.PageRange.Size = new System.Drawing.Size(69, 20); this.PageRange.TabIndex = 15; this.PageRange.Text = "1 - 50"; // @@ -278,19 +228,18 @@ // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("宋体", 12F); - this.label3.Location = new System.Drawing.Point(262, 70); - this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label3.Location = new System.Drawing.Point(349, 88); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(87, 16); + this.label3.Size = new System.Drawing.Size(109, 20); this.label3.TabIndex = 14; this.label3.Text = "显示条数:"; // // LogStart // - this.LogStart.Location = new System.Drawing.Point(746, 81); - this.LogStart.Margin = new System.Windows.Forms.Padding(2); + this.LogStart.Location = new System.Drawing.Point(995, 101); + this.LogStart.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.LogStart.Name = "LogStart"; - this.LogStart.Size = new System.Drawing.Size(85, 40); + this.LogStart.Size = new System.Drawing.Size(113, 50); this.LogStart.TabIndex = 16; this.LogStart.Text = "日志查询"; this.LogStart.UseVisualStyleBackColor = true; @@ -300,10 +249,9 @@ // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("宋体", 12F); - this.label2.Location = new System.Drawing.Point(786, 165); - this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label2.Location = new System.Drawing.Point(1048, 206); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(71, 16); + this.label2.Size = new System.Drawing.Size(89, 20); this.label2.TabIndex = 17; this.label2.Text = "连接状态"; // @@ -311,10 +259,9 @@ // this.label6.AutoSize = true; this.label6.Font = new System.Drawing.Font("宋体", 12F); - this.label6.Location = new System.Drawing.Point(786, 349); - this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label6.Location = new System.Drawing.Point(1048, 436); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(55, 16); + this.label6.Size = new System.Drawing.Size(69, 20); this.label6.TabIndex = 21; this.label6.Text = "总数量"; // @@ -322,10 +269,9 @@ // this.label7.AutoSize = true; this.label7.Font = new System.Drawing.Font("宋体", 12F); - this.label7.Location = new System.Drawing.Point(786, 441); - this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label7.Location = new System.Drawing.Point(1048, 551); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(71, 16); + this.label7.Size = new System.Drawing.Size(89, 20); this.label7.TabIndex = 23; this.label7.Text = "正常数量"; // @@ -333,20 +279,19 @@ // this.label8.AutoSize = true; this.label8.Font = new System.Drawing.Font("宋体", 12F); - this.label8.Location = new System.Drawing.Point(786, 534); - this.label8.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label8.Location = new System.Drawing.Point(1048, 668); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(71, 16); + this.label8.Size = new System.Drawing.Size(89, 20); this.label8.TabIndex = 25; this.label8.Text = "异常数量"; // // pictureBox5 // this.pictureBox5.Image = global::RFIDSocket.Properties.Resources.WarningCount; - this.pictureBox5.Location = new System.Drawing.Point(734, 535); - this.pictureBox5.Margin = new System.Windows.Forms.Padding(2); + this.pictureBox5.Location = new System.Drawing.Point(979, 669); + this.pictureBox5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pictureBox5.Name = "pictureBox5"; - this.pictureBox5.Size = new System.Drawing.Size(45, 48); + this.pictureBox5.Size = new System.Drawing.Size(60, 60); this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox5.TabIndex = 26; this.pictureBox5.TabStop = false; @@ -354,10 +299,10 @@ // pictureBox4 // this.pictureBox4.Image = global::RFIDSocket.Properties.Resources.NormalCount; - this.pictureBox4.Location = new System.Drawing.Point(734, 442); - this.pictureBox4.Margin = new System.Windows.Forms.Padding(2); + this.pictureBox4.Location = new System.Drawing.Point(979, 552); + this.pictureBox4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pictureBox4.Name = "pictureBox4"; - this.pictureBox4.Size = new System.Drawing.Size(45, 48); + this.pictureBox4.Size = new System.Drawing.Size(60, 60); this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox4.TabIndex = 24; this.pictureBox4.TabStop = false; @@ -365,10 +310,10 @@ // pictureBox3 // this.pictureBox3.Image = global::RFIDSocket.Properties.Resources.TotalCount; - this.pictureBox3.Location = new System.Drawing.Point(734, 350); - this.pictureBox3.Margin = new System.Windows.Forms.Padding(2); + this.pictureBox3.Location = new System.Drawing.Point(979, 438); + this.pictureBox3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pictureBox3.Name = "pictureBox3"; - this.pictureBox3.Size = new System.Drawing.Size(45, 48); + this.pictureBox3.Size = new System.Drawing.Size(60, 60); this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox3.TabIndex = 22; this.pictureBox3.TabStop = false; @@ -376,10 +321,10 @@ // DevicePictureBox // this.DevicePictureBox.Image = global::RFIDSocket.Properties.Resources.RunNormal; - this.DevicePictureBox.Location = new System.Drawing.Point(734, 256); - this.DevicePictureBox.Margin = new System.Windows.Forms.Padding(2); + this.DevicePictureBox.Location = new System.Drawing.Point(979, 320); + this.DevicePictureBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.DevicePictureBox.Name = "DevicePictureBox"; - this.DevicePictureBox.Size = new System.Drawing.Size(45, 48); + this.DevicePictureBox.Size = new System.Drawing.Size(60, 60); this.DevicePictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.DevicePictureBox.TabIndex = 20; this.DevicePictureBox.TabStop = false; @@ -387,10 +332,10 @@ // ConnectPictureBox // this.ConnectPictureBox.Image = global::RFIDSocket.Properties.Resources.ConnectNormal; - this.ConnectPictureBox.Location = new System.Drawing.Point(734, 166); - this.ConnectPictureBox.Margin = new System.Windows.Forms.Padding(2); + this.ConnectPictureBox.Location = new System.Drawing.Point(979, 208); + this.ConnectPictureBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.ConnectPictureBox.Name = "ConnectPictureBox"; - this.ConnectPictureBox.Size = new System.Drawing.Size(45, 48); + this.ConnectPictureBox.Size = new System.Drawing.Size(60, 60); this.ConnectPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.ConnectPictureBox.TabIndex = 18; this.ConnectPictureBox.TabStop = false; @@ -399,10 +344,9 @@ // this.label5.AutoSize = true; this.label5.Font = new System.Drawing.Font("宋体", 12F); - this.label5.Location = new System.Drawing.Point(786, 256); - this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label5.Location = new System.Drawing.Point(1048, 320); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(71, 16); + this.label5.Size = new System.Drawing.Size(89, 20); this.label5.TabIndex = 19; this.label5.Text = "设备状态"; // @@ -410,10 +354,9 @@ // this.ConnectState.AutoSize = true; this.ConnectState.Font = new System.Drawing.Font("宋体", 12F); - this.ConnectState.Location = new System.Drawing.Point(787, 198); - this.ConnectState.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.ConnectState.Location = new System.Drawing.Point(1049, 248); this.ConnectState.Name = "ConnectState"; - this.ConnectState.Size = new System.Drawing.Size(31, 16); + this.ConnectState.Size = new System.Drawing.Size(39, 20); this.ConnectState.TabIndex = 27; this.ConnectState.Text = "NAN"; // @@ -421,10 +364,9 @@ // this.DeviceState.AutoSize = true; this.DeviceState.Font = new System.Drawing.Font("宋体", 12F); - this.DeviceState.Location = new System.Drawing.Point(786, 288); - this.DeviceState.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.DeviceState.Location = new System.Drawing.Point(1048, 360); this.DeviceState.Name = "DeviceState"; - this.DeviceState.Size = new System.Drawing.Size(31, 16); + this.DeviceState.Size = new System.Drawing.Size(39, 20); this.DeviceState.TabIndex = 28; this.DeviceState.Text = "NAN"; // @@ -432,10 +374,9 @@ // this.TotalCount.AutoSize = true; this.TotalCount.Font = new System.Drawing.Font("宋体", 12F); - this.TotalCount.Location = new System.Drawing.Point(787, 382); - this.TotalCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.TotalCount.Location = new System.Drawing.Point(1049, 478); this.TotalCount.Name = "TotalCount"; - this.TotalCount.Size = new System.Drawing.Size(31, 16); + this.TotalCount.Size = new System.Drawing.Size(39, 20); this.TotalCount.TabIndex = 29; this.TotalCount.Text = "NAN"; // @@ -443,10 +384,9 @@ // this.NormalCount.AutoSize = true; this.NormalCount.Font = new System.Drawing.Font("宋体", 12F); - this.NormalCount.Location = new System.Drawing.Point(787, 474); - this.NormalCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.NormalCount.Location = new System.Drawing.Point(1049, 592); this.NormalCount.Name = "NormalCount"; - this.NormalCount.Size = new System.Drawing.Size(31, 16); + this.NormalCount.Size = new System.Drawing.Size(39, 20); this.NormalCount.TabIndex = 30; this.NormalCount.Text = "NAN"; // @@ -454,10 +394,9 @@ // this.WarningCount.AutoSize = true; this.WarningCount.Font = new System.Drawing.Font("宋体", 12F); - this.WarningCount.Location = new System.Drawing.Point(787, 567); - this.WarningCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.WarningCount.Location = new System.Drawing.Point(1049, 709); this.WarningCount.Name = "WarningCount"; - this.WarningCount.Size = new System.Drawing.Size(31, 16); + this.WarningCount.Size = new System.Drawing.Size(39, 20); this.WarningCount.TabIndex = 31; this.WarningCount.Text = "NAN"; // @@ -465,10 +404,9 @@ // this.label9.AutoSize = true; this.label9.Font = new System.Drawing.Font("宋体", 12F); - this.label9.Location = new System.Drawing.Point(731, 618); - this.label9.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label9.Location = new System.Drawing.Point(975, 772); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(71, 16); + this.label9.Size = new System.Drawing.Size(89, 20); this.label9.TabIndex = 32; this.label9.Text = "未读取:"; // @@ -476,10 +414,9 @@ // this.label10.AutoSize = true; this.label10.Font = new System.Drawing.Font("宋体", 12F); - this.label10.Location = new System.Drawing.Point(731, 644); - this.label10.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label10.Location = new System.Drawing.Point(975, 805); this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(87, 16); + this.label10.Size = new System.Drawing.Size(109, 20); this.label10.TabIndex = 33; this.label10.Text = "间距异常:"; // @@ -487,10 +424,9 @@ // this.label11.AutoSize = true; this.label11.Font = new System.Drawing.Font("宋体", 12F); - this.label11.Location = new System.Drawing.Point(731, 695); - this.label11.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label11.Location = new System.Drawing.Point(975, 869); this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(71, 16); + this.label11.Size = new System.Drawing.Size(89, 20); this.label11.TabIndex = 34; this.label11.Text = "多标签:"; // @@ -498,10 +434,9 @@ // this.NoReadCount.AutoSize = true; this.NoReadCount.Font = new System.Drawing.Font("宋体", 12F); - this.NoReadCount.Location = new System.Drawing.Point(818, 618); - this.NoReadCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.NoReadCount.Location = new System.Drawing.Point(1091, 772); this.NoReadCount.Name = "NoReadCount"; - this.NoReadCount.Size = new System.Drawing.Size(31, 16); + this.NoReadCount.Size = new System.Drawing.Size(39, 20); this.NoReadCount.TabIndex = 35; this.NoReadCount.Text = "NAN"; // @@ -509,10 +444,9 @@ // this.NearCount.AutoSize = true; this.NearCount.Font = new System.Drawing.Font("宋体", 12F); - this.NearCount.Location = new System.Drawing.Point(818, 644); - this.NearCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.NearCount.Location = new System.Drawing.Point(1091, 805); this.NearCount.Name = "NearCount"; - this.NearCount.Size = new System.Drawing.Size(31, 16); + this.NearCount.Size = new System.Drawing.Size(39, 20); this.NearCount.TabIndex = 36; this.NearCount.Text = "NAN"; // @@ -520,10 +454,9 @@ // this.MultiCount.AutoSize = true; this.MultiCount.Font = new System.Drawing.Font("宋体", 12F); - this.MultiCount.Location = new System.Drawing.Point(818, 695); - this.MultiCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.MultiCount.Location = new System.Drawing.Point(1091, 869); this.MultiCount.Name = "MultiCount"; - this.MultiCount.Size = new System.Drawing.Size(31, 16); + this.MultiCount.Size = new System.Drawing.Size(39, 20); this.MultiCount.TabIndex = 37; this.MultiCount.Text = "NAN"; // @@ -531,10 +464,9 @@ // this.ShortCount.AutoSize = true; this.ShortCount.Font = new System.Drawing.Font("宋体", 12F); - this.ShortCount.Location = new System.Drawing.Point(818, 670); - this.ShortCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.ShortCount.Location = new System.Drawing.Point(1091, 838); this.ShortCount.Name = "ShortCount"; - this.ShortCount.Size = new System.Drawing.Size(31, 16); + this.ShortCount.Size = new System.Drawing.Size(39, 20); this.ShortCount.TabIndex = 39; this.ShortCount.Text = "NAN"; // @@ -542,29 +474,27 @@ // this.label13.AutoSize = true; this.label13.Font = new System.Drawing.Font("宋体", 12F); - this.label13.Location = new System.Drawing.Point(731, 670); - this.label13.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label13.Location = new System.Drawing.Point(975, 838); this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(71, 16); + this.label13.Size = new System.Drawing.Size(89, 20); this.label13.TabIndex = 38; this.label13.Text = "包过短:"; // // ServerIP // this.ServerIP.FormattingEnabled = true; - this.ServerIP.Location = new System.Drawing.Point(478, 22); - this.ServerIP.Margin = new System.Windows.Forms.Padding(2); + this.ServerIP.Location = new System.Drawing.Point(637, 28); + this.ServerIP.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.ServerIP.Name = "ServerIP"; - this.ServerIP.Size = new System.Drawing.Size(108, 20); + this.ServerIP.Size = new System.Drawing.Size(143, 23); this.ServerIP.TabIndex = 40; // // label12 // this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(389, 26); - this.label12.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label12.Location = new System.Drawing.Point(519, 32); this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(89, 12); + this.label12.Size = new System.Drawing.Size(112, 15); this.label12.TabIndex = 41; this.label12.Text = "选择监听地址:"; // @@ -572,20 +502,19 @@ // this.label14.AutoSize = true; this.label14.Font = new System.Drawing.Font("宋体", 12F); - this.label14.Location = new System.Drawing.Point(387, 70); - this.label14.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label14.Location = new System.Drawing.Point(516, 88); this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size(47, 16); + this.label14.Size = new System.Drawing.Size(59, 20); this.label14.TabIndex = 42; this.label14.Text = "共200"; // // ServerPort // - this.ServerPort.Location = new System.Drawing.Point(635, 22); - this.ServerPort.Margin = new System.Windows.Forms.Padding(2); + this.ServerPort.Location = new System.Drawing.Point(847, 28); + this.ServerPort.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.ServerPort.MaxLength = 6; this.ServerPort.Name = "ServerPort"; - this.ServerPort.Size = new System.Drawing.Size(45, 21); + this.ServerPort.Size = new System.Drawing.Size(59, 25); this.ServerPort.TabIndex = 43; this.ServerPort.Text = "1234"; // @@ -593,18 +522,71 @@ // this.label15.AutoSize = true; this.label15.BackColor = System.Drawing.Color.Transparent; - this.label15.Location = new System.Drawing.Point(590, 26); - this.label15.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label15.Location = new System.Drawing.Point(787, 32); this.label15.Name = "label15"; - this.label15.Size = new System.Drawing.Size(41, 12); + this.label15.Size = new System.Drawing.Size(52, 15); this.label15.TabIndex = 44; this.label15.Text = "端口号"; // + // sNDataGridViewTextBoxColumn + // + this.sNDataGridViewTextBoxColumn.DataPropertyName = "SN"; + dataGridViewCellStyle1.Format = "G"; + dataGridViewCellStyle1.NullValue = null; + this.sNDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle1; + this.sNDataGridViewTextBoxColumn.HeaderText = "包裹码"; + this.sNDataGridViewTextBoxColumn.MinimumWidth = 6; + this.sNDataGridViewTextBoxColumn.Name = "sNDataGridViewTextBoxColumn"; + this.sNDataGridViewTextBoxColumn.Width = 60; + // + // intervalDataGridViewTextBoxColumn + // + this.intervalDataGridViewTextBoxColumn.DataPropertyName = "Interval"; + this.intervalDataGridViewTextBoxColumn.HeaderText = "间距"; + this.intervalDataGridViewTextBoxColumn.MinimumWidth = 6; + this.intervalDataGridViewTextBoxColumn.Name = "intervalDataGridViewTextBoxColumn"; + this.intervalDataGridViewTextBoxColumn.Width = 60; + // + // lengthDataGridViewTextBoxColumn + // + this.lengthDataGridViewTextBoxColumn.DataPropertyName = "Length"; + this.lengthDataGridViewTextBoxColumn.HeaderText = "包长"; + this.lengthDataGridViewTextBoxColumn.MinimumWidth = 6; + this.lengthDataGridViewTextBoxColumn.Name = "lengthDataGridViewTextBoxColumn"; + this.lengthDataGridViewTextBoxColumn.Width = 60; + // + // ePCDataGridViewTextBoxColumn + // + this.ePCDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.ePCDataGridViewTextBoxColumn.DataPropertyName = "EPC"; + this.ePCDataGridViewTextBoxColumn.HeaderText = "读取内容"; + this.ePCDataGridViewTextBoxColumn.MinimumWidth = 6; + this.ePCDataGridViewTextBoxColumn.Name = "ePCDataGridViewTextBoxColumn"; + // + // tipsDataGridViewTextBoxColumn + // + this.tipsDataGridViewTextBoxColumn.DataPropertyName = "Tips"; + this.tipsDataGridViewTextBoxColumn.HeaderText = "状态"; + this.tipsDataGridViewTextBoxColumn.MinimumWidth = 6; + this.tipsDataGridViewTextBoxColumn.Name = "tipsDataGridViewTextBoxColumn"; + this.tipsDataGridViewTextBoxColumn.Width = 80; + // + // logTimeDataGridViewTextBoxColumn + // + this.logTimeDataGridViewTextBoxColumn.DataPropertyName = "LogTime"; + dataGridViewCellStyle2.Format = "G"; + dataGridViewCellStyle2.NullValue = null; + this.logTimeDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle2; + this.logTimeDataGridViewTextBoxColumn.HeaderText = "记录时间"; + this.logTimeDataGridViewTextBoxColumn.MinimumWidth = 6; + this.logTimeDataGridViewTextBoxColumn.Name = "logTimeDataGridViewTextBoxColumn"; + this.logTimeDataGridViewTextBoxColumn.Width = 125; + // // RFIDSocket // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(892, 983); + this.ClientSize = new System.Drawing.Size(1189, 1229); this.Controls.Add(this.label15); this.Controls.Add(this.ServerPort); this.Controls.Add(this.label14); @@ -646,7 +628,7 @@ this.Controls.Add(this.label4); this.Controls.Add(this.MonitorOnOff); this.Controls.Add(this.CotentData); - this.Margin = new System.Windows.Forms.Padding(2); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Name = "RFIDSocket"; this.Text = " 通道门监听"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RFIDSocket_FormClosing); @@ -704,15 +686,15 @@ private System.Windows.Forms.ComboBox ServerIP; private System.Windows.Forms.Label label12; private System.Windows.Forms.BindingSource rFIDContentBindingSource; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.TextBox ServerPort; + private System.Windows.Forms.Label label15; private System.Windows.Forms.DataGridViewTextBoxColumn sNDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn intervalDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn lengthDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn ePCDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn tipsDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn logTimeDataGridViewTextBoxColumn; - private System.Windows.Forms.Label label14; - private System.Windows.Forms.TextBox ServerPort; - private System.Windows.Forms.Label label15; } } diff --git a/RFIDSocket/RFIDSocket.cs b/RFIDSocket/RFIDSocket.cs index 6df5ffa..0a76ce4 100644 --- a/RFIDSocket/RFIDSocket.cs +++ b/RFIDSocket/RFIDSocket.cs @@ -57,7 +57,7 @@ namespace RFIDSocket { if (!ServerConnect.State) { - Dictionary results = ServerConnect.ConnectAllServer(ServerPort.Text, CIP, CPort); + Dictionary results = ServerConnect.ConnectAllServer(CIP, CPort, ServerPort.Text); bool flag = false; foreach(var pair in results) { diff --git a/RFIDSocket/ServerConnect.cs b/RFIDSocket/ServerConnect.cs index 29cc001..a7d74fa 100644 --- a/RFIDSocket/ServerConnect.cs +++ b/RFIDSocket/ServerConnect.cs @@ -53,21 +53,6 @@ namespace RFIDSocket } } - /// - /// 查找数据表里所有IP - /// - /// - public List GetAllIP() - { - var groups = baseContentServiceImpl.GetContentInfos().GroupBy(x => x.IP); - List result = new List(); - foreach (var group in groups) - { - result.Add(group.Key); - } - return result; - } - /// /// 连接所有服务端 /// @@ -75,13 +60,16 @@ namespace RFIDSocket /// /// /// 成功与否结果 - public Dictionary ConnectAllServer(string serverPort, string clientIP, string clientPort) + public Dictionary ConnectAllServer(string clientIP, string clientPort, string serverPort) { int count = IPs.Length; Dictionary results = new Dictionary(); for (int i = 0; i < count; i++) { - results.Add(Names[i], TcpClients[i].ClientStart(IPs[i], serverPort, clientIP, clientPort)); + if (!TcpClients[i].State) + { + results.Add(Names[i], TcpClients[i].ClientStart(clientIP, clientPort, IPs[i], serverPort)); + } } State = true; return results; @@ -97,7 +85,10 @@ namespace RFIDSocket Dictionary results = new Dictionary(); for (int i = 0; i < count; i++) { - results.Add(Names[i], TcpClients[i].ClientStop()); + if (TcpClients[i].State) + { + results.Add(Names[i], TcpClients[i].ClientStop()); + } } State = false; return results; @@ -113,11 +104,28 @@ namespace RFIDSocket Dictionary results = new Dictionary(); for (int i = 0; i < count; i++) { - results.Add(Names[i], TcpClients[i].ClientDispose()); + if (!TcpClients[i].State) + { + results.Add(Names[i], TcpClients[i].ClientDispose()); + } } return results; } + /// + /// 查找数据表里所有IP + /// + /// + public List GetAllIP() + { + var groups = baseContentServiceImpl.GetContentInfos().GroupBy(x => x.IP); + List result = new List(); + foreach (var group in groups) + { + result.Add(group.Key); + } + return result; + } } }