LY5源码

master
CaesarBao 4 months ago
parent 43f1f4bf8a
commit 7606da8535

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/projectSettingsUpdater.xml
/modules.xml
/contentModel.xml
/.idea.MaterialTraceability.iml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

@ -404,7 +404,7 @@ namespace MaterialTraceability.Business
LogHelper.Info(String.Format("{0}设备信息:{1}", resource, JsonChange.ModeToJson(deviceInfo)));
if (deviceInfo.materialType == 1)
{
return true;
return false;
}
else
{

@ -40,7 +40,7 @@
<add key="WriteDbm" value="10" />
<add key="AnalysisFlag" value="1" />
<add key="userName" value="Admin" />
<add key="roleId" value="Admin" />
<add key="roleId" value="1" />
<add key="tagAmount" value="3" />
<add key="readTime" value="10" />
</appSettings>

@ -961,9 +961,10 @@ namespace MaterialTraceabilityUI
/// <param name="e"></param>
private void UpLeftFinish_Cilck(object sender, RoutedEventArgs e)
{
if (!"1".Equals(ConfigHelper.GetConfig("roleId"))&& !"2".Equals(ConfigHelper.GetConfig("roleId")))
int roleId = Convert.ToInt32(ConfigHelper.GetConfig("roleId"));
if (roleId > 3 || roleId == 0)
{
System.Windows.MessageBox.Show("请登录系统管理账号进行操作");
System.Windows.MessageBox.Show($"请登录系统管理账号进行操作当前用户角色ID{roleId}");
}
else
{
@ -991,9 +992,10 @@ namespace MaterialTraceabilityUI
/// <param name="e"></param>
private void UpRightFinish_Cilck(object sender, RoutedEventArgs e)
{
if (!"1".Equals(ConfigHelper.GetConfig("roleId")) && !"2".Equals(ConfigHelper.GetConfig("roleId")))
int roleId = Convert.ToInt32(ConfigHelper.GetConfig("roleId"));
if (roleId > 3 || roleId == 0)
{
System.Windows.MessageBox.Show("请登录系统管理账号进行操作");
System.Windows.MessageBox.Show($"请登录系统管理账号进行操作当前用户角色ID{roleId}");
}
else
{
@ -1022,9 +1024,10 @@ namespace MaterialTraceabilityUI
/// <param name="e"></param>
private void DownLeftFinish_Cilck(object sender, RoutedEventArgs e)
{
if (!"1".Equals(ConfigHelper.GetConfig("roleId")) && !"2".Equals(ConfigHelper.GetConfig("roleId")))
int roleId = Convert.ToInt32(ConfigHelper.GetConfig("roleId"));
if (roleId > 3 || roleId == 0)
{
System.Windows.MessageBox.Show("请登录系统管理账号进行操作");
System.Windows.MessageBox.Show($"请登录系统管理账号进行操作当前用户角色ID{roleId}");
}
else
{
@ -1053,9 +1056,10 @@ namespace MaterialTraceabilityUI
/// <param name="e"></param>
private void DownRightFinish_Cilck(object sender, RoutedEventArgs e)
{
if (!"1".Equals(ConfigHelper.GetConfig("roleId")) && !"2".Equals(ConfigHelper.GetConfig("roleId")))
int roleId = Convert.ToInt32(ConfigHelper.GetConfig("roleId"));
if (roleId > 3 || roleId == 0)
{
System.Windows.MessageBox.Show("请登录系统管理账号进行操作");
System.Windows.MessageBox.Show($"请登录系统管理账号进行操作当前用户角色ID{roleId}");
}
else
{
@ -1216,9 +1220,10 @@ namespace MaterialTraceabilityUI
/// <param name="e"></param>
private void LeftFinish_Cilck(object sender, RoutedEventArgs e)
{
if (!"1".Equals(ConfigHelper.GetConfig("roleId")) && !"2".Equals(ConfigHelper.GetConfig("roleId")))
int roleId = Convert.ToInt32(ConfigHelper.GetConfig("roleId"));
if (roleId > 3 || roleId == 0)
{
System.Windows.MessageBox.Show("请登录系统管理账号进行操作");
System.Windows.MessageBox.Show($"请登录系统管理账号进行操作当前用户角色ID{roleId}");
}
else
{
@ -1236,9 +1241,10 @@ namespace MaterialTraceabilityUI
/// <param name="e"></param>
private void RightFinish_Cilck(object sender, RoutedEventArgs e)
{
if (!"1".Equals(ConfigHelper.GetConfig("roleId")) && !"2".Equals(ConfigHelper.GetConfig("roleId")))
int roleId = Convert.ToInt32(ConfigHelper.GetConfig("roleId"));
if (roleId > 3 || roleId == 0)
{
System.Windows.MessageBox.Show("请登录系统管理账号进行操作");
System.Windows.MessageBox.Show($"请登录系统管理账号进行操作当前用户角色ID{roleId}");
}
else
{

@ -132,6 +132,9 @@
<Compile Include="DieCuttingProcess.xaml.cs">
<DependentUpon>DieCuttingProcess.xaml</DependentUpon>
</Compile>
<Compile Include="intaglioPage.xaml.cs">
<DependentUpon>intaglioPage.xaml</DependentUpon>
</Compile>
<Compile Include="SplitSfc.xaml.cs">
<DependentUpon>SplitSfc.xaml</DependentUpon>
</Compile>
@ -187,6 +190,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="intaglioPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="SplitSfc.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

@ -692,9 +692,10 @@ namespace MaterialTraceabilityUI
{
string eaStr = "";
if (!"1".Equals(ConfigHelper.GetConfig("roleId")) && !"2".Equals(ConfigHelper.GetConfig("roleId")))
int roleId = Convert.ToInt32(ConfigHelper.GetConfig("roleId"));
if (roleId > 3 || roleId == 0)
{
System.Windows.MessageBox.Show("请登录系统管理账号进行操作");
System.Windows.MessageBox.Show($"请登录系统管理账号进行操作当前用户角色ID{roleId}");
return;
}
@ -770,9 +771,10 @@ namespace MaterialTraceabilityUI
private void Complete_Click(object sender, RoutedEventArgs e)
{
if (!"1".Equals(ConfigHelper.GetConfig("roleId")) && !"2".Equals(ConfigHelper.GetConfig("roleId")))
int roleId = Convert.ToInt32(ConfigHelper.GetConfig("roleId"));
if (roleId > 3 || roleId == 0)
{
System.Windows.MessageBox.Show("请登录系统管理账号进行操作");
System.Windows.MessageBox.Show($"请登录系统管理账号进行操作当前用户角色ID{roleId}");
return;
}

@ -65,6 +65,10 @@ namespace MaterialTraceabilityUI.ViewModel
{
param = "DieCuttingProcess";
}
if (process.Contains("AB"))
{
param = "intaglioPage";
}
}
Type type = Type.GetType("MaterialTraceabilityUI." + param.ToString());

@ -57,14 +57,15 @@ namespace MaterialTraceabilityUI
private void Button_Click(object sender, RoutedEventArgs e)
{
if (!"1".Equals(ConfigHelper.GetConfig("roleId")) && !"2".Equals(ConfigHelper.GetConfig("roleId")))
int roleId = Convert.ToInt32(ConfigHelper.GetConfig("roleId"));
if (roleId > 2 || roleId == 0)
{
System.Windows.MessageBox.Show("请登录系统管理账号进行操作");
System.Windows.MessageBox.Show($"请登录系统管理账号进行操作当前用户角色ID{roleId}");
return;
}
string rfidCode = this.rfidCode.Text.ToString();
LogHelperBusiness.LogInfo("手动写入RFID条码信息"+ rfidCode);
if (StringExtension.IsBlank(rfidCode) || rfidCode.Length != 14)
if (StringExtension.IsBlank(rfidCode))
{
MessageBox.Show("请输入正确的RFID条码信息");
return;

@ -0,0 +1,255 @@
<UserControl x:Class="MaterialTraceabilityUI.intaglioPage"
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:MaterialTraceabilityUI"
mc:Ignorable="d"
d:DesignHeight="560" d:DesignWidth="1280"
Background="#F0F7FF" Loaded="UserControl_Loaded">
<Border CornerRadius="15">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="70*"/>
<RowDefinition Height="50*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Margin="0,0,0,162.5" Grid.RowSpan="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="73*"/>
<ColumnDefinition Width="27*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Height="310" Orientation="Horizontal" HorizontalAlignment="Left" Background="AliceBlue">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
</Grid.RowDefinitions>
<UniformGrid Columns="4" Margin="0,5">
<Border x:Name="upMaterial" BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" CornerRadius="5" Margin="5,0" Width="220" MouseDown="upMaterial_MouseDown">
<StackPanel Margin="5,5">
<TextBlock Text="放卷位" FontSize="15" Foreground="#666867" HorizontalAlignment="Center"/>
<TextBlock x:Name="upMaterial_SFC" Text="SFC" FontSize="13" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2" FontWeight="Bold"/>
<TextBlock x:Name="upMaterial_RFID" Text="RFID" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
<TextBlock x:Name="upMaterial_EA" Text="EA" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
</StackPanel>
</Border>
<Border Margin="5,0" Width="170" MouseDown="upMaterial_MouseDown">
</Border>
<Border Margin="5,0" Width="170" MouseDown="upMaterial_MouseDown">
</Border>
</UniformGrid>
<UniformGrid Columns="4" Grid.Row="1" Margin="0,5">
<Border x:Name="down_1" BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" CornerRadius="5" Margin="5,0" Width="220" MouseDown="down_1_MouseDown">
<StackPanel Margin="5,5">
<TextBlock Text="收卷1A轴内侧" FontSize="15" Foreground="#666867" HorizontalAlignment="Center"/>
<TextBlock x:Name="Down_SFC_1" Text="SFC" FontSize="13" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2" FontWeight="Bold"/>
<TextBlock x:Name="Down_RFID_1" Text="RFID" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
<TextBlock x:Name="Down_EA_1" Text="EA" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
</StackPanel>
</Border>
<Border x:Name="down_2" BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" CornerRadius="5" Margin="5,0" Width="220" MouseDown="down_2_MouseDown">
<StackPanel Margin="5,5">
<TextBlock Text="收卷1A轴外侧" FontSize="15" Foreground="#666867" HorizontalAlignment="Center"/>
<TextBlock x:Name="Down_SFC_2" Text="SFC" FontSize="13" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2" FontWeight="Bold"/>
<TextBlock x:Name="Down_RFID_2" Text="RFID" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
<TextBlock x:Name="Down_EA_2" Text="EA" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
</StackPanel>
</Border>
<Border x:Name="down_3" BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" CornerRadius="5" Margin="5,0,5,-0.333" Width="220" Height="91" VerticalAlignment="Bottom" MouseDown="down_3_MouseDown">
<StackPanel Margin="5,5">
<TextBlock Text="收卷2A轴内侧" FontSize="15" Foreground="#666867" HorizontalAlignment="Center"/>
<TextBlock x:Name="Down_SFC_3" Text="SFC" FontSize="13" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2" FontWeight="Bold"/>
<TextBlock x:Name="Down_RFID_3" Text="RFID" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
<TextBlock x:Name="Down_EA_3" Text="EA" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
</StackPanel>
</Border>
<Border x:Name="down_4" BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" CornerRadius="5" Margin="5,0" Width="220" MouseDown="down_4_MouseDown">
<StackPanel Margin="5,5">
<TextBlock Text="收卷2A轴外侧" FontSize="15" Foreground="#666867" HorizontalAlignment="Center"/>
<TextBlock x:Name="Down_SFC_4" Text="SFC" FontSize="13" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2" FontWeight="Bold"/>
<TextBlock x:Name="Down_RFID_4" Text="RFID" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
<TextBlock x:Name="Down_EA_4" Text="EA" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
</StackPanel>
</Border>
</UniformGrid>
<UniformGrid Columns="4" Grid.Row="2" Margin="0,5">
<Border x:Name="down_5" BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" CornerRadius="5" Margin="5,0" Width="220" MouseDown="down_5_MouseDown">
<StackPanel Margin="5,5">
<TextBlock Text="收卷1B轴内侧" FontSize="15" Foreground="#666867" HorizontalAlignment="Center"/>
<TextBlock x:Name="Down_SFC_5" Text="SFC" FontSize="13" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2" FontWeight="Bold"/>
<TextBlock x:Name="Down_RFID_5" Text="RFID" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
<TextBlock x:Name="Down_EA_5" Text="EA" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
</StackPanel>
</Border>
<Border x:Name="down_6" BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" CornerRadius="5" Margin="5,0" Width="220" MouseDown="down_6_MouseDown">
<StackPanel Margin="5,5">
<TextBlock Text="收卷1B轴外侧" FontSize="15" Foreground="#666867" HorizontalAlignment="Center"/>
<TextBlock x:Name="Down_SFC_6" Text="SFC" FontSize="13" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2" FontWeight="Bold"/>
<TextBlock x:Name="Down_RFID_6" Text="RFID" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
<TextBlock x:Name="Down_EA_6" Text="EA" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
</StackPanel>
</Border>
<Border x:Name="down_7" BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" CornerRadius="5" Margin="5,0" Width="220" MouseDown="down_7_MouseDown">
<StackPanel Margin="5,5">
<TextBlock Text="收卷2B轴内侧" FontSize="15" Foreground="#666867" HorizontalAlignment="Center"/>
<TextBlock x:Name="Down_SFC_7" Text="SFC" FontSize="13" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2" FontWeight="Bold"/>
<TextBlock x:Name="Down_RFID_7" Text="RFID" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
<TextBlock x:Name="Down_EA_7" Text="EA" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
</StackPanel>
</Border>
<Border x:Name="down_8" BorderThickness="1,1,1,1" BorderBrush="#DBE6FA" Background="#F0F7FF" CornerRadius="5" Margin="5,0" Width="220" MouseDown="down_8_MouseDown">
<StackPanel Margin="5,5">
<TextBlock Text="收卷2B轴外侧" FontSize="15" Foreground="#666867" HorizontalAlignment="Center"/>
<TextBlock x:Name="Down_SFC_8" Text="SFC" FontSize="13" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2" FontWeight="Bold"/>
<TextBlock x:Name="Down_RFID_8" Text="RFID" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
<TextBlock x:Name="Down_EA_8" Text="EA" TextWrapping="Wrap" Foreground="#5985EA" Margin="0,2"/>
</StackPanel>
</Border>
</UniformGrid>
</Grid>
</StackPanel>
<StackPanel Grid.Column="1" Height="310" Width="340" x:Name="rightLog" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="160"/>
<RowDefinition Height="160"/>
</Grid.RowDefinitions>
<StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="130"/>
</Grid.RowDefinitions>
<StackPanel Margin="0,5,0,0" Width="340" Orientation="Horizontal" HorizontalAlignment="Left" Background="#007dfa">
<RadioButton Content="MES日志" Margin="5,0" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="White" IsChecked="True" VerticalAlignment="Center" CommandParameter="OrderRecordControl" Command="{Binding RecordChangeContentCommand}"/>
</StackPanel>
<StackPanel Grid.Row="1">
<ListBox x:Name="MesLog" Foreground="Gray" HorizontalAlignment="Left" Height="120" VerticalAlignment="Center" Width="340" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0"/>
</StackPanel>
</Grid>
</StackPanel>
<StackPanel Grid.Row="1" Margin="0,0,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="17*"/>
<ColumnDefinition Width="53*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="130"/>
</Grid.RowDefinitions>
<StackPanel Margin="0,5,0,0" Width="340" Orientation="Horizontal" HorizontalAlignment="Left" Background="#007dfa" Grid.ColumnSpan="2">
<RadioButton Content="PLC日志" Margin="5,0" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="White" IsChecked="True" VerticalAlignment="Center" CommandParameter="MesLogControl" Command="{Binding LogChangeContentCommand}"/>
</StackPanel>
<StackPanel Grid.Row="1" Grid.ColumnSpan="2">
<ListBox x:Name="PlcLog" Foreground="Gray" HorizontalAlignment="Left" Height="115" VerticalAlignment="Center" Width="340" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0"/>
</StackPanel>
</Grid>
</StackPanel>
</Grid>
</StackPanel>
</Grid>
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Bottom">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="55*"/>
<ColumnDefinition Width="450"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Height="210" Background="White" Margin="0,5,0,10" Orientation="Horizontal" HorizontalAlignment="Left" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="180"/>
</Grid.RowDefinitions>
<StackPanel Margin="0,0,0,0" Width="275" Orientation="Horizontal" HorizontalAlignment="Left" Background="#007dfa">
<RadioButton Content="设备状态" Margin="5,0" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="White" IsChecked="True" VerticalAlignment="Center" CommandParameter="MesLogControl" Command="{Binding LogChangeContentCommand}"/>
</StackPanel>
<StackPanel Height="180" Grid.Row="1" Margin="0,25,0,0" Orientation="Horizontal" VerticalAlignment="Center">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="309*"/>
<ColumnDefinition Width="41*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<UniformGrid Columns="1" Margin="25,5,0,0" Grid.ColumnSpan="2">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<Border Width="30" Height="30" CornerRadius="15">
<Border.Background>
<ImageBrush x:Name="TestBImage" ImageSource="Assets/Images/失败-01.png"/>
</Border.Background>
</Border>
<TextBlock x:Name="TestTB" Text="放卷位设备" VerticalAlignment="Center" Foreground="Red" FontSize="15" Margin="10,0"/>
</StackPanel>
</UniformGrid>
<UniformGrid Columns="1" Grid.Row="1" Margin="25,5,0,0" Grid.ColumnSpan="2">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<Border Width="30" Height="30" CornerRadius="15">
<Border.Background>
<ImageBrush x:Name="TestCImage" ImageSource="Assets/Images/失败-01.png"/>
</Border.Background>
</Border>
<TextBlock x:Name="TestTC" Text="收卷位设备" VerticalAlignment="Center" Foreground="Red" FontSize="15" Margin="10,0"/>
</StackPanel>
</UniformGrid>
</Grid>
</StackPanel>
</Grid>
</StackPanel>
<StackPanel Grid.Column="1" Height="210" Background="White" Margin="5,5,5,10" HorizontalAlignment="Center">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="180"/>
</Grid.RowDefinitions>
<StackPanel Margin="0,0,0,0" Width="555" Orientation="Horizontal" HorizontalAlignment="Left" Background="#007dfa">
<RadioButton Content="RFID日志" Margin="5,0" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="White" IsChecked="True" VerticalAlignment="Center" CommandParameter="MesLogControl" Command="{Binding LogChangeContentCommand}"/>
</StackPanel>
<StackPanel Grid.Row="1" x:Name="listbox">
<ListBox x:Name="RfidLog" Foreground="Gray" HorizontalAlignment="Left" Height="{Binding Path=ActualHeight,ElementName=listbox}" VerticalAlignment="Center" Width="555" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0"/>
</StackPanel>
</Grid>
</StackPanel>
<StackPanel Grid.Column="2" Width="450" Height="210" Background="White" Margin="5,5,0,10" HorizontalAlignment="Center">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="180"/>
</Grid.RowDefinitions>
<StackPanel Margin="0,0,0,0" Width="450" Orientation="Horizontal" HorizontalAlignment="Left" Background="#007dfa">
<RadioButton Content="报警日志" Margin="5,0" Style="{StaticResource NavRadioButtonStyle}" FontSize="15" Foreground="White" IsChecked="True" VerticalAlignment="Center" CommandParameter="MesLogControl" Command="{Binding LogChangeContentCommand}"/>
</StackPanel>
<StackPanel Grid.Row="1">
<ListBox x:Name="AlarmLog" Foreground="Red" HorizontalAlignment="Left" Height="{Binding Path=ActualHeight,ElementName=listbox}" VerticalAlignment="Center" Width="450" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0"/>
</StackPanel>
</Grid>
</StackPanel>
</Grid>
</StackPanel>
</Grid>
</Border>
</UserControl>

@ -0,0 +1,685 @@
using MaterialTraceability.Business;
using MaterialTraceability.Business.Impl;
using MaterialTraceability.Entity.DAO;
using MaterialTraceability.Entity.DTO;
using MaterialTraceability.Entity.Enum;
using MaterialTraceability.SqlSugar;
using MaterialTraceability.SqlSugar.ServiceImpl;
using MaterialTraceabilityUI.Common;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace MaterialTraceabilityUI
{
/// <summary>
/// firstPage.xaml 的交互逻辑
/// </summary>
public partial class intaglioPage : UserControl
{
private EquipBusiness equipBusiness = new EquipBusiness();
private IBaseServices<RecordLogInfo> logInfoServices = new BaseServices<RecordLogInfo>();
private IBaseServices<ProShaftInfo> shftInfoService = new BaseServices<ProShaftInfo>();
private UpLoadBusiness loadBusiness = UpLoadBusiness.Instance;
private AppConfigDto appConfig = AppConfigDto.Instance;
public intaglioPage()
{
InitializeComponent();
try
{
if (appConfig.processId.Contains("LY"))
{
MainBusiness.LogRefreshEvent += LogRefresh;
LYSignalReadBusiness.LogRefreshEvent += LogRefresh;
LYSignalReadBusiness.ViewModelRefreshEvent += ProductionParam;
UserControlInit();
refreshThread();
}
}
catch(Exception ex)
{
LogHelperBusiness.LogError("界面异常",ex);
}
}
public void ProductionParam(ViewModelDto viewModelDto)
{
if (viewModelDto.rfidInfo != null)
{
Action action;
switch (viewModelDto.rfidInfo.position)
{
case 0 :
action = () =>
{
this.upMaterial_SFC.Text = "SFC"+viewModelDto.rfidInfo.sfc;
};
upMaterial_SFC.Dispatcher.BeginInvoke(action);
action = () =>
{
this.upMaterial_RFID.Text = "RFID"+viewModelDto.rfidInfo.rfid;
};
upMaterial_RFID.Dispatcher.BeginInvoke(action);
action = () =>
{
this.upMaterial_EA.Text = "EA"+viewModelDto.rfidInfo.ea;
};
upMaterial_EA.Dispatcher.BeginInvoke(action);
break;
case 1:
action = () =>
{
this.Down_SFC_1.Text = "SFC" + viewModelDto.rfidInfo.sfc;
};
Down_SFC_1.Dispatcher.BeginInvoke(action);
action = () =>
{
this.Down_RFID_1.Text = "RFID"+viewModelDto.rfidInfo.rfid;
};
Down_RFID_1.Dispatcher.BeginInvoke(action);
action = () =>
{
this.Down_EA_1.Text = "EA"+viewModelDto.rfidInfo.ea;
};
Down_EA_1.Dispatcher.BeginInvoke(action);
break;
case 2:
action = () =>
{
this.Down_SFC_2.Text = "SFC" + viewModelDto.rfidInfo.sfc;
};
Down_SFC_2.Dispatcher.BeginInvoke(action);
action = () =>
{
this.Down_RFID_2.Text = "RFID"+viewModelDto.rfidInfo.rfid;
};
Down_RFID_2.Dispatcher.BeginInvoke(action);
action = () =>
{
this.Down_EA_2.Text = "EA"+viewModelDto.rfidInfo.ea;
};
Down_EA_2.Dispatcher.BeginInvoke(action);
break;
case 5:
action = () =>
{
this.Down_SFC_3.Text = "SFC"+viewModelDto.rfidInfo.sfc;
};
Down_SFC_3.Dispatcher.BeginInvoke(action);
action = () =>
{
this.Down_RFID_3.Text = "RFID"+viewModelDto.rfidInfo.rfid;
};
Down_RFID_3.Dispatcher.BeginInvoke(action);
action = () =>
{
this.Down_EA_3.Text = "EA"+viewModelDto.rfidInfo.ea;
};
Down_EA_3.Dispatcher.BeginInvoke(action);
break;
case 6:
action = () =>
{
this.Down_SFC_4.Text = "SFC"+viewModelDto.rfidInfo.sfc;
};
Down_SFC_4.Dispatcher.BeginInvoke(action);
action = () =>
{
this.Down_RFID_4.Text = "RFID"+viewModelDto.rfidInfo.rfid;
};
Down_RFID_4.Dispatcher.BeginInvoke(action);
action = () =>
{
this.Down_EA_4.Text = "EA"+viewModelDto.rfidInfo.ea;
};
Down_EA_4.Dispatcher.BeginInvoke(action);
break;
case 4:
action = () =>
{
this.Down_SFC_5.Text = "SFC"+viewModelDto.rfidInfo.sfc;
};
Down_SFC_5.Dispatcher.BeginInvoke(action);
action = () =>
{
this.Down_RFID_5.Text = "RFID"+viewModelDto.rfidInfo.rfid;
};
Down_RFID_5.Dispatcher.BeginInvoke(action);
action = () =>
{
this.Down_EA_5.Text = "EA"+viewModelDto.rfidInfo.ea;
};
Down_EA_5.Dispatcher.BeginInvoke(action);
break;
case 3:
action = () =>
{
this.Down_SFC_6.Text = "SFC"+viewModelDto.rfidInfo.sfc;
};
Down_SFC_6.Dispatcher.BeginInvoke(action);
action = () =>
{
this.Down_RFID_6.Text = "RFID"+viewModelDto.rfidInfo.rfid;
};
Down_RFID_6.Dispatcher.BeginInvoke(action);
action = () =>
{
this.Down_EA_6.Text = "EA"+viewModelDto.rfidInfo.ea;
};
Down_EA_6.Dispatcher.BeginInvoke(action);
break;
case 8:
action = () =>
{
this.Down_SFC_7.Text = "SFC"+viewModelDto.rfidInfo.sfc;
};
Down_SFC_7.Dispatcher.BeginInvoke(action);
action = () =>
{
this.Down_RFID_7.Text = "RFID"+viewModelDto.rfidInfo.rfid;
};
Down_RFID_7.Dispatcher.BeginInvoke(action);
action = () =>
{
this.Down_EA_7.Text = "EA"+viewModelDto.rfidInfo.ea;
};
Down_EA_7.Dispatcher.BeginInvoke(action);
break;
case 7:
action = () =>
{
this.Down_SFC_8.Text = "SFC"+viewModelDto.rfidInfo.sfc;
};
Down_SFC_8.Dispatcher.BeginInvoke(action);
action = () =>
{
this.Down_RFID_8.Text = "RFID"+viewModelDto.rfidInfo.rfid;
};
Down_RFID_8.Dispatcher.BeginInvoke(action);
action = () =>
{
this.Down_EA_8.Text = "EA"+viewModelDto.rfidInfo.ea;
};
Down_EA_8.Dispatcher.BeginInvoke(action);
break;
default:
break;
}
}
}
private void refreshThread()
{
System.Timers.Timer timer = new System.Timers.Timer(1000 * 30);
timer.Elapsed += new System.Timers.ElapsedEventHandler(refreshEquipStatus);
timer.AutoReset = true;
timer.Enabled = true;
timer.Start();
}
private void refreshEquipStatus(object source, System.Timers.ElapsedEventArgs e)
{
try
{
equipBusiness.CheckEquipState();
UpdateDeviceStatus();
}catch(Exception ex)
{
LogHelperBusiness.LogError("界面refreshEquipStatus异常",ex);
}
}
private void UpdateDeviceStatus()
{
Action action;
try
{
var equipInfo = equipBusiness.Equiplist.Where(x => x.positionId == 0).FirstOrDefault();
if (equipInfo != null)
{
if (equipInfo.IsConnect)
{
action = () =>
{
this.TestTB.Foreground = Brushes.Green;
};
TestTB.Dispatcher.BeginInvoke(action);
action = () =>
{
string imageUrl = "pack://application:,,,/MaterialTraceabilityUI;component/Assets/Images/正常.png";
BitmapImage bitmapImage = new BitmapImage(new Uri(imageUrl));
this.TestBImage.ImageSource = bitmapImage;
};
TestBImage.Dispatcher.BeginInvoke(action);
}
else
{
action = () =>
{
this.TestTB.Foreground = Brushes.Red;
};
TestTB.Dispatcher.BeginInvoke(action);
action = () =>
{
string imageUrl = "pack://application:,,,/MaterialTraceabilityUI;component/Assets/Images/失败-01.png";
BitmapImage bitmapImage = new BitmapImage(new Uri(imageUrl));
this.TestBImage.ImageSource = bitmapImage;
};
TestBImage.Dispatcher.BeginInvoke(action);
}
}
var equipInfo2 = equipBusiness.Equiplist.Where(x => x.positionId == 1).FirstOrDefault();
if (equipInfo2 != null)
{
if (equipInfo2.IsConnect)
{
action = () =>
{
this.TestTC.Foreground = Brushes.Green;
};
TestTC.Dispatcher.BeginInvoke(action);
action = () =>
{
string imageUrl = "pack://application:,,,/MaterialTraceabilityUI;component/Assets/Images/正常.png";
BitmapImage bitmapImage = new BitmapImage(new Uri(imageUrl));
this.TestCImage.ImageSource = bitmapImage;
};
TestCImage.Dispatcher.BeginInvoke(action);
}
else
{
action = () =>
{
this.TestTC.Foreground = Brushes.Red;
};
TestTC.Dispatcher.BeginInvoke(action);
action = () =>
{
string imageUrl = "pack://application:,,,/MaterialTraceabilityUI;component/Assets/Images/失败-01.png";
BitmapImage bitmapImage = new BitmapImage(new Uri(imageUrl));
this.TestCImage.ImageSource = bitmapImage;
};
TestCImage.Dispatcher.BeginInvoke(action);
}
}
}
catch (Exception ex)
{
LogHelperBusiness.LogError("设备状态刷新异常", ex);
}
}
public void UserControlInit()
{
//List<int> downNumberItem = new List<int>() { 3, 6, 9 };
//this.downNumber.ItemsSource = downNumberItem;
//this.downNumber.SelectedItem = Convert.ToInt32(ConfigHelper.GetConfig("downNumber"));
//查询前五个小时的数据
//DateTime beginTime = DateTime.Now.AddHours(-5);
//&& Convert.ToDateTime(x.bindTime) > beginTime
try
{
LogRefresh(LogType.RfidLog, "冷压RFID物料追溯系统初始化");
Expression<Func<ProShaftInfo, bool>> exp = s1 => true;
exp = exp.And(x => x.processId == appConfig.processId);
List<ProShaftInfo> shaftInfos = shftInfoService.Query(exp).Result;
if (shaftInfos == null || shaftInfos.Count == 0)
{
LogRefresh(LogType.RfidLog, "程序初始化数据为空");
return;
}
shaftInfos.ForEach(x =>
{
ProductionParam(new ViewModelDto()
{
rfidInfo = new RfidInfoDto()
{
rfid = x.bindRfid,
sfc = x.bindSfc,
ea = x.bindEaValue,
position = Convert.ToInt32(x.positionId)
},
plcStatus = true,
});
});
}catch(Exception ex)
{
LogHelperBusiness.LogError("冷压界面异常UserControlInit",ex);
}
}
public void LogRefresh(LogType logType, string massage)
{
try
{
string info = massage;
string logTypeStr = "";
int isAlarm = 0;
if (logType == LogType.MesLog)
{
logTypeStr = "MES";
ListBoxItemAdd(this.MesLog, massage);
}
if (logType == LogType.PlcLog)
{
logTypeStr = "PLC";
ListBoxItemAdd(this.PlcLog, massage);
}
if (logType == LogType.RfidLog)
{
logTypeStr = "RFID";
ListBoxItemAdd(this.RfidLog, massage);
}
if (logType == LogType.AlarmLog)
{
logTypeStr = "Alarm";
isAlarm = 1;
ListBoxItemAdd(this.AlarmLog, massage);
loadBusiness.SaveLogRecord(0, massage);
}
logInfoServices.Add(new RecordLogInfo()
{
id = System.Guid.NewGuid().ToString("N"),
processId = "LY_A",
machineId = ConfigurationManager.AppSettings["machineId"].ToString(),
alarmType = logTypeStr,
alarmInfo = info,
isAlarm = isAlarm,
recordTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
});
}catch(Exception ex)
{
LogHelperBusiness.LogError("界面LogRefresh异常",ex);
}
}
private List<LogInfoItem> logInfos = new List<LogInfoItem>();
/// <summary>
/// ListBox刷新
/// </summary>
/// <param name="listBox"></param>
/// <param name="massage"></param>
private void ListBoxItemAdd(ListBox listBox, string massage)
{
try
{
LogHelperBusiness.ViewLog(massage);
logInfos.Add(new LogInfoItem()
{
listBox = listBox,
recordTime = DateTime.Now,
message = String.Format("{0} {1}", DateTime.Now.ToString("MM-dd HH:mm:ss"), massage)
});
while(logInfos.Count > 120)
{
logInfos.RemoveAt(0);
}
Action action;
action = () =>
{
listBox.Items.Clear();
var infoList = logInfos.ToArray();
var strArray = infoList.Where(x => x.listBox == listBox).OrderByDescending(x => x.recordTime).ToList();
if (strArray != null)
{
foreach (var str in strArray)
{
SplitByLen(str.message, 50).ForEach(x =>
{
listBox.Items.Add(x);
});
}
}
};
listBox.Dispatcher.BeginInvoke(action);
}catch(Exception ex)
{
LogHelperBusiness.LogError("界面ListBoxItemAdd异常", ex);
}
}
public static List<string> SplitByLen(string str, int separatorCharNum)
{
try
{
string tempStr = str;
List<string> strList = new List<string>();
if (string.IsNullOrEmpty(str) || str.Length <= separatorCharNum)
{
strList.Add(str);
return strList;
}
int iMax = Convert.ToInt32(Math.Ceiling(str.Length / (separatorCharNum * 1.0)));
for (int i = 0; i < iMax; i++)
{
string currMsg = tempStr.Substring(0, tempStr.Length > separatorCharNum ? separatorCharNum : tempStr.Length);
strList.Add(currMsg);
if (tempStr.Length > separatorCharNum)
{
tempStr = tempStr.Substring(separatorCharNum, tempStr.Length - separatorCharNum);
}
}
return strList;
}catch(Exception ex)
{
LogHelperBusiness.LogError("界面SplitByLen异常", ex);
return null;
}
}
private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
UpdateDeviceStatus();
}
/// <summary>
/// 放卷位
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void upMaterial_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
try
{
WriteInfo write = new WriteInfo(appConfig.processId, 0);
write.ShowDialog();
refreshMaterialInfo(appConfig.processId, "0");
}catch(Exception ex)
{
LogHelperBusiness.LogError("界面upMaterial_MouseDown异常", ex);
}
}
/// <summary>
/// 收卷1轴内侧
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void down_1_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
//WriteInfo write = new WriteInfo(appConfig.processId, 1);
//write.ShowDialog();
}
/// <summary>
/// 收卷1轴外侧
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void down_2_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
//WriteInfo write = new WriteInfo(appConfig.processId, 2);
//write.ShowDialog();
}
/// <summary>
/// 收卷1B轴外侧
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void down_6_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
//WriteInfo write = new WriteInfo(appConfig.processId, 3);
//write.ShowDialog();
}
/// <summary>
/// 收卷1B轴内侧
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void down_5_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
//WriteInfo write = new WriteInfo(appConfig.processId, 4);
//write.ShowDialog();
}
/// <summary>
/// 收卷2A轴内侧
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void down_3_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
//WriteInfo write = new WriteInfo(appConfig.processId, 5);
//write.ShowDialog();
}
/// <summary>
/// 收卷2A轴外侧
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void down_4_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
//WriteInfo write = new WriteInfo(appConfig.processId, 6);
//write.ShowDialog();
}
/// <summary>
/// 收卷2B轴外侧
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void down_8_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
//WriteInfo write = new WriteInfo(appConfig.processId, 7);
//write.ShowDialog();
}
/// <summary>
/// 收卷2B轴内侧
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void down_7_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
//WriteInfo write = new WriteInfo(appConfig.processId, 8);
//write.ShowDialog();
}
public void refreshMaterialInfo(string processId, string position)
{
//DateTime beginTime = DateTime.Now.AddHours(-5);
try
{
Expression<Func<ProShaftInfo, bool>> exp = s1 => true;
exp = exp.And(x => x.processId == appConfig.processId);
Expression<Func<ProShaftInfo, object>> order = s1 => s1.bindTime;
ProShaftInfo shaftInfo = shftInfoService.QueryFirst(exp, order, false).Result;
if (shaftInfo == null)
{
//ListBoxItemAdd(this.RfidLog, "获取卷轴数据为空");
return;
}
Action action;
switch (Convert.ToInt32(shaftInfo.positionId))
{
case 0:
action = () =>
{
this.upMaterial_RFID.Text = "RFID:" + shaftInfo.bindRfid;
};
upMaterial_RFID.Dispatcher.BeginInvoke(action);
action = () =>
{
this.upMaterial_SFC.Text = "SFC:" + shaftInfo.bindSfc;
};
upMaterial_SFC.Dispatcher.BeginInvoke(action);
action = () =>
{
this.upMaterial_EA.Text = "EA:" + shaftInfo.bindEaValue;
};
upMaterial_EA.Dispatcher.BeginInvoke(action);
break;
default:
break;
}
}catch(Exception ex)
{
LogHelperBusiness.LogError("界面refreshMaterialInfo异常", ex);
}
}
/// <summary>
/// 设置拆分数量
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void addDownNumber_Click(object sender, System.Windows.RoutedEventArgs e)
{
try
{
//string downNumberItem = this.downNumber.SelectedItem.ToString();
//ConfigHelper.UpdateAppConfig("downNumber", downNumberItem);
//string info = ConfigHelper.GetConfig("downNumber");
//if(downNumberItem == info)
//{
// LogHelperBusiness.LogInfo("设置拆分数量成功,设置为:" + downNumberItem + "卷");
// ListBoxItemAdd(this.RfidLog, "设置拆分数量成功,设置为:" + downNumberItem + "卷");
//}
}
catch(Exception ex)
{
LogHelperBusiness.LogError("设置拆分数量异常", ex);
}
}
}
}

@ -120,9 +120,10 @@ namespace MaterialTraceabilityUI
private void Split_Click(object sender, RoutedEventArgs e)
{
if (!"1".Equals(ConfigHelper.GetConfig("roleId")) && !"2".Equals(ConfigHelper.GetConfig("roleId")))
int roleId = Convert.ToInt32(ConfigHelper.GetConfig("roleId"));
if (roleId > 3 || roleId == 0)
{
System.Windows.MessageBox.Show("请登录系统管理账号进行操作");
System.Windows.MessageBox.Show($"请登录系统管理账号进行操作当前用户角色ID{roleId}");
}
else
{

Loading…
Cancel
Save