From 290b596604b06a992a3d30d18780ded9ac18999a Mon Sep 17 00:00:00 2001 From: wenjy Date: Wed, 9 Oct 2024 17:04:45 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E6=B7=BB=E5=8A=A0=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E7=B1=BB=E5=9E=8B=EF=BC=9A=E5=8C=85=E8=A3=B9=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E3=80=81=E8=AE=BE=E5=A4=87=E7=9B=91=E6=8E=A7=E3=80=81?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SlnMesnac.Business/LogInfoBusiness.cs | 11 ++++++++++- SlnMesnac.Business/TagScanBusiness.cs | 2 +- SlnMesnac.Model/domain/BaseCode.cs | 3 +++ SlnMesnac.TouchSocket/ApiServer.cs | 2 ++ SlnMesnac.WPF/Page/LogInfo/LogInfoControl.xaml | 18 +++++++++--------- SlnMesnac.WPF/ViewModel/LogInfoViewModel.cs | 10 +++++++++- 6 files changed, 34 insertions(+), 12 deletions(-) diff --git a/SlnMesnac.Business/LogInfoBusiness.cs b/SlnMesnac.Business/LogInfoBusiness.cs index 23d117d..71ccd93 100644 --- a/SlnMesnac.Business/LogInfoBusiness.cs +++ b/SlnMesnac.Business/LogInfoBusiness.cs @@ -48,7 +48,7 @@ namespace SlnMesnac.Business /// /// /// - public void QueryLogInfo(string logLevel, DateTime beginTime, DateTime endTime, out List result) + public void QueryLogInfo(string logType, string logLevel, DateTime beginTime, DateTime endTime, out List result) { //var info = scanLogService.Query(x => x.CreateTime >= beginTime && x.CreateTime <= endTime); Expression> exp = s1 => true; @@ -67,6 +67,15 @@ namespace SlnMesnac.Business exp = exp.And(x => x.LogLevel == logLevel); } + if (!string.IsNullOrEmpty(logType) && logType != "所有") + { + if(logType == "系统数据") + { + logType = "1"; + } + exp = exp.And(x => x.LogType == logType); + } + var list = logService.Query(exp); result = list.OrderByDescending(x => x.CreateTime).ToList(); diff --git a/SlnMesnac.Business/TagScanBusiness.cs b/SlnMesnac.Business/TagScanBusiness.cs index 049e35d..82044d4 100644 --- a/SlnMesnac.Business/TagScanBusiness.cs +++ b/SlnMesnac.Business/TagScanBusiness.cs @@ -134,7 +134,7 @@ namespace SlnMesnac.Business if (!string.IsNullOrEmpty(rfidStr)) { - exp = exp.And(x => x.Rfid == rfidStr); + exp = exp.And(x => x.Rfid == rfidStr || x.Code == rfidStr || x.Result == rfidStr); } var list = scanLogService.Query(exp); diff --git a/SlnMesnac.Model/domain/BaseCode.cs b/SlnMesnac.Model/domain/BaseCode.cs index d0aa1fa..aaf2c29 100644 --- a/SlnMesnac.Model/domain/BaseCode.cs +++ b/SlnMesnac.Model/domain/BaseCode.cs @@ -54,6 +54,9 @@ namespace SlnMesnac.Model.domain [SugarColumn(ColumnName = "createtime")] public DateTime CreateTime { get; set; } + [SugarColumn(ColumnName = "log_type")] + public string LogType { get; set; } + [SugarColumn(ColumnName = "log_level")] public string LogLevel { get; set; } diff --git a/SlnMesnac.TouchSocket/ApiServer.cs b/SlnMesnac.TouchSocket/ApiServer.cs index d37b0cd..838aa7b 100644 --- a/SlnMesnac.TouchSocket/ApiServer.cs +++ b/SlnMesnac.TouchSocket/ApiServer.cs @@ -80,6 +80,7 @@ namespace SlnMesnac.TouchSocket BaseLog log = new BaseLog(); log.LogLevel = "Info"; log.ErrMsg = ""; + log.LogType = "包裹数据"; log.Content = hk.ToJsonString(); try { @@ -162,6 +163,7 @@ namespace SlnMesnac.TouchSocket { LogLevel = "Info", ErrMsg = "", + LogType = "设备监控", Content = scanStatus.ToJsonString() }; try diff --git a/SlnMesnac.WPF/Page/LogInfo/LogInfoControl.xaml b/SlnMesnac.WPF/Page/LogInfo/LogInfoControl.xaml index 879aada..b903fae 100644 --- a/SlnMesnac.WPF/Page/LogInfo/LogInfoControl.xaml +++ b/SlnMesnac.WPF/Page/LogInfo/LogInfoControl.xaml @@ -13,17 +13,16 @@ + - + + 包裹数据 + 设备监控 + 系统数据 + 所有 + + Info Warn @@ -51,6 +50,7 @@ + diff --git a/SlnMesnac.WPF/ViewModel/LogInfoViewModel.cs b/SlnMesnac.WPF/ViewModel/LogInfoViewModel.cs index cd15baa..2295236 100644 --- a/SlnMesnac.WPF/ViewModel/LogInfoViewModel.cs +++ b/SlnMesnac.WPF/ViewModel/LogInfoViewModel.cs @@ -46,6 +46,13 @@ namespace SlnMesnac.WPF.ViewModel } + public ComboBoxItem _logType = null; + public ComboBoxItem LogType + { + get => _logType; + set => SetProperty(ref _logType, value); + } + public ComboBoxItem _logLevel = null; public ComboBoxItem LogLevel { @@ -78,7 +85,8 @@ namespace SlnMesnac.WPF.ViewModel private void Query() { string logLevel = _logLevel == null ? string.Empty : _logLevel.Content.ToString(); - logInfoBusiness.QueryLogInfo(logLevel, _beginTime, _endTime, out List info); + string logType = _logType == null ? string.Empty : _logType.Content.ToString(); + logInfoBusiness.QueryLogInfo(logType, logLevel, _beginTime, _endTime, out List info); ScanItems = new ObservableCollection(info); }