123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- using System;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase;
- namespace EFEM.RT.Routines.LP
- {
- internal class ReadAndLoadRoutine : CommonRoutine, IRoutine
- {
- public enum LoadFoup
- {
- ReadID,
- LoadFoup,
- }
- public ModuleName Chamber { get; set; }
- private SCConfigItem _scLoadTimeout = null;
- private int _timeoutLoad = 0;
- //private ReadRFIDRoutine _readFoupIDRoutine = null;
- private LoadFoupRoutine _loadFoupRoutine = null;
- LoadPortBaseDevice _device = null;
- public ReadAndLoadRoutine(string module, string name)
- {
- //_readFoupIDRoutine = new ReadRFIDRoutine(module,"Read FOUP ID");
- _loadFoupRoutine = new LoadFoupRoutine(module, "Load FOUP");
- }
- public bool Initalize()
- {
- _scLoadTimeout = SC.GetConfigItem("LoadPort.TimeLimitLoadportLoad");
- //_readFoupIDRoutine.Initalize();
- _loadFoupRoutine.Initalize();
- return true;
- }
- public void Terminate()
- {
-
- }
- public Result Start(params object[] objs)
- {
- _timeoutLoad = _scLoadTimeout.IntValue;
- Reset();
- //_readFoupIDRoutine.Chamber = Chamber;
- _loadFoupRoutine.Chamber = Chamber;
- _device = DEVICE.GetDevice<LoadPortBaseDevice>(Chamber.ToString());
- EV.PostMessage(Chamber.ToString(), EventEnum.LoadFOUPStart, Chamber.ToString());
-
- return Result.RUN;
- }
- public Result Monitor()
- {
- try
- {
- //ExecuteRoutine((int)LoadFoup.ReadID, "Read Foup ID", _readFoupIDRoutine, Notify, Stop);
- ExecuteRoutine((int)LoadFoup.LoadFoup, "Load Foup", _loadFoupRoutine, Notify, Stop);
- }
- catch (RoutineBreakException)
- {
- return Result.RUN;
- }
- catch (RoutineFaildException)
- {
- return Result.FAIL;
- }
- EV.PostMessage(Chamber.ToString(), EventEnum.LoadFOUPEnd, Chamber.ToString());
- return Result.DONE;
- }
- public new void Abort()
- {
- }
- protected void ExecuteRoutine(int id, string name, IRoutine routines, Action<string> notify, Action<string> error)
- {
- Tuple<bool, Result> ret = ExecuteAndWait(id, routines);
- if (ret.Item1)
- {
- if (ret.Item2 == Result.FAIL)
- {
- error(name);
- throw (new RoutineFaildException());
- }
- else if (ret.Item2 == Result.RUN)
- {
- throw (new RoutineBreakException());
- }
- }
- }
- protected override void Notify(string message)
- {
- EV.PostMessage(Module, EventEnum.GeneralInfo, String.Format("Load Foup:{0}", message));
- }
- /// <summary>
- /// prepare process failed
- /// </summary>
- /// <param name="failReason"></param>
- /// <param name="reactor"></param>
- protected override void Stop(string failReason)
- {
- string reason = String.Empty;
- EV.PostMessage(Module, EventEnum.LoadFOUPFailed, failReason);
- }
- }
- }
|