|
|
@@ -0,0 +1,191 @@
|
|
|
+using Aitex.Core.RT.Device;
|
|
|
+using Aitex.Core.RT.Log;
|
|
|
+using Aitex.Core.RT.Routine;
|
|
|
+using Aitex.Core.RT.SCCore;
|
|
|
+using Aitex.Core.Util;
|
|
|
+using MECF.Framework.Common.Equipment;
|
|
|
+using MECF.Framework.Common.Persistent.Reservoirs;
|
|
|
+using MECF.Framework.Common.RecipeCenter;
|
|
|
+using MECF.Framework.Common.Routine;
|
|
|
+using MECF.Framework.Common.SubstrateTrackings;
|
|
|
+using MECF.Framework.Common.ToolLayout;
|
|
|
+using PunkHPX8_Core;
|
|
|
+using PunkHPX8_RT.Devices.AXIS;
|
|
|
+using PunkHPX8_RT.Devices.PlatingCell;
|
|
|
+using PunkHPX8_RT.Devices.Reservoir;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Diagnostics.Eventing.Reader;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using System.Windows.Media.Imaging;
|
|
|
+
|
|
|
+namespace PunkHPX8_RT.Modules.PlatingCell
|
|
|
+{
|
|
|
+ public class PlatingCellVerticalPositionRoutine : RoutineBase, IRoutine
|
|
|
+ {
|
|
|
+ private enum PositionStep
|
|
|
+ {
|
|
|
+ WaitMatcher,
|
|
|
+ GotoPosition,
|
|
|
+ GoToPositionCheck,
|
|
|
+ End
|
|
|
+ }
|
|
|
+
|
|
|
+ #region 内部变量
|
|
|
+ /// <summary>
|
|
|
+ /// vertical axis
|
|
|
+ /// </summary>
|
|
|
+ private JetAxisBase _verticalAxis;
|
|
|
+ /// <summary>
|
|
|
+ /// matcher集合
|
|
|
+ /// </summary>
|
|
|
+ private List<string> _matcher = new List<string>();
|
|
|
+ /// <summary>
|
|
|
+ /// cell集合
|
|
|
+ /// </summary>
|
|
|
+ private List<PlatingCellEntity> _cellEntities;
|
|
|
+ /// <summary>
|
|
|
+ /// 位置
|
|
|
+ /// </summary>
|
|
|
+ private double _position;
|
|
|
+
|
|
|
+ private string state;
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 构造函数
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="module"></param>
|
|
|
+ public PlatingCellVerticalPositionRoutine(string module) : base(module)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 中止
|
|
|
+ /// </summary>
|
|
|
+ public void Abort()
|
|
|
+ {
|
|
|
+ Runner.Stop("Manual Abort");
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 监控
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public RState Monitor()
|
|
|
+ {
|
|
|
+ Runner.Run(PositionStep.GotoPosition, VerticalGotoLoad, 100)
|
|
|
+ .WaitWithStopCondition(PositionStep.GoToPositionCheck, CheckVerticalPositionStatus, CheckVerticalPositionRunStop)
|
|
|
+ .End(PositionStep.End, NullFun, _delay_1ms);
|
|
|
+ return Runner.Status;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 检验匹配
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool CheckMatcher()
|
|
|
+ {
|
|
|
+ if (_cellEntities.Count<=1)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ foreach (PlatingCellEntity item in _cellEntities)
|
|
|
+ {
|
|
|
+ if (!WaferManager.Instance.CheckHasWafer(item.Module, 0))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ string firstCurrentStep = _cellEntities[0].CurrentStepState;
|
|
|
+ foreach (var item in _cellEntities)
|
|
|
+ {
|
|
|
+ if (item.CurrentStepState != firstCurrentStep)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// vertical 运动到Load位置
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool VerticalGotoLoad()
|
|
|
+ {
|
|
|
+ if(_verticalAxis != null )
|
|
|
+ {
|
|
|
+ if (!_verticalAxis.IsSwitchOn)
|
|
|
+ {
|
|
|
+ LOG.WriteLog(eEvent.ERR_PLATINGCELL, Module, "Vertical is not Power On");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ else if (!_verticalAxis.IsHomed)
|
|
|
+ {
|
|
|
+ LOG.WriteLog(eEvent.ERR_PLATINGCELL, Module, "Vertical is not Home,Home vertical first");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return _verticalAxis.ProfilePositionOperation(_position);
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LOG.WriteLog(eEvent.ERR_PLATINGCELL, Module, "vertical axis is null");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 检验Vertical移动状态
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool CheckVerticalPositionStatus()
|
|
|
+ {
|
|
|
+ return _verticalAxis.Status == RState.End;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 检验Vertical是否还在运动
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool CheckVerticalPositionRunStop()
|
|
|
+ {
|
|
|
+ return _verticalAxis.Status == RState.Failed;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 启动
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="objs"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public RState Start(params object[] objs)
|
|
|
+ {
|
|
|
+ _position=(double)objs[0];
|
|
|
+ _matcher = ModuleMatcherManager.Instance.GetMatcherListByVertical(Module);
|
|
|
+ foreach (string str in _matcher)
|
|
|
+ {
|
|
|
+ if(!Enum.TryParse(str, out ModuleName moduleName))
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!ModuleHelper.IsInstalled(moduleName))
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ PlatingCellEntity cellEntity = Singleton<RouteManager>.Instance.GetModule<PlatingCellEntity>(str);
|
|
|
+ if (cellEntity.IsDisable)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (cellEntity.IsError)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (cellEntity.IsAuto)
|
|
|
+ {
|
|
|
+ _cellEntities.Add(cellEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _verticalAxis = DEVICE.GetDevice<JetAxisBase>($"{Module}.Vertical");
|
|
|
+ return Runner.Start(Module, "Start PlatingCell Vertical Initialize");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|