Преглед на файлове

Revise SRD StopOperation Bug; Revise SRDLotrack Bug of Retry;

niuyx преди 6 дни
родител
ревизия
463d72f325
променени са 2 файла, в които са добавени 70 реда и са изтрити 65 реда
  1. 68 65
      CyberX8_RT/Devices/AXIS/GalilRotation/GalilRotationAxis.cs
  2. 2 0
      CyberX8_RT/Modules/SRD/SRDProcessRecipeRoutine.cs

+ 68 - 65
CyberX8_RT/Devices/AXIS/GalilRotation/GalilRotationAxis.cs

@@ -46,9 +46,9 @@ namespace CyberX8_RT.Devices.AXIS.GalilLipsel
         /// </summary>
         private GalilRotationStopPositionRoutine _stopPositionRoutine;
         /// <summary>
-        /// Axis StopOperation Locker
+        /// Axis Operation Locker
         /// </summary>
-        private readonly object _stopOperationLocker = new object();
+        private readonly object _operationLocker = new object();
         #endregion
         /// <summary>
         /// 构造函数
@@ -91,7 +91,7 @@ namespace CyberX8_RT.Devices.AXIS.GalilLipsel
             {
                 return true;
             }
-            lock (_stopOperationLocker)
+            lock (_operationLocker)
             {
                 _currentOperation = MotionOperation.StopPosition;              
                 if (_profilePositionRoutine.Monitor() == RState.Running)
@@ -177,81 +177,82 @@ namespace CyberX8_RT.Devices.AXIS.GalilLipsel
         /// <returns></returns>
         public override bool OnTimer()
         {
-            if (_status == RState.Running)
+            lock (_operationLocker)
             {
-                if (_currentOperation == MotionOperation.Position)
+                if (_status == RState.Running)
                 {
-                    RState state = _profilePositionRoutine.Monitor();
-                    if (state == RState.End)
-                    {
-                        _inTargetPosition = false;
-                        EndOperation();
-                        _status = RState.End;
-                        LOG.WriteLog(eEvent.INFO_AXIS, $"{Module}.{Name}", $"Position Complete,Current Position {MotionData.MotorPosition}");
-                    }
-                    else if (state == RState.Failed || state == RState.Timeout)
+                    if (_currentOperation == MotionOperation.Position)
                     {
-                        if (_currentOperation == MotionOperation.Position)
+                        RState state = _profilePositionRoutine.Monitor();
+                        if (state == RState.End)
                         {
                             _inTargetPosition = false;
                             EndOperation();
-                            _status = RState.Failed;
-                            LOG.WriteLog(eEvent.ERR_AXIS, $"{Module}.{Name}", $"Profile Position error {_profilePositionRoutine.ErrorMsg}");
-                        }                        
+                            _status = RState.End;
+                            LOG.WriteLog(eEvent.INFO_AXIS, $"{Module}.{Name}", $"Position Complete,Current Position {MotionData.MotorPosition}");
+                        }
+                        else if (state == RState.Failed || state == RState.Timeout)
+                        {
+                            if (_currentOperation == MotionOperation.Position)
+                            {
+                                _inTargetPosition = false;
+                                EndOperation();
+                                _status = RState.Failed;
+                                LOG.WriteLog(eEvent.ERR_AXIS, $"{Module}.{Name}", $"Profile Position error {_profilePositionRoutine.ErrorMsg}");
+                            }
+                        }
                     }
-                }
 
-                else if (_currentOperation == MotionOperation.Home)
-                {
-                    RState state = _homeRoutine.Monitor();
-                    if (state == RState.End)
+                    else if (_currentOperation == MotionOperation.Home)
                     {
-                        MotionData.IsHomed = true;
-                        IsHomed = true;
-                        EndOperation();
-                        _status = RState.End;
-                    }
-                    else if (state == RState.Failed || state == RState.Timeout)
-                    {
-                        EndOperation();
-                        _status = RState.Failed;
-                        LOG.WriteLog(eEvent.ERR_AXIS, $"{Module}.{Name}", "Home error");
-                    }
-                }
-                else if (_currentOperation == MotionOperation.SwitchOn)
-                {
-                    RState state = _switchOnRoutine.Monitor();
-                    if (state == RState.End)
-                    {
-                        EndOperation();
-                        _status = RState.End;
-                    }
-                    else if (state == RState.Failed || state == RState.Timeout)
-                    {
-                        EndOperation();
-                        _status = RState.Failed;
-                        LOG.WriteLog(eEvent.ERR_AXIS, $"{Module}.{Name}", "Switch On error");
+                        RState state = _homeRoutine.Monitor();
+                        if (state == RState.End)
+                        {
+                            MotionData.IsHomed = true;
+                            IsHomed = true;
+                            EndOperation();
+                            _status = RState.End;
+                        }
+                        else if (state == RState.Failed || state == RState.Timeout)
+                        {
+                            EndOperation();
+                            _status = RState.Failed;
+                            LOG.WriteLog(eEvent.ERR_AXIS, $"{Module}.{Name}", "Home error");
+                        }
                     }
-                }
-                else if (_currentOperation == MotionOperation.SwitchOff)
-                {
-                    RState state = _switchOffRoutine.Monitor();
-                    if (state == RState.End)
+                    else if (_currentOperation == MotionOperation.SwitchOn)
                     {
-                        EndOperation();
-                        _status = RState.End;
+                        RState state = _switchOnRoutine.Monitor();
+                        if (state == RState.End)
+                        {
+                            EndOperation();
+                            _status = RState.End;
+                        }
+                        else if (state == RState.Failed || state == RState.Timeout)
+                        {
+                            EndOperation();
+                            _status = RState.Failed;
+                            LOG.WriteLog(eEvent.ERR_AXIS, $"{Module}.{Name}", "Switch On error");
+                        }
                     }
-                    else if (state == RState.Failed || state == RState.Timeout)
+                    else if (_currentOperation == MotionOperation.SwitchOff)
                     {
-                        EndOperation();
-                        _status = RState.Failed;
-                        LOG.WriteLog(eEvent.ERR_AXIS, $"{Module}.{Name}", "Switch Off error");
+                        RState state = _switchOffRoutine.Monitor();
+                        if (state == RState.End)
+                        {
+                            EndOperation();
+                            _status = RState.End;
+                        }
+                        else if (state == RState.Failed || state == RState.Timeout)
+                        {
+                            EndOperation();
+                            _status = RState.Failed;
+                            LOG.WriteLog(eEvent.ERR_AXIS, $"{Module}.{Name}", "Switch Off error");
+                        }
                     }
-                }
-                else if (_currentOperation == MotionOperation.StopPosition)
-                {
-                    lock (_stopOperationLocker)
+                    else if (_currentOperation == MotionOperation.StopPosition)
                     {
+
                         RState state = _stopPositionRoutine.Monitor();
                         if (state == RState.End)
                         {
@@ -264,10 +265,12 @@ namespace CyberX8_RT.Devices.AXIS.GalilLipsel
                             _status = RState.Failed;
                             LOG.WriteLog(eEvent.ERR_AXIS, $"{Module}.{Name}", "StopPosition error");
                         }
-                    }                    
+
+                    }
                 }
+                JudgeRunMonitor();
             }
-            JudgeRunMonitor();
+            
             return true;
         }
 

+ 2 - 0
CyberX8_RT/Modules/SRD/SRDProcessRecipeRoutine.cs

@@ -421,6 +421,8 @@ namespace CyberX8_RT.Modules.SRD
         public RState Retry(int step)
         {
             List<Enum> preStepIds = new List<Enum>();
+            _datas.Clear();
+            _lotTackTime = DateTime.Now;
             return Runner.Retry(SRDProcessState.Ready, preStepIds, Module, "RunRecipe Retry");
         }
         /// <summary>