diff --git a/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs b/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs index 1d969d5..02722d8 100644 --- a/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs +++ b/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs @@ -494,7 +494,7 @@ namespace SlnMesnac.WPF.Page bool unPackStatus1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态")); if (unPackStatus1) { - MessageBox.Show("一键停止失败,拆包机未停止,请先检查原因"); + MessageBox.Show("一键停止失败,拆包机未停止,请先检查"); return; } @@ -574,7 +574,12 @@ namespace SlnMesnac.WPF.Page MessageBox.Show("拆包机MES允许远程,未切换远程"); return; } - + bool unPackWarn = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机堵料停螺旋")); + if (unPackWarn) + { + MessageBox.Show("拆包机堵料停螺旋,请先处理再开机!"); + return; + } Task.Run(() => { plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程急停"), false); @@ -610,11 +615,11 @@ 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; + //} Task.Run(() => { @@ -650,6 +655,13 @@ namespace SlnMesnac.WPF.Page MessageBox.Show("磁选机MES允许远程,未切换远程"); return; } + //判断报警--- + bool magNetWarn = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机设备故障反馈")); + if (magNetWarn) + { + MessageBox.Show("磁选机设备故障,请检查后再启动"); + return; + } Task.Run(() => { SendPulseSignal("磁选机一键启动"); @@ -669,7 +681,11 @@ namespace SlnMesnac.WPF.Page /// private void StopMagNetButton_Click(object sender, RoutedEventArgs e) { - StartMagNet(); + Task.Run(() => + { + SendPulseSignal("磁选机一键停止"); + }); + // StartMagNet(); } #endregion @@ -682,7 +698,30 @@ namespace SlnMesnac.WPF.Page /// private void StartSpiral1Button_Click(object sender, RoutedEventArgs e) { - StartSpiral1(); + + try + { + if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1MES允许远程")) == false) + { + MessageBox.Show("螺旋1MES允许远程,未切换远程"); + return ; + } + bool spiralWarn = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1变频器状态")); + bool spira2Warn = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2变频器状态")); + if (spiralWarn|| spira2Warn) + { + MessageBox.Show("螺旋1或螺旋2设备故障,请检查后再启动"); + return; + } + plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1启动"), true); + plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度设置"), recipeManageCache.useRecipeManage.Spiral1); + } + catch (Exception ex) + { + MessageBoxAndLog($"螺旋1启动异常:{ex.Message}", true); + + } + return ; } @@ -694,7 +733,36 @@ namespace SlnMesnac.WPF.Page /// private void StartSpiral2Button_Click(object sender, RoutedEventArgs e) { - StartSpiral2(); + try + { + + if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2MES允许远程")) == false) + { + MessageBox.Show("螺旋2MES允许远程,未切换远程"); + return; + } + else + { + bool spiralWarn = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1变频器状态")); + bool spira2Warn = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2变频器状态")); + if (spiralWarn || spira2Warn) + { + MessageBox.Show("螺旋1或螺旋2设备故障,请检查后再启动"); + return; + } + + plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2启动"), true); + plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2速度设置"), recipeManageCache.useRecipeManage.Spiral2); + + } + + } + catch (Exception ex) + { + MessageBoxAndLog($"螺旋2启动异常:{ex.Message}", true); + + } + return ; } /// @@ -706,11 +774,11 @@ namespace SlnMesnac.WPF.Page { try { - if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1MES允许远程")) == false) - { - MessageBox.Show("螺旋1MES允许远程,未切换远程"); - return; - } + //if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1MES允许远程")) == false) + //{ + // MessageBox.Show("螺旋1MES允许远程,未切换远程"); + // return; + //} plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1启动"), false); } catch (Exception ex) @@ -728,11 +796,11 @@ namespace SlnMesnac.WPF.Page { try { - if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2MES允许远程")) == false) - { - MessageBox.Show("螺旋2MES允许远程,未切换远程"); - return; - } + //if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2MES允许远程")) == false) + //{ + // MessageBox.Show("螺旋2MES允许远程,未切换远程"); + // return; + //} plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2启动"), false); } catch (Exception ex) @@ -751,14 +819,25 @@ namespace SlnMesnac.WPF.Page /// private void StartDryerSpiralButton_Click(object sender, RoutedEventArgs e) { + try { - StartDryerMagNet(); + bool hotWarn = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机堵料报警")); + if (hotWarn) + { + MessageBoxAndLog("请先处理烘干机堵料报警,再重新启动!", true); + return; + } + SendPulseSignal("烘干机螺旋启动"); + plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋频率设定"), recipeManageCache.useRecipeManage.DryerSpiral); + } catch (Exception ex) { - _logger.LogError($"烘干机螺旋启动异常:{ex.Message}"); + MessageBoxAndLog($"烘干机螺旋启动异常:{ex.Message}", true); + } + return ; } /// @@ -770,6 +849,12 @@ namespace SlnMesnac.WPF.Page { try { + bool hotWarn = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机堵料报警")); + if (hotWarn) + { + MessageBoxAndLog("请先处理烘干机堵料报警,再重新启动!", true); + return; + } Task.Run(() => { SendPulseSignal("烘干机风机启动"); @@ -790,7 +875,24 @@ namespace SlnMesnac.WPF.Page /// private void StartDryerHotButton_Click(object sender, RoutedEventArgs e) { - StartDryerHot(); + + try + { + bool hotWarn = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机堵料报警")); + if (hotWarn) + { + MessageBoxAndLog("请先处理烘干机堵料报警,再重新启动!", true); + return; + } + SendPulseSignal("烘干机燃烧启动"); + + } + catch (Exception ex) + { + MessageBoxAndLog($"烘干机燃烧启动异常:{ex.Message}", true); + + } + return ; } /// @@ -1001,7 +1103,7 @@ namespace SlnMesnac.WPF.Page MessageBox.Show($"烘干机螺旋启动失败:前提条件螺旋1速度{speed1}未达到设定值{value1}的下限阈值80%,请检查后重新启动"); return false; } - int value = int.Parse(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋频率设定值")); + SendPulseSignal("烘干机螺旋启动"); plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋频率设定"), recipeManageCache.useRecipeManage.DryerSpiral); Thread.Sleep(MachineSleep / 2);