diff --git a/SlnMesnac.Business/TagScanBusiness.cs b/SlnMesnac.Business/TagScanBusiness.cs index 82044d4..c41deda 100644 --- a/SlnMesnac.Business/TagScanBusiness.cs +++ b/SlnMesnac.Business/TagScanBusiness.cs @@ -153,7 +153,8 @@ namespace SlnMesnac.Business if (tagScanList.Count > 0) { - var isOkList = tagScanList.Where(x => x.IsOk == "Ok").ToList(); + //var isOkList = tagScanList.Where(x => x.IsOk == "Ok").ToList(); + var isOkList = tagScanList.Where(x => x.IsOk != "NG").ToList(); double passRate = ((double)isOkList.Count / (double)tagScanList.Count)*100; diff --git a/SlnMesnac.TouchSocket/ApiServer.cs b/SlnMesnac.TouchSocket/ApiServer.cs index 838aa7b..e0b53b7 100644 --- a/SlnMesnac.TouchSocket/ApiServer.cs +++ b/SlnMesnac.TouchSocket/ApiServer.cs @@ -219,9 +219,15 @@ namespace SlnMesnac.TouchSocket //_logger.LogInformation("扫描数据回传接口"); //_logger.LogInformation("{Data}", scanLog.ToJsonString()); + _logger.LogInformation($"收到接口数据:{scanLog.ToJsonString()}"); + DateTimeOffset dateTimeOffset = DateTimeOffset.FromUnixTimeMilliseconds(scanLog.timestamp); + + + _logger.LogInformation($"时间戳: {scanLog.timestamp};转换为时间:{dateTimeOffset.LocalDateTime};{dateTimeOffset.LocalDateTime}"); + var model = new ScanLogModel() { - CreateTime = scanLog.CreateTime, + CreateTime = dateTimeOffset.LocalDateTime, DataType = scanLog.data_type, Code = scanLog.code, Rfid = scanLog.rfid, @@ -336,12 +342,13 @@ namespace SlnMesnac.TouchSocket } else { + string mulRes = string.Empty; string[] buffer = hk.code.Split(","); if (buffer.Length > 1) { - hk.code = "多条码"; - + //hk.code = "多条码"; + mulRes = "多条码"; } if (hk.rfid == hk.code && !string.IsNullOrEmpty(hk.rfid) && hk.rfid != "NoRead" && hk.rfid != "多条码") @@ -350,7 +357,15 @@ namespace SlnMesnac.TouchSocket } else { - result = hk.code; + if(hk.code.Contains(hk.rfid)) + { + hk.code = hk.rfid; + result = hk.code; + } + else + { + result = mulRes; + } } } diff --git a/SlnMesnac.TouchSocket/ScanLogSocket.cs b/SlnMesnac.TouchSocket/ScanLogSocket.cs index b4e2a50..108d78f 100644 --- a/SlnMesnac.TouchSocket/ScanLogSocket.cs +++ b/SlnMesnac.TouchSocket/ScanLogSocket.cs @@ -10,11 +10,12 @@ public class ScanLogSocket public DateTime CreateTime { - get - { - DateTimeOffset dateTimeOffset = DateTimeOffset.FromUnixTimeMilliseconds(timestamp); - return dateTimeOffset.UtcDateTime; - } + //get + //{ + // DateTimeOffset dateTimeOffset = DateTimeOffset.FromUnixTimeMilliseconds(timestamp); + // return dateTimeOffset.UtcDateTime; + //} + get; set; } public long timestamp { get; set; } diff --git a/SlnMesnac.WPF/SlnMesnac.WPF.csproj b/SlnMesnac.WPF/SlnMesnac.WPF.csproj index 1cd4eab..2684764 100644 --- a/SlnMesnac.WPF/SlnMesnac.WPF.csproj +++ b/SlnMesnac.WPF/SlnMesnac.WPF.csproj @@ -1,7 +1,7 @@  - Exe + WinExe net6.0-windows enable true diff --git a/SlnMesnac.WPF/ViewModel/IndexViewModel.cs b/SlnMesnac.WPF/ViewModel/IndexViewModel.cs index 0f58fce..438c74a 100644 --- a/SlnMesnac.WPF/ViewModel/IndexViewModel.cs +++ b/SlnMesnac.WPF/ViewModel/IndexViewModel.cs @@ -51,7 +51,7 @@ namespace SlnMesnac.WPF.ViewModel private void Init() { - PassRate = tagScanBusiness.TagScanPassRate(); + //PassRate = tagScanBusiness.TagScanPassRate(); // 初始化数据 RecogEfficiency = new SeriesCollection @@ -169,7 +169,10 @@ namespace SlnMesnac.WPF.ViewModel TagAmount++; - PassRate = tagScanBusiness.TagScanPassRate(); + //PassRate = tagScanBusiness.TagScanPassRate(); + var isOkList = scanLogModelsItems.Where(x => x.IsOk != "Ng").ToList(); + double passRate = ((double)isOkList.Count / (double)scanLogModelsItems.Count) * 100; + PassRate = Math.Round(passRate, 2); }); };