diff --git a/SlnMesnac.TouchSocket/ApiServer.cs b/SlnMesnac.TouchSocket/ApiServer.cs index 05aa421..eb09fb1 100644 --- a/SlnMesnac.TouchSocket/ApiServer.cs +++ b/SlnMesnac.TouchSocket/ApiServer.cs @@ -76,7 +76,7 @@ namespace SlnMesnac.TouchSocket log.Content = hk.ToJsonString(); try { - FilterBuffer(ref hk); + FilterBuffer(ref hk, out string result); ScanLogSocket scan = new ScanLogSocket() @@ -86,7 +86,8 @@ namespace SlnMesnac.TouchSocket ocr = hk.ocr, rfid = hk.rfid, timestamp = hk.timestamp, - url = hk.url + url = hk.url, + result = result }; ba = ScanBack(scan); @@ -186,16 +187,6 @@ namespace SlnMesnac.TouchSocket //_logger.LogInformation("扫描数据回传接口"); //_logger.LogInformation("{Data}", scanLog.ToJsonString()); - string result = string.Empty; - if (string.IsNullOrEmpty(scanLog.code) || scanLog.code == "noread") - { - result = scanLog.rfid; - } - else - { - result = scanLog.code; - } - var model = new ScanLogModel() { CreateTime = scanLog.CreateTime, @@ -204,7 +195,7 @@ namespace SlnMesnac.TouchSocket Rfid = scanLog.rfid, Ocr = scanLog.ocr, Url = scanLog.url, - Result = result, + Result = scanLog.result, }; ScanLogSocketAction?.Invoke(model); @@ -233,17 +224,23 @@ namespace SlnMesnac.TouchSocket } - private void FilterBuffer(ref Hk hk) + private void FilterBuffer(ref Hk hk,out string result) { try { + result = string.Empty; + if (hk.rfid == "noread" || string.IsNullOrEmpty(hk.rfid)) { - if (!string.IsNullOrEmpty(hk.code) && hk.code != "noread") + if (!string.IsNullOrEmpty(hk.code) && hk.code != "NoRead") { - hk.rfid = hk.code; + result = hk.code; } + else + { + result = hk.rfid; + } } else { @@ -253,7 +250,7 @@ namespace SlnMesnac.TouchSocket if (buffer.Length > 1) { hk.rfid = "多条码"; - + result = "多条码"; } else { @@ -262,12 +259,13 @@ namespace SlnMesnac.TouchSocket { AnasysBuffer(ref rfidStr); - if(rfidStr != hk.code && !string.IsNullOrEmpty(hk.code) && hk.code != "noread") + if(rfidStr != hk.code && !string.IsNullOrEmpty(hk.code) && hk.code != "NoRead") { - hk.rfid = hk.code; + result = hk.code; } else { + result = rfidStr; hk.rfid = rfidStr; } } @@ -275,11 +273,23 @@ namespace SlnMesnac.TouchSocket } //处理ATR数据 - if (string.IsNullOrEmpty(hk.code) || hk.code == "noread") + if (string.IsNullOrEmpty(hk.code) || hk.code == "NoRead") { if (hk.rfid != "多条码" && hk.rfid != "noread") { - hk.code = hk.rfid; + result = hk.rfid; + }else + { + + + if(hk.rfid == "多条码") + { + result = hk.rfid; + } + else + { + result = hk.code; + } } } diff --git a/SlnMesnac.TouchSocket/ScanLogSocket.cs b/SlnMesnac.TouchSocket/ScanLogSocket.cs index 3108d98..8121a4d 100644 --- a/SlnMesnac.TouchSocket/ScanLogSocket.cs +++ b/SlnMesnac.TouchSocket/ScanLogSocket.cs @@ -28,6 +28,8 @@ public class ScanLogSocket public string ocr { get; set; } public string url { get; set; } + + public string result { get; set; } } diff --git a/SlnMesnac.WPF/MainWindow.xaml b/SlnMesnac.WPF/MainWindow.xaml index b8ae1c9..7d41068 100644 --- a/SlnMesnac.WPF/MainWindow.xaml +++ b/SlnMesnac.WPF/MainWindow.xaml @@ -40,7 +40,7 @@