From 60b79724b35a22015c4c7256fae675c5ecdc49cb Mon Sep 17 00:00:00 2001 From: wenjy Date: Thu, 12 Dec 2024 17:50:12 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20RFID=E6=9D=A1=E7=A0=81=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SlnMesnac.TouchSocket/ApiServer.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/SlnMesnac.TouchSocket/ApiServer.cs b/SlnMesnac.TouchSocket/ApiServer.cs index 9235584..e92e074 100644 --- a/SlnMesnac.TouchSocket/ApiServer.cs +++ b/SlnMesnac.TouchSocket/ApiServer.cs @@ -96,7 +96,7 @@ namespace SlnMesnac.TouchSocket if(result != "多条码" && result != "noread" && result != "NoRead" && !string.IsNullOrEmpty(result)) { - isOk = "Ok"; + isOk = "OK"; }else if(result == "多条码") { isOk = "Mul"; @@ -257,10 +257,23 @@ namespace SlnMesnac.TouchSocket { if(rfidStr != "noread") { - string bufferHex = rfidStr.Substring(bufferStart.Length, bufferBody.Length); + int hexLength = Convert.ToInt32(rfidStr.Substring(4, 2)); + + string bufferHex = rfidStr.Substring(bufferStart.Length, hexLength * 2); long decimalValue = Convert.ToInt64(bufferHex, 16); + //if (rfidStr.Contains("0C2")) + //{ + // rfidStr = decimalValue.ToString().PadLeft(10, '0'); + //} + //else + //{ + // rfidStr = decimalValue.ToString(); + //} + rfidStr = decimalValue.ToString(); + + } }