feat - 添加格口盘点

dep
SoulStar 2 years ago
parent fd31694420
commit d65af5f866

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms.VisualStyles;
namespace HighWayIot.TouchSocket
{
/// <summary>
/// 客户端字符串解析
/// </summary>
public class ClientStringAnalysis
{
/// <summary>
/// Getinfo信号解析
/// 格式为
/// From 001
/// qwertyuiopasdfghjklzxcvbnm[]\;',./!@#$%^&*()_+1234567890-=`~
/// </summary>
/// <returns>所有的From信号</returns>
public static string[] GetInfoAnalyzer(string mes)
{
if (string.IsNullOrWhiteSpace(mes))
{
return Array.Empty<string>();
}
// 按行分割输入
string[] lines = mes.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
List<string> result = new List<string>();
foreach (string line in lines)
{
// 检查并提取符合格式的 "From XXX"
if (line.StartsWith(" > From "))
{
string number = line.Substring(8, 3); // 提取后三位数字
result.Add(number);
}
}
return result.ToArray();
}
}
}

@ -102,6 +102,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ClientStringAnalysis.cs" />
<Compile Include="ServerBufferAnalysis.cs" />
<Compile Include="TcpClientServer.cs" />
<Compile Include="TcpServer.cs" />

@ -21,6 +21,16 @@ namespace HighWayIot.TouchSocket
TcpClient tcpClient = new TcpClient();
/// <summary>
/// 字符串数组转换为int数组
/// </summary>
public Action<string[]> GetBinCode;
public Action<string> GetString;
/// <summary>
/// 客户端状态获取
/// </summary>
public bool ClientState
{
get => tcpClient.Online;
@ -32,59 +42,113 @@ namespace HighWayIot.TouchSocket
/// <returns></returns>
public async Task<bool> ClientConnect(string ip, string port)
{
tcpClient.Connecting = (client, e) =>
try
{
return EasyTask.CompletedTask;
};//即将连接到服务器此时已经创建socket但是还未建立tcp
tcpClient.Connected = (client, e) =>
{
return EasyTask.CompletedTask;
};//成功连接到服务器
tcpClient.Closing = (client, e) =>
{
return EasyTask.CompletedTask;
};//即将从服务器断开连接。此处仅主动断开才有效。
tcpClient.Closed = (client, e) =>
{
return EasyTask.CompletedTask;
};//从服务器断开连接,当连接不成功时不会触发。
tcpClient.Received = (client, e) =>
{
//从服务器收到信息。但是一般byteBlock和requestInfo会根据适配器呈现不同的值。
var mes = e.ByteBlock.Span.ToString(Encoding.UTF8);
tcpClient.Logger.Info($"客户端接收到信息:{mes}");
return EasyTask.CompletedTask;
};
if (!string.IsNullOrEmpty(tcpClient.IP))
{
tcpClient.Connect();
tcpClient.Logger.Info("客户端成功连接");
return true;
}
tcpClient.Connecting = (client, e) =>
{
return EasyTask.CompletedTask;
};//即将连接到服务器此时已经创建socket但是还未建立tcp
tcpClient.Connected = (client, e) =>
{
return EasyTask.CompletedTask;
};//成功连接到服务器
tcpClient.Closing = (client, e) =>
{
return EasyTask.CompletedTask;
};//即将从服务器断开连接。此处仅主动断开才有效。
tcpClient.Closed = (client, e) =>
{
return EasyTask.CompletedTask;
};//从服务器断开连接,当连接不成功时不会触发。
tcpClient.Received = async (client, e) =>
{
//从服务器收到信息。但是一般byteBlock和requestInfo会根据适配器呈现不同的值。
var mes = e.ByteBlock.Span.ToString(Encoding.UTF8);
logHelper.Info($"客户端接收到信息:{mes}");
if (await MessageAnalyzer(mes))
{
logHelper.Info("数据解析成功");
}
else
{
logHelper.Error("数据解析失败或者getinfo信号发送失败");
}
};
//载入配置
await tcpClient.SetupAsync(new TouchSocketConfig()
.SetRemoteIPHost($"{ip}:{port}")
.ConfigureContainer(a =>
{
a.AddConsoleLogger();//添加一个日志注入
}));
//载入配置
await tcpClient.SetupAsync(new TouchSocketConfig()
.SetRemoteIPHost($"{ip}:{port}")
.ConfigureContainer(a =>
{
a.AddConsoleLogger();//添加一个日志注入
}));
await tcpClient.ConnectAsync();//调用连接,当连接不成功时,会抛出异常。
tcpClient.Connect();//调用连接,当连接不成功时,会抛出异常。
Result result = await tcpClient.TryConnectAsync();//或者可以调用TryConnectAsync
if (result.IsSuccess())
{
tcpClient.Logger.Info("客户端成功连接");
return true;
}
else
catch (Exception ex)
{
tcpClient.Logger.Info("客户端连接失败");
tcpClient.Logger.Info("客户端连接失败" + ex);
return false;
}
return result.IsSuccess();
}
public bool SendMessage(string message)
/// <summary>
/// 接收数据分析
/// </summary>
/// <param name="mes"></param>
/// <returns></returns>
public async Task<bool> MessageAnalyzer(string mes)
{
try
{
tcpClient.SendAsync(message);
if (mes.Contains("OK"))
{
await Send("getinfo");
}
else
{
//string[] binNoList = ClientStringAnalysis.GetInfoAnalyzer(mes);
GetString.Invoke(mes);
}
return true;
}
catch (ClientNotConnectedException ex)
{
logHelper.Error("发送数据发生错误" + ex);
return false;
}
catch (OverlengthException ex)
{
logHelper.Error("发送数据发生错误" + ex);
return false;
}
catch(Exception ex)
{
logHelper.Error("数据解析类发生错误" + ex);
return false;
}
}
/// <summary>
/// 信息发送
/// </summary>
/// <param name="message"></param>
/// <returns></returns>
public async Task<bool> Send(string message)
{
try
{
await tcpClient.SendAsync(message);
return true;
}
catch (Exception e)
@ -94,11 +158,15 @@ namespace HighWayIot.TouchSocket
}
}
public bool ClientClose()
/// <summary>
/// 客户端关闭
/// </summary>
/// <returns></returns>
public async Task<bool> ClientClose()
{
try
{
tcpClient.CloseAsync();
await tcpClient.CloseAsync();
return true;
}
catch(Exception e)

@ -147,6 +147,10 @@ namespace HighWayIot.TouchSocket
{
ServerBufferAnalysis.RFIDCodeSocket(bytes);
}
else
{
logHelper.Error("未知数据格式!");
}
}
}

@ -3,5 +3,11 @@
<ConnectIp>192.168.1.100</ConnectIp>
<ConnectPort>1500</ConnectPort>
<ServiceIpConfig>192.168.0.7:1500</ServiceIpConfig>
<ServiceIpCount>354</ServiceIpCount>
<ServiceIpConfig>192.168.0.7:1500</ServiceIpConfig>
<ServiceIpConfig>192.168.0.7:1500</ServiceIpConfig>
<ServiceIpConfig>192.168.0.7:1500</ServiceIpConfig>
<ServiceIpConfig>192.168.0.7:1500</ServiceIpConfig>
<ServiceIpConfig>192.168.0.7:1500</ServiceIpConfig>
<ServiceIpConfig>192.168.0.7:1500</ServiceIpConfig>
<ServiceIpCount>100</ServiceIpCount>
</BinAudlt>

@ -0,0 +1,124 @@
namespace RFIDSocket
{
partial class MultiFuncLoading
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.lbl_tips = new System.Windows.Forms.Label();
this.lbl_tips_son = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.lbl_jd = new System.Windows.Forms.Label();
this.lbl_cur = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label1
//
this.label1.Image = global::RFIDSocket.Properties.Resources.loading3;
this.label1.Location = new System.Drawing.Point(3, 10);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(75, 69);
this.label1.TabIndex = 0;
//
// lbl_tips
//
this.lbl_tips.AutoSize = true;
this.lbl_tips.Location = new System.Drawing.Point(79, 13);
this.lbl_tips.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lbl_tips.Name = "lbl_tips";
this.lbl_tips.Size = new System.Drawing.Size(107, 12);
this.lbl_tips.TabIndex = 3;
this.lbl_tips.Text = "加载中,请稍等...";
//
// lbl_tips_son
//
this.lbl_tips_son.AutoSize = true;
this.lbl_tips_son.Location = new System.Drawing.Point(79, 38);
this.lbl_tips_son.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lbl_tips_son.Name = "lbl_tips_son";
this.lbl_tips_son.Size = new System.Drawing.Size(113, 12);
this.lbl_tips_son.TabIndex = 4;
this.lbl_tips_son.Text = "Please Waitting...";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(79, 61);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 12);
this.label2.TabIndex = 5;
this.label2.Text = "执行进度:";
//
// lbl_jd
//
this.lbl_jd.AutoSize = true;
this.lbl_jd.Location = new System.Drawing.Point(145, 61);
this.lbl_jd.Name = "lbl_jd";
this.lbl_jd.Size = new System.Drawing.Size(41, 12);
this.lbl_jd.TabIndex = 6;
this.lbl_jd.Text = "label3";
//
// lbl_cur
//
this.lbl_cur.Location = new System.Drawing.Point(12, 88);
this.lbl_cur.Multiline = true;
this.lbl_cur.Name = "lbl_cur";
this.lbl_cur.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.lbl_cur.Size = new System.Drawing.Size(333, 101);
this.lbl_cur.TabIndex = 9;
//
// MultiFuncLoading
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(357, 201);
this.Controls.Add(this.lbl_cur);
this.Controls.Add(this.lbl_jd);
this.Controls.Add(this.label2);
this.Controls.Add(this.lbl_tips_son);
this.Controls.Add(this.lbl_tips);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.Name = "MultiFuncLoading";
this.Text = "Loading";
this.Load += new System.EventHandler(this.Loading_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label lbl_tips;
private System.Windows.Forms.Label lbl_tips_son;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label lbl_jd;
private System.Windows.Forms.TextBox lbl_cur;
}
}

@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace RFIDSocket
{
public partial class MultiFuncLoading : Form
{
//保存父窗口信息,主要用于居中显示加载窗体
private Form partentForm = null;
public MultiFuncLoading(Form partentForm)
{
InitializeComponent();
this.partentForm = partentForm;
}
private void Loading_Load(object sender, EventArgs e)
{
//设置一些Loading窗体信息
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.ControlBox = false;
this.Text = "有进度,有提示,有取消按钮 Loading...";
// 下面的方法用来使得Loading窗体居中父窗体显示
int parentForm_Position_x = this.partentForm.Location.X;
int parentForm_Position_y = this.partentForm.Location.Y;
int parentForm_Width = this.partentForm.Width;
int parentForm_Height = this.partentForm.Height;
int start_x = (int)(parentForm_Position_x + (parentForm_Width - this.Width) / 2);
int start_y = (int)(parentForm_Position_y + (parentForm_Height - this.Height) / 2);
this.Location = new System.Drawing.Point(start_x, start_y);
}
///// <summary>
///// 改变Loading的进度
///// </summary>
///// <param name="percent"></param>
public void SetTxt(string title = "Loading...", string lbl1 = "加载中,请稍等...", string lbl2 = "Please Waitting...")
{
// 采用Invoke形式进行操作
this.Invoke(new MethodInvoker(() =>
{
this.Text = title;
this.lbl_tips.Text = lbl1;
this.lbl_tips_son.Text = lbl2;
}));
}
public void SetJD(string JDStr, string curstr)
{
// 采用Invoke形式进行操作
this.Invoke(new MethodInvoker(() =>
{
this.lbl_jd.Text = JDStr;
this.lbl_cur.AppendText(curstr + "\r\n");
}));
}
}
}

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -1,71 +1,73 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// 对此文件的更改可能导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace RFIDSocket.Properties
{
namespace RFIDSocket.Properties {
using System;
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// 一个强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RFIDSocket.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap loading3 {
get {
object obj = ResourceManager.GetObject("loading3", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
@ -109,9 +112,13 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="loading3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\loading3.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

@ -357,7 +357,7 @@
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(478, 12);
this.label3.Location = new System.Drawing.Point(457, 10);
this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(101, 12);
@ -417,9 +417,7 @@
this.MaximizeBox = false;
this.Name = "RFIDBinAudlt";
this.Text = "格口盘点";
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.RFIDBinAudlt_MouseDown);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.RFIDBinAudlt_MouseMove);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.RFIDBinAudlt_MouseUp);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RFIDBinAudlt_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.DataGroupBox.ResumeLayout(false);
this.ResumeLayout(false);

@ -1,11 +1,15 @@
using HighWayIot.TouchSocket;
using HighWayIot.Log4net;
using HighWayIot.TouchSocket;
using Org.BouncyCastle.Utilities;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
@ -15,31 +19,83 @@ namespace RFIDSocket
{
public partial class RFIDBinAudlt : Form
{
private TcpClientServer TCPClient = TcpClientServer.Instance;
private TcpClientServer Client = TcpClientServer.Instance;
/// <summary>
/// 日志实例
/// </summary>
private static LogHelper logHelper = LogHelper.Instance;
/// <summary>
/// 前端列表实例
/// </summary>
private DataTable dt = new DataTable();
/// <summary>
/// xml读写实例
/// </summary>
XmlDocument xd = new XmlDocument();
/// <summary>
/// 运行时路径
/// </summary>
private string Path = System.Environment.CurrentDirectory;
/// <summary>
/// 所有适配器IP
/// </summary>
private string[] ServiceIPs;
/// <summary>
/// 格口编码集合
/// </summary>
private string[] BinCodes = new string[0];
/// <summary>
/// 格口编码返回结果字符串
/// </summary>
private StringBuilder BinCodesString = new StringBuilder();
/// <summary>
/// 应有格口数
/// </summary>
private int ServiceCount = -1;
/// <summary>
/// 正常格口数
/// </summary>
private int NormalCount = 0;
/// <summary>
/// 异常格口数
/// </summary>
private int ErrorCount = 0;
/// <summary>
/// 服务端端口
/// </summary>
string Port = string.Empty;
/// <summary>
/// 服务端地址
/// </summary>
string IP = string.Empty;
/// <summary>
/// 上次接受数据的时间
/// </summary>
DateTime LastInfoTime = DateTime.Now;
public RFIDBinAudlt()
{
InitializeComponent();
Init();
}
private void Init()
/// <summary>
/// 初始化方法
/// </summary>
private async void Init()
{
GetSetting();
dataGridView.AutoGenerateColumns = false;
@ -47,6 +103,9 @@ namespace RFIDSocket
{
dt.Columns.Add(column.HeaderText, typeof(string));
}
//Client.GetBinCode += AddBinCodeString;
Client.GetString += ConnectMessageString;
}
/// <summary>
@ -54,7 +113,6 @@ namespace RFIDSocket
/// </summary>
private void GetSetting()
{
XmlDocument xd = new XmlDocument();
xd.Load($"{Path}\\Configuration.xml");//加载xml文档
XmlNode rootNode = xd.SelectSingleNode("BinAudlt");//得到xml文档的根节点
XmlNodeList nodes = rootNode.SelectNodes("ServiceIpConfig");//获取根节点的子节点"ServiceIpConfig"
@ -70,8 +128,10 @@ namespace RFIDSocket
}
XmlNode ServerIp = rootNode.SelectSingleNode("ConnectIp"); // 服务器IP
XmlNode ServerPort = rootNode.SelectSingleNode("ConnectPort"); // 服务器端口
IP = ServerIp.InnerText;
Port = ServerPort.InnerText;
IP = ServerIp.InnerText.Trim();
Port = ServerPort.InnerText.Trim();
IPText.Text = IP;
PortText.Text = Port;
}
/// <summary>
@ -81,16 +141,115 @@ namespace RFIDSocket
/// <param name="e"></param>
private void AudltButton_Click(object sender, EventArgs e)
{
BinCodes = new string[0];
BinCodesString.Clear();
MultiFuncLoading loadingfrm = new MultiFuncLoading(this);
SplashScreenManager loading = new SplashScreenManager(loadingfrm);
loading.ShowLoading();
loadingfrm.SetTxt("格口盘点中", $"共有{ServiceIPs.Length}个IP需要扫描", "Please Waitting...");
try
{
Task.Run(async () =>
{
int count = 0;
foreach (string s in ServiceIPs)
{
count++;
Client.Send($"connect {s}").GetAwaiter().GetResult();
loadingfrm.SetJD($"正在盘点{s} {count}/{ServiceIPs.Length}", $"正在盘点{s} {count}/{ServiceIPs.Length}");
do
{
await Task.Delay(500);
}
while (DateTime.Now - LastInfoTime <= TimeSpan.FromMilliseconds(3000));
}
}).GetAwaiter().GetResult();
}
catch (Exception ex)
{
MessageBox.Show("加载发生错误,请检查连接情况" + ex);
return;
}
finally
{
loading.CloseWaitForm();
}
string sss = BinCodesString.ToString();
logHelper.Info($"此次盘点的字符串为{sss}");
BinCodes = ClientStringAnalysis.GetInfoAnalyzer(sss);
int[] intArray = BinCodes
.Select(a => int.Parse(a)) // 转换为整型
.Distinct() // 去重
.OrderBy(x => x) // 排序
.ToArray(); // 转换为数组
NormalCount = 0;
ErrorCount = 0;
GridViewRefresh(GenerateRandomBoolArray(ServiceCount));
GridViewRefresh(ConvertToBoolArray(intArray, ServiceCount));
NormalCountLabel.Text = NormalCount.ToString();
ErrorCountLabel.Text = ErrorCount.ToString();
}
/// <summary>
/// 字符串连接委托类
/// </summary>
/// <param name="message"></param>
private void ConnectMessageString(string message)
{
LastInfoTime = DateTime.Now;
BinCodesString.Append(message);
}
/// <summary>
/// 获取BinCode委托方法
/// </summary>
private void AddBinCodeString(string[] binCodes)
{
///拼接BinCode
Task.Run(() =>
{
string[] temp = new string[binCodes.Length + BinCodes.Length];
Array.Copy(BinCodes, 0, temp, 0, BinCodes.Length);
Array.Copy(binCodes, 0, temp, BinCodes.Length, binCodes.Length);
BinCodes = temp;
});
}
/// <summary>
/// int数组转化为bool数组
/// </summary>
/// <param name="intArray"></param>
/// <param name="count"></param>
/// <returns></returns>
private bool[] ConvertToBoolArray(int[] intArray, int count)
{
// 初始化一个长度为count的bool数组默认为false
bool[] result = new bool[count];
// 遍历intArray将对应位置的值设置为true
foreach (int num in intArray)
{
if (num >= 1 && num <= count) // 确保num在合法范围内
{
result[num - 1] = true; // 将下标为num-1的值设置为true
}
}
return result;
}
/// <summary>
/// 表格刷新
/// </summary>
/// <param name="states">bool状态列表</param>
private void GridViewRefresh(bool[] states)
{
if (ServiceCount < 0)
@ -188,10 +347,13 @@ namespace RFIDSocket
/// <param name="e"></param>
private void MonitorOnOff_Click(object sender, EventArgs e)
{
if (!TCPClient.ClientState)
if (!Client.ClientState)
{
if (TCPClient.ClientConnect(IP, Port).GetAwaiter().GetResult())
if (Client.ClientConnect(IP, Port).GetAwaiter().GetResult())
{
MonitorOnOff.Text = "断开客户端";
MonitorState.Text = "开";
MonitorState.BackColor = Color.Green;
MessageBox.Show("服务端连接成功!");
}
else
@ -199,10 +361,13 @@ namespace RFIDSocket
MessageBox.Show("服务端连接失败!");
}
}
else if (TCPClient.ClientState)
else if (Client.ClientState)
{
if (TCPClient.ClientClose())
if (Client.ClientClose().GetAwaiter().GetResult())
{
MonitorOnOff.Text = "连接客户端";
MonitorState.Text = "关";
MonitorState.BackColor = Color.Transparent;
MessageBox.Show("服务端断开成功!");
}
else
@ -219,44 +384,40 @@ namespace RFIDSocket
/// <param name="e"></param>
private void SetAddress_Click(object sender, EventArgs e)
{
}
#region 鼠标拖拽
private bool isDragging = false; // 用于检测是否正在拖动
private Point lastLocation; // 保存上次鼠标位置
private void RFIDBinAudlt_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
try
{
isDragging = true;
lastLocation = e.Location; // 记录鼠标按下时的位置
IP = IPText.Text.Trim();
Port = PortText.Text.Trim();
//ip保存
XmlNode rootNode = xd.SelectSingleNode("BinAudlt");//得到xml文档的根节点
XmlNode ServerIp = rootNode.SelectSingleNode("ConnectIp"); // 服务器IP
XmlNode ServerPort = rootNode.SelectSingleNode("ConnectPort"); // 服务器端口
ServerIp.InnerText = IP;
ServerPort.InnerText = Port;
xd.Save($"{Path}\\Configuration.xml");
MessageBox.Show("保存成功!");
}
catch (Exception ex)
{
MessageBox.Show("服务端地址 XML文件保存失败");
}
}
/// <summary>
/// 全局拖拽
/// 关闭窗口事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void RFIDBinAudlt_MouseMove(object sender, MouseEventArgs e)
private void RFIDBinAudlt_FormClosing(object sender, FormClosingEventArgs e)
{
if (isDragging)
if (Client.ClientState)
{
this.Top = this.Top + (e.Y - lastLocation.Y);
this.Left = this.Left + (e.X - lastLocation.X);
if (!Client.ClientClose().GetAwaiter().GetResult())
{
MessageBox.Show("服务端断开失败!请检查原因后重新关闭或重试");
}
}
}
private void RFIDBinAudlt_MouseUp(object sender, MouseEventArgs e)
{
isDragging = false;
}
#endregion
}
}

@ -177,64 +177,4 @@
<metadata name="Column20.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column6.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column7.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column8.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column9.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column10.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column11.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column12.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column13.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column14.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column15.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column16.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column17.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column18.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column19.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column20.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

@ -56,6 +56,12 @@
this.Label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.ReadSuccessPercent = new System.Windows.Forms.Label();
this.ErrorReadNum = new System.Windows.Forms.Label();
this.NormalReadNum = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
@ -307,11 +313,83 @@
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// ReadSuccessPercent
//
this.ReadSuccessPercent.AutoSize = true;
this.ReadSuccessPercent.Font = new System.Drawing.Font("宋体", 12F);
this.ReadSuccessPercent.Location = new System.Drawing.Point(132, 836);
this.ReadSuccessPercent.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0);
this.ReadSuccessPercent.Name = "ReadSuccessPercent";
this.ReadSuccessPercent.Size = new System.Drawing.Size(31, 16);
this.ReadSuccessPercent.TabIndex = 18;
this.ReadSuccessPercent.Text = "N/A";
//
// ErrorReadNum
//
this.ErrorReadNum.AutoSize = true;
this.ErrorReadNum.Font = new System.Drawing.Font("宋体", 12F);
this.ErrorReadNum.Location = new System.Drawing.Point(132, 802);
this.ErrorReadNum.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0);
this.ErrorReadNum.Name = "ErrorReadNum";
this.ErrorReadNum.Size = new System.Drawing.Size(31, 16);
this.ErrorReadNum.TabIndex = 17;
this.ErrorReadNum.Text = "N/A";
//
// NormalReadNum
//
this.NormalReadNum.AutoSize = true;
this.NormalReadNum.Font = new System.Drawing.Font("宋体", 12F);
this.NormalReadNum.Location = new System.Drawing.Point(132, 768);
this.NormalReadNum.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0);
this.NormalReadNum.Name = "NormalReadNum";
this.NormalReadNum.Size = new System.Drawing.Size(31, 16);
this.NormalReadNum.TabIndex = 16;
this.NormalReadNum.Text = "N/A";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Font = new System.Drawing.Font("宋体", 12F);
this.label9.Location = new System.Drawing.Point(11, 768);
this.label9.Margin = new System.Windows.Forms.Padding(15, 15, 15, 3);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(119, 16);
this.label9.TabIndex = 15;
this.label9.Text = "正常读码数量:";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("宋体", 12F);
this.label8.Location = new System.Drawing.Point(11, 802);
this.label8.Margin = new System.Windows.Forms.Padding(15, 15, 15, 3);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(119, 16);
this.label8.TabIndex = 14;
this.label8.Text = "异常读码数量:";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("宋体", 12F);
this.label7.Location = new System.Drawing.Point(11, 836);
this.label7.Margin = new System.Windows.Forms.Padding(15, 15, 15, 3);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(103, 16);
this.label7.TabIndex = 13;
this.label7.Text = "读码成功率:";
//
// RFIDLog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(907, 923);
this.Controls.Add(this.ReadSuccessPercent);
this.Controls.Add(this.ErrorReadNum);
this.Controls.Add(this.NormalReadNum);
this.Controls.Add(this.label9);
this.Controls.Add(this.label8);
this.Controls.Add(this.label7);
this.Controls.Add(this.button1);
this.Controls.Add(this.label2);
this.Controls.Add(this.Label1);
@ -367,5 +445,11 @@
private System.Windows.Forms.Label Label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label ReadSuccessPercent;
private System.Windows.Forms.Label ErrorReadNum;
private System.Windows.Forms.Label NormalReadNum;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label7;
}
}

@ -47,6 +47,7 @@ namespace RFIDSocket
LogContent.DataSource = null;
LogContent.DataSource = LogControl.LogTimeSelect(rFIDContents, StartTime.Value, EndTime.Value);
}
NumCount();
}
private void ReadKindSelect_Click(object sender, EventArgs e)
@ -56,6 +57,7 @@ namespace RFIDSocket
LogContent.DataSource = null;
LogContent.DataSource = LogControl.LogReadKindSelect(rFIDContents, ReadKind.Text);
}
NumCount();
}
private void DeviceNoSelect_Click(object sender, EventArgs e)
@ -70,6 +72,7 @@ namespace RFIDSocket
LogContent.DataSource = null;
LogContent.DataSource = LogControl.LogDeviceNoSelect(rFIDContents, no);
}
NumCount();
}
private void ContentSelect_Click(object sender, EventArgs e)
@ -79,6 +82,7 @@ namespace RFIDSocket
LogContent.DataSource = null;
LogContent.DataSource = LogControl.LogContentSelect(rFIDContents, Content.Text);
}
NumCount();
}
private void SelectAll_Click(object sender, EventArgs e)
@ -100,6 +104,22 @@ namespace RFIDSocket
ReadKind.Text),
StartTime.Value, EndTime.Value);
}
NumCount();
}
private void NumCount()
{
int normalCount = rFIDContents.Where(x => x.ReadKind == "GR").Count();
int errorCount = rFIDContents.Where(x => x.ReadKind == "MR" || x.ReadKind == "NB").Count();
NormalReadNum.Text = normalCount.ToString();
ErrorReadNum.Text = errorCount.ToString();
//算比例
float percent = (float)normalCount / (float)rFIDContents.Count;
percent *= 100f;
ReadSuccessPercent.Text = $"%{percent}";
}
/// <summary>

@ -44,15 +44,7 @@
this.label4 = new System.Windows.Forms.Label();
this.MonitorState = new System.Windows.Forms.Label();
this.TableTimer = new System.Windows.Forms.Timer(this.components);
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.StateData = new System.Windows.Forms.DataGridView();
this.deviceNoDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.LogTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.rFIDStateBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.HeartbeatData = new System.Windows.Forms.DataGridView();
this.deviceNoDataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.timeSpanDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.rFIDHeartbeatBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.PgUp = new System.Windows.Forms.Button();
this.PgDn = new System.Windows.Forms.Button();
@ -61,30 +53,45 @@
this.LogStart = new System.Windows.Forms.Button();
this.ControlGrupbox = new System.Windows.Forms.GroupBox();
this.BinAudlt = new System.Windows.Forms.Button();
this.ClearError = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.ConnectCountLabel = new System.Windows.Forms.Label();
this.MainReadGroupBox = new System.Windows.Forms.GroupBox();
this.PageGroupBox = new System.Windows.Forms.GroupBox();
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label6 = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label10 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.NormalReadNum = new System.Windows.Forms.Label();
this.ErrorReadNum = new System.Windows.Forms.Label();
this.ReadSuccessPercent = new System.Windows.Forms.Label();
this.ErrorCountDataGridView = new System.Windows.Forms.DataGridView();
this.BinNo = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ErrorCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.CotentData)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.rFIDContentBindingSource)).BeginInit();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.StateData)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.rFIDStateBindingSource)).BeginInit();
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.HeartbeatData)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.rFIDHeartbeatBindingSource)).BeginInit();
this.ControlGrupbox.SuspendLayout();
this.MainReadGroupBox.SuspendLayout();
this.PageGroupBox.SuspendLayout();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ErrorCountDataGridView)).BeginInit();
this.SuspendLayout();
//
// CotentData
//
this.CotentData.AllowUserToAddRows = false;
this.CotentData.AllowUserToDeleteRows = false;
this.CotentData.AllowUserToResizeRows = false;
this.CotentData.AutoGenerateColumns = false;
this.CotentData.ColumnHeadersHeight = 20;
@ -99,6 +106,7 @@
this.CotentData.Location = new System.Drawing.Point(3, 17);
this.CotentData.Margin = new System.Windows.Forms.Padding(2);
this.CotentData.Name = "CotentData";
this.CotentData.ReadOnly = true;
this.CotentData.RowHeadersVisible = false;
this.CotentData.RowHeadersWidth = 51;
this.CotentData.RowTemplate.Height = 17;
@ -110,6 +118,7 @@
this.ID.DataPropertyName = "ID";
this.ID.HeaderText = "ID";
this.ID.Name = "ID";
this.ID.ReadOnly = true;
this.ID.Width = 40;
//
// deviceNoDataGridViewTextBoxColumn
@ -118,6 +127,7 @@
this.deviceNoDataGridViewTextBoxColumn.HeaderText = "格口";
this.deviceNoDataGridViewTextBoxColumn.MinimumWidth = 6;
this.deviceNoDataGridViewTextBoxColumn.Name = "deviceNoDataGridViewTextBoxColumn";
this.deviceNoDataGridViewTextBoxColumn.ReadOnly = true;
this.deviceNoDataGridViewTextBoxColumn.Width = 40;
//
// readKindDataGridViewTextBoxColumn
@ -126,6 +136,7 @@
this.readKindDataGridViewTextBoxColumn.HeaderText = "读码结果";
this.readKindDataGridViewTextBoxColumn.MinimumWidth = 6;
this.readKindDataGridViewTextBoxColumn.Name = "readKindDataGridViewTextBoxColumn";
this.readKindDataGridViewTextBoxColumn.ReadOnly = true;
this.readKindDataGridViewTextBoxColumn.Width = 60;
//
// contentDataGridViewTextBoxColumn
@ -135,6 +146,7 @@
this.contentDataGridViewTextBoxColumn.HeaderText = "条码内容";
this.contentDataGridViewTextBoxColumn.MinimumWidth = 6;
this.contentDataGridViewTextBoxColumn.Name = "contentDataGridViewTextBoxColumn";
this.contentDataGridViewTextBoxColumn.ReadOnly = true;
//
// logTimeDataGridViewTextBoxColumn
//
@ -142,6 +154,7 @@
this.logTimeDataGridViewTextBoxColumn.HeaderText = "读取时间";
this.logTimeDataGridViewTextBoxColumn.MinimumWidth = 6;
this.logTimeDataGridViewTextBoxColumn.Name = "logTimeDataGridViewTextBoxColumn";
this.logTimeDataGridViewTextBoxColumn.ReadOnly = true;
this.logTimeDataGridViewTextBoxColumn.Width = 105;
//
// rFIDContentBindingSource
@ -226,109 +239,10 @@
this.TableTimer.Interval = 1000;
this.TableTimer.Tick += new System.EventHandler(this.TableTimer_Tick);
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.AutoSize = true;
this.groupBox2.Controls.Add(this.StateData);
this.groupBox2.Location = new System.Drawing.Point(799, 180);
this.groupBox2.Margin = new System.Windows.Forms.Padding(2);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(2);
this.groupBox2.Size = new System.Drawing.Size(185, 626);
this.groupBox2.TabIndex = 11;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "工作状态故障";
//
// StateData
//
this.StateData.AllowUserToResizeRows = false;
this.StateData.AutoGenerateColumns = false;
this.StateData.ColumnHeadersHeight = 20;
this.StateData.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.deviceNoDataGridViewTextBoxColumn1,
this.LogTime});
this.StateData.DataSource = this.rFIDStateBindingSource;
this.StateData.Dock = System.Windows.Forms.DockStyle.Fill;
this.StateData.Location = new System.Drawing.Point(2, 16);
this.StateData.Margin = new System.Windows.Forms.Padding(2);
this.StateData.Name = "StateData";
this.StateData.RowHeadersVisible = false;
this.StateData.RowHeadersWidth = 51;
this.StateData.RowTemplate.Height = 20;
this.StateData.Size = new System.Drawing.Size(181, 608);
this.StateData.TabIndex = 0;
//
// deviceNoDataGridViewTextBoxColumn1
//
this.deviceNoDataGridViewTextBoxColumn1.DataPropertyName = "DeviceNo";
this.deviceNoDataGridViewTextBoxColumn1.HeaderText = "编号";
this.deviceNoDataGridViewTextBoxColumn1.MinimumWidth = 6;
this.deviceNoDataGridViewTextBoxColumn1.Name = "deviceNoDataGridViewTextBoxColumn1";
this.deviceNoDataGridViewTextBoxColumn1.Width = 60;
//
// LogTime
//
this.LogTime.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.LogTime.DataPropertyName = "LogTime";
this.LogTime.HeaderText = "报警时间";
this.LogTime.MinimumWidth = 6;
this.LogTime.Name = "LogTime";
//
// rFIDStateBindingSource
//
this.rFIDStateBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDState);
//
// groupBox3
//
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox3.Controls.Add(this.HeartbeatData);
this.groupBox3.Location = new System.Drawing.Point(989, 180);
this.groupBox3.Margin = new System.Windows.Forms.Padding(2);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Padding = new System.Windows.Forms.Padding(2);
this.groupBox3.Size = new System.Drawing.Size(185, 626);
this.groupBox3.TabIndex = 12;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "连接故障";
//
// HeartbeatData
//
this.HeartbeatData.AllowUserToResizeRows = false;
this.HeartbeatData.AutoGenerateColumns = false;
this.HeartbeatData.ColumnHeadersHeight = 20;
this.HeartbeatData.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.deviceNoDataGridViewTextBoxColumn2,
this.timeSpanDataGridViewTextBoxColumn});
this.HeartbeatData.DataSource = this.rFIDHeartbeatBindingSource;
this.HeartbeatData.Dock = System.Windows.Forms.DockStyle.Fill;
this.HeartbeatData.Location = new System.Drawing.Point(2, 16);
this.HeartbeatData.Margin = new System.Windows.Forms.Padding(2);
this.HeartbeatData.Name = "HeartbeatData";
this.HeartbeatData.RowHeadersVisible = false;
this.HeartbeatData.RowHeadersWidth = 51;
this.HeartbeatData.RowTemplate.Height = 20;
this.HeartbeatData.Size = new System.Drawing.Size(181, 608);
this.HeartbeatData.TabIndex = 0;
//
// deviceNoDataGridViewTextBoxColumn2
//
this.deviceNoDataGridViewTextBoxColumn2.DataPropertyName = "DeviceNo";
this.deviceNoDataGridViewTextBoxColumn2.HeaderText = "编号";
this.deviceNoDataGridViewTextBoxColumn2.MinimumWidth = 6;
this.deviceNoDataGridViewTextBoxColumn2.Name = "deviceNoDataGridViewTextBoxColumn2";
this.deviceNoDataGridViewTextBoxColumn2.Width = 60;
//
// timeSpanDataGridViewTextBoxColumn
//
this.timeSpanDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.timeSpanDataGridViewTextBoxColumn.DataPropertyName = "TimeSpan";
this.timeSpanDataGridViewTextBoxColumn.HeaderText = "距上一次心跳时间";
this.timeSpanDataGridViewTextBoxColumn.MinimumWidth = 6;
this.timeSpanDataGridViewTextBoxColumn.Name = "timeSpanDataGridViewTextBoxColumn";
//
// rFIDHeartbeatBindingSource
//
this.rFIDHeartbeatBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDHeartbeat);
@ -399,7 +313,6 @@
//
this.ControlGrupbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ControlGrupbox.Controls.Add(this.BinAudlt);
this.ControlGrupbox.Controls.Add(this.ClearError);
this.ControlGrupbox.Controls.Add(this.label2);
this.ControlGrupbox.Controls.Add(this.ConnectCountLabel);
this.ControlGrupbox.Controls.Add(this.LogStart);
@ -427,17 +340,6 @@
this.BinAudlt.UseVisualStyleBackColor = true;
this.BinAudlt.Click += new System.EventHandler(this.BinAudlt_Click);
//
// ClearError
//
this.ClearError.Location = new System.Drawing.Point(168, 64);
this.ClearError.Margin = new System.Windows.Forms.Padding(2);
this.ClearError.Name = "ClearError";
this.ClearError.Size = new System.Drawing.Size(96, 45);
this.ClearError.TabIndex = 24;
this.ClearError.Text = "清除报警";
this.ClearError.UseVisualStyleBackColor = true;
this.ClearError.Click += new System.EventHandler(this.ClearError_Click);
//
// label2
//
this.label2.AutoSize = true;
@ -506,28 +408,203 @@
this.panel2.Size = new System.Drawing.Size(190, 39);
this.panel2.TabIndex = 16;
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.ReadSuccessPercent);
this.groupBox1.Controls.Add(this.ErrorReadNum);
this.groupBox1.Controls.Add(this.NormalReadNum);
this.groupBox1.Controls.Add(this.label11);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.groupBox3);
this.groupBox1.Controls.Add(this.label10);
this.groupBox1.Controls.Add(this.label9);
this.groupBox1.Controls.Add(this.label8);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Location = new System.Drawing.Point(799, 181);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(375, 625);
this.groupBox1.TabIndex = 19;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "状态面板";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("宋体", 12F);
this.label6.Location = new System.Drawing.Point(103, 32);
this.label6.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(39, 16);
this.label6.TabIndex = 7;
this.label6.Text = "正常";
//
// groupBox3
//
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox3.Controls.Add(this.ErrorCountDataGridView);
this.groupBox3.Font = new System.Drawing.Font("宋体", 9F);
this.groupBox3.Location = new System.Drawing.Point(6, 202);
this.groupBox3.Margin = new System.Windows.Forms.Padding(3, 15, 3, 3);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(363, 423);
this.groupBox3.TabIndex = 6;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "异常统计最近200条";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Font = new System.Drawing.Font("宋体", 12F);
this.label10.Location = new System.Drawing.Point(18, 66);
this.label10.Margin = new System.Windows.Forms.Padding(15, 15, 15, 3);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(87, 16);
this.label10.TabIndex = 5;
this.label10.Text = "连接状态:";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Font = new System.Drawing.Font("宋体", 12F);
this.label9.Location = new System.Drawing.Point(18, 100);
this.label9.Margin = new System.Windows.Forms.Padding(15, 15, 15, 3);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(119, 16);
this.label9.TabIndex = 4;
this.label9.Text = "正常读码数量:";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("宋体", 12F);
this.label8.Location = new System.Drawing.Point(18, 134);
this.label8.Margin = new System.Windows.Forms.Padding(15, 15, 15, 3);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(119, 16);
this.label8.TabIndex = 3;
this.label8.Text = "异常读码数量:";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("宋体", 12F);
this.label7.Location = new System.Drawing.Point(18, 168);
this.label7.Margin = new System.Windows.Forms.Padding(15, 15, 15, 3);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(103, 16);
this.label7.TabIndex = 2;
this.label7.Text = "读码成功率:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("宋体", 12F);
this.label5.Location = new System.Drawing.Point(18, 32);
this.label5.Margin = new System.Windows.Forms.Padding(15, 15, 15, 3);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(87, 16);
this.label5.TabIndex = 0;
this.label5.Text = "工作状态:";
//
// label11
//
this.label11.AutoSize = true;
this.label11.Font = new System.Drawing.Font("宋体", 12F);
this.label11.Location = new System.Drawing.Point(103, 66);
this.label11.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(39, 16);
this.label11.TabIndex = 8;
this.label11.Text = "正常";
//
// NormalReadNum
//
this.NormalReadNum.AutoSize = true;
this.NormalReadNum.Font = new System.Drawing.Font("宋体", 12F);
this.NormalReadNum.Location = new System.Drawing.Point(139, 100);
this.NormalReadNum.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0);
this.NormalReadNum.Name = "NormalReadNum";
this.NormalReadNum.Size = new System.Drawing.Size(31, 16);
this.NormalReadNum.TabIndex = 9;
this.NormalReadNum.Text = "N/A";
//
// ErrorReadNum
//
this.ErrorReadNum.AutoSize = true;
this.ErrorReadNum.Font = new System.Drawing.Font("宋体", 12F);
this.ErrorReadNum.Location = new System.Drawing.Point(139, 134);
this.ErrorReadNum.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0);
this.ErrorReadNum.Name = "ErrorReadNum";
this.ErrorReadNum.Size = new System.Drawing.Size(31, 16);
this.ErrorReadNum.TabIndex = 10;
this.ErrorReadNum.Text = "N/A";
//
// ReadSuccessPercent
//
this.ReadSuccessPercent.AutoSize = true;
this.ReadSuccessPercent.Font = new System.Drawing.Font("宋体", 12F);
this.ReadSuccessPercent.Location = new System.Drawing.Point(125, 168);
this.ReadSuccessPercent.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0);
this.ReadSuccessPercent.Name = "ReadSuccessPercent";
this.ReadSuccessPercent.Size = new System.Drawing.Size(31, 16);
this.ReadSuccessPercent.TabIndex = 11;
this.ReadSuccessPercent.Text = "N/A";
//
// ErrorCountDataGridView
//
this.ErrorCountDataGridView.AllowUserToAddRows = false;
this.ErrorCountDataGridView.AllowUserToDeleteRows = false;
this.ErrorCountDataGridView.AllowUserToResizeRows = false;
this.ErrorCountDataGridView.ColumnHeadersHeight = 20;
this.ErrorCountDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.BinNo,
this.ErrorCount});
this.ErrorCountDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.ErrorCountDataGridView.Location = new System.Drawing.Point(3, 17);
this.ErrorCountDataGridView.Name = "ErrorCountDataGridView";
this.ErrorCountDataGridView.ReadOnly = true;
this.ErrorCountDataGridView.RowHeadersVisible = false;
this.ErrorCountDataGridView.RowTemplate.Height = 17;
this.ErrorCountDataGridView.Size = new System.Drawing.Size(357, 403);
this.ErrorCountDataGridView.TabIndex = 0;
//
// BinNo
//
this.BinNo.DataPropertyName = "BinNo";
this.BinNo.HeaderText = "格口号";
this.BinNo.Name = "BinNo";
this.BinNo.ReadOnly = true;
//
// ErrorCount
//
this.ErrorCount.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.ErrorCount.DataPropertyName = "ErrorCount";
this.ErrorCount.HeaderText = "异常读码次数";
this.ErrorCount.Name = "ErrorCount";
this.ErrorCount.ReadOnly = true;
//
// RFIDSocket
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScroll = true;
this.ClientSize = new System.Drawing.Size(1186, 817);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.PageGroupBox);
this.Controls.Add(this.MainReadGroupBox);
this.Controls.Add(this.ControlGrupbox);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Margin = new System.Windows.Forms.Padding(2);
this.Name = "RFIDSocket";
this.Text = "小件监控";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RFIDSocket_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.CotentData)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.rFIDContentBindingSource)).EndInit();
this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.StateData)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.rFIDStateBindingSource)).EndInit();
this.groupBox3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.HeartbeatData)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.rFIDHeartbeatBindingSource)).EndInit();
this.ControlGrupbox.ResumeLayout(false);
this.ControlGrupbox.PerformLayout();
@ -536,6 +613,10 @@
this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.ErrorCountDataGridView)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -553,15 +634,7 @@
private System.Windows.Forms.Timer TableTimer;
private System.Windows.Forms.TextBox IPText;
private System.Windows.Forms.BindingSource rFIDContentBindingSource;
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.DataGridView StateData;
private System.Windows.Forms.DataGridViewTextBoxColumn deviceNoDataGridViewTextBoxColumn1;
private System.Windows.Forms.DataGridViewTextBoxColumn LogTime;
private System.Windows.Forms.DataGridViewTextBoxColumn deviceNoDataGridViewTextBoxColumn2;
private System.Windows.Forms.DataGridViewTextBoxColumn timeSpanDataGridViewTextBoxColumn;
private System.Windows.Forms.BindingSource rFIDHeartbeatBindingSource;
private System.Windows.Forms.Button PgUp;
private System.Windows.Forms.Button PgDn;
@ -575,13 +648,27 @@
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label ConnectCountLabel;
private System.Windows.Forms.Button ClearError;
private System.Windows.Forms.DataGridViewTextBoxColumn ID;
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.Button BinAudlt;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label ReadSuccessPercent;
private System.Windows.Forms.Label ErrorReadNum;
private System.Windows.Forms.Label NormalReadNum;
private System.Windows.Forms.DataGridView ErrorCountDataGridView;
private System.Windows.Forms.DataGridViewTextBoxColumn BinNo;
private System.Windows.Forms.DataGridViewTextBoxColumn ErrorCount;
}
}

@ -34,8 +34,12 @@ namespace RFIDSocket
InitAction();
}
/// <summary>
/// 初始化
/// </summary>
private void InitAction()
{
ErrorCountDataGridView.AutoGenerateColumns = false;
if (Server.State != ServerState.Running)
{
MonitorState.Text = "关";
@ -54,6 +58,11 @@ namespace RFIDSocket
IP = IPText.Text;
}
/// <summary>
/// 监视启停按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MonitorOnOff_Click(object sender, EventArgs e)
{
if (Server.State != ServerState.Running)
@ -82,6 +91,11 @@ namespace RFIDSocket
}
}
/// <summary>
/// 服务端IP端口设置
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SetPort_Click(object sender, EventArgs e)
{
Config.AppSettings.Settings["IpSetting"].Value = IPText.Text;
@ -92,6 +106,11 @@ namespace RFIDSocket
MessageBox.Show("服务端IP端口号设置成功");
}
/// <summary>
/// Timer刷新
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void TableTimer_Tick(object sender, EventArgs e)
{
if (Server.State != ServerState.Running)
@ -111,16 +130,52 @@ namespace RFIDSocket
ConnectCountLabel.Text = Server.ConnectCount.ToString();
CotentData.DataSource = null;
StateData.DataSource = null;
HeartbeatData.DataSource = null;
int normalCount = RFIDData.rFIDContents.Where(x => x.ReadKind == "GR").Count();
int errorCount = RFIDData.rFIDContents.Where(x => x.ReadKind == "MR" || x.ReadKind == "NB").Count();
NormalReadNum.Text = normalCount.ToString();
ErrorReadNum.Text = errorCount.ToString();
//算比例
float percent = (float)normalCount / (float)RFIDData.rFIDContents.Count;
percent *= 100f;
ReadSuccessPercent.Text = $"%{percent}";
//展示格口号
string text = string.Empty;
List<int> list = new List<int>(); // 错误的设备编号
foreach (var entity in RFIDData.rFIDContents)
{
if (entity.ReadKind == "MR" || entity.ReadKind == "NB")
{
list.Add(entity.DeviceNo);
}
}
var deviceNoGroup = list.GroupBy(x => x);
DataTable dataTable = new DataTable();
{
dataTable.Columns.Add("BinNo");
dataTable.Columns.Add("ErrorCount");
};
foreach (var data in deviceNoGroup)
{
int deviceNo = data.LastOrDefault();
int deviceErrorCount = data.Count();
dataTable.Rows.Add(deviceNo.ToString(), deviceErrorCount.ToString());
}
ErrorCountDataGridView.DataSource = null;
ErrorCountDataGridView.DataSource = dataTable;
ContentPages();
StateData.DataSource = RFIDData.AlarmState;
HeartbeatData.DataSource = RFIDData.HeartbeatsState;
}
/// <summary>
/// 窗口关闭
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void RFIDSocket_FormClosing(object sender, FormClosingEventArgs e)
{
if (Server.State == ServerState.Running)
@ -138,23 +193,37 @@ namespace RFIDSocket
}
}
/// <summary>
/// 刷新页面
/// </summary>
private void ContentPages()
{
CotentData.DataSource = null;
CotentData.DataSource = RFIDData.rFIDContents.Skip((PageNo - 1) * 50).Take(50).ToList();
PageRange.Text = $"{((PageNo - 1) * 50) + 1} - {PageNo * 50}";
}
/// <summary>
/// 下一页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void PgUp_Click(object sender, EventArgs e)
{
if(PageNo == 1)
if (PageNo == 1)
{
MessageBox.Show("已经是首页!");
MessageBox.Show("已经是首页!");
return;
}
PageNo--;
ContentPages();
}
/// <summary>
/// 上一页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void PgDn_Click(object sender, EventArgs e)
{
if (PageNo == 4)
@ -166,6 +235,11 @@ namespace RFIDSocket
ContentPages();
}
/// <summary>
/// 日志界面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void LogStart_Click(object sender, EventArgs e)
{
RFIDLog rFIDLog = new RFIDLog();
@ -179,16 +253,21 @@ namespace RFIDSocket
/// <param name="e"></param>
private void ClearError_Click(object sender, EventArgs e)
{
if (RFIDData.ClearAllError())
{
MessageBox.Show("设备异常清除成功");
}
else
{
MessageBox.Show("设备异常清除失败");
}
//if (RFIDData.ClearAllError())
//{
// MessageBox.Show("设备异常清除成功");
//}
//else
//{
// MessageBox.Show("设备异常清除失败");
//}
}
/// <summary>
/// 格口盘点界面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BinAudlt_Click(object sender, EventArgs e)
{
RFIDBinAudlt form = new RFIDBinAudlt();

@ -144,6 +144,12 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="MultiFuncLoading.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MultiFuncLoading.Designer.cs">
<DependentUpon>MultiFuncLoading.cs</DependentUpon>
</Compile>
<Compile Include="ServerDataAnalysis.cs" />
<Compile Include="RFIDBinAudlt.cs">
<SubType>Form</SubType>
@ -166,6 +172,10 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SplashScreenManager.cs" />
<EmbeddedResource Include="MultiFuncLoading.resx">
<DependentUpon>MultiFuncLoading.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="RFIDBinAudlt.resx">
<DependentUpon>RFIDBinAudlt.cs</DependentUpon>
</EmbeddedResource>
@ -177,6 +187,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="RFIDLog.resx">
<DependentUpon>RFIDLog.cs</DependentUpon>
@ -236,6 +247,9 @@
</ItemGroup>
<ItemGroup>
<Content Include="Configuration.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="loading3.gif">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

@ -132,13 +132,22 @@
<metadata name="TableTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="LogTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="rFIDStateBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>413, 17</value>
</metadata>
<metadata name="rFIDHeartbeatBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>646, 17</value>
</metadata>
<metadata name="BinNo.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ErrorCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="BinNo.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ErrorCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

@ -24,13 +24,13 @@ namespace RFIDSocket
public static ServerDataAnalysis Instance => lazy.Value;
public List<RFIDContent> rFIDContents = new List<RFIDContent>();
public List<RFIDHeartbeat> rFIDHeartbeats = new List<RFIDHeartbeat>();
public List<RFIDHeartbeat> HeartbeatsState = new List<RFIDHeartbeat>();
public List<RFIDState> rFIDStates = new List<RFIDState>();
public List<RFIDState> AlarmState = new List<RFIDState>();
//public List<RFIDHeartbeat> rFIDHeartbeats = new List<RFIDHeartbeat>();
//public List<RFIDHeartbeat> HeartbeatsState = new List<RFIDHeartbeat>();
//public List<RFIDState> rFIDStates = new List<RFIDState>();
//public List<RFIDState> AlarmState = new List<RFIDState>();
public IContentService ContentService = new BaseContentServiceImpl();
public IHeartbeatService HeartbeatService = new BaseHeartbeatServiceImpl();
public IStateService StateService = new BaseStateServiceImpl();
//public IHeartbeatService HeartbeatService = new BaseHeartbeatServiceImpl();
//public IStateService StateService = new BaseStateServiceImpl();
/// <summary>
/// 获取数据解析
@ -40,46 +40,46 @@ namespace RFIDSocket
rFIDContents = ContentService.GetContentInfos().Reverse<RFIDContent>().Take(200).ToList();
rFIDStates = StateService.GetStateInfos();
//rFIDStates = StateService.GetStateInfos();
var StateGroup = rFIDStates.GroupBy(x => x.DeviceNo);
//var StateGroup = rFIDStates.GroupBy(x => x.DeviceNo);
AlarmState.Clear();
//AlarmState.Clear();
foreach(var a in StateGroup)
{
var b = a.LastOrDefault();
if (b.DeviceState)
{
AlarmState.Add(b);
}
}
//foreach(var a in StateGroup)
//{
// var b = a.LastOrDefault();
// if (b.DeviceState)
// {
// AlarmState.Add(b);
// }
//}
rFIDHeartbeats = HeartbeatService.GetHeartbeatInfos();
//rFIDHeartbeats = HeartbeatService.GetHeartbeatInfos();
var HeartBeatGroup = rFIDHeartbeats.GroupBy(x => x.DeviceNo);
//var HeartBeatGroup = rFIDHeartbeats.GroupBy(x => x.DeviceNo);
HeartbeatsState.Clear();
//HeartbeatsState.Clear();
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);
}
}
//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);
// }
//}
}
/// <summary>
/// 清除报警
/// </summary>
/// <returns></returns>
public bool ClearAllError()
{
return StateService.SetAllNoError();
}
///// <summary>
///// 清除报警
///// </summary>
///// <returns></returns>
//public bool ClearAllError()
//{
// return StateService.SetAllNoError();
//}
/// <summary>
/// 秒转时间

@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace RFIDSocket
{
/// <summary>
/// 另起一个线程跑Loading SplashScreen窗口由主进程执行耗时操作
/// </summary>
public class SplashScreenManager
{
//自定义传入窗口,异步显示
private Form LoadingForm;
/// <summary>
/// 初始化SplashScreenManager需要传入一个Form窗体对象
/// </summary>
/// <param name="ParentForm">The Parent Form of LoadingForm </param>
/// <param name="loadControl">LoadingForm To Show</param>
public SplashScreenManager(Form LoadingForm)
{
this.LoadingForm = LoadingForm;
}
private void ShowWaitForm()
{
LoadingForm.BringToFront();//放在前端显示
LoadingForm.Activate(); //当前窗体是LoadingForm
LoadingForm.ShowDialog();
}
/// <summary>
/// 显示加载窗体
/// </summary>
public void ShowLoading()
{
MethodInvoker invoker = new MethodInvoker(ShowWaitForm);
invoker.BeginInvoke(null, null);
/*Console.WriteLine("等待Loading窗体实例化"); */
while (!LoadingForm.IsHandleCreated) { }
// 把显示窗体放到最前面
LoadingForm.Invoke(new MethodInvoker(() =>
{
LoadingForm.BringToFront();//放在前端显示
LoadingForm.Activate(); //当前窗体是LoadingForm
}));
}
/// <summary>
/// 关闭loading窗体
/// </summary>
public void CloseWaitForm()
{
int err_count = 0;
try
{
LoadingForm.Invoke(new MethodInvoker(() =>
{
LoadingForm.Close();
}));
}
catch (Exception)
{
//防止未初始化,重复去close,直到OK
bool isOK = false;
err_count++;
while (!isOK && err_count < 20)
{
try
{
isOK = true;
LoadingForm.Invoke(new MethodInvoker(() =>
{
LoadingForm.Close();
}));
}
catch (Exception) { isOK = false; err_count++; }
}
}
finally
{
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Loading…
Cancel
Save