diff --git a/.vs/HighWayIot/v17/.suo b/.vs/HighWayIot/v17/.suo index eee881a..bc81352 100644 Binary files a/.vs/HighWayIot/v17/.suo and b/.vs/HighWayIot/v17/.suo differ diff --git a/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.dll b/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.dll index a5f3717..f22cd6b 100644 Binary files a/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.dll and b/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.dll differ diff --git a/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.pdb b/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.pdb index caeaac5..e5bf73a 100644 Binary files a/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.pdb and b/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.pdb differ diff --git a/HighWayIot.Repository/domain/RFIDState.cs b/HighWayIot.Repository/domain/RFIDState.cs index a8002d6..64b39bc 100644 --- a/HighWayIot.Repository/domain/RFIDState.cs +++ b/HighWayIot.Repository/domain/RFIDState.cs @@ -14,9 +14,6 @@ namespace HighWayIot.Repository.domain [SugarColumn(ColumnName = "ip")] public string IP { get; set; } - [SugarColumn(ColumnName = "status")] - public bool Status { get; set; } - [SugarColumn(ColumnName = "logtime")] public DateTime LogTime { get; set; } } diff --git a/HighWayIot.Repository/obj/Debug/HighWayIot.Repository.dll b/HighWayIot.Repository/obj/Debug/HighWayIot.Repository.dll index a5f3717..f22cd6b 100644 Binary files a/HighWayIot.Repository/obj/Debug/HighWayIot.Repository.dll and b/HighWayIot.Repository/obj/Debug/HighWayIot.Repository.dll differ diff --git a/HighWayIot.Repository/obj/Debug/HighWayIot.Repository.pdb b/HighWayIot.Repository/obj/Debug/HighWayIot.Repository.pdb index caeaac5..e5bf73a 100644 Binary files a/HighWayIot.Repository/obj/Debug/HighWayIot.Repository.pdb and b/HighWayIot.Repository/obj/Debug/HighWayIot.Repository.pdb differ diff --git a/HighWayIot.TouchSocket/BufferAnalysis.cs b/HighWayIot.TouchSocket/BufferAnalysis.cs index ba80751..8408001 100644 --- a/HighWayIot.TouchSocket/BufferAnalysis.cs +++ b/HighWayIot.TouchSocket/BufferAnalysis.cs @@ -45,7 +45,6 @@ namespace HighWayIot.TouchSocket RFIDState rFIDState = new RFIDState() { IP = ip, - Status = true, LogTime = DateTime.Now, }; sql.AddStateInfo(rFIDState); diff --git a/HighWayIot.TouchSocket/HighWayIot.TouchSocket.csproj b/HighWayIot.TouchSocket/HighWayIot.TouchSocket.csproj index 0f47b99..8de118c 100644 --- a/HighWayIot.TouchSocket/HighWayIot.TouchSocket.csproj +++ b/HighWayIot.TouchSocket/HighWayIot.TouchSocket.csproj @@ -54,7 +54,7 @@ - + diff --git a/HighWayIot.TouchSocket/TcpServer.cs b/HighWayIot.TouchSocket/TcpClient.cs similarity index 66% rename from HighWayIot.TouchSocket/TcpServer.cs rename to HighWayIot.TouchSocket/TcpClient.cs index 057986a..c35bb09 100644 --- a/HighWayIot.TouchSocket/TcpServer.cs +++ b/HighWayIot.TouchSocket/TcpClient.cs @@ -11,47 +11,45 @@ using TouchSocket.Sockets; namespace HighWayIot.TouchSocket { - public class TcpServer + public class TcpClient { - private static readonly Lazy lazy = new Lazy(() => new TcpServer()); - public static TcpServer Instance => lazy.Value; private static LogHelper logHelper = LogHelper.Instance; - public ServerState State + public bool State { - get => service.ServerState; + get => client.Online; private set => State = value; } - TcpService service = new TcpService(); + global::TouchSocket.Sockets.TcpClient client = new global::TouchSocket.Sockets.TcpClient(); - public bool ServerStart(string ip, string port) + public bool ClientStart(string ip, string port) { try { - service.Connecting = (client, e) => + client.Connecting = (client, e) => { - logHelper.Info($"客户端{client.IP}正在连接"); + logHelper.Info($"正在连接 {client.IP} 客户端"); return EasyTask.CompletedTask; };//有客户端正在连接 - service.Connected = (client, e) => + client.Connected = (client, e) => { - logHelper.Info($"客户端{client.IP}成功连接"); + logHelper.Info($"成功连接 {client.IP} 客户端"); return EasyTask.CompletedTask; };//有客户端成功连接 - service.Disconnecting = (client, e) => + client.Disconnecting = (client, e) => { - logHelper.Info($"客户端{client.IP}正在断开连接"); + logHelper.Info($"正在断开连接 {client.IP} 客户端"); return EasyTask.CompletedTask; };//有客户端正在断开连接,只有当主动断开时才有效。 - service.Disconnected = (client, e) => + client.Disconnected = (client, e) => { - logHelper.Info($"客户端{client.IP}断开连接"); + logHelper.Info($"断开连接 {client.IP} 客户端"); return EasyTask.CompletedTask; };//有客户端断开连接 - service.Received = (client, e) => + client.Received = (client, e) => { ////从客户端收到信息 //var mes = Encoding.ASCII.GetString(e.ByteBlock.Buffer, 0, e.ByteBlock.Len);//注意:数据长度是byteBlock.Len @@ -62,18 +60,8 @@ namespace HighWayIot.TouchSocket return EasyTask.CompletedTask; }; - service.Setup(new TouchSocketConfig()//载入配置 - .SetListenOptions(option => - { - option.Add(new TcpListenOption() - { - IpHost = ip + ":" + port, - Name = "Server",//名称用于区分监听 - ServiceSslOption = null,//可以针对当前监听,单独启用ssl加密 - Adapter = () => new NormalDataHandlingAdapter(),//可以单独对当前地址监听,配置适配器 - //还有其他可配置项,都是单独对当前地址有效。 - }); - }) + client.Setup(new TouchSocketConfig()//载入配置 + .SetRemoteIPHost($"{ip}:{port}") .ConfigureContainer(a =>//容器的配置顺序应该在最前面 { a.AddConsoleLogger();//添加一个控制台日志注入(注意:在maui中控制台日志不可用) @@ -82,7 +70,7 @@ namespace HighWayIot.TouchSocket { //a.Add();//此处可以添加插件 })); - service.Start();//启动 + client.Connect();//启动 logHelper.Info("监听服务启动成功"); return true; } @@ -93,11 +81,11 @@ namespace HighWayIot.TouchSocket } } - public bool ServerStop() + public bool ClientStop() { try { - service.Stop(); + client.Close(); logHelper.Info("监听服务关闭成功!"); return true; } @@ -108,11 +96,11 @@ namespace HighWayIot.TouchSocket } } - public bool ServerDispose() + public bool ClientDispose() { try { - service.Dispose(); + client.Dispose(); logHelper.Info("监听服务释放成功!"); return true; } diff --git a/HighWayIot.TouchSocket/bin/Debug/HighWayIot.TouchSocket.dll b/HighWayIot.TouchSocket/bin/Debug/HighWayIot.TouchSocket.dll index 1c9c164..34a453b 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 fffd3bd..2e74317 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/DesignTimeResolveAssemblyReferencesInput.cache b/HighWayIot.TouchSocket/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index e9f9c8e..169b858 100644 Binary files a/HighWayIot.TouchSocket/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/HighWayIot.TouchSocket/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.AssemblyReference.cache b/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.AssemblyReference.cache index b0e6cb6..91c3f93 100644 Binary files a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.AssemblyReference.cache and b/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.csproj.AssemblyReference.cache differ diff --git a/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.dll b/HighWayIot.TouchSocket/obj/Debug/HighWayIot.TouchSocket.dll index 1c9c164..34a453b 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 fffd3bd..2e74317 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/DataAnalysis.cs b/RFIDSocket/DataAnalysis.cs index ba70014..5a9678b 100644 --- a/RFIDSocket/DataAnalysis.cs +++ b/RFIDSocket/DataAnalysis.cs @@ -17,49 +17,62 @@ namespace RFIDSocket public static DataAnalysis Instance => lazy.Value; public List rFIDContents = new List(); + public List NearContents = new List(); public List rFIDHeartbeats = new List(); public List HeartbeatsState = new List(); public List rFIDStates = new List(); public List AlarmState = new List(); + BaseContentServiceImpl baseContentServiceImpl = new BaseContentServiceImpl(); + BaseHeartbeatServiceImpl baseHeartbeatServiceImpl = new BaseHeartbeatServiceImpl(); + BaseStateServiceImpl baseStateServiceImpl = new BaseStateServiceImpl(); public void GetData() { - //BaseContentServiceImpl baseContentServiceImpl = new BaseContentServiceImpl(); - //BaseHeartbeatServiceImpl baseHeartbeatServiceImpl = new BaseHeartbeatServiceImpl(); - //BaseStateServiceImpl baseStateServiceImpl = new BaseStateServiceImpl(); - //rFIDContents = baseContentServiceImpl.GetContentInfos().Reverse().Take(200).ToList(); + rFIDContents = baseContentServiceImpl.GetContentInfos(); - //rFIDStates = baseStateServiceImpl.GetStateInfos(); + NearContents = rFIDContents.Reverse().Take(200).ToList(); - //var StateGroup = rFIDStates.GroupBy(x => x.DeviceNo); + rFIDStates = baseStateServiceImpl.GetStateInfos(); - //AlarmState.Clear(); + var StateGroup = rFIDStates.GroupBy(x => x.IP); - //foreach(var a in StateGroup) - //{ - // var b = a.LastOrDefault(); - // if (b.DeviceState) - // { - // AlarmState.Add(b); - // } - //} + AlarmState.Clear(); - //rFIDHeartbeats = baseHeartbeatServiceImpl.GetHeartbeatInfos(); + foreach (var a in StateGroup) + { + var b = a.LastOrDefault(); + if (b.LogTime > rFIDContents.Where(x => x.IP == b.IP).LastOrDefault().LogTime) + { + AlarmState.Add(b); + } + } + + rFIDHeartbeats = baseHeartbeatServiceImpl.GetHeartbeatInfos(); - //var HeartBeatGroup = rFIDHeartbeats.GroupBy(x => x.DeviceNo); + var HeartBeatGroup = rFIDHeartbeats.GroupBy(x => x.IP); - //HeartbeatsState.Clear(); + HeartbeatsState.Clear(); + + foreach (var a in HeartBeatGroup) + { + var b = a.LastOrDefault(); + if (DateTime.Now - b.BeatTime > TimeSpan.FromSeconds(10)) + { + HeartbeatsState.Add(b); + } + } + } - //foreach (var a in HeartBeatGroup) - //{ - // var b = a.LastOrDefault(); - // if (DateTime.Now - b.BeatTime > TimeSpan.FromSeconds(10)) - // { - // b.TimeSpan = SecondToTime(Convert.ToInt32((DateTime.Now - b.BeatTime).TotalSeconds)); - // HeartbeatsState.Add(b); - // } - //} + 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; } private string SecondToTime(int t) diff --git a/RFIDSocket/Properties/DataSources/HighWayIot.Repository.domain.RFIDContent.datasource b/RFIDSocket/Properties/DataSources/HighWayIot.Repository.domain.RFIDContent.datasource new file mode 100644 index 0000000..6aeca0b --- /dev/null +++ b/RFIDSocket/Properties/DataSources/HighWayIot.Repository.domain.RFIDContent.datasource @@ -0,0 +1,10 @@ + + + + HighWayIot.Repository.domain.RFIDContent, HighWayIot.Repository, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/RFIDSocket/RFIDLog.Designer.cs b/RFIDSocket/RFIDLog.Designer.cs index 5c88deb..b40aeed 100644 --- a/RFIDSocket/RFIDLog.Designer.cs +++ b/RFIDSocket/RFIDLog.Designer.cs @@ -32,28 +32,57 @@ this.StartTime = new System.Windows.Forms.DateTimePicker(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.EndTime = new System.Windows.Forms.DateTimePicker(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.ReadKind = new System.Windows.Forms.ComboBox(); - this.ReadKindSelect = new System.Windows.Forms.Button(); - this.groupBox3 = new System.Windows.Forms.GroupBox(); - this.DeviceNo = new System.Windows.Forms.TextBox(); - this.DeviceNoSelect = new System.Windows.Forms.Button(); this.LogContent = new System.Windows.Forms.DataGridView(); - this.groupBox4 = new System.Windows.Forms.GroupBox(); - this.Content = new System.Windows.Forms.TextBox(); - this.ContentSelect = new System.Windows.Forms.Button(); + this.SelectByCondition = new System.Windows.Forms.Button(); + this.ShortCount = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.MultiCount = new System.Windows.Forms.Label(); + this.NearCount = new System.Windows.Forms.Label(); + this.NoReadCount = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.WarningCount = new System.Windows.Forms.Label(); + this.NormalCount = new System.Windows.Forms.Label(); + this.TotalCount = new System.Windows.Forms.Label(); + this.pictureBox5 = new System.Windows.Forms.PictureBox(); + this.label8 = new System.Windows.Forms.Label(); + this.pictureBox4 = new System.Windows.Forms.PictureBox(); + this.label7 = new System.Windows.Forms.Label(); + 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.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.SelectAll = new System.Windows.Forms.Button(); + this.label16 = new System.Windows.Forms.Label(); + this.AllAddress = new System.Windows.Forms.ComboBox(); this.groupBox1.SuspendLayout(); - this.groupBox2.SuspendLayout(); - this.groupBox3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.LogContent)).BeginInit(); - this.groupBox4.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); + this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // TimeSelect // this.TimeSelect.Location = new System.Drawing.Point(56, 95); - this.TimeSelect.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.TimeSelect.Margin = new System.Windows.Forms.Padding(4); this.TimeSelect.Name = "TimeSelect"; this.TimeSelect.Size = new System.Drawing.Size(163, 60); this.TimeSelect.TabIndex = 0; @@ -66,7 +95,7 @@ this.StartTime.CustomFormat = "yyyy-MM-dd hh:mm:ss"; this.StartTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom; this.StartTime.Location = new System.Drawing.Point(33, 25); - this.StartTime.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.StartTime.Margin = new System.Windows.Forms.Padding(4); this.StartTime.Name = "StartTime"; this.StartTime.Size = new System.Drawing.Size(209, 25); this.StartTime.TabIndex = 1; @@ -76,10 +105,10 @@ this.groupBox1.Controls.Add(this.EndTime); this.groupBox1.Controls.Add(this.StartTime); this.groupBox1.Controls.Add(this.TimeSelect); - this.groupBox1.Location = new System.Drawing.Point(16, 15); - this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.groupBox1.Location = new System.Drawing.Point(13, 66); + this.groupBox1.Margin = new System.Windows.Forms.Padding(4); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.groupBox1.Padding = new System.Windows.Forms.Padding(4); this.groupBox1.Size = new System.Drawing.Size(277, 164); this.groupBox1.TabIndex = 2; this.groupBox1.TabStop = false; @@ -90,154 +119,427 @@ this.EndTime.CustomFormat = "yyyy-MM-dd hh:mm:ss"; this.EndTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom; this.EndTime.Location = new System.Drawing.Point(33, 61); - this.EndTime.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.EndTime.Margin = new System.Windows.Forms.Padding(4); this.EndTime.Name = "EndTime"; this.EndTime.Size = new System.Drawing.Size(209, 25); this.EndTime.TabIndex = 2; // - // groupBox2 - // - this.groupBox2.Controls.Add(this.ReadKind); - this.groupBox2.Controls.Add(this.ReadKindSelect); - this.groupBox2.Location = new System.Drawing.Point(16, 186); - this.groupBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.groupBox2.Size = new System.Drawing.Size(277, 164); - this.groupBox2.TabIndex = 5; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "读码结果查询"; - // - // ReadKind - // - this.ReadKind.FormattingEnabled = true; - this.ReadKind.Location = new System.Drawing.Point(56, 38); - this.ReadKind.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.ReadKind.Name = "ReadKind"; - this.ReadKind.Size = new System.Drawing.Size(161, 23); - this.ReadKind.TabIndex = 1; - this.ReadKind.Text = " "; - // - // ReadKindSelect - // - this.ReadKindSelect.Location = new System.Drawing.Point(56, 81); - this.ReadKindSelect.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.ReadKindSelect.Name = "ReadKindSelect"; - this.ReadKindSelect.Size = new System.Drawing.Size(163, 60); - this.ReadKindSelect.TabIndex = 0; - this.ReadKindSelect.Text = "读码结果查询"; - this.ReadKindSelect.UseVisualStyleBackColor = true; - this.ReadKindSelect.Click += new System.EventHandler(this.ReadKindSelect_Click); - // - // groupBox3 - // - this.groupBox3.Controls.Add(this.DeviceNo); - this.groupBox3.Controls.Add(this.DeviceNoSelect); - this.groupBox3.Location = new System.Drawing.Point(16, 358); - this.groupBox3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.groupBox3.Name = "groupBox3"; - this.groupBox3.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.groupBox3.Size = new System.Drawing.Size(277, 164); - this.groupBox3.TabIndex = 6; - this.groupBox3.TabStop = false; - this.groupBox3.Text = "设备编号查询"; - // - // DeviceNo - // - this.DeviceNo.Location = new System.Drawing.Point(56, 36); - this.DeviceNo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.DeviceNo.Name = "DeviceNo"; - this.DeviceNo.Size = new System.Drawing.Size(161, 25); - this.DeviceNo.TabIndex = 1; - // - // DeviceNoSelect - // - this.DeviceNoSelect.Location = new System.Drawing.Point(56, 81); - this.DeviceNoSelect.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.DeviceNoSelect.Name = "DeviceNoSelect"; - this.DeviceNoSelect.Size = new System.Drawing.Size(163, 60); - this.DeviceNoSelect.TabIndex = 0; - this.DeviceNoSelect.Text = "设备编号查询"; - this.DeviceNoSelect.UseVisualStyleBackColor = true; - this.DeviceNoSelect.Click += new System.EventHandler(this.DeviceNoSelect_Click); - // // LogContent // this.LogContent.ColumnHeadersHeight = 20; this.LogContent.Location = new System.Drawing.Point(301, 15); - this.LogContent.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.LogContent.Margin = new System.Windows.Forms.Padding(4); this.LogContent.Name = "LogContent"; this.LogContent.RowHeadersVisible = false; this.LogContent.RowHeadersWidth = 51; this.LogContent.RowTemplate.Height = 18; - this.LogContent.Size = new System.Drawing.Size(667, 1124); + this.LogContent.Size = new System.Drawing.Size(667, 1230); this.LogContent.TabIndex = 7; // - // groupBox4 - // - this.groupBox4.Controls.Add(this.Content); - this.groupBox4.Controls.Add(this.ContentSelect); - this.groupBox4.Location = new System.Drawing.Point(16, 529); - this.groupBox4.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.groupBox4.Name = "groupBox4"; - this.groupBox4.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.groupBox4.Size = new System.Drawing.Size(277, 164); - this.groupBox4.TabIndex = 7; - this.groupBox4.TabStop = false; - this.groupBox4.Text = "条码内容查询"; - // - // Content - // - this.Content.Location = new System.Drawing.Point(56, 36); - this.Content.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.Content.Name = "Content"; - this.Content.Size = new System.Drawing.Size(161, 25); - this.Content.TabIndex = 1; - // - // ContentSelect - // - this.ContentSelect.Location = new System.Drawing.Point(56, 81); - this.ContentSelect.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.ContentSelect.Name = "ContentSelect"; - this.ContentSelect.Size = new System.Drawing.Size(163, 60); - this.ContentSelect.TabIndex = 0; - this.ContentSelect.Text = "条码内容查询"; - this.ContentSelect.UseVisualStyleBackColor = true; - this.ContentSelect.Click += new System.EventHandler(this.ContentSelect_Click); + // SelectByCondition + // + this.SelectByCondition.Location = new System.Drawing.Point(7, 220); + this.SelectByCondition.Margin = new System.Windows.Forms.Padding(4); + this.SelectByCondition.Name = "SelectByCondition"; + this.SelectByCondition.Size = new System.Drawing.Size(260, 60); + this.SelectByCondition.TabIndex = 2; + this.SelectByCondition.Text = "条件查询"; + this.SelectByCondition.UseVisualStyleBackColor = true; + this.SelectByCondition.Click += new System.EventHandler(this.SelectAll_Click); + // + // ShortCount + // + this.ShortCount.AutoSize = true; + this.ShortCount.Font = new System.Drawing.Font("宋体", 12F); + this.ShortCount.Location = new System.Drawing.Point(180, 1092); + this.ShortCount.Name = "ShortCount"; + this.ShortCount.Size = new System.Drawing.Size(39, 20); + this.ShortCount.TabIndex = 56; + this.ShortCount.Text = "NAN"; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Font = new System.Drawing.Font("宋体", 12F); + this.label13.Location = new System.Drawing.Point(65, 1092); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(89, 20); + this.label13.TabIndex = 55; + this.label13.Text = "包过短:"; + // + // MultiCount + // + this.MultiCount.AutoSize = true; + this.MultiCount.Font = new System.Drawing.Font("宋体", 12F); + this.MultiCount.Location = new System.Drawing.Point(180, 1124); + this.MultiCount.Name = "MultiCount"; + this.MultiCount.Size = new System.Drawing.Size(39, 20); + this.MultiCount.TabIndex = 54; + this.MultiCount.Text = "NAN"; + // + // NearCount + // + this.NearCount.AutoSize = true; + this.NearCount.Font = new System.Drawing.Font("宋体", 12F); + this.NearCount.Location = new System.Drawing.Point(180, 1060); + this.NearCount.Name = "NearCount"; + this.NearCount.Size = new System.Drawing.Size(39, 20); + this.NearCount.TabIndex = 53; + this.NearCount.Text = "NAN"; + // + // NoReadCount + // + this.NoReadCount.AutoSize = true; + this.NoReadCount.Font = new System.Drawing.Font("宋体", 12F); + this.NoReadCount.Location = new System.Drawing.Point(180, 1027); + this.NoReadCount.Name = "NoReadCount"; + this.NoReadCount.Size = new System.Drawing.Size(39, 20); + this.NoReadCount.TabIndex = 52; + this.NoReadCount.Text = "NAN"; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Font = new System.Drawing.Font("宋体", 12F); + this.label11.Location = new System.Drawing.Point(65, 1124); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(89, 20); + this.label11.TabIndex = 51; + this.label11.Text = "多标签:"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Font = new System.Drawing.Font("宋体", 12F); + this.label10.Location = new System.Drawing.Point(65, 1060); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(109, 20); + this.label10.TabIndex = 50; + this.label10.Text = "间距异常:"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("宋体", 12F); + this.label9.Location = new System.Drawing.Point(65, 1027); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(89, 20); + this.label9.TabIndex = 49; + this.label9.Text = "未读取:"; + // + // WarningCount + // + this.WarningCount.AutoSize = true; + this.WarningCount.Font = new System.Drawing.Font("宋体", 12F); + this.WarningCount.Location = new System.Drawing.Point(139, 964); + this.WarningCount.Name = "WarningCount"; + this.WarningCount.Size = new System.Drawing.Size(39, 20); + this.WarningCount.TabIndex = 48; + this.WarningCount.Text = "NAN"; + // + // NormalCount + // + this.NormalCount.AutoSize = true; + this.NormalCount.Font = new System.Drawing.Font("宋体", 12F); + this.NormalCount.Location = new System.Drawing.Point(139, 847); + this.NormalCount.Name = "NormalCount"; + this.NormalCount.Size = new System.Drawing.Size(39, 20); + this.NormalCount.TabIndex = 47; + this.NormalCount.Text = "NAN"; + // + // TotalCount + // + this.TotalCount.AutoSize = true; + this.TotalCount.Font = new System.Drawing.Font("宋体", 12F); + this.TotalCount.Location = new System.Drawing.Point(139, 732); + this.TotalCount.Name = "TotalCount"; + this.TotalCount.Size = new System.Drawing.Size(39, 20); + this.TotalCount.TabIndex = 46; + this.TotalCount.Text = "NAN"; + // + // pictureBox5 + // + this.pictureBox5.Image = global::RFIDSocket.Properties.Resources.WarningCount; + this.pictureBox5.Location = new System.Drawing.Point(69, 924); + this.pictureBox5.Name = "pictureBox5"; + this.pictureBox5.Size = new System.Drawing.Size(60, 60); + this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox5.TabIndex = 45; + this.pictureBox5.TabStop = false; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("宋体", 12F); + this.label8.Location = new System.Drawing.Point(138, 923); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(89, 20); + this.label8.TabIndex = 44; + this.label8.Text = "异常数量"; + // + // pictureBox4 + // + this.pictureBox4.Image = global::RFIDSocket.Properties.Resources.NormalCount; + this.pictureBox4.Location = new System.Drawing.Point(69, 807); + this.pictureBox4.Name = "pictureBox4"; + this.pictureBox4.Size = new System.Drawing.Size(60, 60); + this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox4.TabIndex = 43; + this.pictureBox4.TabStop = false; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("宋体", 12F); + this.label7.Location = new System.Drawing.Point(138, 806); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(89, 20); + this.label7.TabIndex = 42; + this.label7.Text = "正常数量"; + // + // pictureBox3 + // + this.pictureBox3.Image = global::RFIDSocket.Properties.Resources.TotalCount; + this.pictureBox3.Location = new System.Drawing.Point(69, 692); + this.pictureBox3.Name = "pictureBox3"; + this.pictureBox3.Size = new System.Drawing.Size(60, 60); + this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox3.TabIndex = 41; + this.pictureBox3.TabStop = false; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("宋体", 12F); + this.label6.Location = new System.Drawing.Point(138, 691); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(69, 20); + this.label6.TabIndex = 40; + this.label6.Text = "总数量"; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.EPCText); + this.groupBox2.Controls.Add(this.label15); + this.groupBox2.Controls.Add(this.SNText); + this.groupBox2.Controls.Add(this.label14); + this.groupBox2.Controls.Add(this.TipsText); + this.groupBox2.Controls.Add(this.label12); + this.groupBox2.Controls.Add(this.StatusText); + this.groupBox2.Controls.Add(this.label5); + this.groupBox2.Controls.Add(this.MaxInterval); + this.groupBox2.Controls.Add(this.label3); + this.groupBox2.Controls.Add(this.MinInterval); + this.groupBox2.Controls.Add(this.label4); + this.groupBox2.Controls.Add(this.MaxLength); + this.groupBox2.Controls.Add(this.label2); + this.groupBox2.Controls.Add(this.MinLength); + this.groupBox2.Controls.Add(this.label1); + this.groupBox2.Controls.Add(this.SelectByCondition); + this.groupBox2.Location = new System.Drawing.Point(13, 237); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(274, 287); + this.groupBox2.TabIndex = 57; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "条件查询"; + // + // label1 + // + 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 = "最小包长"; + // + // MinLength + // + 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; + // + // MaxLength + // + 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; + // + // label2 + // + 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 = "最大包长"; + // + // MaxInterval + // + this.MaxInterval.Location = new System.Drawing.Point(216, 63); + this.MaxInterval.Name = "MaxInterval"; + this.MaxInterval.Size = new System.Drawing.Size(52, 25); + this.MaxInterval.TabIndex = 7; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(143, 68); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(67, 15); + this.label3.TabIndex = 6; + this.label3.Text = "最大间距"; + // + // MinInterval + // + this.MinInterval.Location = new System.Drawing.Point(79, 63); + this.MinInterval.Name = "MinInterval"; + this.MinInterval.Size = new System.Drawing.Size(52, 25); + this.MinInterval.TabIndex = 5; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(6, 68); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(67, 15); + 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 + // + 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; + // + // label14 + // + 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 = "包裹号"; + // + // EPCText + // + 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; + // + // label15 + // + 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 = "读码内容"; // // SelectAll // - this.SelectAll.Location = new System.Drawing.Point(16, 700); - this.SelectAll.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.SelectAll.Location = new System.Drawing.Point(13, 531); + this.SelectAll.Margin = new System.Windows.Forms.Padding(4); this.SelectAll.Name = "SelectAll"; - this.SelectAll.Size = new System.Drawing.Size(277, 60); - this.SelectAll.TabIndex = 2; + this.SelectAll.Size = new System.Drawing.Size(274, 60); + this.SelectAll.TabIndex = 16; this.SelectAll.Text = "综合条件查询"; this.SelectAll.UseVisualStyleBackColor = true; - this.SelectAll.Click += new System.EventHandler(this.SelectAll_Click); + // + // label16 + // + this.label16.AutoSize = true; + this.label16.Location = new System.Drawing.Point(18, 29); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(97, 15); + 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; // // RFIDLog // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(984, 1154); + this.ClientSize = new System.Drawing.Size(982, 1258); + this.Controls.Add(this.label16); + this.Controls.Add(this.AllAddress); this.Controls.Add(this.SelectAll); - this.Controls.Add(this.groupBox4); - this.Controls.Add(this.LogContent); - this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox2); + this.Controls.Add(this.ShortCount); + this.Controls.Add(this.label13); + this.Controls.Add(this.MultiCount); + this.Controls.Add(this.NearCount); + this.Controls.Add(this.NoReadCount); + this.Controls.Add(this.label11); + this.Controls.Add(this.label10); + this.Controls.Add(this.label9); + this.Controls.Add(this.WarningCount); + this.Controls.Add(this.NormalCount); + this.Controls.Add(this.TotalCount); + this.Controls.Add(this.pictureBox5); + this.Controls.Add(this.label8); + this.Controls.Add(this.pictureBox4); + this.Controls.Add(this.label7); + this.Controls.Add(this.pictureBox3); + this.Controls.Add(this.label6); + this.Controls.Add(this.LogContent); this.Controls.Add(this.groupBox1); - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.Margin = new System.Windows.Forms.Padding(4); this.Name = "RFIDLog"; this.Text = "日志查询"; this.groupBox1.ResumeLayout(false); - this.groupBox2.ResumeLayout(false); - this.groupBox3.ResumeLayout(false); - this.groupBox3.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.LogContent)).EndInit(); - this.groupBox4.ResumeLayout(false); - this.groupBox4.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); this.ResumeLayout(false); + this.PerformLayout(); } @@ -247,16 +549,44 @@ private System.Windows.Forms.DateTimePicker StartTime; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.DateTimePicker EndTime; - private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.ComboBox ReadKind; - private System.Windows.Forms.Button ReadKindSelect; - private System.Windows.Forms.GroupBox groupBox3; - private System.Windows.Forms.TextBox DeviceNo; - private System.Windows.Forms.Button DeviceNoSelect; private System.Windows.Forms.DataGridView LogContent; - private System.Windows.Forms.GroupBox groupBox4; - private System.Windows.Forms.TextBox Content; - private System.Windows.Forms.Button ContentSelect; + private System.Windows.Forms.Button SelectByCondition; + private System.Windows.Forms.Label ShortCount; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Label MultiCount; + private System.Windows.Forms.Label NearCount; + private System.Windows.Forms.Label NoReadCount; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label WarningCount; + private System.Windows.Forms.Label NormalCount; + private System.Windows.Forms.Label TotalCount; + private System.Windows.Forms.PictureBox pictureBox5; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.PictureBox pictureBox4; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.PictureBox pictureBox3; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.TextBox MinLength; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox EPCText; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.TextBox SNText; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.ComboBox TipsText; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.ComboBox StatusText; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.TextBox MaxInterval; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox MinInterval; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox MaxLength; + private System.Windows.Forms.Label label2; private System.Windows.Forms.Button SelectAll; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.ComboBox AllAddress; } } \ No newline at end of file diff --git a/RFIDSocket/RFIDLog.cs b/RFIDSocket/RFIDLog.cs index 60b148a..90792fb 100644 --- a/RFIDSocket/RFIDLog.cs +++ b/RFIDSocket/RFIDLog.cs @@ -21,14 +21,22 @@ namespace RFIDSocket { InitializeComponent(); StartTime.Value = DateTime.Now.AddDays(-3); - List list = new List + List listStatus = new List { "", - "NB", + "NR", "GR", - "MR" }; - ReadKind.DataSource = list; + + Dictionary listTips = new Dictionary + { + {"ok", "正常"}, + {"noread", "无读"}, + {"near", "近距离"}, + {"short", "包过短"}, + {"multi", "多标签"}, + }; + Init(); } @@ -46,57 +54,10 @@ namespace RFIDSocket } } - private void ReadKindSelect_Click(object sender, EventArgs e) - { - if (LogContent != null) - { - LogContent.DataSource = null; - //LogContent.DataSource = LogControl.LogReadKindSelect(rFIDContents, ReadKind.Text); - } - } - - private void DeviceNoSelect_Click(object sender, EventArgs e) - { - if(!int.TryParse(DeviceNo.Text, out int no)) - { - MessageBox.Show("设备编号格式不正确"); - return; - } - if (LogContent != null) - { - LogContent.DataSource = null; - //LogContent.DataSource = LogControl.LogDeviceNoSelect(rFIDContents, no); - } - } - - private void ContentSelect_Click(object sender, EventArgs e) - { - if (LogContent != null) - { - LogContent.DataSource = null; - //LogContent.DataSource = LogControl.LogContentSelect(rFIDContents, Content.Text); - } - } - + private void SelectAll_Click(object sender, EventArgs e) { - if (!int.TryParse(DeviceNo.Text, out int no)) - { - MessageBox.Show("设备编号格式不正确"); - return; - } - if (LogContent != null) - { - //LogContent.DataSource = null; - //LogContent.DataSource = LogControl.LogTimeSelect( - // LogControl.LogReadKindSelect( - // LogControl.LogDeviceNoSelect( - // LogControl.LogContentSelect(rFIDContents, - // Content.Text), - // no), - // ReadKind.Text), - // StartTime.Value, EndTime.Value); - } + } } diff --git a/RFIDSocket/RFIDSocket.Designer.cs b/RFIDSocket/RFIDSocket.Designer.cs index ddaf98d..6810727 100644 --- a/RFIDSocket/RFIDSocket.Designer.cs +++ b/RFIDSocket/RFIDSocket.Designer.cs @@ -30,6 +30,13 @@ { this.components = new System.ComponentModel.Container(); 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.IPText = new System.Windows.Forms.TextBox(); this.SetAddress = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); @@ -66,7 +73,11 @@ this.MultiCount = new System.Windows.Forms.Label(); this.ShortCount = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); + this.MonitorAddress = new System.Windows.Forms.ComboBox(); + this.label12 = new System.Windows.Forms.Label(); + this.label14 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.CotentData)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.rFIDContentBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); @@ -76,7 +87,16 @@ // // CotentData // + this.CotentData.AutoGenerateColumns = false; this.CotentData.ColumnHeadersHeight = 20; + this.CotentData.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.sNDataGridViewTextBoxColumn, + this.intervalDataGridViewTextBoxColumn, + this.lengthDataGridViewTextBoxColumn, + this.ePCDataGridViewTextBoxColumn, + this.tipsDataGridViewTextBoxColumn, + this.logTimeDataGridViewTextBoxColumn}); + this.CotentData.DataSource = this.rFIDContentBindingSource; 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"; @@ -84,12 +104,64 @@ this.CotentData.RowHeadersWidth = 51; this.CotentData.RowTemplate.Height = 17; this.CotentData.ScrollBars = System.Windows.Forms.ScrollBars.None; - this.CotentData.Size = new System.Drawing.Size(648, 1088); + 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); + // // IPText // - this.IPText.Location = new System.Drawing.Point(155, 29); + this.IPText.Location = new System.Drawing.Point(152, 28); this.IPText.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.IPText.MaxLength = 6; this.IPText.Name = "IPText"; @@ -99,27 +171,27 @@ // // SetAddress // - this.SetAddress.Location = new System.Drawing.Point(356, 12); + 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(160, 56); this.SetAddress.TabIndex = 6; - this.SetAddress.Text = "确认服务端地址"; + this.SetAddress.Text = "确认客户端地址"; this.SetAddress.UseVisualStyleBackColor = true; this.SetAddress.Click += new System.EventHandler(this.SetPort_Click); // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(15, 34); + this.label1.Location = new System.Drawing.Point(12, 33); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(128, 15); this.label1.TabIndex = 1; - this.label1.Text = "服务端IP:端口号"; + this.label1.Text = "客户端IP:端口号"; // // PortText // - this.PortText.Location = new System.Drawing.Point(291, 29); + this.PortText.Location = new System.Drawing.Point(288, 28); this.PortText.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.PortText.MaxLength = 6; this.PortText.Name = "PortText"; @@ -129,10 +201,10 @@ // // MonitorOnOff // - this.MonitorOnOff.Location = new System.Drawing.Point(521, 14); + this.MonitorOnOff.Location = new System.Drawing.Point(928, 13); this.MonitorOnOff.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.MonitorOnOff.Name = "MonitorOnOff"; - this.MonitorOnOff.Size = new System.Drawing.Size(147, 56); + this.MonitorOnOff.Size = new System.Drawing.Size(111, 50); this.MonitorOnOff.TabIndex = 7; this.MonitorOnOff.Text = "启动监听"; this.MonitorOnOff.UseVisualStyleBackColor = true; @@ -141,7 +213,7 @@ // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(673, 34); + this.label4.Location = new System.Drawing.Point(1055, 28); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(82, 15); this.label4.TabIndex = 8; @@ -151,7 +223,7 @@ // this.MonitorState.AutoSize = true; this.MonitorState.BackColor = System.Drawing.Color.Transparent; - this.MonitorState.Location = new System.Drawing.Point(765, 34); + this.MonitorState.Location = new System.Drawing.Point(1147, 28); this.MonitorState.Name = "MonitorState"; this.MonitorState.Size = new System.Drawing.Size(22, 15); this.MonitorState.TabIndex = 9; @@ -175,7 +247,7 @@ // // PgDn // - this.PgDn.Location = new System.Drawing.Point(525, 74); + 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(135, 50); @@ -189,7 +261,7 @@ 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(340, 86); + this.PageRange.Location = new System.Drawing.Point(441, 88); this.PageRange.Name = "PageRange"; this.PageRange.Size = new System.Drawing.Size(69, 20); this.PageRange.TabIndex = 15; @@ -199,7 +271,7 @@ // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("宋体", 12F); - this.label3.Location = new System.Drawing.Point(248, 86); + this.label3.Location = new System.Drawing.Point(349, 88); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(109, 20); this.label3.TabIndex = 14; @@ -207,10 +279,10 @@ // // LogStart // - this.LogStart.Location = new System.Drawing.Point(793, 14); + this.LogStart.Location = new System.Drawing.Point(994, 101); this.LogStart.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.LogStart.Name = "LogStart"; - this.LogStart.Size = new System.Drawing.Size(113, 56); + this.LogStart.Size = new System.Drawing.Size(113, 50); this.LogStart.TabIndex = 16; this.LogStart.Text = "日志查询"; this.LogStart.UseVisualStyleBackColor = true; @@ -220,7 +292,7 @@ // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("宋体", 12F); - this.label2.Location = new System.Drawing.Point(788, 154); + this.label2.Location = new System.Drawing.Point(1048, 206); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(89, 20); this.label2.TabIndex = 17; @@ -230,7 +302,7 @@ // this.label6.AutoSize = true; this.label6.Font = new System.Drawing.Font("宋体", 12F); - this.label6.Location = new System.Drawing.Point(788, 384); + this.label6.Location = new System.Drawing.Point(1048, 436); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(69, 20); this.label6.TabIndex = 21; @@ -240,7 +312,7 @@ // this.label7.AutoSize = true; this.label7.Font = new System.Drawing.Font("宋体", 12F); - this.label7.Location = new System.Drawing.Point(788, 499); + this.label7.Location = new System.Drawing.Point(1048, 551); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(89, 20); this.label7.TabIndex = 23; @@ -250,7 +322,7 @@ // this.label8.AutoSize = true; this.label8.Font = new System.Drawing.Font("宋体", 12F); - this.label8.Location = new System.Drawing.Point(788, 616); + this.label8.Location = new System.Drawing.Point(1048, 668); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(89, 20); this.label8.TabIndex = 25; @@ -259,7 +331,7 @@ // pictureBox5 // this.pictureBox5.Image = global::RFIDSocket.Properties.Resources.WarningCount; - this.pictureBox5.Location = new System.Drawing.Point(719, 617); + this.pictureBox5.Location = new System.Drawing.Point(979, 669); this.pictureBox5.Name = "pictureBox5"; this.pictureBox5.Size = new System.Drawing.Size(60, 60); this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -269,7 +341,7 @@ // pictureBox4 // this.pictureBox4.Image = global::RFIDSocket.Properties.Resources.NormalCount; - this.pictureBox4.Location = new System.Drawing.Point(719, 500); + this.pictureBox4.Location = new System.Drawing.Point(979, 552); this.pictureBox4.Name = "pictureBox4"; this.pictureBox4.Size = new System.Drawing.Size(60, 60); this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -279,7 +351,7 @@ // pictureBox3 // this.pictureBox3.Image = global::RFIDSocket.Properties.Resources.TotalCount; - this.pictureBox3.Location = new System.Drawing.Point(719, 385); + this.pictureBox3.Location = new System.Drawing.Point(979, 437); this.pictureBox3.Name = "pictureBox3"; this.pictureBox3.Size = new System.Drawing.Size(60, 60); this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -289,7 +361,7 @@ // DevicePictureBox // this.DevicePictureBox.Image = global::RFIDSocket.Properties.Resources.RunNormal; - this.DevicePictureBox.Location = new System.Drawing.Point(719, 268); + this.DevicePictureBox.Location = new System.Drawing.Point(979, 320); this.DevicePictureBox.Name = "DevicePictureBox"; this.DevicePictureBox.Size = new System.Drawing.Size(60, 60); this.DevicePictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -299,7 +371,7 @@ // ConnectPictureBox // this.ConnectPictureBox.Image = global::RFIDSocket.Properties.Resources.ConnectNormal; - this.ConnectPictureBox.Location = new System.Drawing.Point(719, 155); + this.ConnectPictureBox.Location = new System.Drawing.Point(979, 207); this.ConnectPictureBox.Name = "ConnectPictureBox"; this.ConnectPictureBox.Size = new System.Drawing.Size(60, 60); this.ConnectPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -310,7 +382,7 @@ // this.label5.AutoSize = true; this.label5.Font = new System.Drawing.Font("宋体", 12F); - this.label5.Location = new System.Drawing.Point(788, 268); + this.label5.Location = new System.Drawing.Point(1048, 320); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(89, 20); this.label5.TabIndex = 19; @@ -320,7 +392,7 @@ // this.ConnectState.AutoSize = true; this.ConnectState.Font = new System.Drawing.Font("宋体", 12F); - this.ConnectState.Location = new System.Drawing.Point(789, 195); + this.ConnectState.Location = new System.Drawing.Point(1049, 247); this.ConnectState.Name = "ConnectState"; this.ConnectState.Size = new System.Drawing.Size(39, 20); this.ConnectState.TabIndex = 27; @@ -330,7 +402,7 @@ // this.DeviceState.AutoSize = true; this.DeviceState.Font = new System.Drawing.Font("宋体", 12F); - this.DeviceState.Location = new System.Drawing.Point(788, 308); + this.DeviceState.Location = new System.Drawing.Point(1048, 360); this.DeviceState.Name = "DeviceState"; this.DeviceState.Size = new System.Drawing.Size(39, 20); this.DeviceState.TabIndex = 28; @@ -340,7 +412,7 @@ // this.TotalCount.AutoSize = true; this.TotalCount.Font = new System.Drawing.Font("宋体", 12F); - this.TotalCount.Location = new System.Drawing.Point(789, 425); + this.TotalCount.Location = new System.Drawing.Point(1049, 477); this.TotalCount.Name = "TotalCount"; this.TotalCount.Size = new System.Drawing.Size(39, 20); this.TotalCount.TabIndex = 29; @@ -350,7 +422,7 @@ // this.NormalCount.AutoSize = true; this.NormalCount.Font = new System.Drawing.Font("宋体", 12F); - this.NormalCount.Location = new System.Drawing.Point(789, 540); + this.NormalCount.Location = new System.Drawing.Point(1049, 592); this.NormalCount.Name = "NormalCount"; this.NormalCount.Size = new System.Drawing.Size(39, 20); this.NormalCount.TabIndex = 30; @@ -360,7 +432,7 @@ // this.WarningCount.AutoSize = true; this.WarningCount.Font = new System.Drawing.Font("宋体", 12F); - this.WarningCount.Location = new System.Drawing.Point(789, 657); + this.WarningCount.Location = new System.Drawing.Point(1049, 709); this.WarningCount.Name = "WarningCount"; this.WarningCount.Size = new System.Drawing.Size(39, 20); this.WarningCount.TabIndex = 31; @@ -370,7 +442,7 @@ // this.label9.AutoSize = true; this.label9.Font = new System.Drawing.Font("宋体", 12F); - this.label9.Location = new System.Drawing.Point(715, 720); + this.label9.Location = new System.Drawing.Point(975, 772); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(89, 20); this.label9.TabIndex = 32; @@ -380,7 +452,7 @@ // this.label10.AutoSize = true; this.label10.Font = new System.Drawing.Font("宋体", 12F); - this.label10.Location = new System.Drawing.Point(715, 753); + this.label10.Location = new System.Drawing.Point(975, 805); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(109, 20); this.label10.TabIndex = 33; @@ -390,7 +462,7 @@ // this.label11.AutoSize = true; this.label11.Font = new System.Drawing.Font("宋体", 12F); - this.label11.Location = new System.Drawing.Point(715, 817); + this.label11.Location = new System.Drawing.Point(975, 869); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(89, 20); this.label11.TabIndex = 34; @@ -400,7 +472,7 @@ // this.NoReadCount.AutoSize = true; this.NoReadCount.Font = new System.Drawing.Font("宋体", 12F); - this.NoReadCount.Location = new System.Drawing.Point(830, 720); + this.NoReadCount.Location = new System.Drawing.Point(1090, 772); this.NoReadCount.Name = "NoReadCount"; this.NoReadCount.Size = new System.Drawing.Size(39, 20); this.NoReadCount.TabIndex = 35; @@ -410,7 +482,7 @@ // this.NearCount.AutoSize = true; this.NearCount.Font = new System.Drawing.Font("宋体", 12F); - this.NearCount.Location = new System.Drawing.Point(830, 753); + this.NearCount.Location = new System.Drawing.Point(1090, 805); this.NearCount.Name = "NearCount"; this.NearCount.Size = new System.Drawing.Size(39, 20); this.NearCount.TabIndex = 36; @@ -420,7 +492,7 @@ // this.MultiCount.AutoSize = true; this.MultiCount.Font = new System.Drawing.Font("宋体", 12F); - this.MultiCount.Location = new System.Drawing.Point(830, 817); + this.MultiCount.Location = new System.Drawing.Point(1090, 869); this.MultiCount.Name = "MultiCount"; this.MultiCount.Size = new System.Drawing.Size(39, 20); this.MultiCount.TabIndex = 37; @@ -430,7 +502,7 @@ // this.ShortCount.AutoSize = true; this.ShortCount.Font = new System.Drawing.Font("宋体", 12F); - this.ShortCount.Location = new System.Drawing.Point(830, 785); + this.ShortCount.Location = new System.Drawing.Point(1090, 837); this.ShortCount.Name = "ShortCount"; this.ShortCount.Size = new System.Drawing.Size(39, 20); this.ShortCount.TabIndex = 39; @@ -440,17 +512,47 @@ // this.label13.AutoSize = true; this.label13.Font = new System.Drawing.Font("宋体", 12F); - this.label13.Location = new System.Drawing.Point(715, 785); + this.label13.Location = new System.Drawing.Point(975, 837); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(89, 20); this.label13.TabIndex = 38; this.label13.Text = "包过短:"; // + // MonitorAddress + // + this.MonitorAddress.FormattingEnabled = true; + this.MonitorAddress.Location = new System.Drawing.Point(700, 28); + this.MonitorAddress.Name = "MonitorAddress"; + this.MonitorAddress.Size = new System.Drawing.Size(143, 23); + this.MonitorAddress.TabIndex = 40; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(582, 32); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(112, 15); + this.label12.TabIndex = 41; + this.label12.Text = "选择监听地址:"; + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Font = new System.Drawing.Font("宋体", 12F); + this.label14.Location = new System.Drawing.Point(516, 88); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(59, 20); + this.label14.TabIndex = 42; + this.label14.Text = "共200"; + // // RFIDSocket // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(927, 1229); + this.ClientSize = new System.Drawing.Size(1189, 1229); + this.Controls.Add(this.label14); + this.Controls.Add(this.label12); + this.Controls.Add(this.MonitorAddress); this.Controls.Add(this.ShortCount); this.Controls.Add(this.label13); this.Controls.Add(this.MultiCount); @@ -489,9 +591,10 @@ this.Controls.Add(this.CotentData); this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Name = "RFIDSocket"; - this.Text = " 小件监听"; + this.Text = " 通道门监听"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RFIDSocket_FormClosing); ((System.ComponentModel.ISupportInitialize)(this.CotentData)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.rFIDContentBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); @@ -541,6 +644,16 @@ private System.Windows.Forms.Label MultiCount; private System.Windows.Forms.Label ShortCount; private System.Windows.Forms.Label label13; + private System.Windows.Forms.ComboBox MonitorAddress; + private System.Windows.Forms.Label label12; + 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; + private System.Windows.Forms.Label label14; } } diff --git a/RFIDSocket/RFIDSocket.cs b/RFIDSocket/RFIDSocket.cs index b955217..9f5d2e0 100644 --- a/RFIDSocket/RFIDSocket.cs +++ b/RFIDSocket/RFIDSocket.cs @@ -11,21 +11,27 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using TouchSocket.Sockets; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; +using TcpClient = HighWayIot.TouchSocket.TcpClient; namespace RFIDSocket { public partial class RFIDSocket : Form { - private static TcpServer Server = TcpServer.Instance; + private static TcpClient Server = TcpClient.Instance; private static DataAnalysis RFIDData = DataAnalysis.Instance; - string Port = "1234"; string IP = "127.0.0.1"; int PageNo = 1; + List IPs = new List(); + private List Content = new List(); + + BindingSource bs = new BindingSource(); + public RFIDSocket() { InitializeComponent(); @@ -34,12 +40,12 @@ namespace RFIDSocket private void InitAction() { - if (Server.State != ServerState.Running) + if (!Server.State) { MonitorState.Text = "关"; MonitorState.BackColor = Color.Yellow; } - else if (Server.State == ServerState.Running) + else if (Server.State) { MonitorState.Text = "开"; MonitorState.BackColor = Color.LightGreen; @@ -48,14 +54,17 @@ namespace RFIDSocket Port = PortText.Text; IP = IPText.Text; - + IPs = RFIDData.GetAllIP(); + + bs.DataSource = IPs; + MonitorAddress.DataSource = bs; } private void MonitorOnOff_Click(object sender, EventArgs e) { - if (Server.State != ServerState.Running) + if (!Server.State) { - if (Server.ServerStart(IP, Port)) + if (Server.ClientStart(IP, Port)) { MessageBox.Show("监听服务启动成功!"); TableTimer.Enabled = true; @@ -65,9 +74,9 @@ namespace RFIDSocket MessageBox.Show("监听服务启动失败!"); } } - else if (Server.State == ServerState.Running) + else if (Server.State) { - if (Server.ServerStop()) + if (Server.ClientStop()) { MessageBox.Show("监听服务关闭成功!"); TableTimer.Enabled = false; @@ -87,13 +96,13 @@ namespace RFIDSocket private void TableTimer_Tick(object sender, EventArgs e) { - if (Server.State != ServerState.Running) + if (!Server.State) { MonitorOnOff.Text = "启动监听"; MonitorState.Text = "关"; MonitorState.BackColor = Color.Yellow; } - else if (Server.State == ServerState.Running) + else if (Server.State) { MonitorOnOff.Text = "关闭监听"; MonitorState.Text = "开"; @@ -102,29 +111,34 @@ namespace RFIDSocket RFIDData.GetData(); - CotentData.DataSource = null; + IPs = RFIDData.GetAllIP(); + bs.DataSource = IPs; + bs.ResetBindings(false); + CotentData.DataSource = null; switch (PageNo) { case 1: ContentPages(0); PageRange.Text = "0 - 50"; break; case 2: ContentPages(50); PageRange.Text = "51 - 100"; break; case 3: ContentPages(100); PageRange.Text = "101 - 150"; break; case 4: ContentPages(150); PageRange.Text = "151 - 200"; break; - default: ContentPages(0); PageRange.Text = "0 - 50"; break; + default: ContentPages(0); PageRange.Text = "0 - 50"; break; } + StateRefresh(); + } private void RFIDSocket_FormClosing(object sender, FormClosingEventArgs e) { - if (Server.State == ServerState.Running) + if (Server.State) { - if (!Server.ServerStop()) + if (!Server.ClientStop()) { MessageBox.Show("监听服务关闭失败! 请成功关闭后再退出"); e.Cancel = true; } - if (!Server.ServerDispose()) + if (!Server.ClientDispose()) { MessageBox.Show("监听服务释放失败! 请再次尝试退出"); e.Cancel = true; @@ -132,9 +146,43 @@ namespace RFIDSocket } } + private void StateRefresh() + { + if (RFIDData.HeartbeatsState.Where(x => x.IP == MonitorAddress.Text.ToString()).Count() == 0) + { + ConnectPictureBox.Image = Properties.Resources.ConnectNormal; + ConnectState.Text = "正常"; + } + else + { + ConnectPictureBox.Image = Properties.Resources.ConnectWarning; + ConnectState.Text = "异常"; + } + + if (RFIDData.AlarmState.Where(x => x.IP == MonitorAddress.Text.ToString()).Count() == 0) + { + DevicePictureBox.Image = Properties.Resources.ConnectNormal; + DeviceState.Text = "正常"; + } + else + { + DevicePictureBox.Image = Properties.Resources.ConnectWarning; + DeviceState.Text = "异常"; + } + + TotalCount.Text = Content.Count.ToString(); + NormalCount.Text = Content.Where(x => x.Tips == "ok").Count().ToString(); + WarningCount.Text = Content.Where(x => x.Tips != "ok").Count().ToString(); + NoReadCount.Text = Content.Where(x => x.Tips == "noread").Count().ToString(); + NearCount.Text = Content.Where(x => x.Tips == "near").Count().ToString(); + ShortCount.Text = Content.Where(x => x.Tips == "short").Count().ToString(); + MultiCount.Text = Content.Where(x => x.Tips == "multi").Count().ToString(); + } + private void ContentPages(int skip) { - CotentData.DataSource = RFIDData.rFIDContents.Skip(skip).Take(50).ToList(); + Content = RFIDData.rFIDContents.Where(x => x.IP == MonitorAddress.Text.ToString()).Reverse().Take(200).ToList(); + CotentData.DataSource = Content.Skip(skip).Take(50).ToList(); } private void PgUp_Click(object sender, EventArgs e) @@ -162,6 +210,5 @@ namespace RFIDSocket RFIDLog rFIDLog = new RFIDLog(); rFIDLog.Show(); } - } } diff --git a/RFIDSocket/RFIDSocket.csproj b/RFIDSocket/RFIDSocket.csproj index 79327fc..db0ff92 100644 --- a/RFIDSocket/RFIDSocket.csproj +++ b/RFIDSocket/RFIDSocket.csproj @@ -88,6 +88,7 @@ RFIDSocket.cs + SettingsSingleFileGenerator Settings.Designer.cs @@ -118,9 +119,7 @@ - - - + Always diff --git a/RFIDSocket/RFIDSocket.resx b/RFIDSocket/RFIDSocket.resx index 2b3df5e..7d63d68 100644 --- a/RFIDSocket/RFIDSocket.resx +++ b/RFIDSocket/RFIDSocket.resx @@ -117,7 +117,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 199, 21 + + + 199, 21 + - 17, 17 + 21, 21 \ No newline at end of file