diff --git a/HighWayIot.TouchSocket/BufferAnalysis.cs b/HighWayIot.TouchSocket/BufferAnalysis.cs index 4804e66..8e607e2 100644 --- a/HighWayIot.TouchSocket/BufferAnalysis.cs +++ b/HighWayIot.TouchSocket/BufferAnalysis.cs @@ -78,11 +78,7 @@ namespace HighWayIot.TouchSocket LogTime = DateTime.Now, }; string content = ""; - if (readKind == "NB") - { - content = Encoding.ASCII.GetString(bytes, 12, 16); - } - else if (readKind == "GR") + if (readKind == "NB" || readKind == "GR") { content = Encoding.ASCII.GetString(bytes, 12, 16); } diff --git a/HighWayIot.TouchSocket/TcpServer.cs b/HighWayIot.TouchSocket/TcpServer.cs index 1ac14da..ac23f9d 100644 --- a/HighWayIot.TouchSocket/TcpServer.cs +++ b/HighWayIot.TouchSocket/TcpServer.cs @@ -25,7 +25,7 @@ namespace HighWayIot.TouchSocket TcpService service = new TcpService(); - public bool ServerStart(int port) + public bool ServerStart(string ip, string port) { try { @@ -65,7 +65,7 @@ namespace HighWayIot.TouchSocket { option.Add(new TcpListenOption() { - IpHost = port, + IpHost = ip + ":" + port, Name = "Server",//名称用于区分监听 ServiceSslOption = null,//可以针对当前监听,单独启用ssl加密 Adapter = () => new NormalDataHandlingAdapter(),//可以单独对当前地址监听,配置适配器 diff --git a/RFIDSocket/DataAnalysis.cs b/RFIDSocket/DataAnalysis.cs new file mode 100644 index 0000000..636fd85 --- /dev/null +++ b/RFIDSocket/DataAnalysis.cs @@ -0,0 +1,33 @@ +using HighWayIot.Repository.domain; +using HighWayIot.Repository.service.Impl; +using HighWayIot.TouchSocket; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +namespace RFIDSocket +{ + public class DataAnalysis + { + private static readonly Lazy lazy = new Lazy(() => new DataAnalysis()); + + public static DataAnalysis Instance => lazy.Value; + + public List rFIDContents = new List(); + public List rFIDHeartbeats = new List(); + public List rFIDStates = new List(); + + public void GetData() + { + BaseContentServiceImpl baseContentServiceImpl = new BaseContentServiceImpl(); + BaseHeartbeatServiceImpl baseHeartbeatServiceImpl = new BaseHeartbeatServiceImpl(); + BaseStateServiceImpl baseStateServiceImpl = new BaseStateServiceImpl(); + rFIDContents = baseContentServiceImpl.GetContentInfos().Reverse().Take(200).ToList(); + rFIDHeartbeats = baseHeartbeatServiceImpl.GetHeartbeatInfos(); + rFIDStates = baseStateServiceImpl.GetStateInfos(); + } + } +} 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/Properties/DataSources/HighWayIot.Repository.domain.RFIDHeartbeat.datasource b/RFIDSocket/Properties/DataSources/HighWayIot.Repository.domain.RFIDHeartbeat.datasource new file mode 100644 index 0000000..a4c36aa --- /dev/null +++ b/RFIDSocket/Properties/DataSources/HighWayIot.Repository.domain.RFIDHeartbeat.datasource @@ -0,0 +1,10 @@ + + + + HighWayIot.Repository.domain.RFIDHeartbeat, HighWayIot.Repository, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/RFIDSocket/Properties/DataSources/HighWayIot.Repository.domain.RFIDState.datasource b/RFIDSocket/Properties/DataSources/HighWayIot.Repository.domain.RFIDState.datasource new file mode 100644 index 0000000..46c7262 --- /dev/null +++ b/RFIDSocket/Properties/DataSources/HighWayIot.Repository.domain.RFIDState.datasource @@ -0,0 +1,10 @@ + + + + HighWayIot.Repository.domain.RFIDState, HighWayIot.Repository, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/RFIDSocket/RFIDSocket.Designer.cs b/RFIDSocket/RFIDSocket.Designer.cs index 513b1da..d2c5641 100644 --- a/RFIDSocket/RFIDSocket.Designer.cs +++ b/RFIDSocket/RFIDSocket.Designer.cs @@ -29,84 +29,113 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.CotentData = new System.Windows.Forms.DataGridView(); this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.SetPort = new System.Windows.Forms.Button(); + this.IPText = new System.Windows.Forms.TextBox(); + this.SetAddress = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); - this.Port212Text = new System.Windows.Forms.TextBox(); - this.dataGridView2 = new System.Windows.Forms.DataGridView(); + this.PortText = new System.Windows.Forms.TextBox(); this.MonitorOnOff = new System.Windows.Forms.Button(); this.label4 = new System.Windows.Forms.Label(); this.MonitorState = new System.Windows.Forms.Label(); this.TableTimer = new System.Windows.Forms.Timer(this.components); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.rFIDContentBindingSource = new System.Windows.Forms.BindingSource(this.components); + this.deviceNoDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.readKindDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.contentDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.logTimeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.StateData = new System.Windows.Forms.DataGridView(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.HeartbeatData = new System.Windows.Forms.DataGridView(); + this.rFIDStateBindingSource = new System.Windows.Forms.BindingSource(this.components); + this.rFIDHeartbeatBindingSource = new System.Windows.Forms.BindingSource(this.components); + this.deviceNoDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.logTimeDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.deviceNoDataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.beatTimeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)(this.CotentData)).BeginInit(); this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.rFIDContentBindingSource)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.StateData)).BeginInit(); + this.groupBox2.SuspendLayout(); + this.groupBox3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.HeartbeatData)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.rFIDStateBindingSource)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.rFIDHeartbeatBindingSource)).BeginInit(); this.SuspendLayout(); // - // dataGridView1 + // CotentData // - this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView1.Location = new System.Drawing.Point(12, 129); - this.dataGridView1.Name = "dataGridView1"; - this.dataGridView1.RowHeadersWidth = 51; - this.dataGridView1.RowTemplate.Height = 27; - this.dataGridView1.Size = new System.Drawing.Size(458, 923); - this.dataGridView1.TabIndex = 0; + this.CotentData.AutoGenerateColumns = false; + this.CotentData.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.deviceNoDataGridViewTextBoxColumn, + this.readKindDataGridViewTextBoxColumn, + this.contentDataGridViewTextBoxColumn, + this.logTimeDataGridViewTextBoxColumn}); + this.CotentData.DataSource = this.rFIDContentBindingSource; + this.CotentData.Location = new System.Drawing.Point(12, 129); + this.CotentData.Name = "CotentData"; + this.CotentData.RowHeadersVisible = false; + this.CotentData.RowHeadersWidth = 51; + this.CotentData.RowTemplate.Height = 20; + this.CotentData.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.CotentData.Size = new System.Drawing.Size(648, 1026); + this.CotentData.TabIndex = 0; // // groupBox1 // - this.groupBox1.Controls.Add(this.SetPort); + this.groupBox1.Controls.Add(this.IPText); + this.groupBox1.Controls.Add(this.SetAddress); this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Controls.Add(this.Port212Text); + this.groupBox1.Controls.Add(this.PortText); this.groupBox1.Location = new System.Drawing.Point(12, 12); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(260, 111); + this.groupBox1.Size = new System.Drawing.Size(408, 111); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; this.groupBox1.Text = "端口设置"; // - // SetPort + // IPText // - this.SetPort.Location = new System.Drawing.Point(63, 55); - this.SetPort.Name = "SetPort"; - this.SetPort.Size = new System.Drawing.Size(130, 50); - this.SetPort.TabIndex = 6; - this.SetPort.Text = "确认端口号"; - this.SetPort.UseVisualStyleBackColor = true; - this.SetPort.Click += new System.EventHandler(this.SetPort_Click); + this.IPText.Location = new System.Drawing.Point(152, 24); + this.IPText.MaxLength = 6; + this.IPText.Name = "IPText"; + this.IPText.Size = new System.Drawing.Size(163, 25); + this.IPText.TabIndex = 7; + this.IPText.Text = "127.0.0.1"; + // + // SetAddress + // + this.SetAddress.Location = new System.Drawing.Point(117, 55); + this.SetAddress.Name = "SetAddress"; + this.SetAddress.Size = new System.Drawing.Size(166, 50); + this.SetAddress.TabIndex = 6; + 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(28, 29); + this.label1.Location = new System.Drawing.Point(18, 29); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(52, 15); + this.label1.Size = new System.Drawing.Size(128, 15); this.label1.TabIndex = 1; - this.label1.Text = "端口号"; + this.label1.Text = "服务端IP:端口号"; // - // Port212Text + // PortText // - this.Port212Text.Location = new System.Drawing.Point(86, 24); - this.Port212Text.MaxLength = 6; - this.Port212Text.Name = "Port212Text"; - this.Port212Text.Size = new System.Drawing.Size(144, 25); - this.Port212Text.TabIndex = 0; - this.Port212Text.Text = "1234"; - // - // dataGridView2 - // - this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView2.Location = new System.Drawing.Point(476, 12); - this.dataGridView2.Name = "dataGridView2"; - this.dataGridView2.RowHeadersWidth = 51; - this.dataGridView2.RowTemplate.Height = 27; - this.dataGridView2.Size = new System.Drawing.Size(458, 1040); - this.dataGridView2.TabIndex = 2; + this.PortText.Location = new System.Drawing.Point(321, 24); + this.PortText.MaxLength = 6; + this.PortText.Name = "PortText"; + this.PortText.Size = new System.Drawing.Size(62, 25); + this.PortText.TabIndex = 0; + this.PortText.Text = "1234"; // // MonitorOnOff // - this.MonitorOnOff.Location = new System.Drawing.Point(278, 12); + this.MonitorOnOff.Location = new System.Drawing.Point(450, 20); this.MonitorOnOff.Name = "MonitorOnOff"; this.MonitorOnOff.Size = new System.Drawing.Size(192, 57); this.MonitorOnOff.TabIndex = 7; @@ -117,7 +146,7 @@ // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(321, 92); + this.label4.Location = new System.Drawing.Point(493, 100); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(82, 15); this.label4.TabIndex = 8; @@ -127,7 +156,7 @@ // this.MonitorState.AutoSize = true; this.MonitorState.BackColor = System.Drawing.Color.Transparent; - this.MonitorState.Location = new System.Drawing.Point(400, 92); + this.MonitorState.Location = new System.Drawing.Point(572, 100); this.MonitorState.Name = "MonitorState"; this.MonitorState.Size = new System.Drawing.Size(22, 15); this.MonitorState.TabIndex = 9; @@ -139,24 +168,159 @@ this.TableTimer.Interval = 1000; this.TableTimer.Tick += new System.EventHandler(this.TableTimer_Tick); // + // rFIDContentBindingSource + // + this.rFIDContentBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDContent); + // + // deviceNoDataGridViewTextBoxColumn + // + this.deviceNoDataGridViewTextBoxColumn.DataPropertyName = "DeviceNo"; + this.deviceNoDataGridViewTextBoxColumn.HeaderText = "编号"; + this.deviceNoDataGridViewTextBoxColumn.MinimumWidth = 6; + this.deviceNoDataGridViewTextBoxColumn.Name = "deviceNoDataGridViewTextBoxColumn"; + this.deviceNoDataGridViewTextBoxColumn.Width = 40; + // + // readKindDataGridViewTextBoxColumn + // + this.readKindDataGridViewTextBoxColumn.DataPropertyName = "ReadKind"; + this.readKindDataGridViewTextBoxColumn.HeaderText = "读码结果"; + this.readKindDataGridViewTextBoxColumn.MinimumWidth = 6; + this.readKindDataGridViewTextBoxColumn.Name = "readKindDataGridViewTextBoxColumn"; + this.readKindDataGridViewTextBoxColumn.Width = 60; + // + // contentDataGridViewTextBoxColumn + // + this.contentDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.contentDataGridViewTextBoxColumn.DataPropertyName = "Content"; + this.contentDataGridViewTextBoxColumn.HeaderText = "条码内容"; + this.contentDataGridViewTextBoxColumn.MinimumWidth = 6; + this.contentDataGridViewTextBoxColumn.Name = "contentDataGridViewTextBoxColumn"; + // + // logTimeDataGridViewTextBoxColumn + // + this.logTimeDataGridViewTextBoxColumn.DataPropertyName = "LogTime"; + this.logTimeDataGridViewTextBoxColumn.HeaderText = "读取时间"; + this.logTimeDataGridViewTextBoxColumn.MinimumWidth = 6; + this.logTimeDataGridViewTextBoxColumn.Name = "logTimeDataGridViewTextBoxColumn"; + this.logTimeDataGridViewTextBoxColumn.Width = 105; + // + // StateData + // + this.StateData.AutoGenerateColumns = false; + this.StateData.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.deviceNoDataGridViewTextBoxColumn1, + this.logTimeDataGridViewTextBoxColumn1}); + this.StateData.DataSource = this.rFIDStateBindingSource; + this.StateData.Location = new System.Drawing.Point(6, 24); + this.StateData.Name = "StateData"; + this.StateData.RowHeadersVisible = false; + this.StateData.RowHeadersWidth = 51; + this.StateData.RowTemplate.Height = 20; + this.StateData.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.StateData.Size = new System.Drawing.Size(236, 531); + this.StateData.TabIndex = 10; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.StateData); + this.groupBox2.Location = new System.Drawing.Point(666, 12); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(248, 561); + this.groupBox2.TabIndex = 11; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "发送设备故障"; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.HeartbeatData); + this.groupBox3.Location = new System.Drawing.Point(666, 579); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(248, 576); + this.groupBox3.TabIndex = 12; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "心跳报文停止10秒以上"; + // + // HeartbeatData + // + this.HeartbeatData.AutoGenerateColumns = false; + this.HeartbeatData.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.deviceNoDataGridViewTextBoxColumn2, + this.beatTimeDataGridViewTextBoxColumn}); + this.HeartbeatData.DataSource = this.rFIDHeartbeatBindingSource; + this.HeartbeatData.Location = new System.Drawing.Point(6, 24); + this.HeartbeatData.Name = "HeartbeatData"; + this.HeartbeatData.RowHeadersVisible = false; + this.HeartbeatData.RowHeadersWidth = 51; + this.HeartbeatData.RowTemplate.Height = 20; + this.HeartbeatData.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.HeartbeatData.Size = new System.Drawing.Size(236, 546); + this.HeartbeatData.TabIndex = 10; + // + // rFIDStateBindingSource + // + this.rFIDStateBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDState); + // + // rFIDHeartbeatBindingSource + // + this.rFIDHeartbeatBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDHeartbeat); + // + // deviceNoDataGridViewTextBoxColumn1 + // + this.deviceNoDataGridViewTextBoxColumn1.DataPropertyName = "DeviceNo"; + this.deviceNoDataGridViewTextBoxColumn1.HeaderText = "编号"; + this.deviceNoDataGridViewTextBoxColumn1.MinimumWidth = 6; + this.deviceNoDataGridViewTextBoxColumn1.Name = "deviceNoDataGridViewTextBoxColumn1"; + this.deviceNoDataGridViewTextBoxColumn1.Width = 60; + // + // logTimeDataGridViewTextBoxColumn1 + // + this.logTimeDataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.logTimeDataGridViewTextBoxColumn1.DataPropertyName = "LogTime"; + this.logTimeDataGridViewTextBoxColumn1.HeaderText = "故障时间"; + this.logTimeDataGridViewTextBoxColumn1.MinimumWidth = 6; + this.logTimeDataGridViewTextBoxColumn1.Name = "logTimeDataGridViewTextBoxColumn1"; + // + // deviceNoDataGridViewTextBoxColumn2 + // + this.deviceNoDataGridViewTextBoxColumn2.DataPropertyName = "DeviceNo"; + this.deviceNoDataGridViewTextBoxColumn2.HeaderText = "编号"; + this.deviceNoDataGridViewTextBoxColumn2.MinimumWidth = 6; + this.deviceNoDataGridViewTextBoxColumn2.Name = "deviceNoDataGridViewTextBoxColumn2"; + this.deviceNoDataGridViewTextBoxColumn2.Width = 60; + // + // beatTimeDataGridViewTextBoxColumn + // + this.beatTimeDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.beatTimeDataGridViewTextBoxColumn.DataPropertyName = "BeatTime"; + this.beatTimeDataGridViewTextBoxColumn.HeaderText = "最后一次心跳时间"; + this.beatTimeDataGridViewTextBoxColumn.MinimumWidth = 6; + this.beatTimeDataGridViewTextBoxColumn.Name = "beatTimeDataGridViewTextBoxColumn"; + // // RFIDSocket // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(949, 1064); + this.ClientSize = new System.Drawing.Size(927, 1167); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.groupBox2); this.Controls.Add(this.MonitorState); this.Controls.Add(this.label4); this.Controls.Add(this.MonitorOnOff); - this.Controls.Add(this.dataGridView2); this.Controls.Add(this.groupBox1); - this.Controls.Add(this.dataGridView1); + this.Controls.Add(this.CotentData); this.Name = "RFIDSocket"; this.Text = "小件日志"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RFIDSocket_FormClosing); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.CotentData)).EndInit(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.rFIDContentBindingSource)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.StateData)).EndInit(); + this.groupBox2.ResumeLayout(false); + this.groupBox3.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.HeartbeatData)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.rFIDStateBindingSource)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.rFIDHeartbeatBindingSource)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -164,16 +328,31 @@ #endregion - private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.DataGridView CotentData; private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.Button SetPort; + private System.Windows.Forms.Button SetAddress; private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox Port212Text; - private System.Windows.Forms.DataGridView dataGridView2; + private System.Windows.Forms.TextBox PortText; private System.Windows.Forms.Button MonitorOnOff; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label MonitorState; private System.Windows.Forms.Timer TableTimer; + private System.Windows.Forms.TextBox IPText; + private System.Windows.Forms.BindingSource rFIDContentBindingSource; + private System.Windows.Forms.DataGridViewTextBoxColumn deviceNoDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn readKindDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn contentDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn logTimeDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridView StateData; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.BindingSource rFIDStateBindingSource; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.DataGridView HeartbeatData; + private System.Windows.Forms.BindingSource rFIDHeartbeatBindingSource; + private System.Windows.Forms.DataGridViewTextBoxColumn deviceNoDataGridViewTextBoxColumn1; + private System.Windows.Forms.DataGridViewTextBoxColumn logTimeDataGridViewTextBoxColumn1; + private System.Windows.Forms.DataGridViewTextBoxColumn deviceNoDataGridViewTextBoxColumn2; + private System.Windows.Forms.DataGridViewTextBoxColumn beatTimeDataGridViewTextBoxColumn; } } diff --git a/RFIDSocket/RFIDSocket.cs b/RFIDSocket/RFIDSocket.cs index 76fd447..4df7997 100644 --- a/RFIDSocket/RFIDSocket.cs +++ b/RFIDSocket/RFIDSocket.cs @@ -17,7 +17,11 @@ namespace RFIDSocket { private static TcpServer Server = TcpServer.Instance; - int Port; + private static DataAnalysis RFIDData = DataAnalysis.Instance; + + + string Port = "1234"; + string IP = "127.0.0.1"; public RFIDSocket() { @@ -38,14 +42,15 @@ namespace RFIDSocket MonitorState.BackColor = Color.LightGreen; } - Port = Convert.ToInt32(Port212Text.Text); + Port = PortText.Text; + IP = IPText.Text; } private void MonitorOnOff_Click(object sender, EventArgs e) { if (Server.State != ServerState.Running) { - if (Server.ServerStart(Port)) + if (Server.ServerStart(IP, Port)) { MessageBox.Show("监听服务启动成功!"); } @@ -69,7 +74,8 @@ namespace RFIDSocket private void SetPort_Click(object sender, EventArgs e) { - Port = Convert.ToInt32(Port212Text.Text); + Port = PortText.Text; + IP = IPText.Text; } private void TableTimer_Tick(object sender, EventArgs e) @@ -86,6 +92,11 @@ namespace RFIDSocket MonitorState.Text = "开"; MonitorState.BackColor = Color.LightGreen; } + + RFIDData.GetData(); + + CotentData.DataSource = RFIDData.rFIDContents; + } private void RFIDSocket_FormClosing(object sender, FormClosingEventArgs e) @@ -104,5 +115,6 @@ namespace RFIDSocket } } } + } } diff --git a/RFIDSocket/RFIDSocket.csproj b/RFIDSocket/RFIDSocket.csproj index 701c578..aac9914 100644 --- a/RFIDSocket/RFIDSocket.csproj +++ b/RFIDSocket/RFIDSocket.csproj @@ -55,6 +55,7 @@ + Form @@ -76,6 +77,9 @@ RFIDSocket.cs + + + SettingsSingleFileGenerator Settings.Designer.cs @@ -90,6 +94,10 @@ + + {d0dc3cfb-6748-4d5e-b56a-76fdc72ab4b3} + HighWayIot.Repository + {DD18A634-1F9C-409A-8C32-C3C81B1B55B5} HighWayIot.TouchSocket diff --git a/RFIDSocket/RFIDSocket.resx b/RFIDSocket/RFIDSocket.resx index 2b3df5e..eb4f47f 100644 --- a/RFIDSocket/RFIDSocket.resx +++ b/RFIDSocket/RFIDSocket.resx @@ -117,7 +117,25 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 159, 17 + 17, 17 + + 159, 17 + + + 413, 17 + + + 646, 17 + + + 413, 17 + + + 646, 17 + \ No newline at end of file