1.GPI日志

master
zhangxy 2 weeks ago
parent c85cf6f0b4
commit 77a5559f8d

@ -6,7 +6,7 @@
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:SocketExample"
mc:Ignorable="d"
Title="RFID读写器多终端监控软件v1.05" Height="450" Width="800">
Title="RFID读写器多终端监控软件v1.051" Height="450" Width="800">
<Window.Resources>
<Style x:Key="SocketButton" TargetType="Button" BasedOn="{StaticResource BaseButtonStyle}">
@ -404,7 +404,13 @@
<StackPanel Grid.Column="0" Orientation="Horizontal">
<Label Content="GPI1" HorizontalAlignment="Left" Margin="0 0 6 0"/>
<Border BorderBrush="Black" BorderThickness="0.5">
<Label Content="{Binding GPI1}"></Label>
<Label Content="{Binding GPI1}" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="">
</i:EventTrigger>
</i:Interaction.Triggers>
</Label>
</Border>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal">

@ -137,10 +137,10 @@ namespace SocketExample
public string GPO3 { get => _gpo3; set { _gpo3 = value; OnPropertyChanged(); } }
public string GPO4 { get => _gpo4; set { _gpo4 = value; OnPropertyChanged(); } }
public string GPI1 { get => _gpi1; set { _gpi1 = value; OnPropertyChanged(); } }
public string GPI2 { get => _gpi2; set { _gpi2 = value; OnPropertyChanged(); } }
public string GPI3 { get => _gpi3; set { _gpi3 = value; OnPropertyChanged(); } }
public string GPI4 { get => _gpi4; set { _gpi4 = value; OnPropertyChanged(); } }
public string GPI1 { get => _gpi1; set { if (_gpi1 != value && _gpi1 != null) { _gpi1 = value; LabelPropertyChanged(); } else { _gpi1 = value; OnPropertyChanged(); } } }
public string GPI2 { get => _gpi2; set { if (_gpi2 != value && _gpi1 != null) { _gpi2 = value; LabelPropertyChanged(); } else { _gpi2 = value; OnPropertyChanged(); } } }
public string GPI3 { get => _gpi3; set { if (_gpi3 != value && _gpi1 != null) { _gpi3 = value; LabelPropertyChanged(); } else { _gpi3 = value; OnPropertyChanged(); } } }
public string GPI4 { get => _gpi4; set { if (_gpi4 != value && _gpi1 != null) { _gpi4 = value; LabelPropertyChanged(); } else { _gpi4 = value; OnPropertyChanged(); } } }
private string _moduleinfo;
private string _motherboardhardware;
@ -250,6 +250,7 @@ namespace SocketExample
private Task onRecieved(ITcpClient client, ReceivedDataEventArgs e) //接收事件
{
path = "";
string time = DateTime.Now.ToString();
string currentTime = time.Substring(9, time.Length-9);
var mes = e.ByteBlock.Span.ToString(Encoding.UTF8);
@ -293,7 +294,7 @@ namespace SocketExample
startTemp += 16 + TempLength;
string year = DateTime.Now.ToString("yyyy-MM-dd");
EnsureFolderExists($"日志文件夹/{year}/{Text}");
path = $"日志文件夹/{year}/{Text}/" + path + Text +"("+ IPtext+")"+ ".txt";
path = $"日志文件夹/{year}/{Text}/" + Text +"("+ IPtext+")"+ ".txt";
EnsureTxtExists(path,Text, IPtext, Porttext);
writeToTxt(path, $"接收消息:{hexString}\nEPC:{taglist[j].EPCstring}\nHEX:{EPCinfo}\nRSSI:{taglist[j].RSSI.ToString()} Count:{taglist[j].Count.ToString()} Time:{Timeinfo}\n____________________________");
path = "";
@ -329,7 +330,7 @@ namespace SocketExample
startTemp += 16 + TempLength;
string year = DateTime.Now.ToString("yyyy-MM-dd");
EnsureFolderExists($"日志文件夹/{year}/{Text}");
path = $"日志文件夹/{year}/{Text}/" + path + Text + "(" + IPtext + ")" + ".txt";
path = $"日志文件夹/{year}/{Text}/" + Text + "(" + IPtext + ")" + ".txt";
EnsureTxtExists(path, Text, IPtext, Porttext);
writeToTxt(path, $"接收消息:{hexString}\nEPC:{taglist[j].EPCstring}\nHEX:{EPCinfo}\nRSSI:{taglist[j].RSSI.ToString()} Count:{taglist[j].Count.ToString()} Time:{Timeinfo}\n____________________________");
path = "";
@ -466,7 +467,7 @@ namespace SocketExample
}
break;
default:
Infotext += $"default";
//Infotext += $"default";
break;
}
@ -489,7 +490,7 @@ namespace SocketExample
TagItems = items;
string year = DateTime.Now.ToString("yyyy-MM-dd");
EnsureFolderExists($"日志文件夹/{year}/{Text}");
path = $"日志文件夹/{year}/{Text}/" + path + Text + "(" + IPtext + ")" + ".txt";
path = $"日志文件夹/{year}/{Text}/" + Text + "(" + IPtext + ")" + ".txt";
EnsureTxtExists(path, Text, IPtext, Porttext);
writeToTxt(path, $"接收消息:{hexString}\nEPC:{EPCASC}\nHEX:{EPCinfo}\nRSSI:{RSSIinfo} Count:{Countinfo} Time:{Timeinfo}\n____________________________");
path = "";
@ -961,6 +962,47 @@ namespace SocketExample
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
protected void LabelPropertyChanged([CallerMemberName] string propertyName = null)
{
if(GPI1 == "" || GPI2 == ""|| GPI3 == ""|| GPI4 == "" || GPI1 ==null || GPI2 == null || GPI3 == null || GPI4 == null ||client == null)
{
return;
}
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
string year = DateTime.Now.ToString("yyyy-MM-dd");
EnsureFolderExists($"日志文件夹/{year}/{Text}");
string temppath = $"日志文件夹/{year}/{Text}/" + Text + "GPI"+"(" + IPtext + ")" + ".txt";
EnsureTxtExists(temppath, Text, IPtext, Porttext);
string GPIname = "";
string front = "";
string back = "";
switch (propertyName)
{
case "GPI1":
GPIname = "GPI1";
back = GPI1;
break;
case "GPI2":
GPIname = "GPI2";
back = GPI2;
break;
case "GPI3":
GPIname = "GPI3";
back = GPI3;
break;
case "GPI4":
GPIname = "GPI4";
back = GPI4;
break;
}
if (back == "高")
front = "低";
else
front = "高";
writeToTxt(temppath,$"{GPIname}:{front} => {back}\n当前状态GPI1:{GPI1} GPI2:{GPI2} GPI3:{GPI3} GPI4:{GPI4}\n当前时间{year}\n ______________________________");
}
public class TagItem : INotifyPropertyChanged
{
private string _originmessage;//原始数据

Loading…
Cancel
Save