change - 修改逻辑

master
wenjy 1 month ago
parent c7b19faa98
commit 11fead73dc

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

@ -28,6 +28,8 @@ public class ScanLogSocket
public string ocr { get; set; }
public string url { get; set; }
public string result { get; set; }
}

@ -40,7 +40,7 @@
<StackPanel Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal">
<Button Content="首 页" x:Name="Index" Command="{Binding ControlOnClickCommand}" CommandParameter="{Binding Name,ElementName=Index}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#5095F3" BorderBrush="#5095F3" Margin="10,0,10,0"/>
<Button Content="数据记录" x:Name="History" Command="{Binding ControlOnClickCommand}" CommandParameter="{Binding Name,ElementName=History}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>
<Button Content="日志信息" x:Name="Log" Command="{Binding ControlOnClickCommand}" CommandParameter="{Binding Name,ElementName=Log}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>
<Button Content="日志信息" x:Name="LogInfo" Command="{Binding ControlOnClickCommand}" CommandParameter="{Binding Name,ElementName=LogInfo}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>
<Button Content="系统版本" x:Name="Version" Command="{Binding ControlOnClickCommand}" CommandParameter="{Binding Name,ElementName=Version}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>
<Button Content="键 盘" Command="{Binding OpenSystemKeyboardCommand}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>
<Button Content="最小化" x:Name="Minimized" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Minimized}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#FF9900" BorderBrush="#FF9900" Margin="0,0,10,0"/>

@ -0,0 +1,70 @@
<UserControl x:Class="SlnMesnac.WPF.Page.LogInfo.LogInfoControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SlnMesnac.WPF.Page.LogInfo"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="14*"/>
</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">
<ComboBoxItem>INFO</ComboBoxItem>
<ComboBoxItem>WARN</ComboBoxItem>
<ComboBoxItem>ERROR</ComboBoxItem>
<ComboBoxItem>所有</ComboBoxItem>
<!--<ComboBox.Template>
<ControlTemplate TargetType="ComboBox">
<Border Background="White" BorderBrush="White" BorderThickness="1" CornerRadius="5">
<ScrollViewer x:Name="PART_ContentHost" />
</Border>
</ControlTemplate>
</ComboBox.Template>-->
</ComboBox>
<TextBlock Text="日志时间" FontSize="18" Foreground="#31446E" Margin="20,3,10,0"/>
<DatePicker x:Name="BeginTimeDatePicker" SelectedDate="{Binding BeginTime}" Width="120" VerticalAlignment="Center" Margin="0,0,5,0"/>
<TextBlock Text="-" FontSize="18" Foreground="#31446E" Margin="10,3"/>
<DatePicker x:Name="EndTimeDatePicker" SelectedDate="{Binding EndTime}" Width="120" VerticalAlignment="Center" Margin="0,0,5,0"/>
<Button Content="查 询" Command="{Binding QueryCommand}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#5095F3" BorderBrush="#5095F3" Margin="10,0,10,0"/>
<Button Content="导 出" Command="{Binding ExportCommand}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>
</StackPanel>
</Border>
<Border Grid.Row="1" BorderBrush="#EBF4FD" BorderThickness="2" CornerRadius="10" Background="#EBF4FD" Margin="10,10">
<DataGrid Grid.Row="0" ItemsSource="{Binding ScanItems}" Background="Transparent"
FontSize="18" ColumnHeaderHeight="35"
RowHeight="31" AutoGenerateColumns="False" RowHeaderWidth="0"
GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0" CanUserAddRows="False" HorizontalAlignment="Center"
Foreground="#31446E" x:Name="dataGrid" Margin="0,10,0,0" >
<!--resourceStyle 399行修改选中字体颜色-->
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding CreateTime ,StringFormat=\{0:yyyy-MM-dd HH:mm:ss\}}" Header="记录时间" Width="1.5*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Rfid}" Header="RFID" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Code}" Header="ATR" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Ocr}" Header="OCR" Width="2*" IsReadOnly="True"/>
<DataGridTextColumn Binding="{Binding Url}" Header="图像路径" Width="2*" IsReadOnly="True"/>
</DataGrid.Columns>
</DataGrid>
</Border>
</Grid>
</UserControl>

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace SlnMesnac.WPF.Page.LogInfo
{
/// <summary>
/// LogInfoControl.xaml 的交互逻辑
/// </summary>
public partial class LogInfoControl : UserControl
{
public LogInfoControl()
{
InitializeComponent();
}
}
}

@ -5,6 +5,7 @@ using Microsoft.Extensions.Logging;
using SlnMesnac.Business;
using SlnMesnac.WPF.Page;
using SlnMesnac.WPF.Page.History;
using SlnMesnac.WPF.Page.LogInfo;
using SlnMesnac.WPF.Page.Version;
using System;
using System.Windows;
@ -18,6 +19,7 @@ namespace SlnMesnac.WPF.ViewModel
private IndexControl indexControl = new IndexControl();
private HistoryControl historyControl = new HistoryControl();
private LogInfoControl logInfoControl = new LogInfoControl();
#region 参数定义
/// <summary>
@ -168,7 +170,8 @@ namespace SlnMesnac.WPF.ViewModel
UserContent = indexControl; break;
case "History":
UserContent = historyControl; break;
//historyControl
case "LogInfo":
UserContent = logInfoControl; break;
case "Version":
VersionInfoWindow versionInfoWindow = new VersionInfoWindow();
versionInfoWindow.Topmost = true; // 设置为最顶层

Loading…
Cancel
Save