diff --git a/FrameworkLocal/RTEquipmentLibrary/HardwareUnits/Robots/HwinRobort/HwinRobot.cs b/FrameworkLocal/RTEquipmentLibrary/HardwareUnits/Robots/HwinRobort/HwinRobot.cs index 07bf13e..47a45a0 100644 --- a/FrameworkLocal/RTEquipmentLibrary/HardwareUnits/Robots/HwinRobort/HwinRobot.cs +++ b/FrameworkLocal/RTEquipmentLibrary/HardwareUnits/Robots/HwinRobort/HwinRobot.cs @@ -223,21 +223,31 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.HwinRobot private void CheckStateThenDo(Action onCheckSucceed, Action onCheckFailed = null) { // 检查Robot状态 - _lstHandler.AddLast(new HwinRobotSTATHandler(this, onHandlerEndTask: () => + _lstHandler.AddLast(new HwinRobotERRHandler(this, onHandlerEndTask: () => { - if (Status.IsServoOff) + if (Errors.AggregateErrorMessages != null && Errors.AggregateErrorMessages.Count > 0) { - EV.PostAlarmLog(Module, "Servo Off"); - onCheckFailed?.Invoke(); - } - else if (Status.IsMotorError || Status.IsControllerError) - { - // 读取错误信息,并PostAlarm - _lstHandler.AddLast(new HwinRobotERRHandler(this, onHandlerEndTask:onCheckFailed)); + try + { + onCheckFailed?.Invoke(); + } + catch (Exception ex) + { + EV.PostWarningLog(Module, "onCheckFailed action error"); + LOG.Error(ex.Message); + } } else { - onCheckSucceed?.Invoke(); + try + { + onCheckSucceed?.Invoke(); + } + catch (Exception ex) + { + EV.PostWarningLog(Module, "onCheckSucceed action error"); + LOG.Error(ex.Message); + } } })); } @@ -414,7 +424,6 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.HwinRobot } else { - Errors = null; Errors = new HiwinRobotAggregatedErrors(response); if (Errors.AggregateErrorMessages.Count > 0) @@ -424,10 +433,6 @@ namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.HwinRobot EV.PostAlarmLog(Module, errMsg); } } - else - { - EV.PostAlarmLog(Module, "Unknown Error"); - } } return true; diff --git a/FrameworkLocal/RTEquipmentLibrary/HardwareUnits/Robots/HwinRobort/HwinRobotHandler.cs b/FrameworkLocal/RTEquipmentLibrary/HardwareUnits/Robots/HwinRobort/HwinRobotHandler.cs index 3a5548d..9e4b21b 100644 --- a/FrameworkLocal/RTEquipmentLibrary/HardwareUnits/Robots/HwinRobort/HwinRobotHandler.cs +++ b/FrameworkLocal/RTEquipmentLibrary/HardwareUnits/Robots/HwinRobort/HwinRobotHandler.cs @@ -1,13 +1,7 @@ -using Aitex.Sorter.Common; -using MECF.Framework.Common.CommonData; +using MECF.Framework.Common.CommonData; using MECF.Framework.Common.Communications; using MECF.Framework.Common.Equipment; -using Newtonsoft.Json.Linq; using System; -using System.Linq; -using System.Text; -using Aitex.Core.RT.Event; -using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.HwinRobort.Errors; namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.HwinRobot {