123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using Aitex.Sorter.Common;
- using athosRT.tool;
- using athosRT.FSM;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using MECF.Framework.Common.SubstrateTrackings;
- namespace athosRT.Modules.LPs
- {
- public class UnloadFoupRoutine : ModuleRoutineBase, FSM.IRoutine
- {
- int _timeout = -1;
- public ModuleName _chamber { get; set; }
- private RobotBaseDevice _robot = null;
- private LoadPortBaseDevice _device = (LoadPortBaseDevice)null;
- private string _reason = string.Empty;
- public UnloadFoupRoutine(ModuleName chamber, RobotBaseDevice robot) : base(chamber)
- {
- _chamber = chamber;
- _timeout = 3000;
- _robot = robot;
- }
- public void Abort()
- {
- }
- public RState Start(params object[] objs)
- {
- Reset();
- _device = DEVICE.GetDevice<LoadPortBaseDevice>(this._chamber.ToString());
- ModuleName chamber = this._chamber;
- string module = chamber.ToString();
- object[] objArray = new object[1];
- chamber = this._chamber;
- objArray[0] = (object)chamber.ToString();
- //EV.PostMessage<EventEnum>(module, EventEnum.UnloadFOUPStart, objArray);
- string reason = string.Empty;
- LogObject.Info(this._chamber.ToString(), "Check DockState");
- if (this._device.DockState == FoupDockState.Undocked)
- {
- LogObject.Warning(this._chamber.ToString(), $"lp is unload, can't do again");
- return RState.Failed;
- }
- LogObject.Info(this._chamber.ToString(), "Check LPRobotActionIntervene && CheckLoadportMotionInterlock");
- if (SC.GetValue<bool>("System.LPRobotActionIntervene") && !CheckLoadportMotionInterlock())
- {
- LogObject.Warning(this._chamber.ToString(), "LPRobotActionIntervene && CheckLoadportMotionInterlock");
- return RState.Failed;
- }
- LogObject.Info(this._chamber.ToString(), "Check Is Enable Unload");
- if (!this._device.IsEnableUnload(out reason))
- {
- LogObject.Warning(this._chamber.ToString(), "Is not Enable Unload");
- return RState.Failed;
- }
- LogObject.Info(this._chamber.ToString(), "Is going to Unloadfoup");
- return Runner.Start(Module, $"{Module}=>UnloadFoup");
- }
- public RState Monitor()
- {
- Runner.Run(UnloadFoupStep.Unload, Unload, WaitLoadportMotion, _timeout)
- .End(UnloadFoupStep.WaitLoadportMotion, NullFun, 500);
- //.End(UnloadFoupStep.WaitLoadportMotion, WaitLoadportMotion, _timeout);
- return Runner.Status;
- }
-
- public bool Unload() => _device.Unload(out _reason);
- protected bool WaitLoadportMotion()
- {
- LogObject.Info(Module.ToString(), "正在等待LoadportMotion");
- if (_device.CurrentState == LoadPortStateEnum.Error)
- return false;
- if (!_device.IsReady())
- return false;
- LogObject.Info(Module.ToString(), "等待Load port Motion完毕");
- //Clear WaferInfo
- WaferManager.Instance.DeleteWafer(Module, 0, 25);
- return true;
- }
- public bool CheckLoadportMotionInterlock()
- {
- if (_robot.RobotState != RobotStateEnum.Idle)
- {
- LogObject.Info(Module.ToString(), "robot非空闲状态");
- return false;
- }
- if (_robot.IsReady())
- {
- LogObject.Info(Module.ToString(), "robot尚未准备好");
- return true;
- }
- return false;
- }
- public enum UnloadFoupStep {
- Unload,
- WaitLoadportMotion
- }
-
- }
- }
|