liuwf 3 months ago
parent 1e3b60b32d
commit b6ca315cc7

@ -76,12 +76,12 @@ namespace SlnMesnac.Business
_basePalletInfoService = basePalletInfoService; _basePalletInfoService = basePalletInfoService;
_baseRealTaskService = baseRealTaskService; _baseRealTaskService = baseRealTaskService;
_palletTasks = palletTasks; _palletTasks = palletTasks;
// testTran(); // testTran();
} }
public async void testTran() public async void testTran()
{ {
//TcpClient tcpClient = new TcpClient(); //TcpClient tcpClient = new TcpClient();
//var waitClient = tcpClient.CreateWaitingClient(new WaitingOptions() //var waitClient = tcpClient.CreateWaitingClient(new WaitingOptions()
@ -93,7 +93,7 @@ namespace SlnMesnac.Business
//}); //});
//tcpClient.Setup(new TouchSocketConfig().SetRemoteIPHost($"192.168.2.51:3000")); //tcpClient.Setup(new TouchSocketConfig().SetRemoteIPHost($"192.168.2.51:3000"));
//tcpClient.Connect(); //tcpClient.Connect();
// byte[] reciveBuffer = await waitClient.SendThenReturnAsync(pMessagePack.m_pData, timeout); // byte[] reciveBuffer = await waitClient.SendThenReturnAsync(pMessagePack.m_pData, timeout);
string aaa =await ReadEpcStrByRfidKeyAsync("test"); string aaa =await ReadEpcStrByRfidKeyAsync("test");
// ReadEpcStrByRfidKey("test", out string epcStr); // ReadEpcStrByRfidKey("test", out string epcStr);
Console.WriteLine(aaa); Console.WriteLine(aaa);

@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SlnMesnac.WPF" xmlns:local="clr-namespace:SlnMesnac.WPF"
StartupUri="MainWindow.xaml"> StartupUri="MainWindow.xaml" DispatcherUnhandledException="Application_DispatcherUnhandledException">
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>

@ -63,7 +63,15 @@ namespace SlnMesnac.WPF
} }
private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
//记录日志
Console.WriteLine(e.Exception.Message);
}
/// <summary> /// <summary>
/// CreateHostBuilder /// CreateHostBuilder

@ -263,10 +263,10 @@
<TextBlock Text="烘干机报警:" FontSize="20" VerticalAlignment="Center" Width="170" Margin="0,0,20,0" Foreground="White"/> <TextBlock Text="烘干机报警:" FontSize="20" VerticalAlignment="Center" Width="170" Margin="0,0,20,0" Foreground="White"/>
<TextBlock x:Name="HotSignal7_2_Value" Text="无" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/> <TextBlock x:Name="HotSignal7_2_Value" Text="无" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
</StackPanel> </StackPanel>
<StackPanel Grid.Row="7" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0"> <!--<StackPanel Grid.Row="7" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<TextBox x:Name="HotSpiralSpeedTxt" Width="70" Height="35" FontSize="20" VerticalAlignment="Center" Margin="30,0,10,0" Foreground="White"/> <TextBox x:Name="HotSpiralSpeedTxt" Width="70" Height="35" FontSize="20" VerticalAlignment="Center" Margin="30,0,10,0" Foreground="White"/>
<Button x:Name="HotSpiralSpeedSet" Content="烘干机螺旋频率设定" FontSize="20" Width="200" Height="40" VerticalAlignment="Center" Margin="0,0,20,0" Background="DeepSkyBlue" Click="HotSpiralSpeedSet_Click" /> <Button x:Name="HotSpiralSpeedSet" Content="烘干机螺旋频率设定" FontSize="20" Width="200" Height="40" VerticalAlignment="Center" Margin="0,0,20,0" Background="DeepSkyBlue" Click="HotSpiralSpeedSet_Click" />
</StackPanel> </StackPanel>-->
<!--<StackPanel Grid.Row="7" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0"> <!--<StackPanel Grid.Row="7" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<TextBox x:Name="HotTempTxt" Width="70" Height="35" FontSize="20" VerticalAlignment="Center" Margin="30,0,10,0" Foreground="White"/> <TextBox x:Name="HotTempTxt" Width="70" Height="35" FontSize="20" VerticalAlignment="Center" Margin="30,0,10,0" Foreground="White"/>
<Button x:Name="HotTempSet" Content="烘干机温度设定" FontSize="20" Width="150" Height="40" VerticalAlignment="Center" Margin="0,0,20,0" Background="DeepSkyBlue" Click="HotTempSet_Click" /> <Button x:Name="HotTempSet" Content="烘干机温度设定" FontSize="20" Width="150" Height="40" VerticalAlignment="Center" Margin="0,0,20,0" Background="DeepSkyBlue" Click="HotTempSet_Click" />
@ -274,6 +274,8 @@
</Grid> </Grid>
<StackPanel Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Top" Orientation="Horizontal" > <StackPanel Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Top" Orientation="Horizontal" >
<TextBox x:Name="HotSpiralSpeedTxt" Width="70" Height="35" FontSize="20" VerticalAlignment="Center" Margin="30,0,10,0" Foreground="White"/>
<Button x:Name="HotSpiralSpeedSet" Content="螺旋频率设定" FontSize="20" Width="150" Height="40" VerticalAlignment="Center" Margin="0,0,20,0" Background="DeepSkyBlue" Click="HotSpiralSpeedSet_Click" />
<Button x:Name="StartDryerSpiralButton" Content="螺旋启动" FontSize="20" Background="LimeGreen" Width="120" Height="40" Margin="0 0 20 0" Click="StartDryerSpiralButton_Click"/> <Button x:Name="StartDryerSpiralButton" Content="螺旋启动" FontSize="20" Background="LimeGreen" Width="120" Height="40" Margin="0 0 20 0" Click="StartDryerSpiralButton_Click"/>
<Button x:Name="StartDryerFanButton" Content="风机启动" FontSize="20" Background="LimeGreen" Width="90" Height="40" Margin="0 0 20 0" Click="StartDryerFanButton_Click"/> <Button x:Name="StartDryerFanButton" Content="风机启动" FontSize="20" Background="LimeGreen" Width="90" Height="40" Margin="0 0 20 0" Click="StartDryerFanButton_Click"/>
<Button x:Name="StartDryerHotButton" Content="燃烧启动" FontSize="20" Background="LimeGreen" Width="90" Height="40" Margin="0 0 20 0" Click="StartDryerHotButton_Click"/> <Button x:Name="StartDryerHotButton" Content="燃烧启动" FontSize="20" Background="LimeGreen" Width="90" Height="40" Margin="0 0 20 0" Click="StartDryerHotButton_Click"/>

@ -126,75 +126,80 @@ namespace SlnMesnac.WPF.Page
/// <param name="e"></param> /// <param name="e"></param>
private void StartButton_Click(object sender, RoutedEventArgs e) private void StartButton_Click(object sender, RoutedEventArgs e)
{ {
try var result = MessageBox.Show("是否确认启动?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Information);
if (result == MessageBoxResult.Yes)
{ {
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程")) == false) try
{
MessageBox.Show("拆包机MES允许远程未切换远程");
return;
}
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机MES允许远程")) == false)
{
MessageBox.Show("磁选机MES允许远程未切换远程");
return;
}
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1MES允许远程")) == false)
{ {
MessageBox.Show("螺旋1MES允许远程未切换远程"); if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程")) == false)
return; {
} MessageBox.Show("拆包机MES允许远程未切换远程");
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2MES允许远程")) == false) return;
{ }
MessageBox.Show("螺旋2MES允许远程未切换远程"); if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机MES允许远程")) == false)
return; {
} MessageBox.Show("磁选机MES允许远程未切换远程");
return;
}
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1MES允许远程")) == false)
{
MessageBox.Show("螺旋1MES允许远程未切换远程");
return;
}
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2MES允许远程")) == false)
{
MessageBox.Show("螺旋2MES允许远程未切换远程");
return;
}
//StartButton.IsEnabled = false; //StartButton.IsEnabled = false;
//StopButton.IsEnabled = true; //StopButton.IsEnabled = true;
//StopUrgentButton.IsEnabled = true; //StopUrgentButton.IsEnabled = true;
Task.Run(() => Task.Run(() =>
{ {
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程急停"), false); plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程急停"), false);
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程停止"), false); plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程停止"), false);
#region 按顺序依次启动设备 #region 按顺序依次启动设备
//1.螺旋2 //1.螺旋2
bool Spiral2Status = StartSpiral2(); bool Spiral2Status = StartSpiral2();
if (!Spiral2Status) return; if (!Spiral2Status) return;
//2.磁选机 //2.磁选机
bool MagNetStatus = StartMagNet(); bool MagNetStatus = StartMagNet();
if (!MagNetStatus) return; if (!MagNetStatus) return;
//3.螺旋1 //3.螺旋1
bool Spiral1Status = StartSpiral1(); bool Spiral1Status = StartSpiral1();
if (!MagNetStatus) return; if (!MagNetStatus) return;
//4.烘干机:烘干螺旋、烘干风机、烘干燃烧 //4.烘干机:烘干螺旋、烘干风机、烘干燃烧
bool DryerStatus1 = StartDryerMagNet(); bool DryerStatus1 = StartDryerMagNet();
if (!DryerStatus1) return; if (!DryerStatus1) return;
bool DryerStatus2 = StartDryerFan(); bool DryerStatus2 = StartDryerFan();
if (!DryerStatus2) return; if (!DryerStatus2) return;
bool DryerStatus3 = StartDryerHot(); bool DryerStatus3 = StartDryerHot();
if (!DryerStatus3) return; if (!DryerStatus3) return;
//5.拆包机 //5.拆包机
bool unpackStatus = StartUnPack(); bool unpackStatus = StartUnPack();
#endregion #endregion
if (unpackStatus) if (unpackStatus)
{ {
MessageBoxAndLog("一键启动所有机器成功!"); MessageBoxAndLog("一键启动所有机器成功!");
} }
}); });
}
catch (Exception ex)
{
_logger.LogError($"一键启动:{ex.Message}");
}
} }
catch (Exception ex)
{
_logger.LogError($"一键启动:{ex.Message}");
}
} }
@ -205,46 +210,50 @@ namespace SlnMesnac.WPF.Page
/// <param name="e"></param> /// <param name="e"></param>
private void StopButton_Click(object sender, RoutedEventArgs e) private void StopButton_Click(object sender, RoutedEventArgs e)
{ {
try var result = MessageBox.Show("是否确认停止?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Warning);
if (result == MessageBoxResult.Yes)
{ {
String address = baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程"); try
#region 依次按序停止
Task.Run(() =>
{ {
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程启动"), false); String address = baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程");
SendPulseSignal("拆包机远程停止");
Thread.Sleep(MachineSleep); #region 依次按序停止
bool unPackStatus1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态")); Task.Run(() =>
if (unPackStatus1)
{ {
MessageBox.Show("一键停止失败,拆包机未停止,请先检查原因"); plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程启动"), false);
return; SendPulseSignal("拆包机远程停止");
} Thread.Sleep(MachineSleep);
bool unPackStatus1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
if (unPackStatus1)
{
MessageBox.Show("一键停止失败,拆包机未停止,请先检查原因");
return;
}
#region 烘干机 #region 烘干机
SendPulseSignal("烘干机螺旋停止"); SendPulseSignal("烘干机螺旋停止");
Thread.Sleep(MachineSleep); Thread.Sleep(MachineSleep);
SendPulseSignal("烘干机燃烧停止"); SendPulseSignal("烘干机燃烧停止");
Thread.Sleep(MachineSleep); Thread.Sleep(MachineSleep);
SendPulseSignal("烘干机风机停止"); SendPulseSignal("烘干机风机停止");
#endregion
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1启动"), false);
Thread.Sleep(MachineSleep);
SendPulseSignal("磁选机一键停止");
Thread.Sleep(MachineSleep);
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2启动"), false);
MessageBoxAndLog("一键停止所有机器成功!");
});
#endregion #endregion
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1启动"), false); //StopButton.IsEnabled = false;
Thread.Sleep(MachineSleep); //StopUrgentButton.IsEnabled = false;
SendPulseSignal("磁选机一键停止"); //StartButton.IsEnabled = true;
Thread.Sleep(MachineSleep); }
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2启动"), false); catch (Exception ex)
{
MessageBoxAndLog("一键停止所有机器成功!"); _logger.LogError($"一键停止:{ex.Message}");
}); }
#endregion
//StopButton.IsEnabled = false;
//StopUrgentButton.IsEnabled = false;
//StartButton.IsEnabled = true;
}
catch (Exception ex)
{
_logger.LogError($"一键停止:{ex.Message}");
} }
} }
@ -255,27 +264,31 @@ namespace SlnMesnac.WPF.Page
/// <param name="e"></param> /// <param name="e"></param>
private void StopUrgentButton_Click(object sender, RoutedEventArgs e) private void StopUrgentButton_Click(object sender, RoutedEventArgs e)
{ {
try var result = MessageBox.Show("是否确认急停?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Warning);
if (result == MessageBoxResult.Yes)
{ {
if (StopUrgentButton.Content.ToString() == "急停") try
{ {
//StopButton.IsEnabled = false; if (StopUrgentButton.Content.ToString() == "急停")
//StopUrgentButton.Content = "复位"; {
//StopButton.IsEnabled = false;
//StopUrgentButton.Content = "复位";
SendPulseSignal("拆包机远程急停"); SendPulseSignal("拆包机远程急停");
}
else if (StopUrgentButton.Content.ToString() == "复位")
{
//StopButton.IsEnabled = true;
//StopUrgentButton.Content = "急停";
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程急停"), false);
}
} }
else if (StopUrgentButton.Content.ToString() == "复位") catch (Exception ex)
{ {
//StopButton.IsEnabled = true; _logger.LogError($"拆包机远程急停:{ex.Message}");
//StopUrgentButton.Content = "急停";
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程急停"), false);
} }
} }
catch (Exception ex)
{
_logger.LogError($"拆包机远程急停:{ex.Message}");
}
} }
#region 拆包机 #region 拆包机

@ -47,4 +47,8 @@
<Resource Include="Templates\image\background.jpg" /> <Resource Include="Templates\image\background.jpg" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Page\Window\" />
</ItemGroup>
</Project> </Project>

@ -45,7 +45,7 @@ namespace SlnMesnac.WPF
//RFID //RFID
services.AddRfidFactorySetup(); services.AddRfidFactorySetup();
} }

Loading…
Cancel
Save