123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656 |
- 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<DeviceManager>
- {
- }
- 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<int>("System.Buffer1SlotCount") : 0;
- private static readonly int Buffer2SlotCount = SC.ContainsItem("System.Buffer2SlotCount") ? SC.GetValue<int>("System.Buffer2SlotCount") : 0;
- private static readonly int LoadPortQuantity = DeviceDefineManager.Instance.GetValue<int>("LoadPortQuantity") ?? 0;
- private static readonly int LoadLockQuantity = DeviceDefineManager.Instance.GetValue<int>("LoadLockQuantity") ?? 0;
- private static readonly int BufferQuantity = DeviceDefineManager.Instance.GetValue<int>("BufferQuantity") ?? 0;
- private static readonly int LoadLockSlot = DeviceDefineManager.Instance.GetValue<int>("LoadLockSlot") ?? 0;
- //private static readonly int BufferSlot = DeviceDefineManager.Instance.GetValue<int>("BufferSlot") ?? 0;
- private static readonly bool LoadLockDoorControlByStation = DeviceDefineManager.Instance.GetValue<bool>("LLDoorControlByStation") ?? false;
- //private static readonly bool DmcCardUsed = DeviceDefineManager.Instance.GetValue<bool>("DmcCardInstalled") ?? false;
- private static readonly bool DisableSignalTower = DeviceDefineManager.Instance.GetValue<bool>("DisableSignalTower") ?? false;
- private static readonly bool BufferIsDisable = SC.ContainsItem("System.BufferDisable") ? SC.GetValue<bool>("System.BufferDisable") : true;
- private static readonly bool Buffer1IsDisable = SC.ContainsItem("System.Buffer1Disable") ? SC.GetValue<bool>("System.Buffer1Disable") : true;
- private static readonly bool Buffer2IsDisable = SC.ContainsItem("System.Buffer2Disable") ? SC.GetValue<bool>("System.Buffer2Disable") : true;
- private static readonly bool Aligner1IsDisable = SC.ContainsItem("System.Aligner1Disable") ? SC.GetValue<bool>("System.Aligner1Disable") : true;
- private static readonly bool Aligner2IsDisable = SC.ContainsItem("System.Aligner2Disable") ? SC.GetValue<bool>("System.Aligner2Disable") : true;
- private static readonly bool PMAIsDisable = SC.ContainsItem("System.PMADisable") ? SC.GetValue<bool>("System.PMADisable") : true;
- private static readonly bool PMBIsDisable = SC.ContainsItem("System.PMBDisable") ? SC.GetValue<bool>("System.PMBDisable") : true;
- private static readonly bool CoolingBuffer1IsDisable = SC.ContainsItem("System.CoolingBuffer1Disable") ? SC.GetValue<bool>("System.CoolingBuffer1Disable") : true;
- private static readonly bool CoolingBuffer2IsDisable = SC.ContainsItem("System.CoolingBuffer2Disable") ? SC.GetValue<bool>("System.CoolingBuffer2Disable") : true;
- private static readonly bool LoadPort1IsDisable = SC.ContainsItem("LoadPort.LP1.Disable") ? SC.GetValue<bool>("LoadPort.LP1.Disable") : true;
- private static readonly bool LoadPort2IsDisable = SC.ContainsItem("LoadPort.LP2.Disable") ? SC.GetValue<bool>("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<ModuleName> 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<LoadPortBaseDevice>(moduleName.ToString()).IsIdle);
- }
- public ModuleName[] GetAllLoadPortName()
- {
- return LpNames as ModuleName[];
- }
- public LoadPortBaseDevice[] GetAllLoadPorts()
- {
- var lp = LpNames.Select(lpName => DEVICE.GetDevice<LoadPortBaseDevice>(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<CIDReaderBaseDevice>($"CarrierIDReader.{_barcodeIdReaderName[match - 1]}");
- return null;
- //var index = Array.IndexOf(LpNames.ToArray(), lp);
- //return DEVICE.GetDevice<GeneralBarcodeReader>(lp + "." + _barcodeIdReaderName[index]);
- }
- private OmronBarcodeReader GetBarcodeReader(string lp)
- {
- var index = Array.IndexOf(LpNames.ToArray(), lp);
- return DEVICE.GetDevice<OmronBarcodeReader>(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<OmronRfidReader>(_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<bool>($"LoadPort.LP{i + 1}.Disable"))
- {
- if (SC.GetValue<int>($"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<bool>($"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<int>($"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<int>($"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<int>("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<int>("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<WaferManager>.Instance.SubscribeLocation(ModuleName.Aligner2, 1);
- }
- //FFU Device Initialize
- if (DeviceDefineManager.Instance.GetValue<bool>("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<bool>($"LoadPort.{args[0].ToString()}.ExternalSmartTagReader") && SC.GetValue<int>($"LoadPort.{args[0].ToString()}.CstType")==0)
- {
- var lp = DEVICE.GetDevice<LoadPortBaseDevice>(args[0].ToString());
- return lp.ReadCarrierID();//lp.ReadCarrierID(
- }
- else
- {
- var lp = DEVICE.GetDevice<LoadPortBaseDevice>(args[0].ToString());
- return lp.ReadCarrierIDByIndex(new object[] { 0 });//lp.ReadCarrierID();
- }
- }
- private bool InvokeSetManualScanCode(string arg1, object[] args)
- {
- var lp = DEVICE.GetDevice<LoadPortBaseDevice>(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<LoadPortBaseDevice>(module.ToString());
- if (lp != null) lp.OnSlotMapRead(slotMap);
- }
- if (ModuleHelper.IsBuffer(module))
- {
- var buffer = DEVICE.GetDevice<BufferStation>(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<DeviceEntity>.Instance.PostMsg(DeviceEntityT<DeviceManager>.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);
- }
-
- }
- }
|