change-添加气压检测及开机阈值判断

dev
liuwf 3 months ago
parent 770b106178
commit 99506633ae

@ -23,6 +23,9 @@
<Button x:Name="StartButton" Style="{StaticResource BUTTON_AGREE}" Content="一键启动" FontSize="30" Background="LimeGreen" Width="180" Height="45" Margin="0 0 20 0" Click="StartButton_Click"/>
<Button x:Name="StopButton" Style="{StaticResource BUTTON_AGREE}" Content="一键停止" FontSize="30" Background="OrangeRed" Width="180" Height="45" Margin="0,0,20,0" Click="StopButton_Click"/>
<TextBlock Text="气压实时监测:" FontSize="25" VerticalAlignment="Center" Width="172" Foreground="White" Margin="50 0 10 0" />
<TextBlock x:Name="PressureTxt" Text="0" Width="70" FontSize="25" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
<TextBlock Text="缓存区重量:" FontSize="25" VerticalAlignment="Center" Width="140" Foreground="White" HorizontalAlignment="Left" Margin="150 0 10 0" />
<TextBlock x:Name="BufferWeightTxt" Text="0" Width="80" FontSize="25" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
<Button x:Name="SetStopWeightButton" Content="设置重量阈值" FontSize="25" Foreground="White" Background="CadetBlue" Width="200" Height="60" Margin="0 0 20 0" HorizontalAlignment="Left" Click="SetStopWeightButton_Click" />
@ -32,7 +35,7 @@
<TextBlock Visibility="Collapsed" x:Name="BagsAmountTxt" Text="0" Width="80" FontSize="25" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
<Button Visibility="Collapsed" x:Name="AmountChangeButton" Style="{StaticResource BUTTON_AGREE}" Content="数量调整" FontSize="30" Background="CadetBlue" Width="180" Height="60" Margin="0 0 20 0" HorizontalAlignment="Left" Click="AmountChangeButton_Click"/>
<Button x:Name="MachineStopHistoryButton" Content="停机记录" FontSize="25" Foreground="White" Background="CadetBlue" Width="200" Height="60" Margin="300 0 20 0" HorizontalAlignment="Left" Click="MachineStopHistoryButton_Click"/>
<Button x:Name="MachineStopHistoryButton" Content="停机记录" FontSize="25" Foreground="White" Background="CadetBlue" Width="200" Height="60" Margin="50 0 20 0" HorizontalAlignment="Left" Click="MachineStopHistoryButton_Click"/>
</StackPanel>
</Grid>
@ -479,7 +482,7 @@
<StackPanel x:Name="Spiral2BackColor" Grid.Row="1" Grid.Column="2" Orientation="Horizontal" Background="Green" Margin="0,3" Height="50">
<TextBlock Text="螺旋2" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="24" Foreground="White"/>
</StackPanel>
</Grid>
<StackPanel Grid.Row="2" VerticalAlignment="Top" Orientation="Horizontal" HorizontalAlignment="Center">

@ -56,6 +56,7 @@ namespace SlnMesnac.WPF.Page
private readonly IDmsRealtimeStatusService? dmsRealtimeStatusService;
PlcAbsractFactory plc = null;
PlcAbsractFactory pressurePlc = null;
int MachineSleep = 1000;
private readonly ILogger<DevMonitorPage>? _logger;
@ -81,6 +82,7 @@ namespace SlnMesnac.WPF.Page
baseBusiness = App.ServiceProvider.GetService<BaseBusiness>();
MachineSleep = Convert.ToInt32(baseBusiness.GetPlcAddressByConfigKey("设备启动间隔"));
plc = baseBusiness.GetPlcByKey("plc");
pressurePlc = baseBusiness.GetPlcByKey("pressurePlc");
InitializeComponent();
this.DataContext = new DevMonitorViewModel();
Init();
@ -175,7 +177,7 @@ namespace SlnMesnac.WPF.Page
RefreshHot(machineStatusDtos, realtimeStatusList);
RefreshUnPack(machineStatusDtos, realtimeStatusList);
//设备缓存区重量监听及启停机控制,监听包装袋余量
//设备缓存区重量监听及启停机控制,监听管道气压
RefreshWeight(realtimeStatusList);
//开关机时间采集
@ -220,10 +222,34 @@ namespace SlnMesnac.WPF.Page
{
try
{
string Bags_Amount = _configInfoBusiness.GetConfigInfos().FirstOrDefault(x => x.ConfigKey == "包装袋余量").ConfigValue;
#region 监听气压 192.168.2.31PLCDB100.DBD46 压缩空气压力 real
float pressure = 0;
if (pressurePlc != null && pressurePlc.IsConnected)
{
float pressureWarnValue = float.Parse(baseBusiness.GetPlcAddressByConfigKey("3楼拆包机气压检测报警阈值"));
pressure = pressurePlc.readFloatByAddress("DB100.DBD46");
// 预留功能 推送昆明气压值及设定阈值
//如果系统设备在运行,气压不足报警
if(recipeManageCache.SystemStatus == "1" && pressure < pressureWarnValue)
{
Application.Current.Dispatcher.Invoke(() =>
{
Msg.MsgShow($"设备气压不足,当前{pressure},阈值{pressureWarnValue}", 2, 1);
});
}
}
#endregion
// string Bags_Amount = _configInfoBusiness.GetConfigInfos().FirstOrDefault(x => x.ConfigKey == "包装袋余量").ConfigValue;
App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
BagsAmountTxt.Text = Bags_Amount;
// BagsAmountTxt.Text = Bags_Amount;
PressureTxt.Text = pressure.ToString();
BufferWeightTxt.Text = recipeManageCache.BufferWeight.ToString("F2");
}));
@ -256,7 +282,7 @@ namespace SlnMesnac.WPF.Page
}
}
realtimeStatusList.First(x => x.StatusCode == "Bags_Amount").StatusValue = Bags_Amount;
// realtimeStatusList.First(x => x.StatusCode == "Bags_Amount").StatusValue = Bags_Amount;
realtimeStatusList.First(x => x.StatusCode == "Cache_MaxWeight").StatusValue = Cache_MaxWeight.ToString();
realtimeStatusList.First(x => x.StatusCode == "Cache_Weight").StatusValue = Cache_Weight.ToString();
@ -755,6 +781,24 @@ namespace SlnMesnac.WPF.Page
try
{
//判断气压
if (pressurePlc != null && pressurePlc.IsConnected)
{
float pressureWarnValue = float.Parse(baseBusiness.GetPlcAddressByConfigKey("3楼拆包机气压检测报警阈值"));
float pressure = pressurePlc.readFloatByAddress("DB100.DBD46");
//如果系统设备在运行,气压不足报警
if (pressure < pressureWarnValue)
{
Application.Current.Dispatcher.Invoke(() =>
{
Msg.MsgShow($"设备气压不足,当前{pressure},阈值{pressureWarnValue}", 2, 1);
});
return;
}
}
var result = MessageBox.Show("是否确认启动?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Information);
if (result == MessageBoxResult.Yes)
{
@ -835,6 +879,8 @@ namespace SlnMesnac.WPF.Page
{
try
{
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程")) == false)
{
@ -2165,6 +2211,16 @@ namespace SlnMesnac.WPF.Page
realtimeStatusList.First(x => x.StatusCode == "UnPack_Spiral2_HZ").StatusValue = UnPack_Spiral2_HZ.ToString("F2");
realtimeStatusList.First(x => x.StatusCode == "UnPack_Waste_HZ").StatusValue = UnPack_Waste_HZ.ToString("F2");
#region 监听气压
if (pressurePlc != null && pressurePlc.IsConnected)
{
float pressure = pressurePlc.readFloatByAddress("DB100.DBD46");
realtimeStatusList.First(x => x.StatusCode == "PressureValue").StatusValue = pressure.ToString("F2");
}
#endregion
}
catch (Exception ex)
{

@ -45,12 +45,13 @@
"isFlage": true
},
{
"configId": 2, //MES
"configId": 2,
"plcType": "SiemensPlc",
"plcIp": "127.0.0.1",
"plcPort": 103,
"plcKey": "mesSingal",
"isFlage": false
"plcIp": "192.168.2.31",
"plcPort": 102,
//plc DB100.DBD46 real
"plcKey": "pressurePlc",
"isFlage": true
}
],
"RfidConfig": [

Loading…
Cancel
Save