using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text.RegularExpressions; using System.Xml; using Aitex.Common.Util; using Aitex.Core.Backend; using Aitex.Core.RT.DataCenter; using Aitex.Core.RT.Device; using Aitex.Core.RT.Device.Unit; using Aitex.Core.RT.Event; using Aitex.Core.RT.IOCore; using Aitex.Core.RT.Log; using Aitex.Core.RT.OperationCenter; using Aitex.Core.RT.SCCore; using Aitex.Core.Util; using Aitex.Sorter.Common; using EFEM.RT.Devices.Aligner; using EFEM.RT.Devices.LoadPorts.Fortrend; using EFEM.RT.Devices.LoadPorts.JetOpenCst; using EFEM.RT.Devices.LoadPorts.SmartTagReader; using EFEM.RT.Devices.Rorze751; using EfemRT.Devices.LoadPorts.Hirata; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.SubstrateTrackings; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.BufferStations; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.CarrierIdReaders.CarrierIDReaderBase; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.CarrierIdReaders.OmronBarcode; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.CarrierIdReaders.OmronRFID; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.CarrierIdReaders.OmronV640; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.FFUs.AAF; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.HirataII; //using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.Fortrend; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.SMIF; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.TDK; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.OcrReaders; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.JEL; using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase; //using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.Rorze; using SorterCommon; namespace EFEM.RT.Devices { internal class DeviceEntity : DeviceEntityT { } public class DeviceManager : DeviceManagerBase { private const int LoadPortMaxQuantity = 3; private const int PMSlot = 1; private static readonly int Buffer1SlotCount = SC.ContainsItem("System.Buffer1SlotCount") ? SC.GetValue("System.Buffer1SlotCount") : 0; private static readonly int Buffer2SlotCount = SC.ContainsItem("System.Buffer2SlotCount") ? SC.GetValue("System.Buffer2SlotCount") : 0; private static readonly int LoadPortQuantity = DeviceDefineManager.Instance.GetValue("LoadPortQuantity") ?? 0; private static readonly int LoadLockQuantity = DeviceDefineManager.Instance.GetValue("LoadLockQuantity") ?? 0; private static readonly int BufferQuantity = DeviceDefineManager.Instance.GetValue("BufferQuantity") ?? 0; private static readonly int LoadLockSlot = DeviceDefineManager.Instance.GetValue("LoadLockSlot") ?? 0; //private static readonly int BufferSlot = DeviceDefineManager.Instance.GetValue("BufferSlot") ?? 0; private static readonly bool LoadLockDoorControlByStation = DeviceDefineManager.Instance.GetValue("LLDoorControlByStation") ?? false; //private static readonly bool DmcCardUsed = DeviceDefineManager.Instance.GetValue("DmcCardInstalled") ?? false; private static readonly bool DisableSignalTower = DeviceDefineManager.Instance.GetValue("DisableSignalTower") ?? false; private static readonly bool BufferIsDisable = SC.ContainsItem("System.BufferDisable") ? SC.GetValue("System.BufferDisable") : true; private static readonly bool Buffer1IsDisable = SC.ContainsItem("System.Buffer1Disable") ? SC.GetValue("System.Buffer1Disable") : true; private static readonly bool Buffer2IsDisable = SC.ContainsItem("System.Buffer2Disable") ? SC.GetValue("System.Buffer2Disable") : true; private static readonly bool Aligner1IsDisable = SC.ContainsItem("System.Aligner1Disable") ? SC.GetValue("System.Aligner1Disable") : true; private static readonly bool Aligner2IsDisable = SC.ContainsItem("System.Aligner2Disable") ? SC.GetValue("System.Aligner2Disable") : true; private static readonly bool PMAIsDisable = SC.ContainsItem("System.PMADisable") ? SC.GetValue("System.PMADisable") : true; private static readonly bool PMBIsDisable = SC.ContainsItem("System.PMBDisable") ? SC.GetValue("System.PMBDisable") : true; private static readonly bool CoolingBuffer1IsDisable = SC.ContainsItem("System.CoolingBuffer1Disable") ? SC.GetValue("System.CoolingBuffer1Disable") : true; private static readonly bool CoolingBuffer2IsDisable = SC.ContainsItem("System.CoolingBuffer2Disable") ? SC.GetValue("System.CoolingBuffer2Disable") : true; private static readonly bool LoadPort1IsDisable = SC.ContainsItem("LoadPort.LP1.Disable") ? SC.GetValue("LoadPort.LP1.Disable") : true; private static readonly bool LoadPort2IsDisable = SC.ContainsItem("LoadPort.LP2.Disable") ? SC.GetValue("LoadPort.LP2.Disable") : true; private static readonly string RobotType = SC.ContainsItem("Robot.RobotType") ? SC.GetStringValue("Robot.RobotType") : "None"; public string[] CarrierIdReader => _carrierIdReader.Take(LoadPortQuantity).ToArray(); private readonly string[] _carrierIdReader = { "CarrierIdReader", "CarrierIdReader", "CarrierIdReader", "CarrierIdReader", "CarrierIdReader", "CarrierIdReader", "CarrierIdReader", "CarrierIdReader", "CarrierIdReader", "CarrierIdReader" }; public string[] CarrierRfidReader => _carrierRfidReader.Take(LoadPortQuantity).ToArray(); private readonly string[] _carrierRfidReader = { "RFID", "RFID", "RFID", "RFID", "RFID", "RFID", "RFID", "RFID", "RFID", "RFID" }; public string[] BarcodeIdReaderName => _barcodeIdReaderName.Take(LoadPortQuantity).ToArray(); private readonly string[] _barcodeIdReaderName = new[] { "BarcodeReaderA", "BarcodeReaderB", "BarcodeReaderC", "BarcodeReaderD", "BarcodeReaderE", "BarcodeReaderF", "BarcodeReaderG", "BarcodeReaderH", "BarcodeReaderI", "BarcodeReaderJ", "BarcodeReaderK", }; public string[] BufferNames => _bufferNames.Take(BufferQuantity).ToArray(); private readonly string[] _bufferNames = { DeviceName.Buffer1, DeviceName.Buffer2, DeviceName.Buffer3, DeviceName.Buffer4, DeviceName.Buffer5 }; public IEnumerable LpNames => _lpNames.Take(LoadPortQuantity); private readonly ModuleName[] _lpNames = { ModuleName.LP1, ModuleName.LP2, ModuleName.LP3, ModuleName.LP4, ModuleName.LP5, ModuleName.LP6, ModuleName.LP7, ModuleName.LP8, ModuleName.LP9, ModuleName.LP10 }; private string[] CarrierIdReaderPortScName => _carrierIdReaderPortScName.Take(LoadPortQuantity).ToArray(); private readonly string[] _carrierIdReaderPortScName = { SorterCommon.ScPathName.LoadPort_LoadPort1CarrierIdReaderPortName, SorterCommon.ScPathName.LoadPort_LoadPort2CarrierIdReaderPortName, SorterCommon.ScPathName.LoadPort_LoadPort3CarrierIdReaderPortName, SorterCommon.ScPathName.LoadPort_LoadPort4CarrierIdReaderPortName, SorterCommon.ScPathName.LoadPort_LoadPort5CarrierIdReaderPortName, SorterCommon.ScPathName.LoadPort_LoadPort6CarrierIdReaderPortName, SorterCommon.ScPathName.LoadPort_LoadPort7CarrierIdReaderPortName, SorterCommon.ScPathName.LoadPort_LoadPort8CarrierIdReaderPortName, SorterCommon.ScPathName.LoadPort_LoadPort9CarrierIdReaderPortName, SorterCommon.ScPathName.LoadPort_LoadPort10CarrierIdReaderPortName }; private readonly string[] _rfidReaderAddress = { EFEMSC.ScPathName.LoadPort_LoadPort1CarrierIdReaderAddress, EFEMSC.ScPathName.LoadPort_LoadPort2CarrierIdReaderAddress, EFEMSC.ScPathName.LoadPort_LoadPort3CarrierIdReaderAddress, EFEMSC.ScPathName.LoadPort_LoadPort4CarrierIdReaderAddress, EFEMSC.ScPathName.LoadPort_LoadPort5CarrierIdReaderAddress, EFEMSC.ScPathName.LoadPort_LoadPort6CarrierIdReaderAddress, EFEMSC.ScPathName.LoadPort_LoadPort7CarrierIdReaderAddress, EFEMSC.ScPathName.LoadPort_LoadPort8CarrierIdReaderAddress, EFEMSC.ScPathName.LoadPort_LoadPort9CarrierIdReaderAddress, EFEMSC.ScPathName.LoadPort_LoadPort10CarrierIdReaderAddress }; private readonly string[] _rfidReaderPages = { EFEMSC.ScPathName.LoadPort_LoadPort1CarrierIdReaderPage, EFEMSC.ScPathName.LoadPort_LoadPort2CarrierIdReaderPage, EFEMSC.ScPathName.LoadPort_LoadPort3CarrierIdReaderPage, EFEMSC.ScPathName.LoadPort_LoadPort4CarrierIdReaderPage, EFEMSC.ScPathName.LoadPort_LoadPort5CarrierIdReaderPage, EFEMSC.ScPathName.LoadPort_LoadPort6CarrierIdReaderPage, EFEMSC.ScPathName.LoadPort_LoadPort7CarrierIdReaderPage, EFEMSC.ScPathName.LoadPort_LoadPort8CarrierIdReaderPage, EFEMSC.ScPathName.LoadPort_LoadPort9CarrierIdReaderPage, EFEMSC.ScPathName.LoadPort_LoadPort10CarrierIdReaderPage }; private readonly string[] _rfidNames = { DeviceName.RFIDReaderA, DeviceName.RFIDReaderB, DeviceName.RFIDReaderC, DeviceName.RFIDReaderD, DeviceName.RFIDReaderE, DeviceName.RFIDReaderF, DeviceName.RFIDReaderG, DeviceName.RFIDReaderH, DeviceName.RFIDReaderI, DeviceName.RFIDReaderJ }; public string[] LpPortNameSc => _lpPortNameSc.Take(LoadPortQuantity).ToArray(); private readonly string[] _lpPortNameSc = { EFEMSC.ScPathName.LoadPort_LoadPort1PortName, EFEMSC.ScPathName.LoadPort_LoadPort2PortName, EFEMSC.ScPathName.LoadPort_LoadPort3PortName, EFEMSC.ScPathName.LoadPort_LoadPort4PortName, EFEMSC.ScPathName.LoadPort_LoadPort5PortName, EFEMSC.ScPathName.LoadPort_LoadPort6PortName, EFEMSC.ScPathName.LoadPort_LoadPort7PortName, EFEMSC.ScPathName.LoadPort_LoadPort8PortName, EFEMSC.ScPathName.LoadPort_LoadPort9PortName, EFEMSC.ScPathName.LoadPort_LoadPort10PortName }; public string[] LLNames => _llNames.Take(LoadLockQuantity).ToArray(); private readonly string[] _llNames = { DeviceName.LL1, DeviceName.LL2, DeviceName.LL3, DeviceName.LL4, DeviceName.LL5, DeviceName.LL6, DeviceName.LL7, DeviceName.LL8 }; private char[] rfidInstallment; private char[] carrierIdInstallment; private char[] e84Support; public bool IsAnyLPIdle() { return LpNames.Any(moduleName => DEVICE.GetDevice(moduleName.ToString()).IsIdle); } public ModuleName[] GetAllLoadPortName() { return LpNames as ModuleName[]; } public LoadPortBaseDevice[] GetAllLoadPorts() { var lp = LpNames.Select(lpName => DEVICE.GetDevice(lpName.ToString())).ToList(); return lp.ToArray(); } public CIDReaderBaseDevice GetGeneralBarcodeReader(string lp) { string pattern = "[1-9]\\d*"; Regex rgx = new Regex(pattern); var match = int.Parse(rgx.Match(lp).ToString()); if (match <= LoadPortQuantity) return DEVICE.GetDevice($"CarrierIDReader.{_barcodeIdReaderName[match - 1]}"); return null; //var index = Array.IndexOf(LpNames.ToArray(), lp); //return DEVICE.GetDevice(lp + "." + _barcodeIdReaderName[index]); } private OmronBarcodeReader GetBarcodeReader(string lp) { var index = Array.IndexOf(LpNames.ToArray(), lp); return DEVICE.GetDevice(lp + "." + _carrierIdReader[index]); } public OmronRfidReader GetRfidReader(string lp) { string pattern = "[1-9]\\d*"; Regex rgx = new Regex(pattern); var match = int.Parse(rgx.Match(lp).ToString()); if (match <= LoadPortQuantity) return DEVICE.GetDevice(_rfidNames[match - 1]); return null; } //Initialize should be call by main before fsm run public override bool Initialize() { var fi = typeof(DeviceModel).GetFields(); foreach (var p in fi) p.SetValue(null, GetDevice(p.Name)); IoSensor[] llDoorOpen = { DeviceModel.SensorPMASystemInterlock, DeviceModel.SensorPMBSystemInterlock, }; IoSensor[] llArmExtendEnable = { DeviceModel.SensorRBNotExtendPMA, DeviceModel.SensorRBNotExtendPMB, }; IoTrigger[] llSsfeytoPM = { DeviceModel.TrigSafetytoPMA, DeviceModel.TrigSafetytoPMB, }; IoTrigger[] llArmNotExtendExtendPM = { DeviceModel.TrigRBNotExtendPMA, DeviceModel.TrigRBNotExtendPMB, }; IoSensor[] lpPoadOpen = { DeviceModel.SensorSMIF1PODOPEN, DeviceModel.SensorSMIF2PODOPEN, }; IoSensor[] robotExtendtoLP = { DeviceModel.SensorRBNotExtendSIMF1, DeviceModel.SensorRBNotExtendSIMF2, }; IoSensor[] GirdSensor= { DeviceModel.SensorRBNotExtendSIMF1, DeviceModel.SensorRBNotExtendSIMF2, }; IoTrigger[] SafeytoLP = { DeviceModel.TrigSafetytoPMA, DeviceModel.TrigSafetytoPMB, }; IoSensor[][] LPSensorArry = { new IoSensor[] { DeviceModel.Sensor4InchCstPresence, DeviceModel.Sensor4InchCstProtrusion1, //DeviceModel.Sensor4InchCstProtrusion2, DeviceModel.Sensor6InchCstPresence, DeviceModel.Sensor6InchCstProtrusion1, // DeviceModel.Sensor4InchCstProtrusion2, DeviceModel.Sensor8InchCstPresence, DeviceModel.Sensor8InchCstProtrusion1, // DeviceModel.Sensor4InchCstProtrusion2, DeviceModel.SensorCstDoorClosed, DeviceModel.SensorRBNotExtendSIMF1, DeviceModel.SensorRobotRemotetoEFEM, }, }; var barcodeIdReaderName = new[] { "BarcodeReaderA", "BarcodeReaderB", "BarcodeReaderC", "BarcodeReaderD", "BarcodeReaderE", "BarcodeReaderF", "BarcodeReaderG", "BarcodeReaderH", "BarcodeReaderI", "BarcodeReaderJ", "BarcodeReaderK", }; IoTrigger[][] LPTriggerArry = { new IoTrigger[] { DeviceModel.TrigSafetytoSMIF1, }, }; IoTrigger[] ioTriggerLP = new IoTrigger[2] { DeviceModel.TrigSafetytoSMIF1, DeviceModel.TrigSafetytoSMIF2 }; //Robot Device Initialize RobotBaseDevice robot; switch (RobotType) { case "NXC100": robot = new RorzeRobot751(ModuleName.System.ToString(), DeviceName.Robot, "Robot", null, null); AddCustomDevice(robot, "Robot", robot.GetType()); break; default: robot = new RorzeRobot751(ModuleName.System.ToString(), DeviceName.Robot, "Robot", null, null); AddCustomDevice(robot, "Robot", robot.GetType()); break; } //LoadPort Device Initialize for (int i = 0; i < LoadPortMaxQuantity; i++) { if(!SC.ContainsItem($"LoadPort.LP{i + 1}.Disable")) continue; if(!SC.GetValue($"LoadPort.LP{i + 1}.Disable")) { if (SC.GetValue($"LoadPort.LP{i + 1}.CstType") == 0) { LoadPortBaseDevice lp = new FortrendSmifPort("", _lpNames[i].ToString(), "LoadPort", robot, robotExtendtoLP[i], lpPoadOpen[i]); AddCustomDevice(lp, "LoadPort", typeof(LoadPortBaseDevice)); if (SC.GetValue($"LoadPort.LP{i + 1}.ExternalSmartTagReader")) { CIDReaderBaseDevice barcodeReader = new SmartTagReader("CarrierIDReader", barcodeIdReaderName[i], "CarrierID", lp); AddCustomDevice(barcodeReader, "BarcodeReader", typeof(CIDReaderBaseDevice)); lp.CIDReaders = new CIDReaderBaseDevice[] { barcodeReader }; } } else if (SC.GetValue($"LoadPort.LP{i + 1}.CstType") == 1) { LoadPortBaseDevice lp = new OpenStageJet("", _lpNames[i].ToString(), LPSensorArry[i], LPTriggerArry[i], robot); AddCustomDevice(lp, "LoadPort", typeof(LoadPortBaseDevice)); string readcommand = "LON\r"; string stopcommand = "LOFF\r"; CIDReaderBaseDevice barcodeReader = new GeneralBarcodeReader("CarrierIDReader", barcodeIdReaderName[i], "CarrierID", readcommand, true, lp, stopcommand); AddCustomDevice(barcodeReader, "BarcodeReader", typeof(CIDReaderBaseDevice)); lp.CIDReaders = new CIDReaderBaseDevice[] { barcodeReader }; } else if (SC.GetValue($"LoadPort.LP{i + 1}.CstType") == 2) { AddCustomDevice(new HirataLoadPort(ModuleName.System.ToString(), this._lpNames[i].ToString(), "LoadPort", (RobotBaseDevice)null, ioTriggerLP), "LoadPort", typeof(LoadPortBaseDevice)); } } } //Aligner Device Initialize if (!Aligner1IsDisable) { switch (SC.GetValue("Aligner.AlignerType")) { case 1://Aligner with Pin break; default://Aligner without Pin AddCustomDevice(new MechanicalAligner(ModuleName.System, ModuleName.Aligner1, 1), "Aligner1", typeof(MechanicalAligner)); break; } } if (!Aligner2IsDisable) { switch (SC.GetValue("Aligner.AlignerType")) { case 1://Aligner with Pin //AddCustomDevice(new RorzePreAligner(ModuleName.System.ToString(), "Aligner2", "Aligner2", "", ""), "Aligner2", typeof(PreAligner)); break; default://Aligner without Pin AddCustomDevice(new MechanicalAligner(ModuleName.System, ModuleName.Aligner2, 1), "Aligner2", typeof(MechanicalAligner)); break; } Singleton.Instance.SubscribeLocation(ModuleName.Aligner2, 1); } //FFU Device Initialize if (DeviceDefineManager.Instance.GetValue("FfuMemoBusControl") ?? false) { var comPort = SC.GetStringValue("System.FFUComPortName"); var ffu1 = new Ffu("","FFU1", "01", comPort); AddCustomDevice(ffu1, "FFU", typeof(Ffu)); var ffu2 = new Ffu("","FFU2", "02", comPort); AddCustomDevice(ffu2, "FFU", typeof(Ffu)); } //PM Device Initialize if (!PMAIsDisable) { LoadLockDevice ll = new LoadLockDevice("System", _llNames[0], PMSlot, llDoorOpen[0], llArmExtendEnable[0], llSsfeytoPM[0], llArmNotExtendExtendPM[0]); AddCustomDevice(ll, "LoadLockDevice", ll.GetType()); } if (!PMBIsDisable) { LoadLockDevice ll = new LoadLockDevice("System", _llNames[1], PMSlot, llDoorOpen[1], llArmExtendEnable[1], llSsfeytoPM[1], llArmNotExtendExtendPM[1]); AddCustomDevice(ll, "LoadLockDevice", ll.GetType()); } //Buffer Device Initialize if (!BufferIsDisable) { BufferStation buffer = new Buffer("System", "Buffer", Buffer1SlotCount, llDoorOpen[0]);//Normal Buffer AddCustomDevice(buffer, "BufferStation", buffer.GetType()); } if (!Buffer1IsDisable) { BufferStation buffer = new Buffer("System", _bufferNames[0], Buffer1SlotCount, llDoorOpen[0]);//Normal Buffer AddCustomDevice(buffer, "BufferStation", buffer.GetType()); } if (!Buffer2IsDisable) { BufferStation buffer = new Buffer("System", _bufferNames[1], Buffer2SlotCount, llDoorOpen[1]);//Normal Buffer AddCustomDevice(buffer, "BufferStation", buffer.GetType()); } //SignalTower Initialize if (DisableSignalTower) { DeviceModel.SignalTower.CustomSignalTower(PathManager.GetCfgDir() + "\\SignalTower.xml"); } //EquipmentMonitor Initialize AddCustomDevice(new EquipmentMonitor(), "EquipmentMonitor", typeof(EquipmentMonitor)); foreach (var nodeModelChild in DeviceModelNodes.ChildNodes) { XmlElement nodeDevices = nodeModelChild as XmlElement; } var SorterFFU = new FfuAAF("FFU", "FFU", "System",1); SorterFFU.Initialize(); OP.Subscribe(OperationName.ResetDevice, InvokeResetDevice); OP.Subscribe(OperationName.DeviceOperation, InvokeDeviceOperation); OP.Subscribe(OperationName.SetManualScanCode, InvokeSetManualScanCode); OP.Subscribe(OperationName.Scan, InvokeScan); OP.Subscribe(OperationName.Write, InvokeWrite); OP.Subscribe("ReadCarrierId", InvokeScan); OP.Subscribe(OperationName.ReadFoupRFID, InvokeReadRfid); OP.Subscribe(OperationName.WriteFoupRFID, InvokeWriteRfid); robot.OnSlotMapRead += Robot_OnSlotMapRead; return true; } private bool InvokeWrite(string arg1, object[] args) { if (!(GetRfidReader(args[0].ToString()).Write(args[1].ToString(),out string reason))) { EV.PostWarningLog(args[0].ToString(),$"fail to write RFID, {reason}"); return false; } return true; } private bool InvokeWriteRfid(string arg1, object[] arg2) { if (!GetRfidReader(arg2[0].ToString()).Write(arg2[1].ToString(), out var reason)) { EV.PostWarningLog(arg1, $"fail to write RFID, {reason}"); return false; } return true; } private bool InvokeReadRfid(string arg1, object[] arg2) { if (!GetRfidReader(arg2[0].ToString()).Read(out var reason)) { EV.PostWarningLog(arg1, $"fail to read RFID, {reason}"); return false; } return true; } private bool InvokeScan(string arg1, object[] args) { if (SC.GetValue($"LoadPort.{args[0].ToString()}.ExternalSmartTagReader") && SC.GetValue($"LoadPort.{args[0].ToString()}.CstType")==0) { var lp = DEVICE.GetDevice(args[0].ToString()); return lp.ReadCarrierID();//lp.ReadCarrierID( } else { var lp = DEVICE.GetDevice(args[0].ToString()); return lp.ReadCarrierIDByIndex(new object[] { 0 });//lp.ReadCarrierID(); } } private bool InvokeSetManualScanCode(string arg1, object[] args) { var lp = DEVICE.GetDevice(args[0].ToString()); lp.OnCarrierIdRead(args[1].ToString()); return true; } private bool InvokeOffline(string arg1, object[] arg2) { return true; } private void Robot_OnSlotMapRead(ModuleName module, string slotMap) { if (ModuleHelper.IsLoadPort(module)) { var lp = DEVICE.GetDevice(module.ToString()); if (lp != null) lp.OnSlotMapRead(slotMap); } if (ModuleHelper.IsBuffer(module)) { var buffer = DEVICE.GetDevice(module.ToString()); if (buffer != null) buffer.OnSlotMapRead(slotMap); } } private bool InvokeDeviceOperation(string arg1, object[] args) { var name = ""; var func = ""; try { name = (string) args[0]; func = (string) args[1]; if ((bool) DATA.Poll(ModuleName.System.ToString(), ParamName.IsMaintenanceMode)) { EV.PostMessage("System", EventEnum.DefaultWarning, string.Format("System in maintenance, can not execute {0}{1}", name, func)); return false; } var param = new object[args.Length - 2]; for (var i = 2; i < args.Length; i++) param[i - 2] = args[i].ToString(); if (name == "SignalTower") { OP.DoOperation($"System.SignalTower.{func}"); return true; } if (ModuleHelper.IsLoadPort(ModuleHelper.Converter(name))) { OP.DoOperation($"{name}.{func}", param); } else { DeviceCmd(name, func, param); } } catch (Exception ex) { LOG.Write(ex); EV.PostMessage("System", EventEnum.DefaultWarning, string.Format("Invalid parameters, can not execute {0}{1}", name, func)); return false; } return true; } private bool InvokeResetDevice(string arg1, object[] arg2) { Singleton.Instance.PostMsg(DeviceEntityT.MSG.RESET); return true; } private void DeviceCmd(string name, string cmd, params object[] args) { DEVICE.Do(string.Format("{0}.{1}", name, cmd), 0, true, args); } } }