1
0
Fork 0

feat - 选择读取次数最多的标签

master
SoulStar 2 months ago
parent 6d5403b591
commit c3fb4d5f51

@ -27,7 +27,7 @@ namespace HighWayIot.Plc
/// <summary>
/// 静态懒加载MelsecMcNet2
/// </summary>
private static readonly MelsecMcNet MelsecInstance2 = new PlcConnect().CreateAb("192.168.0.8");
private static readonly MelsecMcNet MelsecInstance2 = new PlcConnect().CreateAb("10.20.48.225");
private PlcConnect()
{

@ -148,12 +148,14 @@ namespace HighWayIot.Winform.Business
public void ReciveRFIDSingal(byte[] bytes, string ip)
{
Receive02HEntity entity = _rfidDataAnalyse.Receive02H(bytes);
if(entity.TagCount != 1)
{
_logHelper.Error("返回多标签!");
return;
}
byte[] data = entity.Data[0].EPC;
//if(entity.TagCount != 1)
//{
// _logHelper.Error("返回多标签!");
// return;
//}
//找到读取次数最大的标签EPC
byte[] data = entity.Data.Where(x => x.Count == entity.Data.Max(y => y.Count)).First().EPC;
//标签号byte数组转换成字符串
string result = string.Join(" ", data.Select(x => x.ToString("X2")));

Loading…
Cancel
Save