using Aitex.Core.Util; using athosRT.Modules; using athosRT.Modules.EFEMs; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using RouteManager = athosRT.Modules.RouteManager1; namespace athosRT.Devices.EFEM { public class SystemServerModule : IServerModule, IData, IFunction { private Dictionary _dicEventStatus = new Dictionary(); public string Name { get; set; } public bool Busy => Singleton.Instance.IsRunning; public bool Moving { get; set; } public bool Error => Singleton.Instance.IsError; public bool IsLinkOk => Singleton.Instance.IsCommunicationOk; public bool Disabled { get; set; } public bool Initialized { get; set; } public bool OriginSearched { get; set; } public bool InUsed { get; set; } public SystemServerModule(string name) { this.Name = name; foreach (EfemEventType key in Enum.GetValues(typeof(EfemEventType))) this._dicEventStatus[key] = EfemEventValue.ON; } public bool Init(out string reason) { reason = string.Empty; if (!Singleton.Instance.CheckToPostMsg(RouteManager.MSG.HOME)) { reason = "BUSY"; return false; } Thread.Sleep(100);//原来就有 this.Initialized = true; return true; } public bool Home(out string reason) { reason = string.Empty; if (!Singleton.Instance.CheckToPostMsg(RouteManager.MSG.HOME)) { reason = "BUSY"; return false; } this.Initialized = true; return true; } public bool MapWafer(string device, out string reason) { reason = string.Empty; if (Singleton.Instance.CheckToPostMsg(RouteManager.MSG.MapWafer, (object)device)) return true; reason = "BUSY"; return false; } public bool SetEvent(EfemEventType type, EfemEventValue value) { this._dicEventStatus[type] = value; return true; } public bool IsEventEnabled(EfemEventType type) => this._dicEventStatus[type] == EfemEventValue.ON; public bool Hold() => true; public bool Resume() => true; public bool Abort() => true; public bool Stop() => true; public bool ClearError() { if (Singleton.Instance.IsError) Singleton.Instance.Invoke("Reset"); return true; } public string GetLastError() => string.Empty; } }