change - 添加日志类型:包裹数据、设备监控、系统数据

master
wenjy 1 month ago
parent 298016d048
commit 290b596604

@ -48,7 +48,7 @@ namespace SlnMesnac.Business
/// <param name="beginTime"></param>
/// <param name="endTime"></param>
/// <param name="result"></param>
public void QueryLogInfo(string logLevel, DateTime beginTime, DateTime endTime, out List<BaseLog> result)
public void QueryLogInfo(string logType, string logLevel, DateTime beginTime, DateTime endTime, out List<BaseLog> result)
{
//var info = scanLogService.Query(x => x.CreateTime >= beginTime && x.CreateTime <= endTime);
Expression<Func<BaseLog, bool>> 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();

@ -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);

@ -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; }

@ -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

@ -13,17 +13,16 @@
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="#EBF4FD" BorderThickness="2" CornerRadius="10" Background="#EBF4FD" Margin="10,10">
<StackPanel Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal">
<TextBlock Text="日志类型" FontSize="18" Foreground="#31446E" Margin="10,3"/>
<!--<TextBox Text="{Binding RfidCode}" FontSize="24" Grid.Row="1" Width="180" Height="30" VerticalContentAlignment="Center" HorizontalAlignment="Center" Padding="5">
<TextBox.Template>
<ControlTemplate TargetType="TextBox">
<Border Background="White" BorderBrush="White" BorderThickness="1" CornerRadius="5">
<ScrollViewer x:Name="PART_ContentHost" />
</Border>
</ControlTemplate>
</TextBox.Template>
</TextBox>-->
<ComboBox SelectedItem="{Binding LogType}" FontSize="16" Grid.Row="1" Width="180" Height="30" VerticalContentAlignment="Center" HorizontalAlignment="Center" Padding="5">
<ComboBoxItem>包裹数据</ComboBoxItem>
<ComboBoxItem>设备监控</ComboBoxItem>
<ComboBoxItem>系统数据</ComboBoxItem>
<ComboBoxItem IsSelected="True">所有</ComboBoxItem>
</ComboBox>
<TextBlock Text="日志级别" FontSize="18" Foreground="#31446E" Margin="10,3"/>
<ComboBox SelectedItem="{Binding LogLevel}" FontSize="16" Grid.Row="1" Width="180" Height="30" VerticalContentAlignment="Center" HorizontalAlignment="Center" Padding="5">
<ComboBoxItem>Info</ComboBoxItem>
<ComboBoxItem>Warn</ComboBoxItem>
@ -51,6 +50,7 @@
<!--resourceStyle 399行修改选中字体颜色-->
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Id}" Header="序号" Width="1*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding LogType}" Header="日志类型" Width="1*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding LogLevel}" Header="日志级别" Width="1*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Content}" Header="日志内容" Width="3*" IsReadOnly="True">
<DataGridTextColumn.ElementStyle>

@ -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<BaseLog> info);
string logType = _logType == null ? string.Empty : _logType.Content.ToString();
logInfoBusiness.QueryLogInfo(logType, logLevel, _beginTime, _endTime, out List<BaseLog> info);
ScanItems = new ObservableCollection<BaseLog>(info);
}

Loading…
Cancel
Save