liuwf 3 months ago
parent 138aba9860
commit d7a6ad0b83

@ -352,5 +352,10 @@ namespace SlnMesnac.Plc.Factory
{
throw new NotImplementedException();
}
public override float readFloatByAddress(string address)
{
throw new NotImplementedException();
}
}
}

@ -293,5 +293,10 @@ namespace SlnMesnac.Plc.Factory
{
throw new NotImplementedException();
}
public override float readFloatByAddress(string address)
{
throw new NotImplementedException();
}
}
}

@ -296,5 +296,10 @@ namespace SlnMesnac.Plc.Factory
{
throw new NotImplementedException();
}
public override float readFloatByAddress(string address)
{
throw new NotImplementedException();
}
}
}

@ -260,6 +260,31 @@ namespace SlnMesnac.Plc.Factory
}
}
/// <summary>
/// 通过PLC地址读取float类型数据
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
/// <exception cref="InvalidOperationException"></exception>
public override float readFloatByAddress(string address)
{
try
{
OperateResult<float> read = s7.ReadFloat(address);
if (!read.IsSuccess)
{
throw new InvalidOperationException($"根据地址:{address};读取bool数据失败{read.Content}");
}
return read.Content;
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据地址:{address};读取bool数据异常{ex.Message}");
}
}
/// <summary>
/// 通过PLC地址写入Bool类型数据
/// </summary>

@ -97,6 +97,12 @@ namespace SlnMesnac.Plc
/// <param name="address"></param>
/// <returns></returns>
public abstract int readByteByAddress(string address);
/// <summary>
/// 通过PLC地址读取Float类型数据
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
public abstract float readFloatByAddress(string address);
/// <summary>
/// 通过PLC地址写入Bool类型数据

@ -6,6 +6,8 @@
xmlns:local="clr-namespace:SlnMesnac.WPF.Page"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent">
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
@ -37,8 +39,8 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="9*"/>
<RowDefinition Height="3*"/>
</Grid.RowDefinitions>
<TextBlock Text="拆包机设备监控" FontSize="22" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Grid Grid.Row="1">
@ -50,40 +52,80 @@
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<Ellipse x:Name="UnpackStatus0" VerticalAlignment="Center" Width="30" Height="30" Fill="Red"/>
<TextBlock Text="拆包机MES允许远程" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<Ellipse x:Name="UnpackStatus0" VerticalAlignment="Center" Width="30" Height="30" Fill="Red"/>
<TextBlock Text="拆包机MES允许远程" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<Ellipse x:Name="UnpackStatus1" VerticalAlignment="Center" Width="30" Height="30" Fill="Red"/>
<TextBlock Text="拆包机系统运行状态" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<Ellipse x:Name="UnpackStatus7" VerticalAlignment="Center" Width="30" Height="30" Fill="Red"/>
<TextBlock Text="连接状态" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<Ellipse x:Name="UnpackStatus1" VerticalAlignment="Center" Width="30" Height="30" Fill="Red"/>
<TextBlock Text="拆包机系统运行状态" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<Ellipse x:Name="UnpackStatus8" VerticalAlignment="Center" Width="30" Height="30" Fill="Green"/>
<TextBlock Text="拆包机堵料停螺旋报警" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<StackPanel Grid.Row="2" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<Ellipse Width="30" Height="30" Visibility="Hidden"/>
<TextBlock Text="翻转机频率反馈:" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Width="200" Foreground="White"/>
<TextBlock x:Name="UnpackStatus9" Text="" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
</StackPanel>
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<Ellipse Width="30" Height="30" Visibility="Hidden"/>
<TextBlock Text="滚筒筛频率反馈:" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Width="200" Foreground="White"/>
<TextBlock x:Name="UnpackStatus10" Text="" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
</StackPanel>
<StackPanel Grid.Row="3" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<Ellipse Width="30" Height="30" Visibility="Hidden"/>
<TextBlock Text="螺旋1频率反馈:" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Width="200" Foreground="White"/>
<TextBlock x:Name="UnpackStatus11" Text="" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
</StackPanel>
<StackPanel Grid.Row="3" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<Ellipse Width="30" Height="30" Visibility="Hidden"/>
<TextBlock Text="螺旋2频率反馈:" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Width="200" Foreground="White"/>
<TextBlock x:Name="UnpackStatus12" Text="" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
</StackPanel>
<StackPanel Grid.Row="4" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<Ellipse Width="30" Height="30" Visibility="Hidden"/>
<TextBlock Text="废袋机频率反馈:" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Width="200" Foreground="White"/>
<TextBlock x:Name="UnpackStatus13" Text="" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
</StackPanel>
<StackPanel Grid.Row="5" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<Ellipse Width="30" Height="30" Visibility="Hidden"/>
<TextBlock Text="设备请求叫料信号:" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Width="200" Foreground="White"/>
<TextBlock x:Name="UnpackStatus2" Text="False" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<StackPanel Grid.Row="5" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<Ellipse Width="30" Height="30" Visibility="Hidden"/>
<TextBlock Text="物料到位请求翻转信号:" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Width="200" Foreground="White"/>
<TextBlock x:Name="UnpackStatus3" Text="False" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
</StackPanel>
<StackPanel Grid.Row="2" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<StackPanel Grid.Row="6" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<Ellipse Width="30" Height="30" Visibility="Hidden"/>
<TextBlock Text="设备投料允许翻转信号:" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Width="200" Foreground="White"/>
<TextBlock x:Name="UnpackStatus4" Text="False" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
</StackPanel>
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<StackPanel Grid.Row="6" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<Ellipse Width="30" Height="30" Visibility="Hidden"/>
<TextBlock Text="请求移走空托盘信号:" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Width="200" Foreground="White"/>
<TextBlock x:Name="UnpackStatus5" Text="False" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
</StackPanel>
</Grid>
<!--<DataGrid ItemsSource="{Binding UnPackDataGrid}" Background="Transparent"
FontSize="15" ColumnHeaderHeight="35"
@ -97,10 +139,31 @@
<DataGridTextColumn Binding="{Binding Value}" Header="监听值" Width="2*" IsReadOnly="True"/>
</DataGrid.Columns>
</DataGrid>-->
<StackPanel Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Top" Orientation="Horizontal" >
<Button x:Name="StartUnPackButton" Content="拆包机启动" FontSize="20" Background="LimeGreen" Width="150" Height="40" Margin="0 0 20 0" Click="StartUnPackButton_Click" />
<Button x:Name="StopUnPackButton" Content="拆包机停止" FontSize="20" Background="OrangeRed" Width="150" Height="40" Margin="0,0,0,0" Click="StopUnPackButton_Click"/>
</StackPanel>
<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Top" Orientation="Horizontal" >
<TextBlock Text="翻转机:" FontSize="20" VerticalAlignment="Center" Margin="5,0,0,0" Foreground="White"/>
<TextBox x:Name="UnpackSet1Txt" Text="0.00" Width="70" Height="35" FontSize="20" VerticalAlignment="Center" Margin="10,0,0,0" Foreground="White"/>
<TextBlock Text="滚筒筛:" FontSize="20" VerticalAlignment="Center" Margin="5,0,5,0" Foreground="White"/>
<TextBox x:Name="UnpackSet2Txt" Text="0.00" Width="70" Height="35" FontSize="20" VerticalAlignment="Center" Margin="0,0,10,0" Foreground="White"/>
<TextBlock Text="螺旋1:" FontSize="20" VerticalAlignment="Center" Margin="5,0,5,0" Foreground="White"/>
<TextBox x:Name="UnpackSet3Txt" Text="0.00" Width="70" Height="35" FontSize="20" VerticalAlignment="Center" Margin="0,0,10,0" Foreground="White"/>
<TextBlock Text="螺旋2:" FontSize="20" VerticalAlignment="Center" Margin="5,0,5,0" Foreground="White"/>
<TextBox x:Name="UnpackSet4Txt" Text="0.00" Width="70" Height="35" FontSize="20" VerticalAlignment="Center" Margin="0,0,10,0" Foreground="White"/>
<TextBlock Text="滚筒筛:" FontSize="20" VerticalAlignment="Center" Margin="5,0,5,0" Foreground="White"/>
<TextBox x:Name="UnpackSet5Txt" Text="0.00" Width="70" Height="35" FontSize="20" VerticalAlignment="Center" Margin="0,0,10,0" Foreground="White"/>
<Button x:Name="UnpackSetButton" Content="频率设定(0-50HZ)" FontSize="20" Width="170" Height="40" VerticalAlignment="Center" Margin="0,0,0,0" Background="DeepSkyBlue" Click="UnpackSetButton_Click" />
</StackPanel>
<StackPanel Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Top" Orientation="Horizontal" >
<Button x:Name="StartUnPackButton" Content="拆包机启动" FontSize="20" Background="LimeGreen" Width="120" Height="40" Margin="0 0 20 0" Click="StartUnPackButton_Click" />
<Button x:Name="StopUnPackButton" Content="拆包机停止" FontSize="20" Background="OrangeRed" Width="120" Height="40" Margin="0,0,0,0" Click="StopUnPackButton_Click"/>
</StackPanel>
</Grid>
</Grid>
</Border>
@ -112,6 +175,7 @@
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="烘干机设备监控" FontSize="22" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
@ -128,11 +192,14 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<Ellipse x:Name="HotSignal1_1" VerticalAlignment="Center" Width="30" Height="30" Fill="Red"/>
<TextBlock Text="烘干机螺旋状态:" FontSize="20" VerticalAlignment="Center" Width="170" Margin="0,0,20,0" Foreground="White"/>
<TextBlock x:Name="HotSignal1_1_Value" Text="停止" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<Ellipse x:Name="HotSignal1_1" VerticalAlignment="Center" Width="30" Height="30" Fill="Red"/>
<TextBlock Text="烘干机螺旋状态:" FontSize="20" VerticalAlignment="Center" Width="170" Margin="0,0,20,0" Foreground="White"/>
<TextBlock x:Name="HotSignal1_1_Value" Text="停止" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<Ellipse x:Name="HotSignal1_2" VerticalAlignment="Center" Width="30" Height="30" Fill="Red"/>
<TextBlock Text="烘干机传动启动" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
@ -196,13 +263,13 @@
<TextBlock x:Name="HotSignal7_2_Value" Text="无" FontSize="20" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
</StackPanel>
<StackPanel Grid.Row="7" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<TextBox x:Name="HotSpiralSpeedTxt" Text="0.00" 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" />
</StackPanel>
<StackPanel Grid.Row="7" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 0">
<TextBox x:Name="HotTempTxt" Text="0.00" Width="70" Height="35" FontSize="20" VerticalAlignment="Center" Margin="30,0,10,0" Foreground="White"/>
<!--<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"/>
<Button x:Name="HotTempSet" Content="烘干机温度设定" FontSize="20" Width="150" Height="40" VerticalAlignment="Center" Margin="0,0,20,0" Background="DeepSkyBlue" Click="HotTempSet_Click" />
</StackPanel>
</StackPanel>-->
</Grid>
<StackPanel Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Top" Orientation="Horizontal" >
@ -326,7 +393,7 @@
<TextBox x:Name="Speed1Txt" Text="0.00" Width="70" Height="35" FontSize="20" VerticalAlignment="Center" Margin="10,0,0,0" Foreground="White"/>
<TextBlock Text="/" FontSize="20" VerticalAlignment="Center" Margin="5,0,5,0" Foreground="White"/>
<TextBox x:Name="Speed2Txt" Text="0.00" Width="70" Height="35" FontSize="20" VerticalAlignment="Center" Margin="0,0,10,0" Foreground="White"/>
<Button x:Name="SpiralSpeed" Content="螺旋1/2频率设定(0-50)" FontSize="20" Width="250" Height="40" VerticalAlignment="Center" Margin="0,0,20,0" Background="DeepSkyBlue" Click="SpiralSpeed_Click" />
<Button x:Name="SpiralSpeed" Content="螺旋1/2频率设定(0-50HZ)" FontSize="20" Width="250" Height="40" VerticalAlignment="Center" Margin="0,0,20,0" Background="DeepSkyBlue" Click="SpiralSpeed_Click" />
<Button x:Name="StartSpiral1Button" Content="螺旋1启动" FontSize="20" Background="LimeGreen" Width="100" Height="40" Margin="30 0 10 0" Click="StartSpiral1Button_Click"/>
<Button x:Name="StartSpiral2Button" Content="螺旋2启动" FontSize="20" Background="LimeGreen" Width="100" Height="40" Margin="0 0 10 0" Click="StartSpiral2Button_Click"/>

@ -57,10 +57,18 @@ namespace SlnMesnac.WPF.Page
private void Init()
{
List<BaseConfigInfo> configInfos = _configInfoBusiness.GetConfigInfos();
UnpackSet1Txt.Text = configInfos.Where(x => x.ConfigKey == "拆包机翻转机频率设定值").FirstOrDefault().ConfigValue;
UnpackSet2Txt.Text = configInfos.Where(x => x.ConfigKey == "拆包机滚筒筛频率设定值").FirstOrDefault().ConfigValue;
UnpackSet3Txt.Text = configInfos.Where(x => x.ConfigKey == "拆包机螺旋1频率设定值").FirstOrDefault().ConfigValue;
UnpackSet4Txt.Text = configInfos.Where(x => x.ConfigKey == "拆包机螺旋2频率设定值").FirstOrDefault().ConfigValue;
UnpackSet5Txt.Text = configInfos.Where(x => x.ConfigKey == "拆包机废袋机频率设定值").FirstOrDefault().ConfigValue;
Speed1Txt.Text = configInfos.Where(x => x.ConfigKey == "螺旋1速度值").FirstOrDefault().ConfigValue;
Speed2Txt.Text = configInfos.Where(x => x.ConfigKey == "螺旋2速度值").FirstOrDefault().ConfigValue;
HotSpiralSpeedTxt.Text = configInfos.Where(x => x.ConfigKey == "烘干机螺旋频率设定值").FirstOrDefault().ConfigValue;
HotTempTxt.Text = configInfos.Where(x => x.ConfigKey == "烘干机温度设定值").FirstOrDefault().ConfigValue;
//HotTempTxt.Text = configInfos.Where(x => x.ConfigKey == "烘干机温度设定值").FirstOrDefault().ConfigValue;
}
/// <summary>
/// 设备参数监听
@ -199,32 +207,20 @@ namespace SlnMesnac.WPF.Page
{
try
{
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程")) == false)
{
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允许远程未切换远程");
return;
}
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2MES允许远程")) == false)
{
MessageBox.Show("螺旋2MES允许远程未切换远程");
return;
}
String address = baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程");
#region 依次按序停止
Task.Run(() =>
{
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程启动"), false);
SendPulseSignal("拆包机远程停止");
Thread.Sleep(MachineSleep);
bool unPackStatus1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
if (unPackStatus1)
{
MessageBox.Show("一键停止失败,拆包机未停止,请先检查原因");
return;
}
#region 烘干机
SendPulseSignal("烘干机螺旋停止");
@ -232,13 +228,13 @@ namespace SlnMesnac.WPF.Page
SendPulseSignal("烘干机燃烧停止");
Thread.Sleep(MachineSleep);
SendPulseSignal("烘干机风机停止");
#endregion
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1启动"), false);
Thread.Sleep(MachineSleep);
SendPulseSignal("磁选机一键停止");
Thread.Sleep(MachineSleep);
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2启动"), false);
#endregion
MessageBoxAndLog("一键停止所有机器成功!");
});
#endregion
@ -305,6 +301,14 @@ namespace SlnMesnac.WPF.Page
SendPulseSignal("拆包机远程启动");
//频率设定
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机翻转机频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机翻转机频率设定值")));
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机滚筒筛频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机滚筒筛频率设定值")));
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率设定值")));
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率设定值")));
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定值")));
});
//StartUnPackButton.IsEnabled = false;
//StopUnPackButton.IsEnabled = true;
@ -702,7 +706,7 @@ namespace SlnMesnac.WPF.Page
bool result = false;
try
{
int value1 = int.Parse(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度值")) * 100;
int value1 = int.Parse(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度值"));
bool startFlag = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1启动"));
int speed1 = plc.readInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度反馈"));
if (!startFlag)
@ -710,7 +714,7 @@ namespace SlnMesnac.WPF.Page
MessageBox.Show($"烘干机螺旋启动失败:前提条件螺旋1未成功启动,请检查后重新启动");
return false;
}
if (speed1 < value1 * 0.8)
if (speed1 < value1 *100 * 0.8)
{
// plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2启动"), false);
MessageBox.Show($"烘干机螺旋启动失败:前提条件螺旋1速度{speed1}未达到设定值{value1}的下限阈值80%,请检查后重新启动");
@ -718,7 +722,7 @@ namespace SlnMesnac.WPF.Page
}
int value = int.Parse(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋频率设定值"));
SendPulseSignal("烘干机螺旋启动");
plc.writeInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋频率设定"), value1 * 100);
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋频率设定"), value1);
Thread.Sleep(MachineSleep / 2);
return true;
}
@ -774,7 +778,7 @@ namespace SlnMesnac.WPF.Page
}
int value = int.Parse(baseBusiness.GetPlcAddressByConfigKey("烘干机温度设定值"));
SendPulseSignal("烘干机燃烧启动");
plc.writeInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机温度设定"), value * 10);
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机温度设定"), value);
Thread.Sleep(MachineSleep);
return true;
}
@ -807,8 +811,18 @@ namespace SlnMesnac.WPF.Page
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程急停"), false);
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程停止"), false);
SendPulseSignal("拆包机远程启动");
//频率设定
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机翻转机频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机翻转机频率设定值")));
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机滚筒筛频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机滚筒筛频率设定值")));
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率设定值")));
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率设定值")));
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定值")));
Thread.Sleep(MachineSleep);
return plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机运行状态系统"));
// return plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机运行状态系统"));
return true;
}
catch (Exception ex)
@ -840,6 +854,16 @@ namespace SlnMesnac.WPF.Page
bool unPackStatus4 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("设备投料"));
bool unPackStatus5 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机请求移走空托盘"));
bool unPackStatus7 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机连接状态"));
bool unPackStatus8 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机堵料停螺旋"));
float unPackStatus9 = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机翻转机频率反馈"));
float unPackStatus10 = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机滚筒筛频率反馈"));
float unPackStatus11 = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率反馈"));
float unPackStatus12 = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率反馈"));
float unPackStatus13 = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率反馈"));
await App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
UnpackStatus0.Fill = unPackStatus0 ? Brushes.Green : Brushes.Red;
@ -849,7 +873,16 @@ namespace SlnMesnac.WPF.Page
UnpackStatus3.Text = unPackStatus3.ToString();
UnpackStatus4.Text = unPackStatus4.ToString();
UnpackStatus5.Text = unPackStatus5.ToString();
UnpackStatus7.Fill = unPackStatus7 ? Brushes.Green : Brushes.Red;
UnpackStatus8.Fill = unPackStatus8 ? Brushes.Red : Brushes.Green;
UnpackStatus9.Text = unPackStatus9.ToString("F2");
UnpackStatus10.Text = unPackStatus10.ToString("F2");
UnpackStatus11.Text = unPackStatus11.ToString("F2");
UnpackStatus12.Text = unPackStatus12.ToString("F2");
UnpackStatus13.Text = unPackStatus13.ToString("F2");
}));
}
@ -1122,7 +1155,7 @@ namespace SlnMesnac.WPF.Page
List<BaseConfigInfo> configInfos = _configInfoBusiness.GetConfigInfos();
BaseConfigInfo configInfo = configInfos.Where(x => x.ConfigKey == "烘干机螺旋频率设定值").FirstOrDefault();
plc.writeInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋频率设定"), speed1 * 100);
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋频率设定"), speed1);
configInfo.ConfigValue = HotSpiralSpeedTxt.Text;
@ -1142,38 +1175,53 @@ namespace SlnMesnac.WPF.Page
}
}
/// <summary>
/// 烘干机温度设定
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void HotTempSet_Click(object sender, RoutedEventArgs e)
private void UnpackSetButton_Click(object sender, RoutedEventArgs e)
{
try
{
bool isValidTemp = int.TryParse(HotTempTxt.Text, out int temp);
bool isValidSpeed1 = int.TryParse(UnpackSet1Txt.Text, out int speed1) && speed1 >= 0 && speed1 <= 50;
bool isValidSpeed2 = int.TryParse(UnpackSet2Txt.Text, out int speed2) && speed2 >= 0 && speed2 <= 50;
bool isValidSpeed3 = int.TryParse(UnpackSet3Txt.Text, out int speed3) && speed3 >= 0 && speed3 <= 50;
bool isValidSpeed4 = int.TryParse(UnpackSet4Txt.Text, out int speed4) && speed4 >= 0 && speed4 <= 50;
bool isValidSpeed5 = int.TryParse(UnpackSet5Txt.Text, out int speed5) && speed5 >= 0 && speed5 <= 50;
// 校验输入的整数是否在0到50之间且大于0
if (isValidTemp && temp > 0)
if (isValidSpeed1 && isValidSpeed2 && isValidSpeed3 && isValidSpeed4 && isValidSpeed5)
{
var result = MessageBox.Show("是否确认更改?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Information);
if (result == MessageBoxResult.Yes)
{
List<BaseConfigInfo> configInfos = _configInfoBusiness.GetConfigInfos();
BaseConfigInfo configInfo = configInfos.Where(x => x.ConfigKey == "烘干机螺旋频率设定值").FirstOrDefault();
plc.writeInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机温度设定"), temp*10);
configInfo.ConfigValue = HotTempTxt.Text;
_configInfoBusiness.UpdateConfigInfo(configInfo);
//频率设定
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机翻转机频率设定"), speed1);
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机滚筒筛频率设定"), speed2);
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率设定"), speed3);
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率设定"), speed4);
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定"), speed5);
List<BaseConfigInfo> configInfos = _configInfoBusiness.GetConfigInfos();
BaseConfigInfo configInfo1 = configInfos.Where(x => x.ConfigKey == "拆包机翻转机频率设定值").FirstOrDefault();
BaseConfigInfo configInfo2 = configInfos.Where(x => x.ConfigKey == "拆包机滚筒筛频率设定值").FirstOrDefault();
BaseConfigInfo configInfo3 = configInfos.Where(x => x.ConfigKey == "拆包机螺旋1频率设定值").FirstOrDefault();
BaseConfigInfo configInfo4 = configInfos.Where(x => x.ConfigKey == "拆包机螺旋2频率设定值").FirstOrDefault();
BaseConfigInfo configInfo5 = configInfos.Where(x => x.ConfigKey == "拆包机废袋机频率设定值").FirstOrDefault();
configInfo1.ConfigValue = UnpackSet1Txt.Text;
configInfo2.ConfigValue = UnpackSet2Txt.Text;
configInfo3.ConfigValue = UnpackSet3Txt.Text;
configInfo4.ConfigValue = UnpackSet4Txt.Text;
configInfo5.ConfigValue = UnpackSet5Txt.Text;
_configInfoBusiness.UpdateConfigInfo(configInfo1);
_configInfoBusiness.UpdateConfigInfo(configInfo2);
_configInfoBusiness.UpdateConfigInfo(configInfo3);
_configInfoBusiness.UpdateConfigInfo(configInfo4);
_configInfoBusiness.UpdateConfigInfo(configInfo5);
}
}
else
{
MessageBox.Show("请输入大于0正整数");
MessageBox.Show("请输入0到50之间的正整数!");
}
}
@ -1181,6 +1229,50 @@ namespace SlnMesnac.WPF.Page
{
_logger.LogError(ex.Message);
}
}
/// <summary>
/// 烘干机温度设定
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//private void HotTempSet_Click(object sender, RoutedEventArgs e)
//{
// try
// {
// bool isValidTemp = int.TryParse(HotTempTxt.Text, out int temp);
// // 校验输入的整数是否在0到50之间且大于0
// if (isValidTemp && temp > 0)
// {
// var result = MessageBox.Show("是否确认更改?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Information);
// if (result == MessageBoxResult.Yes)
// {
// List<BaseConfigInfo> configInfos = _configInfoBusiness.GetConfigInfos();
// BaseConfigInfo configInfo = configInfos.Where(x => x.ConfigKey == "烘干机温度设定值").FirstOrDefault();
// plc.writeInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机温度设定"), temp);
// configInfo.ConfigValue = HotTempTxt.Text;
// _configInfoBusiness.UpdateConfigInfo(configInfo);
// }
// }
// else
// {
// MessageBox.Show("请输入大于0正整数");
// }
// }
// catch (Exception ex)
// {
// _logger.LogError(ex.Message);
// }
//}
}
}

Loading…
Cancel
Save