123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- using System;
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using MECF.Framework.Common.Equipment;
- namespace JetMainframe.TMs
- {
- public class TMMapRoutine : ModuleRoutineBase, IStepRoutine
- {
- enum RoutineStep
- {
- CheckTargetEnableMap,
- Map,
- End,
- }
- private int _mapTimeout;
- private ModuleName _target;
- private int _thicknessIndex;
- //private Hand _hand;
- //private bool _autoHand;
- private TMModule _tmModule;
- public TMMapRoutine(TMModule tmModule) : base(ModuleName.TM.ToString())
- {
- Name = "Map";
- _tmModule = tmModule;
- }
- public RState Start(params object[] objs)
- {
- _mapTimeout = SC.GetValue<int>("TM.MapTimeout");
- Reset();
- _thicknessIndex = 0;
- Notify($"Start map {_target}");
- return Runner.Start(ModuleName.TM.ToString(), Name);
- }
- public void Init(ModuleName source)
- {
- //_autoHand = true;
- _target = source;
- }
- public void Abort()
- {
- Notify($"Abort map {_target}");
- }
- public RState Monitor()
- {
- Runner.Wait(RoutineStep.CheckTargetEnableMap, CheckTargetEnableMap)
- .Run(RoutineStep.Map, Map, CheckMap, _mapTimeout * 1000)
- .End(RoutineStep.End, NullFun, _delay_1s);
- if (Runner.Status == RState.End)
- Notify($"Complete map {_target}");
- return Runner.Status;
- }
- bool CheckTargetEnableMap()
- {
- Notify($"Check {_target} enable map");
- if (!ModuleHelper.IsLoadPort(_target))
- {
- Stop($"Can not map {_target}, only LP supported");
- return false;
- }
- //LoadPortModuleBase lp = EquipmentManager.Modules[target] as LoadPortModuleBase;
- //if (!lp.CheckReadyForMap(ModuleName.EfemRobot, Hand.Blade1, out string reason))
- //{
- // Stop(reason);
- // return false;
- //}
- return true;
- }
- bool Map()
- {
- //ModuleName target, int thicknessIndex
- Notify($"Robot start map {_target}");
- //string reason;
- //if (!_efemModule.RobotDevice.Map(_target, _thicknessIndex, out reason))
- //{
- // Stop(reason);
- // return false;
- //}
- return true;
- }
- bool CheckMap()
- {
- return !_tmModule.RobotDevice.IsError && _tmModule.RobotDevice.IsIdle;
- }
- }
- }
|