123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- using System.Collections.Generic;
- using Aitex.Core.RT.Fsm;
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using Aitex.Core.Util;
- namespace VirgoRT.Modules
- {
- public class HomeAll
- {
- private List<List<IModuleEntity>> _lstModules = new List<List<IModuleEntity>>();
- private Dictionary<IModuleEntity, int> _homeToken = new Dictionary<IModuleEntity, int>();
- public HomeAll()
- {
- }
- public Result Start(params object[] objs)
- {
- var pms = new List<IModuleEntity>();
- if (SC.GetValue<bool>("System.PMAIsInstalled"))
- pms.Add(Singleton<RouteManager>.Instance.PMA);
- if (SC.GetValue<bool>("System.PMBIsInstalled"))
- pms.Add(Singleton<RouteManager>.Instance.PMB);
- _lstModules.Clear();
- _lstModules.Add(new List<IModuleEntity>() { Singleton<RouteManager>.Instance.EFEM });
- _lstModules.Add(pms);
- return Result.RUN;
- }
- public Result Monitor(params object[] objs)
- {
- if (_homeToken.Count == 0 && _lstModules.Count == 0)
- return Result.DONE;
- if (_homeToken.Count > 0)
- {
- foreach (var moduleToken in _homeToken)
- {
- IModuleEntity module = moduleToken.Key;
- if (module.IsError)
- return Result.FAIL;
- if (!module.CheckAcked(moduleToken.Value) || module.IsBusy || module.IsInit)
- return Result.RUN;
- }
- _homeToken.Clear();
- if (_lstModules.Count == 0)
- return Result.DONE;
- }
- if (_homeToken.Count == 0)
- {
- foreach (var moduleEntity in _lstModules[0])
- {
- _homeToken[moduleEntity] = moduleEntity.Invoke("Home");
- }
- _lstModules.RemoveAt(0);
- }
- return Result.RUN;
- }
- public void Clear()
- {
- _lstModules.Clear();
- _homeToken.Clear();
- }
- }
- }
|