change-设备监听bug修复

dev
liuwf 2 months ago
parent 5ee2442966
commit 5d543ce35a

@ -78,17 +78,18 @@ namespace SlnMesnac.Business
_mesProductOrderService = serviceProvider.GetRequiredService<IMesProductOrderService>(); _mesProductOrderService = serviceProvider.GetRequiredService<IMesProductOrderService>();
_baseMaterialInfoService = serviceProvider.GetRequiredService<IBaseMaterialInfoService>(); _baseMaterialInfoService = serviceProvider.GetRequiredService<IBaseMaterialInfoService>();
Init(); Init();
// test();
} }
private void test() private void test()
{ {
// MesProductPlanDetail? mesProductPlanDetail = sqlSugarClient.AsTenant().GetConnection("mes").Queryable<MesProductPlanDetail>().First(x => x.PlanCode == "20240724144533JL001"); // MesProductPlanDetail? mesProductPlanDetail = sqlSugarClient.AsTenant().GetConnection("mes").Queryable<MesProductPlanDetail>().First(x => x.PlanCode == "20240724144533JL001");
// string epc = "A123456"; sqlSugarClient.AsTenant().BeginTran();
//_mesProductPlanService.GetStartedProdPlan(out MesProductPlanDto productPlanDto); string epc = "A123456";
// string bigCode = GenerateBigBarcode(productPlanDto, epc); _mesProductPlanService.GetStartedProdPlan(out MesProductPlanDto productPlanDto);
// BindingBarCode(bigCode, epc); string bigCode = GenerateBigBarcode(productPlanDto, epc);
BindingBarCode(bigCode, epc, productPlanDto);
sqlSugarClient.AsTenant().BeginTran();
} }
@ -287,7 +288,6 @@ namespace SlnMesnac.Business
readRfidAmount++; readRfidAmount++;
if (readRfidAmount == 5) if (readRfidAmount == 5)
{ {
string virtualEpc = NoReadRFIDAlarm(); string virtualEpc = NoReadRFIDAlarm();
_logger.LogError("小包出口到位信号触发,读取RFID失败超过5次......"); _logger.LogError("小包出口到位信号触发,读取RFID失败超过5次......");
if (!string.IsNullOrEmpty(virtualEpc)) if (!string.IsNullOrEmpty(virtualEpc))

@ -22,7 +22,6 @@
<TextBlock x:Name="SystemStatusTxt" Text="系统停机中" FontSize="35" VerticalAlignment="Center" Width="180" Foreground="White" /> <TextBlock x:Name="SystemStatusTxt" Text="系统停机中" FontSize="35" VerticalAlignment="Center" Width="180" Foreground="White" />
<Button x:Name="StartButton" Style="{StaticResource BUTTON_AGREE}" Content="一键启动" FontSize="30" Background="LimeGreen" Width="180" Height="60" Margin="0 0 20 0" Click="StartButton_Click"/> <Button x:Name="StartButton" Style="{StaticResource BUTTON_AGREE}" Content="一键启动" FontSize="30" Background="LimeGreen" Width="180" Height="60" Margin="0 0 20 0" Click="StartButton_Click"/>
<Button x:Name="StopButton" Style="{StaticResource BUTTON_AGREE}" Content="一键停止" FontSize="30" Background="OrangeRed" Width="180" Height="60" Margin="0,0,20,0" Click="StopButton_Click"/> <Button x:Name="StopButton" Style="{StaticResource BUTTON_AGREE}" Content="一键停止" FontSize="30" Background="OrangeRed" Width="180" Height="60" Margin="0,0,20,0" Click="StopButton_Click"/>
<Button x:Name="StopUrgentButton" Style="{StaticResource BUTTON_AGREE}" Content="急停" FontSize="30" Background="#E4B74C" Width="150" Height="60" Margin="0,0,0,0" Click="StopUrgentButton_Click"/>
<TextBlock Text="缓存区重量:" FontSize="25" VerticalAlignment="Center" Width="140" Foreground="White" HorizontalAlignment="Left" Margin="150 0 10 0" /> <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"/> <TextBlock x:Name="BufferWeightTxt" Text="0" Width="80" FontSize="25" VerticalAlignment="Center" Margin="0,0,20,0" Foreground="White"/>
@ -173,7 +172,9 @@
<StackPanel Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Top" Orientation="Horizontal" > <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="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"/> <Button x:Name="StopUnPackButton" Content="拆包机停止" FontSize="20" Background="OrangeRed" Width="120" Height="40" Margin="0,0,20,0" Click="StopUnPackButton_Click"/>
<Button x:Name="StopUrgentButton" Style="{StaticResource BUTTON_AGREE}" Content="急停" FontSize="20" Background="#E4B74C" Width="120" Height="40" Margin="0,0,0,0" Click="StopUrgentButton_Click"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
</Grid> </Grid>

@ -42,7 +42,7 @@ namespace SlnMesnac.WPF.Page
// 设备报警采集缓存 // 设备报警采集缓存
private List<DmsRecordAlarmTime>? WarningList = null; private List<DmsRecordAlarmTime>? WarningList = null;
// 设备参数实时状态 // 设备参数实时状态
private List<DmsRealtimeStatus>? realtimeStatusList= null; private List<DmsRealtimeStatus>? realtimeStatusList = null;
private ISqlSugarClient? sqlClient = null; private ISqlSugarClient? sqlClient = null;
@ -82,7 +82,7 @@ namespace SlnMesnac.WPF.Page
StartAdjustRecipe(); StartAdjustRecipe();
} }
private void Init() private void Init()
{ {
@ -177,7 +177,7 @@ namespace SlnMesnac.WPF.Page
Thread.Sleep(1000 * 30); Thread.Sleep(1000 * 30);
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -197,7 +197,7 @@ namespace SlnMesnac.WPF.Page
{ {
string Bags_Amount = _configInfoBusiness.GetConfigInfos().FirstOrDefault(x => x.ConfigKey == "包装袋余量").ConfigValue; string Bags_Amount = _configInfoBusiness.GetConfigInfos().FirstOrDefault(x => x.ConfigKey == "包装袋余量").ConfigValue;
App.Current.Dispatcher.BeginInvoke((Action)(() => App.Current.Dispatcher.BeginInvoke((Action)(() =>
{ {
BagsAmountTxt.Text = Bags_Amount; BagsAmountTxt.Text = Bags_Amount;
BufferWeightTxt.Text = recipeManageCache.BufferWeight.ToString("F2"); BufferWeightTxt.Text = recipeManageCache.BufferWeight.ToString("F2");
@ -208,21 +208,21 @@ namespace SlnMesnac.WPF.Page
double Cache_MinWeight = recipeManageCache.MinBufferWeight; double Cache_MinWeight = recipeManageCache.MinBufferWeight;
double Cache_Weight = recipeManageCache.BufferWeight; double Cache_Weight = recipeManageCache.BufferWeight;
bool unPackStatus = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态")); bool unPackStatus = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
if (unPackStatus && (Cache_MaxWeight <= Cache_Weight)) if (recipeManageCache.SystemStatus == "1" && unPackStatus && (Cache_MaxWeight <= Cache_Weight))
{ {
// 停拆包机 // 停拆包机
Task.Run(() => StopMachine(0);
{ _logger.LogWarning($"设备缓存区当前重量:{Cache_Weight},预设最大重量值:{Cache_MaxWeight},已经超重并且拆包机运行,系统下发停机命令!");
StopMachine(0);
MessageBox.Show($"设备缓存区当前重量:{Cache_Weight},预设最大重量值:{Cache_MaxWeight},已经超重并且拆包机运行,系统下发停机命令!");
_logger.LogError($"设备缓存区当前重量:{Cache_Weight},预设最大重量值:{Cache_MaxWeight},已经超重并且拆包机运行,系统下发停机命令!");
});
Thread.Sleep(2000); }
}else if(recipeManageCache.SystemStatus=="1" && (Cache_MinWeight >= Cache_Weight) && unPackStatus == false) else if (recipeManageCache.SystemStatus == "1" && (Cache_MinWeight >= Cache_Weight) && unPackStatus == false)
{ {
StartAll(); bool unPackWarn = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机堵料停螺旋"));
if (!unPackWarn && plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程")) == true)
{
StartUnPack();
}
} }
realtimeStatusList.First(x => x.StatusCode == "Bags_Amount").StatusValue = Bags_Amount; realtimeStatusList.First(x => x.StatusCode == "Bags_Amount").StatusValue = Bags_Amount;
@ -409,7 +409,7 @@ namespace SlnMesnac.WPF.Page
alarmWindow.ShowDialog(); alarmWindow.ShowDialog();
}); });
if(status >= 0) if (status >= 0)
{ {
Task.Run(() => Task.Run(() =>
{ {
@ -430,7 +430,8 @@ namespace SlnMesnac.WPF.Page
if (warnStatusEnum == WarnStatusEnum.) if (warnStatusEnum == WarnStatusEnum.)
{ {
return 0; return 0;
}else if(warnStatusEnum == WarnStatusEnum. || warnStatusEnum == WarnStatusEnum.) }
else if (warnStatusEnum == WarnStatusEnum. || warnStatusEnum == WarnStatusEnum.)
{ // 不停 { // 不停
return -1; return -1;
} }
@ -438,16 +439,19 @@ namespace SlnMesnac.WPF.Page
{ {
return 3; return 3;
} }
else if(warnStatusEnum == WarnStatusEnum.1) else if (warnStatusEnum == WarnStatusEnum.1)
{ {
return 4; return 4;
}else if (warnStatusEnum == WarnStatusEnum.2) }
else if (warnStatusEnum == WarnStatusEnum.2)
{ {
return 6; return 6;
}else if (warnStatusEnum.ToString().Contains("磁选机")) }
else if (warnStatusEnum.ToString().Contains("磁选机"))
{ {
return 5; return 5;
}else }
else
{ {
return -1; return -1;
} }
@ -727,29 +731,29 @@ namespace SlnMesnac.WPF.Page
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程")) == false) if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程")) == false)
{ {
MessageBox.Show("拆包机MES允许远程,未切换远程"); MessageBox.Show("拆包机MES屏蔽");
return; return;
} }
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机MES允许远程")) == false) if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机MES允许远程")) == false)
{ {
MessageBox.Show("磁选机MES允许远程,未切换远程"); MessageBox.Show("磁选机MES屏蔽");
return; return;
} }
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1MES允许远程")) == false) if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1MES允许远程")) == false)
{ {
MessageBox.Show("螺旋1MES允许远程,未切换远程"); MessageBox.Show("螺旋1MES屏蔽");
return; return;
} }
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2MES允许远程")) == false) if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2MES允许远程")) == false)
{ {
MessageBox.Show("螺旋2MES允许远程,未切换远程"); MessageBox.Show("螺旋2MES屏蔽");
return; return;
} }
App.Current.Dispatcher.BeginInvoke((Action)(() => App.Current.Dispatcher.BeginInvoke((Action)(() =>
{ {
StartButton.IsEnabled = false; StartButton.IsEnabled = false;
})); }));
Task.Run(() => Task.Run(() =>
{ {
@ -784,13 +788,12 @@ namespace SlnMesnac.WPF.Page
#endregion #endregion
if (unpackStatus) if (unpackStatus)
{ {
recipeManageCache.SystemStatus = "1"; recipeManageCache.SystemStatus = "1";
App.Current.Dispatcher.BeginInvoke((Action)(() => App.Current.Dispatcher.BeginInvoke((Action)(() =>
{ {
StartButton.IsEnabled = true; StartButton.IsEnabled = true;
})); }));
} }
}); });
@ -819,25 +822,25 @@ namespace SlnMesnac.WPF.Page
StopButton.IsEnabled = false; StopButton.IsEnabled = false;
})); }));
recipeManageCache.SystemStatus = "0";
#region 依次按序停止 #region 依次按序停止
Task.Run(() => Task.Run(() =>
{ {
bool result =StopMachine(99); bool result = StopMachine(99);
if (result) if (result)
{ {
MessageBoxAndLog("一键停止所有机器成功!"); MessageBoxAndLog("一键停止所有机器成功!");
recipeManageCache.SystemStatus = "0";
App.Current.Dispatcher.BeginInvoke((Action)(() => App.Current.Dispatcher.BeginInvoke((Action)(() =>
{ {
StopButton.IsEnabled = true; StopButton.IsEnabled = true;
})); }));
} }
}); });
#endregion #endregion
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -862,22 +865,22 @@ namespace SlnMesnac.WPF.Page
private bool StopMachine(int stopLevel = 0) private bool StopMachine(int stopLevel = 0)
{ {
bool result = false; bool result = false;
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程启动"), false); plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程启动"), false);
SendPulseSignal("拆包机远程停止"); SendPulseSignal("拆包机远程停止");
if (stopLevel < 1) return result;
Thread.Sleep(MachineSleep); Thread.Sleep(MachineSleep);
bool unPackStatus1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态")); bool unPackStatus1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
if (unPackStatus1) if (unPackStatus1)
{ {
MessageBox.Show("拆包机未成功停止,请检查"); Console.WriteLine("拆包机未成功停止,请检查");
return result; return result;
} }
if (stopLevel < 1) return true;
#region 烘干机 #region 烘干机
SendPulseSignal("烘干机燃烧停止"); SendPulseSignal("烘干机燃烧停止");
if (stopLevel < 3) return result; if (stopLevel < 3) return result;
Thread.Sleep(MachineSleep); Thread.Sleep(MachineSleep);
SendPulseSignal("烘干机螺旋停止"); SendPulseSignal("烘干机螺旋停止");
@ -889,10 +892,10 @@ namespace SlnMesnac.WPF.Page
if (stopLevel < 4) return result; if (stopLevel < 4) return result;
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1启动"), false); plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1启动"), false);
if(stopLevel < 5) return result; if (stopLevel < 5) return result;
Thread.Sleep(MachineSleep); Thread.Sleep(MachineSleep);
SendPulseSignal("磁选机一键停止"); SendPulseSignal("磁选机一键停止");
if(stopLevel < 6) return result; if (stopLevel < 6) return result;
Thread.Sleep(MachineSleep); Thread.Sleep(MachineSleep);
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2启动"), false); plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2启动"), false);
result = true; result = true;
@ -907,35 +910,43 @@ namespace SlnMesnac.WPF.Page
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
private void StopUrgentButton_Click(object sender, RoutedEventArgs e) private async void StopUrgentButton_Click(object sender, RoutedEventArgs e)
{ {
var result = MessageBox.Show("是否确认急停?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Warning);
if (result == MessageBoxResult.Yes) try
{ {
try if (StopUrgentButton.Content.ToString() == "急停")
{ {
if (StopUrgentButton.Content.ToString() == "急停") var result = MessageBox.Show("是否确认急停?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Warning);
if (result == MessageBoxResult.Yes)
{ {
//StopButton.IsEnabled = false; StopUrgentButton.Background = Brushes.Red;
//StopUrgentButton.Content = "复位"; StopUrgentButton.Content = "复位";
SendPulseSignal("拆包机远程急停"); SendPulseSignal("拆包机远程急停");
recipeManageCache.SystemStatus = "0";
recipeManageCache.SystemStatus = "0";
} }
else if (StopUrgentButton.Content.ToString() == "复位") }
else if (StopUrgentButton.Content.ToString() == "复位")
{
var result = MessageBox.Show("是否确认复位?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Warning);
if (result == MessageBoxResult.Yes)
{ {
//StopButton.IsEnabled = true; // StopButton.IsEnabled = true;
//StopUrgentButton.Content = "急停"; StopUrgentButton.Content = "急停";
StopUrgentButton.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#E4B74C"));
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程急停"), false); plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程急停"), false);
recipeManageCache.SystemStatus = "1"; recipeManageCache.SystemStatus = "1";
} }
} }
catch (Exception ex)
{
_logger.LogError($"拆包机远程急停:{ex.Message}");
}
} }
catch (Exception ex)
{
_logger.LogError($"拆包机远程急停:{ex.Message}");
}
} }
#region 拆包机 #region 拆包机
@ -948,9 +959,14 @@ namespace SlnMesnac.WPF.Page
{ {
try try
{ {
if(StopUrgentButton.Content.ToString() == "复位")
{
MessageBox.Show("请先点击复位按钮");
return;
}
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程")) == false) if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程")) == false)
{ {
MessageBox.Show("拆包机MES允许远程未切换远程"); MessageBox.Show("拆包机MES屏蔽");
return; return;
} }
bool unPackWarn = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机堵料停螺旋")); bool unPackWarn = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机堵料停螺旋"));
@ -1031,7 +1047,7 @@ namespace SlnMesnac.WPF.Page
{ {
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机MES允许远程")) == false) if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机MES允许远程")) == false)
{ {
MessageBox.Show("磁选机MES允许远程,未切换远程"); MessageBox.Show("磁选机MES屏蔽");
return; return;
} }
//判断报警--- //判断报警---
@ -1361,7 +1377,7 @@ namespace SlnMesnac.WPF.Page
Thread.Sleep(MachineSleep); Thread.Sleep(MachineSleep);
result = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2启动")); result = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2启动"));
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -1565,7 +1581,7 @@ namespace SlnMesnac.WPF.Page
bool startFlag = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机反馈燃烧启动")); bool startFlag = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机反馈燃烧启动"));
if (!startFlag) if (!startFlag)
{ {
MessageBox.Show($"拆包机启动失败:前提条件烘干机燃烧未成功启动,请检查后重新启动"); _logger.LogError($"拆包机启动失败:前提条件烘干机燃烧未成功启动,请检查后重新启动");
return false; return false;
} }
@ -1580,7 +1596,6 @@ namespace SlnMesnac.WPF.Page
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率设定"), recipeManageCache.useRecipeManage.UnpackSpiral2); plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率设定"), recipeManageCache.useRecipeManage.UnpackSpiral2);
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定值"))); // plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定值")));
Thread.Sleep(MachineSleep); Thread.Sleep(MachineSleep);
// return plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机运行状态系统")); // return plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机运行状态系统"));
return true; return true;
@ -1603,7 +1618,7 @@ namespace SlnMesnac.WPF.Page
/// <summary> /// <summary>
/// 拆包机参数监控 /// 拆包机参数监控
/// </summary> /// </summary>
private void RefreshUnPack(List<MachineStatusDto> machineStatusDtos,List<DmsRealtimeStatus> realtimeStatusList) private void RefreshUnPack(List<MachineStatusDto> machineStatusDtos, List<DmsRealtimeStatus> realtimeStatusList)
{ {
try try
{ {
@ -1614,7 +1629,7 @@ namespace SlnMesnac.WPF.Page
bool unPackStatus3 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("物料到位")); bool unPackStatus3 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("物料到位"));
bool unPackStatus4 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("设备投料")); bool unPackStatus4 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("设备投料"));
bool unPackStatus5 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机请求移走空托盘")); bool unPackStatus5 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机请求移走空托盘"));
bool unPackStatus7 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机连接状态")); bool unPackStatus7 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机连接状态"));
bool unPackStatus8 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机堵料停螺旋")); bool unPackStatus8 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机堵料停螺旋"));
@ -1623,39 +1638,39 @@ namespace SlnMesnac.WPF.Page
float UnPack_Spiral1_HZ = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率反馈")); float UnPack_Spiral1_HZ = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率反馈"));
float UnPack_Spiral2_HZ = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率反馈")); float UnPack_Spiral2_HZ = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率反馈"));
float UnPack_Waste_HZ = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率反馈")); float UnPack_Waste_HZ = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率反馈"));
App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
UnpackStatus0.Fill = UnPack_MesUse_Flag ? Brushes.Green : Brushes.Red;
UnpackStatus1.Fill = UnPack_Status ? Brushes.Green : Brushes.Red;
UnpackStatus2.Text = unPackStatus2.ToString();
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 = UnPack_Flip_HZ.ToString("F2"); App.Current.Dispatcher.BeginInvoke((Action)(() =>
UnpackStatus10.Text = UnPack_Roll_HZ.ToString("F2"); {
UnpackStatus11.Text = UnPack_Spiral1_HZ.ToString("F2"); UnpackStatus0.Fill = UnPack_MesUse_Flag ? Brushes.Green : Brushes.Red;
UnpackStatus12.Text = UnPack_Spiral2_HZ.ToString("F2"); UnpackStatus1.Fill = UnPack_Status ? Brushes.Green : Brushes.Red;
UnpackStatus13.Text = UnPack_Waste_HZ.ToString("F2");
UnpackStatus2.Text = unPackStatus2.ToString();
if (recipeManageCache.SystemStatus == "1") UnpackStatus3.Text = unPackStatus3.ToString();
{ UnpackStatus4.Text = unPackStatus4.ToString();
SystemStatusTxt.Text = "系统运行中"; UnpackStatus5.Text = unPackStatus5.ToString();
SystemStatusColor.Fill = Brushes.Green;
} UnpackStatus7.Fill = unPackStatus7 ? Brushes.Green : Brushes.Red;
else UnpackStatus8.Fill = unPackStatus8 ? Brushes.Red : Brushes.Green;
{
SystemStatusTxt.Text = "系统停机中"; UnpackStatus9.Text = UnPack_Flip_HZ.ToString("F2");
SystemStatusColor.Fill = Brushes.Red; UnpackStatus10.Text = UnPack_Roll_HZ.ToString("F2");
} UnpackStatus11.Text = UnPack_Spiral1_HZ.ToString("F2");
UnpackStatus12.Text = UnPack_Spiral2_HZ.ToString("F2");
})); UnpackStatus13.Text = UnPack_Waste_HZ.ToString("F2");
if (recipeManageCache.SystemStatus == "1")
{
SystemStatusTxt.Text = "系统运行中";
SystemStatusColor.Fill = Brushes.Green;
}
else
{
SystemStatusTxt.Text = "系统停机中";
SystemStatusColor.Fill = Brushes.Red;
}
}));
//数据采集部分 //数据采集部分
@ -1693,7 +1708,7 @@ namespace SlnMesnac.WPF.Page
/// <summary> /// <summary>
/// 磁选机参数监控 /// 磁选机参数监控
/// </summary> /// </summary>
private void RefreshMagNet(List<MachineStatusDto> machineStatusDtos, List<DmsRealtimeStatus> realtimeStatusList) private void RefreshMagNet(List<MachineStatusDto> machineStatusDtos, List<DmsRealtimeStatus> realtimeStatusList)
{ {
try try
{ {
@ -1702,13 +1717,13 @@ namespace SlnMesnac.WPF.Page
bool MagNet_MesUse_Flag = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机MES允许远程")); bool MagNet_MesUse_Flag = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机MES允许远程"));
bool signal3 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机设备故障反馈")); bool signal3 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机设备故障反馈"));
App.Current.Dispatcher.BeginInvoke((Action)(() => App.Current.Dispatcher.BeginInvoke((Action)(() =>
{ {
MagNetStatus1.Fill = MagNet_Shake_Status ? Brushes.Green : Brushes.Red; MagNetStatus1.Fill = MagNet_Shake_Status ? Brushes.Green : Brushes.Red;
MagNetStatus2.Fill = MagNet_Status ? Brushes.Green : Brushes.Red; MagNetStatus2.Fill = MagNet_Status ? Brushes.Green : Brushes.Red;
MagNetStatus3.Fill = MagNet_MesUse_Flag ? Brushes.Green : Brushes.Red; MagNetStatus3.Fill = MagNet_MesUse_Flag ? Brushes.Green : Brushes.Red;
MagNetStatus4.Fill = signal3 ? Brushes.Red : Brushes.Green; MagNetStatus4.Fill = signal3 ? Brushes.Red : Brushes.Green;
})); }));
MachineStatusDto machineStatusDto = new MachineStatusDto(); MachineStatusDto machineStatusDto = new MachineStatusDto();
machineStatusDto.deviceId = 1017; machineStatusDto.deviceId = 1017;
@ -1738,7 +1753,7 @@ namespace SlnMesnac.WPF.Page
/// <summary> /// <summary>
/// 螺旋机参数监控 /// 螺旋机参数监控
/// </summary> /// </summary>
private void RefreshSpiral(List<MachineStatusDto> machineStatusDtos, List<DmsRealtimeStatus> realtimeStatusList) private void RefreshSpiral(List<MachineStatusDto> machineStatusDtos, List<DmsRealtimeStatus> realtimeStatusList)
{ {
try try
{ {
@ -1757,23 +1772,23 @@ namespace SlnMesnac.WPF.Page
int Spiral1_Set_Speed = int.Parse(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度设定值")); int Spiral1_Set_Speed = int.Parse(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度设定值"));
int Spiral2_Set_Speed = int.Parse(baseBusiness.GetPlcAddressByConfigKey("螺旋2速度设定值")); int Spiral2_Set_Speed = int.Parse(baseBusiness.GetPlcAddressByConfigKey("螺旋2速度设定值"));
App.Current.Dispatcher.BeginInvoke((Action)(() => App.Current.Dispatcher.BeginInvoke((Action)(() =>
{ {
SpiralSignal0.Fill = Spiral1_MesUse_Flag ? Brushes.Green : Brushes.Red; SpiralSignal0.Fill = Spiral1_MesUse_Flag ? Brushes.Green : Brushes.Red;
SpiralSignal1.Fill = Spiral2_MesUse_Flag ? Brushes.Green : Brushes.Red; SpiralSignal1.Fill = Spiral2_MesUse_Flag ? Brushes.Green : Brushes.Red;
SpiralSignal2.Fill = Spiral1_Status ? Brushes.Green : Brushes.Red; SpiralSignal2.Fill = Spiral1_Status ? Brushes.Green : Brushes.Red;
SpiralSignal3.Fill = Spiral2_Status ? Brushes.Green : Brushes.Red; SpiralSignal3.Fill = Spiral2_Status ? Brushes.Green : Brushes.Red;
//变频器状态 0正常1故障 //变频器状态 0正常1故障
SpiralSignal4.Fill = Spiral1_Inverter_Status ? Brushes.Red : Brushes.Green; SpiralSignal4.Fill = Spiral1_Inverter_Status ? Brushes.Red : Brushes.Green;
SpiralSignal5.Fill = Spiral2_Inverter_Status ? Brushes.Red : Brushes.Green; SpiralSignal5.Fill = Spiral2_Inverter_Status ? Brushes.Red : Brushes.Green;
//螺旋1 速度低于80%预警 //螺旋1 速度低于80%预警
SpiralSignal6.Fill = Spiral1_Speed < Spiral1_Set_Speed * 0.8 ? Brushes.Red : Brushes.Green; SpiralSignal6.Fill = Spiral1_Speed < Spiral1_Set_Speed * 0.8 ? Brushes.Red : Brushes.Green;
SpiralSignal6_Value.Text = Spiral1_Speed.ToString(); SpiralSignal6_Value.Text = Spiral1_Speed.ToString();
//螺旋2 速度低于80%预警 //螺旋2 速度低于80%预警
SpiralSignal7.Fill = Spiral2_Speed < Spiral2_Set_Speed * 0.8 ? Brushes.Red : Brushes.Green; SpiralSignal7.Fill = Spiral2_Speed < Spiral2_Set_Speed * 0.8 ? Brushes.Red : Brushes.Green;
SpiralSignal7_Value.Text = Spiral2_Speed.ToString(); SpiralSignal7_Value.Text = Spiral2_Speed.ToString();
})); }));
MachineStatusDto machineStatusDto = new MachineStatusDto(); MachineStatusDto machineStatusDto = new MachineStatusDto();
@ -1815,7 +1830,7 @@ namespace SlnMesnac.WPF.Page
/// <summary> /// <summary>
/// 烘干机参数监控 /// 烘干机参数监控
/// </summary> /// </summary>
private void RefreshHot(List<MachineStatusDto> machineStatusDtos, List<DmsRealtimeStatus> realtimeStatusList) private void RefreshHot(List<MachineStatusDto> machineStatusDtos, List<DmsRealtimeStatus> realtimeStatusList)
{ {
try try
{ {
@ -1840,33 +1855,33 @@ namespace SlnMesnac.WPF.Page
int signal7_2 = plc.readByteByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机报警")); int signal7_2 = plc.readByteByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机报警"));
App.Current.Dispatcher.BeginInvoke((Action)(() => App.Current.Dispatcher.BeginInvoke((Action)(() =>
{ {
HotSignal1_1.Fill = Hot_Spiral_Status == 1 ? Brushes.Green : Brushes.Red; HotSignal1_1.Fill = Hot_Spiral_Status == 1 ? Brushes.Green : Brushes.Red;
HotSignal1_1_Value.Text = ChangeHotStatus(Hot_Spiral_Status); HotSignal1_1_Value.Text = ChangeHotStatus(Hot_Spiral_Status);
HotSignal2_1.Fill = Hot_Fan_Status == 1 ? Brushes.Green : Brushes.Red; HotSignal2_1.Fill = Hot_Fan_Status == 1 ? Brushes.Green : Brushes.Red;
HotSignal2_1_Value.Text = ChangeHotStatus(Hot_Fan_Status); HotSignal2_1_Value.Text = ChangeHotStatus(Hot_Fan_Status);
HotSignal3_1.Fill = Hot_Burn_Status == 1 ? Brushes.Green : Brushes.Red; HotSignal3_1.Fill = Hot_Burn_Status == 1 ? Brushes.Green : Brushes.Red;
HotSignal3_1_Value.Text = ChangeHotStatus(Hot_Burn_Status); HotSignal3_1_Value.Text = ChangeHotStatus(Hot_Burn_Status);
HotSignal1_2.Fill = signal1_2 ? Brushes.Green : Brushes.Red; HotSignal1_2.Fill = signal1_2 ? Brushes.Green : Brushes.Red;
HotSignal2_2.Fill = signal2_2 ? Brushes.Green : Brushes.Red; HotSignal2_2.Fill = signal2_2 ? Brushes.Green : Brushes.Red;
HotSignal3_2.Fill = signal3_2 ? Brushes.Green : Brushes.Red; HotSignal3_2.Fill = signal3_2 ? Brushes.Green : Brushes.Red;
HotSignal4_1.Fill = signal4_1 ? Brushes.Green : Brushes.Red; HotSignal4_1.Fill = signal4_1 ? Brushes.Green : Brushes.Red;
HotSignal4_2.Fill = signal14_2 ? Brushes.Red : Brushes.Green; HotSignal4_2.Fill = signal14_2 ? Brushes.Red : Brushes.Green;
HotSignal5_1_Value.Text = ((double)Hot_Drying_Temperature / 10).ToString(); HotSignal5_1_Value.Text = ((double)Hot_Drying_Temperature / 10).ToString();
HotSignal5_2_Value.Text = ((double)Hot_Heat_Temperature / 10).ToString(); HotSignal5_2_Value.Text = ((double)Hot_Heat_Temperature / 10).ToString();
HotSignal6_1_Value.Text = ((double)Hot_OutAir_Temperature / 10).ToString(); HotSignal6_1_Value.Text = ((double)Hot_OutAir_Temperature / 10).ToString();
HotSignal6_2_Value.Text = ((double)Hot_OutPut_Rate / 10).ToString(); HotSignal6_2_Value.Text = ((double)Hot_OutPut_Rate / 10).ToString();
HotSignal7_1.Fill = signal7_1 ? Brushes.Red : Brushes.Green; HotSignal7_1.Fill = signal7_1 ? Brushes.Red : Brushes.Green;
HotSignal7_2.Fill = signal7_2 == 0 ? Brushes.Green : Brushes.Red; HotSignal7_2.Fill = signal7_2 == 0 ? Brushes.Green : Brushes.Red;
HotSignal7_2_Value.Text = ChangeHotWarn(signal7_2); HotSignal7_2_Value.Text = ChangeHotWarn(signal7_2);
})); }));
@ -1897,14 +1912,14 @@ namespace SlnMesnac.WPF.Page
machineStatusDtos.Add(machineStatusDto); machineStatusDtos.Add(machineStatusDto);
//设备参数实时更新 //设备参数实时更新
realtimeStatusList.First(x => x.StatusCode == "Hot_Spiral_Status").StatusValue = (Hot_Spiral_Status==1).ToString(); realtimeStatusList.First(x => x.StatusCode == "Hot_Spiral_Status").StatusValue = (Hot_Spiral_Status == 1).ToString();
realtimeStatusList.First(x => x.StatusCode == "Hot_Fan_Status").StatusValue = (Hot_Fan_Status==1).ToString(); realtimeStatusList.First(x => x.StatusCode == "Hot_Fan_Status").StatusValue = (Hot_Fan_Status == 1).ToString();
realtimeStatusList.First(x => x.StatusCode == "Hot_Burn_Status").StatusValue = (Hot_Burn_Status==1).ToString(); realtimeStatusList.First(x => x.StatusCode == "Hot_Burn_Status").StatusValue = (Hot_Burn_Status == 1).ToString();
realtimeStatusList.First(x => x.StatusCode == "Hot_Drying_Temperature").StatusValue = ((double)Hot_Drying_Temperature / 10).ToString(); realtimeStatusList.First(x => x.StatusCode == "Hot_Drying_Temperature").StatusValue = ((double)Hot_Drying_Temperature / 10).ToString();
realtimeStatusList.First(x => x.StatusCode == "Hot_Heat_Temperature").StatusValue = ((double)Hot_Heat_Temperature / 10).ToString();; realtimeStatusList.First(x => x.StatusCode == "Hot_Heat_Temperature").StatusValue = ((double)Hot_Heat_Temperature / 10).ToString(); ;
realtimeStatusList.First(x => x.StatusCode == "Hot_OutAir_Temperature").StatusValue = ((double)Hot_OutAir_Temperature / 10).ToString(); realtimeStatusList.First(x => x.StatusCode == "Hot_OutAir_Temperature").StatusValue = ((double)Hot_OutAir_Temperature / 10).ToString();
realtimeStatusList.First(x => x.StatusCode == "Hot_OutPut_Rate").StatusValue = ((double)Hot_OutPut_Rate / 10).ToString(); realtimeStatusList.First(x => x.StatusCode == "Hot_OutPut_Rate").StatusValue = ((double)Hot_OutPut_Rate / 10).ToString();

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SlnMesnac.WPF.Page" xmlns:local="clr-namespace:SlnMesnac.WPF.Page"
mc:Ignorable="d" mc:Ignorable="d"
Title="Alarm" Height="350" Width="600" WindowStyle="None" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Topmost="True" Background="Red"> Title="Alarm" Height="350" Width="600" WindowStyle="None" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Background="Red">
<Border Margin="5" Background="LightGoldenrodYellow" CornerRadius="10"> <Border Margin="5" Background="LightGoldenrodYellow" CornerRadius="10">
<Border.Effect> <Border.Effect>
<DropShadowEffect Color="White" ShadowDepth="0" BlurRadius="5" Opacity="0.3" Direction="0"></DropShadowEffect> <DropShadowEffect Color="White" ShadowDepth="0" BlurRadius="5" Opacity="0.3" Direction="0"></DropShadowEffect>

@ -34,16 +34,17 @@ namespace SlnMesnac.WPF.Page
{ {
InitializeComponent(); InitializeComponent();
MaxWeightTxt.Text = recipeManageCache.MaxBufferWeight.ToString(); MaxWeightTxt.Text = recipeManageCache.MaxBufferWeight.ToString();
MinWeightTxt.Text = recipeManageCache.MinBufferWeight.ToString();
} }
private void MaxWeightChangeButton_Click(object sender, RoutedEventArgs e) private void MaxWeightChangeButton_Click(object sender, RoutedEventArgs e)
{ {
bool flag = double.TryParse(MaxWeightTxt.Text,out double maxValue); bool flag = double.TryParse(MaxWeightTxt.Text,out double maxValue);
bool flag2 = double.TryParse(MinWeightTxt.Text,out double minValue); bool flag2 = double.TryParse(MinWeightTxt.Text,out double minValue);
if (flag&&flag2) if (flag&&flag2&& maxValue>minValue)
{ {
recipeManageCache.MaxBufferWeight = maxValue; recipeManageCache.MaxBufferWeight = maxValue;
recipeManageCache.MinBufferWeight = minValue;
} }
else else
{ {

Loading…
Cancel
Save