change - 初步实现多服务端连接

master
wangsr 10 months ago
parent 267460dfa8
commit 850763a9d0

Binary file not shown.

@ -36,6 +36,7 @@
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
@ -54,7 +55,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="BufferAnalysis.cs" /> <Compile Include="BufferAnalysis.cs" />
<Compile Include="TcpClient.cs" /> <Compile Include="RFIDTcpClient.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

@ -11,10 +11,9 @@ using TouchSocket.Sockets;
namespace HighWayIot.TouchSocket namespace HighWayIot.TouchSocket
{ {
public class TcpClient public class RFIDTcpClient
{ {
private static LogHelper logHelper = LogHelper.Instance; private static LogHelper logHelper = LogHelper.Instance;
public bool State public bool State
@ -25,7 +24,7 @@ namespace HighWayIot.TouchSocket
global::TouchSocket.Sockets.TcpClient client = new global::TouchSocket.Sockets.TcpClient(); global::TouchSocket.Sockets.TcpClient client = new global::TouchSocket.Sockets.TcpClient();
public bool ClientStart(string ip, string port) public bool ClientStart(string clientIP, string clientPort, string serverIP, string serverPort)
{ {
try try
{ {
@ -61,7 +60,7 @@ namespace HighWayIot.TouchSocket
}; };
client.Setup(new TouchSocketConfig()//载入配置 client.Setup(new TouchSocketConfig()//载入配置
.SetRemoteIPHost($"{ip}:{port}") .SetRemoteIPHost($"{clientIP}:{clientPort}")
.ConfigureContainer(a =>//容器的配置顺序应该在最前面 .ConfigureContainer(a =>//容器的配置顺序应该在最前面
{ {
a.AddConsoleLogger();//添加一个控制台日志注入注意在maui中控制台日志不可用 a.AddConsoleLogger();//添加一个控制台日志注入注意在maui中控制台日志不可用
@ -70,7 +69,7 @@ namespace HighWayIot.TouchSocket
{ {
//a.Add();//此处可以添加插件 //a.Add();//此处可以添加插件
})); }));
client.Connect();//启动 client.Connect($"{serverIP}:{serverPort}");//启动
logHelper.Info("监听服务启动成功"); logHelper.Info("监听服务启动成功");
return true; return true;
} }
@ -139,6 +138,5 @@ namespace HighWayIot.TouchSocket
logHelper.Info($"输入格式错误!"); logHelper.Info($"输入格式错误!");
} }
} }
} }
} }

@ -1 +1 @@
23d15fd1b9a74cae28e799b73990ede6b8b2b47e 529351f342a8ba9c98ec790a05321d5270e3d850

@ -1,8 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup> <configSections>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /> <!--把MyConfigData节点的数据映射到MyConfigData类中-->
</startup> <section name="IPConfigData" type="System.Configuration.NameValueSectionHandler"/>
</configSections>
<IPConfigData configSource="IPConfig.config"/>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>

@ -3,6 +3,8 @@ using HighWayIot.Repository.service.Impl;
using HighWayIot.TouchSocket; using HighWayIot.TouchSocket;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -57,24 +59,13 @@ namespace RFIDSocket
foreach (var a in HeartBeatGroup) foreach (var a in HeartBeatGroup)
{ {
var b = a.LastOrDefault(); var b = a.LastOrDefault();
if (DateTime.Now - b.BeatTime > TimeSpan.FromSeconds(10)) if (DateTime.Now - b.BeatTime < TimeSpan.FromSeconds(10))
{ {
HeartbeatsState.Add(b); HeartbeatsState.Add(b);
} }
} }
} }
public List<string> GetAllIP()
{
var groups = baseContentServiceImpl.GetContentInfos().GroupBy(x => x.IP);
List<string> result = new List<string>();
foreach (var group in groups)
{
result.Add(group.Key);
}
return result;
}
private string SecondToTime(int t) private string SecondToTime(int t)
{ {
int m = t / 60; int m = t / 60;

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<IPConfigData>
<add key="设备1" value="127.0.0.1" />
<add key="设备2" value="2.0.0.1" />
</IPConfigData>

@ -37,10 +37,10 @@
this.tipsDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.tipsDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.logTimeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.logTimeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.rFIDContentBindingSource = new System.Windows.Forms.BindingSource(this.components); this.rFIDContentBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.IPText = new System.Windows.Forms.TextBox(); this.ClientIP = new System.Windows.Forms.TextBox();
this.SetAddress = new System.Windows.Forms.Button(); this.SetAddress = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.PortText = new System.Windows.Forms.TextBox(); this.ClientPort = new System.Windows.Forms.TextBox();
this.MonitorOnOff = new System.Windows.Forms.Button(); this.MonitorOnOff = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.MonitorState = new System.Windows.Forms.Label(); this.MonitorState = new System.Windows.Forms.Label();
@ -73,9 +73,11 @@
this.MultiCount = new System.Windows.Forms.Label(); this.MultiCount = new System.Windows.Forms.Label();
this.ShortCount = new System.Windows.Forms.Label(); this.ShortCount = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label();
this.MonitorAddress = new System.Windows.Forms.ComboBox(); this.ServerIP = new System.Windows.Forms.ComboBox();
this.label12 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label();
this.ServerPort = new System.Windows.Forms.TextBox();
this.label15 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.CotentData)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.CotentData)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.rFIDContentBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.rFIDContentBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
@ -97,14 +99,14 @@
this.tipsDataGridViewTextBoxColumn, this.tipsDataGridViewTextBoxColumn,
this.logTimeDataGridViewTextBoxColumn}); this.logTimeDataGridViewTextBoxColumn});
this.CotentData.DataSource = this.rFIDContentBindingSource; this.CotentData.DataSource = this.rFIDContentBindingSource;
this.CotentData.Location = new System.Drawing.Point(12, 129); this.CotentData.Location = new System.Drawing.Point(9, 103);
this.CotentData.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.CotentData.Margin = new System.Windows.Forms.Padding(2);
this.CotentData.Name = "CotentData"; this.CotentData.Name = "CotentData";
this.CotentData.RowHeadersVisible = false; this.CotentData.RowHeadersVisible = false;
this.CotentData.RowHeadersWidth = 51; this.CotentData.RowHeadersWidth = 51;
this.CotentData.RowTemplate.Height = 17; this.CotentData.RowTemplate.Height = 17;
this.CotentData.ScrollBars = System.Windows.Forms.ScrollBars.None; this.CotentData.ScrollBars = System.Windows.Forms.ScrollBars.None;
this.CotentData.Size = new System.Drawing.Size(911, 1088); this.CotentData.Size = new System.Drawing.Size(683, 870);
this.CotentData.TabIndex = 0; this.CotentData.TabIndex = 0;
// //
// sNDataGridViewTextBoxColumn // sNDataGridViewTextBoxColumn
@ -159,22 +161,22 @@
// //
this.rFIDContentBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDContent); this.rFIDContentBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDContent);
// //
// IPText // ClientIP
// //
this.IPText.Location = new System.Drawing.Point(152, 28); this.ClientIP.Location = new System.Drawing.Point(114, 22);
this.IPText.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.ClientIP.Margin = new System.Windows.Forms.Padding(2);
this.IPText.MaxLength = 6; this.ClientIP.MaxLength = 6;
this.IPText.Name = "IPText"; this.ClientIP.Name = "ClientIP";
this.IPText.Size = new System.Drawing.Size(129, 25); this.ClientIP.Size = new System.Drawing.Size(98, 21);
this.IPText.TabIndex = 7; this.ClientIP.TabIndex = 7;
this.IPText.Text = "127.0.0.1"; this.ClientIP.Text = "127.0.0.1";
// //
// SetAddress // SetAddress
// //
this.SetAddress.Location = new System.Drawing.Point(353, 11); this.SetAddress.Location = new System.Drawing.Point(265, 9);
this.SetAddress.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.SetAddress.Margin = new System.Windows.Forms.Padding(2);
this.SetAddress.Name = "SetAddress"; this.SetAddress.Name = "SetAddress";
this.SetAddress.Size = new System.Drawing.Size(160, 56); this.SetAddress.Size = new System.Drawing.Size(120, 45);
this.SetAddress.TabIndex = 6; this.SetAddress.TabIndex = 6;
this.SetAddress.Text = "确认客户端地址"; this.SetAddress.Text = "确认客户端地址";
this.SetAddress.UseVisualStyleBackColor = true; this.SetAddress.UseVisualStyleBackColor = true;
@ -183,28 +185,29 @@
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 33); this.label1.Location = new System.Drawing.Point(9, 26);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(128, 15); this.label1.Size = new System.Drawing.Size(101, 12);
this.label1.TabIndex = 1; this.label1.TabIndex = 1;
this.label1.Text = "客户端IP端口号"; this.label1.Text = "客户端IP端口号";
// //
// PortText // ClientPort
// //
this.PortText.Location = new System.Drawing.Point(288, 28); this.ClientPort.Location = new System.Drawing.Point(216, 22);
this.PortText.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.ClientPort.Margin = new System.Windows.Forms.Padding(2);
this.PortText.MaxLength = 6; this.ClientPort.MaxLength = 6;
this.PortText.Name = "PortText"; this.ClientPort.Name = "ClientPort";
this.PortText.Size = new System.Drawing.Size(59, 25); this.ClientPort.Size = new System.Drawing.Size(45, 21);
this.PortText.TabIndex = 0; this.ClientPort.TabIndex = 0;
this.PortText.Text = "1234"; this.ClientPort.Text = "1234";
// //
// MonitorOnOff // MonitorOnOff
// //
this.MonitorOnOff.Location = new System.Drawing.Point(928, 13); this.MonitorOnOff.Location = new System.Drawing.Point(696, 10);
this.MonitorOnOff.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.MonitorOnOff.Margin = new System.Windows.Forms.Padding(2);
this.MonitorOnOff.Name = "MonitorOnOff"; this.MonitorOnOff.Name = "MonitorOnOff";
this.MonitorOnOff.Size = new System.Drawing.Size(111, 50); this.MonitorOnOff.Size = new System.Drawing.Size(83, 40);
this.MonitorOnOff.TabIndex = 7; this.MonitorOnOff.TabIndex = 7;
this.MonitorOnOff.Text = "启动监听"; this.MonitorOnOff.Text = "启动监听";
this.MonitorOnOff.UseVisualStyleBackColor = true; this.MonitorOnOff.UseVisualStyleBackColor = true;
@ -213,9 +216,10 @@
// label4 // label4
// //
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(1055, 28); this.label4.Location = new System.Drawing.Point(791, 22);
this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(82, 15); this.label4.Size = new System.Drawing.Size(65, 12);
this.label4.TabIndex = 8; this.label4.TabIndex = 8;
this.label4.Text = "监听状态:"; this.label4.Text = "监听状态:";
// //
@ -223,23 +227,25 @@
// //
this.MonitorState.AutoSize = true; this.MonitorState.AutoSize = true;
this.MonitorState.BackColor = System.Drawing.Color.Transparent; this.MonitorState.BackColor = System.Drawing.Color.Transparent;
this.MonitorState.Location = new System.Drawing.Point(1147, 28); this.MonitorState.Location = new System.Drawing.Point(860, 22);
this.MonitorState.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.MonitorState.Name = "MonitorState"; this.MonitorState.Name = "MonitorState";
this.MonitorState.Size = new System.Drawing.Size(22, 15); this.MonitorState.Size = new System.Drawing.Size(17, 12);
this.MonitorState.TabIndex = 9; this.MonitorState.TabIndex = 9;
this.MonitorState.Text = "关"; this.MonitorState.Text = "关";
// //
// TableTimer // TableTimer
// //
this.TableTimer.Enabled = true;
this.TableTimer.Interval = 1000; this.TableTimer.Interval = 1000;
this.TableTimer.Tick += new System.EventHandler(this.TableTimer_Tick); this.TableTimer.Tick += new System.EventHandler(this.TableTimer_Tick);
// //
// PgUp // PgUp
// //
this.PgUp.Location = new System.Drawing.Point(12, 74); this.PgUp.Location = new System.Drawing.Point(9, 59);
this.PgUp.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.PgUp.Margin = new System.Windows.Forms.Padding(2);
this.PgUp.Name = "PgUp"; this.PgUp.Name = "PgUp";
this.PgUp.Size = new System.Drawing.Size(135, 50); this.PgUp.Size = new System.Drawing.Size(101, 40);
this.PgUp.TabIndex = 8; this.PgUp.TabIndex = 8;
this.PgUp.Text = "上一页"; this.PgUp.Text = "上一页";
this.PgUp.UseVisualStyleBackColor = true; this.PgUp.UseVisualStyleBackColor = true;
@ -247,10 +253,10 @@
// //
// PgDn // PgDn
// //
this.PgDn.Location = new System.Drawing.Point(788, 74); this.PgDn.Location = new System.Drawing.Point(591, 59);
this.PgDn.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.PgDn.Margin = new System.Windows.Forms.Padding(2);
this.PgDn.Name = "PgDn"; this.PgDn.Name = "PgDn";
this.PgDn.Size = new System.Drawing.Size(135, 50); this.PgDn.Size = new System.Drawing.Size(101, 40);
this.PgDn.TabIndex = 13; this.PgDn.TabIndex = 13;
this.PgDn.Text = "下一页"; this.PgDn.Text = "下一页";
this.PgDn.UseVisualStyleBackColor = true; this.PgDn.UseVisualStyleBackColor = true;
@ -261,9 +267,10 @@
this.PageRange.AutoSize = true; this.PageRange.AutoSize = true;
this.PageRange.BackColor = System.Drawing.Color.Transparent; this.PageRange.BackColor = System.Drawing.Color.Transparent;
this.PageRange.Font = new System.Drawing.Font("宋体", 12F); this.PageRange.Font = new System.Drawing.Font("宋体", 12F);
this.PageRange.Location = new System.Drawing.Point(441, 88); this.PageRange.Location = new System.Drawing.Point(331, 70);
this.PageRange.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.PageRange.Name = "PageRange"; this.PageRange.Name = "PageRange";
this.PageRange.Size = new System.Drawing.Size(69, 20); this.PageRange.Size = new System.Drawing.Size(55, 16);
this.PageRange.TabIndex = 15; this.PageRange.TabIndex = 15;
this.PageRange.Text = "1 - 50"; this.PageRange.Text = "1 - 50";
// //
@ -271,18 +278,19 @@
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 12F); this.label3.Font = new System.Drawing.Font("宋体", 12F);
this.label3.Location = new System.Drawing.Point(349, 88); this.label3.Location = new System.Drawing.Point(262, 70);
this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(109, 20); this.label3.Size = new System.Drawing.Size(87, 16);
this.label3.TabIndex = 14; this.label3.TabIndex = 14;
this.label3.Text = "显示条数:"; this.label3.Text = "显示条数:";
// //
// LogStart // LogStart
// //
this.LogStart.Location = new System.Drawing.Point(994, 101); this.LogStart.Location = new System.Drawing.Point(746, 81);
this.LogStart.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.LogStart.Margin = new System.Windows.Forms.Padding(2);
this.LogStart.Name = "LogStart"; this.LogStart.Name = "LogStart";
this.LogStart.Size = new System.Drawing.Size(113, 50); this.LogStart.Size = new System.Drawing.Size(85, 40);
this.LogStart.TabIndex = 16; this.LogStart.TabIndex = 16;
this.LogStart.Text = "日志查询"; this.LogStart.Text = "日志查询";
this.LogStart.UseVisualStyleBackColor = true; this.LogStart.UseVisualStyleBackColor = true;
@ -292,9 +300,10 @@
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 12F); this.label2.Font = new System.Drawing.Font("宋体", 12F);
this.label2.Location = new System.Drawing.Point(1048, 206); this.label2.Location = new System.Drawing.Point(786, 165);
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(89, 20); this.label2.Size = new System.Drawing.Size(71, 16);
this.label2.TabIndex = 17; this.label2.TabIndex = 17;
this.label2.Text = "连接状态"; this.label2.Text = "连接状态";
// //
@ -302,9 +311,10 @@
// //
this.label6.AutoSize = true; this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("宋体", 12F); this.label6.Font = new System.Drawing.Font("宋体", 12F);
this.label6.Location = new System.Drawing.Point(1048, 436); this.label6.Location = new System.Drawing.Point(786, 349);
this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label6.Name = "label6"; this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(69, 20); this.label6.Size = new System.Drawing.Size(55, 16);
this.label6.TabIndex = 21; this.label6.TabIndex = 21;
this.label6.Text = "总数量"; this.label6.Text = "总数量";
// //
@ -312,9 +322,10 @@
// //
this.label7.AutoSize = true; this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("宋体", 12F); this.label7.Font = new System.Drawing.Font("宋体", 12F);
this.label7.Location = new System.Drawing.Point(1048, 551); this.label7.Location = new System.Drawing.Point(786, 441);
this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label7.Name = "label7"; this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(89, 20); this.label7.Size = new System.Drawing.Size(71, 16);
this.label7.TabIndex = 23; this.label7.TabIndex = 23;
this.label7.Text = "正常数量"; this.label7.Text = "正常数量";
// //
@ -322,18 +333,20 @@
// //
this.label8.AutoSize = true; this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("宋体", 12F); this.label8.Font = new System.Drawing.Font("宋体", 12F);
this.label8.Location = new System.Drawing.Point(1048, 668); this.label8.Location = new System.Drawing.Point(786, 534);
this.label8.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label8.Name = "label8"; this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(89, 20); this.label8.Size = new System.Drawing.Size(71, 16);
this.label8.TabIndex = 25; this.label8.TabIndex = 25;
this.label8.Text = "异常数量"; this.label8.Text = "异常数量";
// //
// pictureBox5 // pictureBox5
// //
this.pictureBox5.Image = global::RFIDSocket.Properties.Resources.WarningCount; this.pictureBox5.Image = global::RFIDSocket.Properties.Resources.WarningCount;
this.pictureBox5.Location = new System.Drawing.Point(979, 669); this.pictureBox5.Location = new System.Drawing.Point(734, 535);
this.pictureBox5.Margin = new System.Windows.Forms.Padding(2);
this.pictureBox5.Name = "pictureBox5"; this.pictureBox5.Name = "pictureBox5";
this.pictureBox5.Size = new System.Drawing.Size(60, 60); this.pictureBox5.Size = new System.Drawing.Size(45, 48);
this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox5.TabIndex = 26; this.pictureBox5.TabIndex = 26;
this.pictureBox5.TabStop = false; this.pictureBox5.TabStop = false;
@ -341,9 +354,10 @@
// pictureBox4 // pictureBox4
// //
this.pictureBox4.Image = global::RFIDSocket.Properties.Resources.NormalCount; this.pictureBox4.Image = global::RFIDSocket.Properties.Resources.NormalCount;
this.pictureBox4.Location = new System.Drawing.Point(979, 552); this.pictureBox4.Location = new System.Drawing.Point(734, 442);
this.pictureBox4.Margin = new System.Windows.Forms.Padding(2);
this.pictureBox4.Name = "pictureBox4"; this.pictureBox4.Name = "pictureBox4";
this.pictureBox4.Size = new System.Drawing.Size(60, 60); this.pictureBox4.Size = new System.Drawing.Size(45, 48);
this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox4.TabIndex = 24; this.pictureBox4.TabIndex = 24;
this.pictureBox4.TabStop = false; this.pictureBox4.TabStop = false;
@ -351,9 +365,10 @@
// pictureBox3 // pictureBox3
// //
this.pictureBox3.Image = global::RFIDSocket.Properties.Resources.TotalCount; this.pictureBox3.Image = global::RFIDSocket.Properties.Resources.TotalCount;
this.pictureBox3.Location = new System.Drawing.Point(979, 437); this.pictureBox3.Location = new System.Drawing.Point(734, 350);
this.pictureBox3.Margin = new System.Windows.Forms.Padding(2);
this.pictureBox3.Name = "pictureBox3"; this.pictureBox3.Name = "pictureBox3";
this.pictureBox3.Size = new System.Drawing.Size(60, 60); this.pictureBox3.Size = new System.Drawing.Size(45, 48);
this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox3.TabIndex = 22; this.pictureBox3.TabIndex = 22;
this.pictureBox3.TabStop = false; this.pictureBox3.TabStop = false;
@ -361,9 +376,10 @@
// DevicePictureBox // DevicePictureBox
// //
this.DevicePictureBox.Image = global::RFIDSocket.Properties.Resources.RunNormal; this.DevicePictureBox.Image = global::RFIDSocket.Properties.Resources.RunNormal;
this.DevicePictureBox.Location = new System.Drawing.Point(979, 320); this.DevicePictureBox.Location = new System.Drawing.Point(734, 256);
this.DevicePictureBox.Margin = new System.Windows.Forms.Padding(2);
this.DevicePictureBox.Name = "DevicePictureBox"; this.DevicePictureBox.Name = "DevicePictureBox";
this.DevicePictureBox.Size = new System.Drawing.Size(60, 60); this.DevicePictureBox.Size = new System.Drawing.Size(45, 48);
this.DevicePictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.DevicePictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.DevicePictureBox.TabIndex = 20; this.DevicePictureBox.TabIndex = 20;
this.DevicePictureBox.TabStop = false; this.DevicePictureBox.TabStop = false;
@ -371,9 +387,10 @@
// ConnectPictureBox // ConnectPictureBox
// //
this.ConnectPictureBox.Image = global::RFIDSocket.Properties.Resources.ConnectNormal; this.ConnectPictureBox.Image = global::RFIDSocket.Properties.Resources.ConnectNormal;
this.ConnectPictureBox.Location = new System.Drawing.Point(979, 207); this.ConnectPictureBox.Location = new System.Drawing.Point(734, 166);
this.ConnectPictureBox.Margin = new System.Windows.Forms.Padding(2);
this.ConnectPictureBox.Name = "ConnectPictureBox"; this.ConnectPictureBox.Name = "ConnectPictureBox";
this.ConnectPictureBox.Size = new System.Drawing.Size(60, 60); this.ConnectPictureBox.Size = new System.Drawing.Size(45, 48);
this.ConnectPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.ConnectPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.ConnectPictureBox.TabIndex = 18; this.ConnectPictureBox.TabIndex = 18;
this.ConnectPictureBox.TabStop = false; this.ConnectPictureBox.TabStop = false;
@ -382,9 +399,10 @@
// //
this.label5.AutoSize = true; this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("宋体", 12F); this.label5.Font = new System.Drawing.Font("宋体", 12F);
this.label5.Location = new System.Drawing.Point(1048, 320); this.label5.Location = new System.Drawing.Point(786, 256);
this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label5.Name = "label5"; this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(89, 20); this.label5.Size = new System.Drawing.Size(71, 16);
this.label5.TabIndex = 19; this.label5.TabIndex = 19;
this.label5.Text = "设备状态"; this.label5.Text = "设备状态";
// //
@ -392,9 +410,10 @@
// //
this.ConnectState.AutoSize = true; this.ConnectState.AutoSize = true;
this.ConnectState.Font = new System.Drawing.Font("宋体", 12F); this.ConnectState.Font = new System.Drawing.Font("宋体", 12F);
this.ConnectState.Location = new System.Drawing.Point(1049, 247); this.ConnectState.Location = new System.Drawing.Point(787, 198);
this.ConnectState.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.ConnectState.Name = "ConnectState"; this.ConnectState.Name = "ConnectState";
this.ConnectState.Size = new System.Drawing.Size(39, 20); this.ConnectState.Size = new System.Drawing.Size(31, 16);
this.ConnectState.TabIndex = 27; this.ConnectState.TabIndex = 27;
this.ConnectState.Text = "NAN"; this.ConnectState.Text = "NAN";
// //
@ -402,9 +421,10 @@
// //
this.DeviceState.AutoSize = true; this.DeviceState.AutoSize = true;
this.DeviceState.Font = new System.Drawing.Font("宋体", 12F); this.DeviceState.Font = new System.Drawing.Font("宋体", 12F);
this.DeviceState.Location = new System.Drawing.Point(1048, 360); this.DeviceState.Location = new System.Drawing.Point(786, 288);
this.DeviceState.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.DeviceState.Name = "DeviceState"; this.DeviceState.Name = "DeviceState";
this.DeviceState.Size = new System.Drawing.Size(39, 20); this.DeviceState.Size = new System.Drawing.Size(31, 16);
this.DeviceState.TabIndex = 28; this.DeviceState.TabIndex = 28;
this.DeviceState.Text = "NAN"; this.DeviceState.Text = "NAN";
// //
@ -412,9 +432,10 @@
// //
this.TotalCount.AutoSize = true; this.TotalCount.AutoSize = true;
this.TotalCount.Font = new System.Drawing.Font("宋体", 12F); this.TotalCount.Font = new System.Drawing.Font("宋体", 12F);
this.TotalCount.Location = new System.Drawing.Point(1049, 477); this.TotalCount.Location = new System.Drawing.Point(787, 382);
this.TotalCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.TotalCount.Name = "TotalCount"; this.TotalCount.Name = "TotalCount";
this.TotalCount.Size = new System.Drawing.Size(39, 20); this.TotalCount.Size = new System.Drawing.Size(31, 16);
this.TotalCount.TabIndex = 29; this.TotalCount.TabIndex = 29;
this.TotalCount.Text = "NAN"; this.TotalCount.Text = "NAN";
// //
@ -422,9 +443,10 @@
// //
this.NormalCount.AutoSize = true; this.NormalCount.AutoSize = true;
this.NormalCount.Font = new System.Drawing.Font("宋体", 12F); this.NormalCount.Font = new System.Drawing.Font("宋体", 12F);
this.NormalCount.Location = new System.Drawing.Point(1049, 592); this.NormalCount.Location = new System.Drawing.Point(787, 474);
this.NormalCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.NormalCount.Name = "NormalCount"; this.NormalCount.Name = "NormalCount";
this.NormalCount.Size = new System.Drawing.Size(39, 20); this.NormalCount.Size = new System.Drawing.Size(31, 16);
this.NormalCount.TabIndex = 30; this.NormalCount.TabIndex = 30;
this.NormalCount.Text = "NAN"; this.NormalCount.Text = "NAN";
// //
@ -432,9 +454,10 @@
// //
this.WarningCount.AutoSize = true; this.WarningCount.AutoSize = true;
this.WarningCount.Font = new System.Drawing.Font("宋体", 12F); this.WarningCount.Font = new System.Drawing.Font("宋体", 12F);
this.WarningCount.Location = new System.Drawing.Point(1049, 709); this.WarningCount.Location = new System.Drawing.Point(787, 567);
this.WarningCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.WarningCount.Name = "WarningCount"; this.WarningCount.Name = "WarningCount";
this.WarningCount.Size = new System.Drawing.Size(39, 20); this.WarningCount.Size = new System.Drawing.Size(31, 16);
this.WarningCount.TabIndex = 31; this.WarningCount.TabIndex = 31;
this.WarningCount.Text = "NAN"; this.WarningCount.Text = "NAN";
// //
@ -442,9 +465,10 @@
// //
this.label9.AutoSize = true; this.label9.AutoSize = true;
this.label9.Font = new System.Drawing.Font("宋体", 12F); this.label9.Font = new System.Drawing.Font("宋体", 12F);
this.label9.Location = new System.Drawing.Point(975, 772); this.label9.Location = new System.Drawing.Point(731, 618);
this.label9.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label9.Name = "label9"; this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(89, 20); this.label9.Size = new System.Drawing.Size(71, 16);
this.label9.TabIndex = 32; this.label9.TabIndex = 32;
this.label9.Text = "未读取:"; this.label9.Text = "未读取:";
// //
@ -452,9 +476,10 @@
// //
this.label10.AutoSize = true; this.label10.AutoSize = true;
this.label10.Font = new System.Drawing.Font("宋体", 12F); this.label10.Font = new System.Drawing.Font("宋体", 12F);
this.label10.Location = new System.Drawing.Point(975, 805); this.label10.Location = new System.Drawing.Point(731, 644);
this.label10.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label10.Name = "label10"; this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(109, 20); this.label10.Size = new System.Drawing.Size(87, 16);
this.label10.TabIndex = 33; this.label10.TabIndex = 33;
this.label10.Text = "间距异常:"; this.label10.Text = "间距异常:";
// //
@ -462,9 +487,10 @@
// //
this.label11.AutoSize = true; this.label11.AutoSize = true;
this.label11.Font = new System.Drawing.Font("宋体", 12F); this.label11.Font = new System.Drawing.Font("宋体", 12F);
this.label11.Location = new System.Drawing.Point(975, 869); this.label11.Location = new System.Drawing.Point(731, 695);
this.label11.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label11.Name = "label11"; this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(89, 20); this.label11.Size = new System.Drawing.Size(71, 16);
this.label11.TabIndex = 34; this.label11.TabIndex = 34;
this.label11.Text = "多标签:"; this.label11.Text = "多标签:";
// //
@ -472,9 +498,10 @@
// //
this.NoReadCount.AutoSize = true; this.NoReadCount.AutoSize = true;
this.NoReadCount.Font = new System.Drawing.Font("宋体", 12F); this.NoReadCount.Font = new System.Drawing.Font("宋体", 12F);
this.NoReadCount.Location = new System.Drawing.Point(1090, 772); this.NoReadCount.Location = new System.Drawing.Point(818, 618);
this.NoReadCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.NoReadCount.Name = "NoReadCount"; this.NoReadCount.Name = "NoReadCount";
this.NoReadCount.Size = new System.Drawing.Size(39, 20); this.NoReadCount.Size = new System.Drawing.Size(31, 16);
this.NoReadCount.TabIndex = 35; this.NoReadCount.TabIndex = 35;
this.NoReadCount.Text = "NAN"; this.NoReadCount.Text = "NAN";
// //
@ -482,9 +509,10 @@
// //
this.NearCount.AutoSize = true; this.NearCount.AutoSize = true;
this.NearCount.Font = new System.Drawing.Font("宋体", 12F); this.NearCount.Font = new System.Drawing.Font("宋体", 12F);
this.NearCount.Location = new System.Drawing.Point(1090, 805); this.NearCount.Location = new System.Drawing.Point(818, 644);
this.NearCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.NearCount.Name = "NearCount"; this.NearCount.Name = "NearCount";
this.NearCount.Size = new System.Drawing.Size(39, 20); this.NearCount.Size = new System.Drawing.Size(31, 16);
this.NearCount.TabIndex = 36; this.NearCount.TabIndex = 36;
this.NearCount.Text = "NAN"; this.NearCount.Text = "NAN";
// //
@ -492,9 +520,10 @@
// //
this.MultiCount.AutoSize = true; this.MultiCount.AutoSize = true;
this.MultiCount.Font = new System.Drawing.Font("宋体", 12F); this.MultiCount.Font = new System.Drawing.Font("宋体", 12F);
this.MultiCount.Location = new System.Drawing.Point(1090, 869); this.MultiCount.Location = new System.Drawing.Point(818, 695);
this.MultiCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.MultiCount.Name = "MultiCount"; this.MultiCount.Name = "MultiCount";
this.MultiCount.Size = new System.Drawing.Size(39, 20); this.MultiCount.Size = new System.Drawing.Size(31, 16);
this.MultiCount.TabIndex = 37; this.MultiCount.TabIndex = 37;
this.MultiCount.Text = "NAN"; this.MultiCount.Text = "NAN";
// //
@ -502,9 +531,10 @@
// //
this.ShortCount.AutoSize = true; this.ShortCount.AutoSize = true;
this.ShortCount.Font = new System.Drawing.Font("宋体", 12F); this.ShortCount.Font = new System.Drawing.Font("宋体", 12F);
this.ShortCount.Location = new System.Drawing.Point(1090, 837); this.ShortCount.Location = new System.Drawing.Point(818, 670);
this.ShortCount.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.ShortCount.Name = "ShortCount"; this.ShortCount.Name = "ShortCount";
this.ShortCount.Size = new System.Drawing.Size(39, 20); this.ShortCount.Size = new System.Drawing.Size(31, 16);
this.ShortCount.TabIndex = 39; this.ShortCount.TabIndex = 39;
this.ShortCount.Text = "NAN"; this.ShortCount.Text = "NAN";
// //
@ -512,26 +542,29 @@
// //
this.label13.AutoSize = true; this.label13.AutoSize = true;
this.label13.Font = new System.Drawing.Font("宋体", 12F); this.label13.Font = new System.Drawing.Font("宋体", 12F);
this.label13.Location = new System.Drawing.Point(975, 837); this.label13.Location = new System.Drawing.Point(731, 670);
this.label13.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label13.Name = "label13"; this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(89, 20); this.label13.Size = new System.Drawing.Size(71, 16);
this.label13.TabIndex = 38; this.label13.TabIndex = 38;
this.label13.Text = "包过短:"; this.label13.Text = "包过短:";
// //
// MonitorAddress // ServerIP
// //
this.MonitorAddress.FormattingEnabled = true; this.ServerIP.FormattingEnabled = true;
this.MonitorAddress.Location = new System.Drawing.Point(700, 28); this.ServerIP.Location = new System.Drawing.Point(478, 22);
this.MonitorAddress.Name = "MonitorAddress"; this.ServerIP.Margin = new System.Windows.Forms.Padding(2);
this.MonitorAddress.Size = new System.Drawing.Size(143, 23); this.ServerIP.Name = "ServerIP";
this.MonitorAddress.TabIndex = 40; this.ServerIP.Size = new System.Drawing.Size(108, 20);
this.ServerIP.TabIndex = 40;
// //
// label12 // label12
// //
this.label12.AutoSize = true; this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(582, 32); this.label12.Location = new System.Drawing.Point(389, 26);
this.label12.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label12.Name = "label12"; this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(112, 15); this.label12.Size = new System.Drawing.Size(89, 12);
this.label12.TabIndex = 41; this.label12.TabIndex = 41;
this.label12.Text = "选择监听地址:"; this.label12.Text = "选择监听地址:";
// //
@ -539,20 +572,44 @@
// //
this.label14.AutoSize = true; this.label14.AutoSize = true;
this.label14.Font = new System.Drawing.Font("宋体", 12F); this.label14.Font = new System.Drawing.Font("宋体", 12F);
this.label14.Location = new System.Drawing.Point(516, 88); this.label14.Location = new System.Drawing.Point(387, 70);
this.label14.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label14.Name = "label14"; this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(59, 20); this.label14.Size = new System.Drawing.Size(47, 16);
this.label14.TabIndex = 42; this.label14.TabIndex = 42;
this.label14.Text = "共200"; 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.MaxLength = 6;
this.ServerPort.Name = "ServerPort";
this.ServerPort.Size = new System.Drawing.Size(45, 21);
this.ServerPort.TabIndex = 43;
this.ServerPort.Text = "1234";
//
// label15
//
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.Name = "label15";
this.label15.Size = new System.Drawing.Size(41, 12);
this.label15.TabIndex = 44;
this.label15.Text = "端口号";
//
// RFIDSocket // RFIDSocket
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1189, 1229); this.ClientSize = new System.Drawing.Size(892, 983);
this.Controls.Add(this.label15);
this.Controls.Add(this.ServerPort);
this.Controls.Add(this.label14); this.Controls.Add(this.label14);
this.Controls.Add(this.label12); this.Controls.Add(this.label12);
this.Controls.Add(this.MonitorAddress); this.Controls.Add(this.ServerIP);
this.Controls.Add(this.ShortCount); this.Controls.Add(this.ShortCount);
this.Controls.Add(this.label13); this.Controls.Add(this.label13);
this.Controls.Add(this.MultiCount); this.Controls.Add(this.MultiCount);
@ -579,17 +636,17 @@
this.Controls.Add(this.LogStart); this.Controls.Add(this.LogStart);
this.Controls.Add(this.PageRange); this.Controls.Add(this.PageRange);
this.Controls.Add(this.label3); this.Controls.Add(this.label3);
this.Controls.Add(this.IPText); this.Controls.Add(this.ClientIP);
this.Controls.Add(this.PgDn); this.Controls.Add(this.PgDn);
this.Controls.Add(this.SetAddress); this.Controls.Add(this.SetAddress);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.PgUp); this.Controls.Add(this.PgUp);
this.Controls.Add(this.PortText); this.Controls.Add(this.ClientPort);
this.Controls.Add(this.MonitorState); this.Controls.Add(this.MonitorState);
this.Controls.Add(this.label4); this.Controls.Add(this.label4);
this.Controls.Add(this.MonitorOnOff); this.Controls.Add(this.MonitorOnOff);
this.Controls.Add(this.CotentData); this.Controls.Add(this.CotentData);
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Margin = new System.Windows.Forms.Padding(2);
this.Name = "RFIDSocket"; this.Name = "RFIDSocket";
this.Text = " 通道门监听"; this.Text = " 通道门监听";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RFIDSocket_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RFIDSocket_FormClosing);
@ -610,12 +667,12 @@
private System.Windows.Forms.DataGridView CotentData; private System.Windows.Forms.DataGridView CotentData;
private System.Windows.Forms.Button SetAddress; private System.Windows.Forms.Button SetAddress;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox PortText; private System.Windows.Forms.TextBox ClientPort;
private System.Windows.Forms.Button MonitorOnOff; private System.Windows.Forms.Button MonitorOnOff;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label MonitorState; private System.Windows.Forms.Label MonitorState;
private System.Windows.Forms.Timer TableTimer; private System.Windows.Forms.Timer TableTimer;
private System.Windows.Forms.TextBox IPText; private System.Windows.Forms.TextBox ClientIP;
private System.Windows.Forms.Button PgUp; private System.Windows.Forms.Button PgUp;
private System.Windows.Forms.Button PgDn; private System.Windows.Forms.Button PgDn;
private System.Windows.Forms.Label PageRange; private System.Windows.Forms.Label PageRange;
@ -644,7 +701,7 @@
private System.Windows.Forms.Label MultiCount; private System.Windows.Forms.Label MultiCount;
private System.Windows.Forms.Label ShortCount; private System.Windows.Forms.Label ShortCount;
private System.Windows.Forms.Label label13; private System.Windows.Forms.Label label13;
private System.Windows.Forms.ComboBox MonitorAddress; private System.Windows.Forms.ComboBox ServerIP;
private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label12;
private System.Windows.Forms.BindingSource rFIDContentBindingSource; private System.Windows.Forms.BindingSource rFIDContentBindingSource;
private System.Windows.Forms.DataGridViewTextBoxColumn sNDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn sNDataGridViewTextBoxColumn;
@ -654,6 +711,8 @@
private System.Windows.Forms.DataGridViewTextBoxColumn tipsDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn tipsDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn logTimeDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn logTimeDataGridViewTextBoxColumn;
private System.Windows.Forms.Label label14; private System.Windows.Forms.Label label14;
private System.Windows.Forms.TextBox ServerPort;
private System.Windows.Forms.Label label15;
} }
} }

@ -12,26 +12,22 @@ using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using TouchSocket.Sockets; using TouchSocket.Sockets;
using static System.Windows.Forms.VisualStyles.VisualStyleElement; using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using TcpClient = HighWayIot.TouchSocket.TcpClient; using System.Configuration;
namespace RFIDSocket namespace RFIDSocket
{ {
public partial class RFIDSocket : Form public partial class RFIDSocket : Form
{ {
private static TcpClient Server = TcpClient.Instance;
private static DataAnalysis RFIDData = DataAnalysis.Instance; private static DataAnalysis RFIDData = DataAnalysis.Instance;
private static ServerConnect ServerConnect = ServerConnect.Instance;
string Port = "1234"; string CPort = "1234";
string IP = "127.0.0.1"; string CIP = "127.0.0.1";
int PageNo = 1; int PageNo = 1;
List<string> IPs = new List<string>();
private List<RFIDContent> Content = new List<RFIDContent>(); private List<RFIDContent> Content = new List<RFIDContent>();
BindingSource bs = new BindingSource();
public RFIDSocket() public RFIDSocket()
{ {
InitializeComponent(); InitializeComponent();
@ -40,69 +36,76 @@ namespace RFIDSocket
private void InitAction() private void InitAction()
{ {
if (!Server.State) if (!ServerConnect.State)
{ {
MonitorState.Text = "关"; MonitorState.Text = "关";
MonitorState.BackColor = Color.Yellow; MonitorState.BackColor = Color.Yellow;
} }
else if (Server.State) else if (ServerConnect.State)
{ {
MonitorState.Text = "开"; MonitorState.Text = "开";
MonitorState.BackColor = Color.LightGreen; MonitorState.BackColor = Color.LightGreen;
} }
Port = PortText.Text; CPort = ClientPort.Text;
IP = IPText.Text; CIP = ClientIP.Text;
IPs = RFIDData.GetAllIP();
bs.DataSource = IPs; ServerIP.DataSource = ServerConnect.IPConfig.Keys.ToArray();
MonitorAddress.DataSource = bs;
} }
private void MonitorOnOff_Click(object sender, EventArgs e) private void MonitorOnOff_Click(object sender, EventArgs e)
{ {
if (!Server.State) if (!ServerConnect.State)
{ {
if (Server.ClientStart(IP, Port)) Dictionary<string, bool> results = ServerConnect.ConnectAllServer(ServerPort.Text, CIP, CPort);
bool flag = false;
foreach(var pair in results)
{ {
MessageBox.Show("监听服务启动成功!"); if (!pair.Value)
TableTimer.Enabled = true; {
MessageBox.Show($"{pair.Key}连接启动失败!");
flag = true;
}
} }
else if (!flag)
{ {
MessageBox.Show("监听服务启动失败"); MessageBox.Show("监听服务启动成功");
} }
} }
else if (Server.State) else if (ServerConnect.State)
{ {
if (Server.ClientStop()) Dictionary<string, bool> results = ServerConnect.ConnectAllStop();
bool flag = false;
foreach (var pair in results)
{ {
MessageBox.Show("监听服务关闭成功!"); if (!pair.Value)
TableTimer.Enabled = false; {
MessageBox.Show($"{pair.Key}连接关闭失败!");
flag = true;
}
} }
else if (!flag)
{ {
MessageBox.Show("监听服务关闭失败"); MessageBox.Show("监听服务关闭成功");
} }
} }
} }
private void SetPort_Click(object sender, EventArgs e) private void SetPort_Click(object sender, EventArgs e)
{ {
Port = PortText.Text; CPort = ClientPort.Text;
IP = IPText.Text; CIP = ClientIP.Text;
} }
private void TableTimer_Tick(object sender, EventArgs e) private void TableTimer_Tick(object sender, EventArgs e)
{ {
if (!Server.State) if (!ServerConnect.State)
{ {
MonitorOnOff.Text = "启动监听"; MonitorOnOff.Text = "启动监听";
MonitorState.Text = "关"; MonitorState.Text = "关";
MonitorState.BackColor = Color.Yellow; MonitorState.BackColor = Color.Yellow;
} }
else if (Server.State) else if (ServerConnect.State)
{ {
MonitorOnOff.Text = "关闭监听"; MonitorOnOff.Text = "关闭监听";
MonitorState.Text = "开"; MonitorState.Text = "开";
@ -111,10 +114,6 @@ namespace RFIDSocket
RFIDData.GetData(); RFIDData.GetData();
IPs = RFIDData.GetAllIP();
bs.DataSource = IPs;
bs.ResetBindings(false);
CotentData.DataSource = null; CotentData.DataSource = null;
switch (PageNo) switch (PageNo)
{ {
@ -131,24 +130,46 @@ namespace RFIDSocket
private void RFIDSocket_FormClosing(object sender, FormClosingEventArgs e) private void RFIDSocket_FormClosing(object sender, FormClosingEventArgs e)
{ {
if (Server.State) if (ServerConnect.State)
{ {
if (!Server.ClientStop()) Dictionary<string, bool> results = ServerConnect.ConnectAllStop();
bool flag = false;
foreach (var pair in results)
{
if (!pair.Value)
{
flag = true;
}
}
if (flag)
{
if(MessageBox.Show("退出确认", "部分服务未能完全关闭!确认要退出?", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
{
e.Cancel = true;
}
}
results = ServerConnect.ConnectAllDispose();
flag = false;
foreach (var pair in results)
{ {
MessageBox.Show("监听服务关闭失败! 请成功关闭后再退出"); if (!pair.Value)
e.Cancel = true; {
flag = true;
}
} }
if (!Server.ClientDispose()) if (flag)
{ {
MessageBox.Show("监听服务释放失败! 请再次尝试退出"); if (MessageBox.Show("退出确认", "部分服务未能完全释放!确认要退出?", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
e.Cancel = true; {
e.Cancel = true;
}
} }
} }
} }
private void StateRefresh() private void StateRefresh()
{ {
if (RFIDData.HeartbeatsState.Where(x => x.IP == MonitorAddress.Text.ToString()).Count() == 0) if (RFIDData.HeartbeatsState.Where(x => x.IP == ServerConnect.IPConfig[ServerIP.Text].ToString()).Count() != 0)
{ {
ConnectPictureBox.Image = Properties.Resources.ConnectNormal; ConnectPictureBox.Image = Properties.Resources.ConnectNormal;
ConnectState.Text = "正常"; ConnectState.Text = "正常";
@ -159,7 +180,7 @@ namespace RFIDSocket
ConnectState.Text = "异常"; ConnectState.Text = "异常";
} }
if (RFIDData.AlarmState.Where(x => x.IP == MonitorAddress.Text.ToString()).Count() == 0) if (RFIDData.AlarmState.Where(x => x.IP == ServerConnect.IPConfig[ServerIP.Text].ToString()).Count() == 0)
{ {
DevicePictureBox.Image = Properties.Resources.ConnectNormal; DevicePictureBox.Image = Properties.Resources.ConnectNormal;
DeviceState.Text = "正常"; DeviceState.Text = "正常";
@ -181,7 +202,7 @@ namespace RFIDSocket
private void ContentPages(int skip) private void ContentPages(int skip)
{ {
Content = RFIDData.rFIDContents.Where(x => x.IP == MonitorAddress.Text.ToString()).Reverse<RFIDContent>().Take(200).ToList(); Content = RFIDData.rFIDContents.Where(x => x.IP == ServerConnect.IPConfig[ServerIP.Text].ToString()).Reverse<RFIDContent>().Take(200).ToList();
CotentData.DataSource = Content.Skip(skip).Take(50).ToList(); CotentData.DataSource = Content.Skip(skip).Take(50).ToList();
} }

@ -37,6 +37,7 @@
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
@ -71,6 +72,7 @@
</Compile> </Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ServerConnect.cs" />
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@ -98,6 +100,9 @@
<DependentUpon>Settings.settings</DependentUpon> <DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput> <DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile> </Compile>
<None Include="IPConfig.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />

@ -120,9 +120,6 @@
<metadata name="rFIDContentBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="rFIDContentBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>199, 21</value> <value>199, 21</value>
</metadata> </metadata>
<metadata name="rFIDContentBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>199, 21</value>
</metadata>
<metadata name="TableTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="TableTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>21, 21</value> <value>21, 21</value>
</metadata> </metadata>

@ -0,0 +1,123 @@
using HighWayIot.Repository.service.Impl;
using HighWayIot.TouchSocket;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
using System.Linq;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace RFIDSocket
{
public class ServerConnect
{
private static readonly Lazy<ServerConnect> lazy = new Lazy<ServerConnect>(() => new ServerConnect());
public static ServerConnect Instance => lazy.Value;
BaseContentServiceImpl baseContentServiceImpl => new BaseContentServiceImpl();
private static List<RFIDTcpClient> TcpClients = new List<RFIDTcpClient>();
/// <summary>
/// 获取配置键值对
/// </summary>
public static Dictionary<string, string> IPConfig
{
get
{
NameValueCollection config = ConfigurationManager.GetSection("IPConfigData") as NameValueCollection;
Dictionary<string, string> result = new Dictionary<string, string>();
foreach (string key in config.AllKeys)
{
result.Add(key, config[key]);
}
return result;
}
}
public bool State = false;
public static string[] IPs = IPConfig.Values.ToArray();
public static string[] Names = IPConfig.Keys.ToArray();
public ServerConnect()
{
for(int i = 0; i < IPs.Length; i++)
{
TcpClients.Add(new RFIDTcpClient());
}
}
/// <summary>
/// 查找数据表里所有IP
/// </summary>
/// <returns></returns>
public List<string> GetAllIP()
{
var groups = baseContentServiceImpl.GetContentInfos().GroupBy(x => x.IP);
List<string> result = new List<string>();
foreach (var group in groups)
{
result.Add(group.Key);
}
return result;
}
/// <summary>
/// 连接所有服务端
/// </summary>
/// <param name="serverPort"></param>
/// <param name="clientIP"></param>
/// <param name="clientPort"></param>
/// <returns>成功与否结果</returns>
public Dictionary<string, bool> ConnectAllServer(string serverPort, string clientIP, string clientPort)
{
int count = IPs.Length;
Dictionary<string, bool> results = new Dictionary<string, bool>();
for (int i = 0; i < count; i++)
{
results.Add(Names[i], TcpClients[i].ClientStart(IPs[i], serverPort, clientIP, clientPort));
}
State = true;
return results;
}
/// <summary>
/// 暂停所有服务端
/// </summary>
/// <returns>成功与否结果</returns>
public Dictionary<string, bool> ConnectAllStop()
{
int count = IPs.Length;
Dictionary<string, bool> results = new Dictionary<string, bool>();
for (int i = 0; i < count; i++)
{
results.Add(Names[i], TcpClients[i].ClientStop());
}
State = false;
return results;
}
/// <summary>
/// 释放所有服务端
/// </summary>
/// <returns>成功与否结果</returns>
public Dictionary<string, bool> ConnectAllDispose()
{
int count = IPs.Length;
Dictionary<string, bool> results = new Dictionary<string, bool>();
for (int i = 0; i < count; i++)
{
results.Add(Names[i], TcpClients[i].ClientDispose());
}
return results;
}
}
}
Loading…
Cancel
Save