123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934 |
- // EfemRT, Version=1.8.4.5, Culture=neutral, PublicKeyToken=null
- // EFEM.RT.Modules.SorterCycleManager
- using System;
- using System.Collections.Generic;
- using Aitex.Core.Common;
- using Aitex.Core.RT.DataCenter;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.Log;
- using Aitex.Core.RT.Routine;
- using Aitex.Core.RT.SCCore;
- using Aitex.Core.Util;
- using Aitex.Sorter.Common;
- using Aitex.Sorter.RT.Module;
- using athosRT.Devices;
- using athosRT.Modules;
- using athosRT.Modules.LPs;
- using athosRT.Modules.EFEMs.Routine;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.SubstrateTrackings;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.BufferStations;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts.LoadPortBase;
- using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robots.RobotBase;
- public class MoveErrorArgument
- {
- public string ErrorModule;
- public string ErrorMessage;
- public MoveErrorArgument(string module, string message)
- {
- ErrorModule = module;
- ErrorMessage = message;
- }
- }
- public class SorterCycleManager
- {
- //private RobotBaseDevice m_Robot = null;
- //private double lastTime = 0.0;
- //private double elapsedTime = 0.0;
- //private LoadPortBaseDevice m_soucelp;
- //private LoadPortBaseDevice m_destlp;
- //private DateTime _cycleStartTime;
- //private int WaferCount = 0;
- //private int CycleCounter = 0;
- //private ModuleName _originStation;
- //private ModuleName _toStation;
- //private int _cycleTaskCount;
- //private int _cycleTaskRunningCounter;
- //private List<ModuleName> _lstPassThrough = new List<ModuleName>();
- //private PickRoutine m_pickRoutine = null;
- //private PlaceRoutine m_placeRoutine = null;
- //private SwapRoutine m_swaproutine = null;
- //private LoadFoupRoutine m_sourceLoadRoutine = null;
- //private LoadFoupRoutine m_destLoadRoutine = null;
- //private UnloadFoupRoutine m_sourceUnloadRoutine = null;
- //private UnloadFoupRoutine m_destUnloadRoutine = null;
- //private bool _isLowerArmEnable = true;
- //private bool _isUpperArmEnable = true;
- //public int bf1solt = 0;
- //public int bf2solt = 0;
- //public int orbf1slot = 0;
- //public int orbf2slot = 0;
- //public int TransferCount => WaferCount;
- //public int CycleCount => CycleCounter;
- //public ModuleName OriginStation => _originStation;
- //public ModuleName ToStation => _toStation;
- //public int CycleWaferCount { get; set; }
- //public double CycleMoveTime { get; private set; }
- //public void Initialize()
- //{
- // m_Robot = DEVICE.GetDevice<RobotBaseDevice>("Robot");
- // m_pickRoutine = new PickRoutine("System", "CyclePickRoutine");
- // m_placeRoutine = new PlaceRoutine("System", "CyclePlaceRoutine");
- // m_swaproutine = new SwapRoutine("System", "CycleSwapRoutine");
- // m_sourceLoadRoutine = new LoadFoupRoutine("System", "CycleLoadSourceFoupRoutine");
- // m_destLoadRoutine = new LoadFoupRoutine("System", "CycleLoadDestFoupRoutine");
- // m_sourceUnloadRoutine = new UnloadFoupRoutine();
- // m_destUnloadRoutine = new UnloadFoupRoutine();
- // _cycleStartTime = DateTime.Now;
- // Singleton<EventManager>.Instance.FireEvent += CycleOnEvent;
- // DATA.Subscribe(ModuleName.System.ToString(), "TransferCount", () => CycleWaferCount);
- // DATA.Subscribe(ModuleName.System.ToString(), "TransferTime", () => (int)CycleMoveTime);
- // DATA.Subscribe(ModuleName.System.ToString(), "TranserThroughput", () => (CycleMoveTime != 0.0) ? ((int)((double)(CycleWaferCount * 3600) / CycleMoveTime)) : 0);
- // DATA.Subscribe(ModuleName.System.ToString(), "TotalWaferCount", () => SC.GetValue<int>("System.TotalWaferCount"));
- // DATA.Subscribe(ModuleName.System.ToString(), "CycleCount", () => _cycleTaskRunningCounter);
- // DATA.Subscribe(ModuleName.System.ToString(), "TotalCycleCount", () => _cycleTaskCount);
- //}
- //private void CycleOnEvent(EventItem obj)
- //{
- // if (Singleton<RouteManager1>.Instance.IsCycle && obj.EventEnum == "WAFER_ARRIVE_POSITION" && obj.DVID.ContainsKey("ARRIVE_POS_NAME") && obj.DVID["ARRIVE_POS_NAME"].Contains(_toStation.ToString()))
- // {
- // CycleWaferCount++;
- // }
- //}
- //private void OnMoveError(MoveErrorArgument obj)
- //{
- // EV.PostAlarmLog("System", "transfer error");
- //}
- //public void Terminate()
- //{
- //}
- //public Result Start(ModuleName originStation, ModuleName toStation, string[] passoption)
- //{
- // _originStation = originStation;
- // _toStation = toStation;
- // _lstPassThrough.Clear();
- // foreach (string text in passoption)
- // {
- // if (!Enum.TryParse<ModuleName>(text, out var result))
- // {
- // EV.PostAlarmLog("System", "Cycle station parse failed.");
- // return Result.FAIL;
- // }
- // LOG.Write("lstPassThrough_" + text, 2, "D:\\sorter\\trunk\\Efem\\Jet\\Jet_001_2P_Jet\\EfemRT\\Modules\\SorterCycleManager.cs", "Start", 182);
- // _lstPassThrough.Add(result);
- // }
- // Clear();
- // m_pickRoutine.Initalize();
- // m_placeRoutine.Initalize();
- // m_swaproutine.Initalize();
- // m_sourceLoadRoutine.Initalize();
- // m_destLoadRoutine.Initalize();
- // m_sourceUnloadRoutine.Initalize();
- // m_destUnloadRoutine.Initalize();
- // m_Robot.IsBusy = false;
- // _isLowerArmEnable = SC.GetValue<bool>("Robot.Blade1Enable");
- // _isUpperArmEnable = SC.GetValue<bool>("Robot.Blade2Enable");
- // if (!_isLowerArmEnable && !_isUpperArmEnable)
- // {
- // return Result.FAIL;
- // }
- // _cycleTaskCount = SC.GetValue<int>("Process.CycleCount");
- // _cycleTaskRunningCounter = 0;
- // if (!ModuleHelper.IsLoadPort(originStation))
- // {
- // return Result.FAIL;
- // }
- // if (!ModuleHelper.IsLoadPort(toStation))
- // {
- // return Result.FAIL;
- // }
- // m_soucelp = DEVICE.GetDevice<LoadPortBaseDevice>(originStation.ToString());
- // m_destlp = DEVICE.GetDevice<LoadPortBaseDevice>(toStation.ToString());
- // if (!m_soucelp.IsPlacement)
- // {
- // return Result.FAIL;
- // }
- // if (!m_destlp.IsPlacement)
- // {
- // return Result.FAIL;
- // }
- // if (m_soucelp.IsMapWaferByLoadPort && m_soucelp.DockState == FoupDockState.Undocked)
- // {
- // m_sourceLoadRoutine.Chamber = _originStation;
- // if (m_sourceLoadRoutine.Start(originStation) == Result.FAIL)
- // {
- // return Result.FAIL;
- // }
- // }
- // if (m_soucelp.Name != m_destlp.Name && m_destlp.IsMapWaferByLoadPort && m_destlp.DockState == FoupDockState.Undocked)
- // {
- // m_destLoadRoutine.Chamber = _toStation;
- // if (m_destLoadRoutine.Start(_toStation) == Result.FAIL)
- // {
- // return Result.FAIL;
- // }
- // }
- // _cycleStartTime = DateTime.Now;
- // return Result.RUN;
- //}
- //public Result Monitor()
- //{
- // CycleMoveTime = (DateTime.Now - _cycleStartTime).TotalSeconds;
- // Result result = Result.RUN;
- // string reason;
- // if (!m_soucelp.IsMapWaferByLoadPort && !m_soucelp.IsMapped)
- // {
- // if (!m_soucelp.IsEnableMapWafer(out reason))
- // {
- // EV.PostAlarmLog("System", "Source Load port is not ready to map wafer.");
- // return Result.FAIL;
- // }
- // if (m_Robot.IsReady())
- // {
- // m_Robot.WaferMapping(_originStation, out reason);
- // }
- // return Result.RUN;
- // }
- // if (m_soucelp.Name != m_destlp.Name && !m_destlp.IsMapWaferByLoadPort && !m_destlp.IsMapped)
- // {
- // if (!m_destlp.IsEnableMapWafer(out reason))
- // {
- // EV.PostAlarmLog("System", "Destination Load port is not ready to map wafer.");
- // return Result.FAIL;
- // }
- // if (m_Robot.IsReady())
- // {
- // m_Robot.WaferMapping(_toStation, out reason);
- // }
- // return Result.RUN;
- // }
- // if (m_destlp.IsMapWaferByLoadPort)
- // {
- // result = m_destLoadRoutine.Monitor();
- // if (result == Result.FAIL || result == Result.TIMEOUT)
- // {
- // return Result.FAIL;
- // }
- // if (result == Result.RUN)
- // {
- // return Result.RUN;
- // }
- // result = m_destUnloadRoutine.Monitor();
- // if (result == Result.FAIL || result == Result.TIMEOUT)
- // {
- // return Result.FAIL;
- // }
- // if (result == Result.RUN)
- // {
- // return Result.RUN;
- // }
- // }
- // if (m_soucelp.IsMapWaferByLoadPort)
- // {
- // result = m_sourceLoadRoutine.Monitor();
- // if (result == Result.FAIL || result == Result.TIMEOUT)
- // {
- // return Result.FAIL;
- // }
- // if (result == Result.RUN)
- // {
- // return Result.RUN;
- // }
- // result = m_sourceUnloadRoutine.Monitor();
- // if (result == Result.FAIL || result == Result.TIMEOUT)
- // {
- // return Result.FAIL;
- // }
- // if (result == Result.RUN)
- // {
- // return Result.RUN;
- // }
- // }
- // switch (m_pickRoutine.Monitor())
- // {
- // case athosRT.FSM.RState.Failed:
- // return Result.FAIL;
- // case athosRT.FSM.RState.Timeout:
- // return Result.FAIL;
- // case athosRT.FSM.RState.Running:
- // return Result.RUN;
- // default:
- // switch (m_placeRoutine.Monitor())
- // {
- // case athosRT.FSM.RState.Failed:
- // return Result.FAIL;
- // case athosRT.FSM.RState.Timeout:
- // return Result.FAIL;
- // case athosRT.FSM.RState.Running:
- // return Result.RUN;
- // default:
- // switch (m_swaproutine.Monitor())
- // {
- // case athosRT.FSM.RState.Failed:
- // return Result.FAIL;
- // case athosRT.FSM.RState.Timeout:
- // return Result.FAIL;
- // case athosRT.FSM.RState.Running:
- // return Result.RUN;
- // default:
- // //判定完成
- // if (IsModulesEmpty(_lstPassThrough) && IsRobotEmpty() && m_Robot.IsReady() && !IsAnyWaferInProcess(_originStation))
- // {
- // if (_cycleTaskRunningCounter >= _cycleTaskCount)
- // {
- // return Result.DONE;
- // }
- // if (m_soucelp.DockState == FoupDockState.Undocked || m_destlp.DockState == FoupDockState.Undocked)
- // {
- // if (m_soucelp.DockState == FoupDockState.Undocked && m_destlp.IsMapWaferByLoadPort)
- // {
- // m_sourceLoadRoutine.Chamber = _originStation;
- // if (m_sourceLoadRoutine.Start(_originStation) == Result.FAIL)
- // {
- // return Result.FAIL;
- // }
- // }
- // if (m_soucelp.Name != m_destlp.Name && m_destlp.IsMapWaferByLoadPort && m_destlp.DockState == FoupDockState.Undocked)
- // {
- // m_destLoadRoutine.Chamber = _toStation;
- // if (m_destLoadRoutine.Start(_toStation) == Result.FAIL)
- // {
- // return Result.FAIL;
- // }
- // }
- // return Result.RUN;
- // }
- // if (!WaferDispatch())
- // {
- // return Result.DONE;
- // }
- // }
- // if (m_Robot.IsReady())
- // {
- // UpdateWaferNextStation();
- // }
- // if (m_Robot.IsReady())
- // {
- // if (_isLowerArmEnable && _isUpperArmEnable)
- // {
- // DualArmMoveDispatch();
- // }
- // else
- // {
- // SinglaArmMoveDispatch();
- // }
- // }
- // return Result.RUN;
- // }
- // }
- // }
- //}
- //private Result DualArmMoveDispatch()
- //{
- // string reason;
- // if (IsRobotEmpty())
- // {
- // WaferInfo firstWafer = GetFirstWafer(new List<ModuleName> { _originStation }, EnumE90Status.InProcess);
- // if (firstWafer != null)
- // {
- // m_pickRoutine.Blade = Hand.Blade1;
- // m_pickRoutine.Source = _originStation;
- // m_pickRoutine.Slot = firstWafer.Slot;
- // LoadPortBaseDevice device = DEVICE.GetDevice<LoadPortBaseDevice>(m_pickRoutine.Source.ToString());
- // if (device.IsEnableTransferWafer(out reason))
- // {
- // return m_pickRoutine.Start(null);
- // }
- // }
- // firstWafer = GetFirstWafer(_lstPassThrough, EnumE90Status.InProcess);
- // if (firstWafer != null)
- // {
- // m_pickRoutine.Blade = Hand.Blade1;
- // m_pickRoutine.Source = (ModuleName)firstWafer.Station;
- // m_pickRoutine.Slot = firstWafer.Slot;
- // if (ModuleHelper.IsLoadPort(m_pickRoutine.Source))
- // {
- // LoadPortBaseDevice device2 = DEVICE.GetDevice<LoadPortBaseDevice>(m_pickRoutine.Source.ToString());
- // if (device2.IsEnableTransferWafer(out reason))
- // {
- // return m_pickRoutine.Start(null);
- // }
- // }
- // if (ModuleHelper.IsBuffer(m_pickRoutine.Source))
- // {
- // BufferStation device3 = DEVICE.GetDevice<BufferStation>(m_pickRoutine.Source.ToString());
- // if (device3.IsEnableTransferWafer(out reason))
- // {
- // return m_pickRoutine.Start(null);
- // }
- // }
- // if (ModuleHelper.IsCoolingBuffer(m_pickRoutine.Source))
- // {
- // return m_pickRoutine.Start(null);
- // }
- // if (ModuleHelper.IsAligner(m_pickRoutine.Source))
- // {
- // return m_pickRoutine.Start(null);
- // }
- // if (ModuleHelper.IsLoadLock(m_pickRoutine.Source))
- // {
- // LoadLockDevice device4 = DEVICE.GetDevice<LoadLockDevice>(m_pickRoutine.Source.ToString());
- // if (device4.IsEnableTransferWafer(out reason))
- // {
- // return m_pickRoutine.Start(null);
- // }
- // }
- // }
- // }
- // else if (IsRobotFull())
- // {
- // WaferInfo wafer = Singleton<WaferManager>.Instance.GetWafer(ModuleName.Robot, 0);
- // if (Singleton<WaferManager>.Instance.CheckHasWafer((ModuleName)wafer.NextStation, wafer.NextStationSlot))
- // {
- // EV.PostAlarmLog("System", "Scheduler deadlock.");
- // return Result.FAIL;
- // }
- // m_placeRoutine.Blade = Hand.Blade1;
- // m_placeRoutine.Station = (ModuleName)wafer.NextStation;
- // m_placeRoutine.Slot = wafer.NextStationSlot;
- // if (ModuleHelper.IsLoadPort(m_placeRoutine.Station))
- // {
- // LoadPortBaseDevice device5 = DEVICE.GetDevice<LoadPortBaseDevice>(m_placeRoutine.Station.ToString());
- // if (device5.IsEnableTransferWafer(out reason))
- // {
- // return m_placeRoutine.Start(null);
- // }
- // }
- // if (ModuleHelper.IsCoolingBuffer(m_placeRoutine.Station))
- // {
- // return m_placeRoutine.Start(null);
- // }
- // if (ModuleHelper.IsAligner(m_placeRoutine.Station))
- // {
- // return m_placeRoutine.Start(null);
- // }
- // if (ModuleHelper.IsLoadLock(m_placeRoutine.Station))
- // {
- // LoadLockDevice device6 = DEVICE.GetDevice<LoadLockDevice>(m_placeRoutine.Station.ToString());
- // if (device6.IsEnableTransferWafer(out reason))
- // {
- // return m_placeRoutine.Start(null);
- // }
- // }
- // if (ModuleHelper.IsBuffer(m_placeRoutine.Station))
- // {
- // BufferStation device7 = DEVICE.GetDevice<BufferStation>(m_placeRoutine.Station.ToString());
- // if (device7.IsEnableTransferWafer(out reason))
- // {
- // return m_placeRoutine.Start(null);
- // }
- // }
- // }
- // else
- // {
- // WaferInfo firstWafer2 = GetFirstWafer(new List<ModuleName> { ModuleName.Robot }, EnumE90Status.InProcess);
- // if (firstWafer2 == null)
- // {
- // return Result.FAIL;
- // }
- // if (Singleton<WaferManager>.Instance.CheckNoWafer((ModuleName)firstWafer2.NextStation, firstWafer2.NextStationSlot))
- // {
- // m_placeRoutine.Blade = (Hand)firstWafer2.Slot;
- // m_placeRoutine.Station = (ModuleName)firstWafer2.NextStation;
- // m_placeRoutine.Slot = firstWafer2.NextStationSlot;
- // if (ModuleHelper.IsLoadPort(m_placeRoutine.Station))
- // {
- // LoadPortBaseDevice device8 = DEVICE.GetDevice<LoadPortBaseDevice>(m_placeRoutine.Station.ToString());
- // if (device8.IsEnableTransferWafer(out reason))
- // {
- // return m_placeRoutine.Start(null);
- // }
- // }
- // if (ModuleHelper.IsCoolingBuffer(m_placeRoutine.Station))
- // {
- // return m_placeRoutine.Start(null);
- // }
- // if (ModuleHelper.IsAligner(m_placeRoutine.Station))
- // {
- // m_placeRoutine.Start(null);
- // }
- // if (ModuleHelper.IsLoadLock(m_placeRoutine.Station))
- // {
- // LoadLockDevice device9 = DEVICE.GetDevice<LoadLockDevice>(m_placeRoutine.Station.ToString());
- // if (device9.IsEnableTransferWafer(out reason))
- // {
- // return m_placeRoutine.Start(null);
- // }
- // }
- // if (ModuleHelper.IsBuffer(m_placeRoutine.Station))
- // {
- // BufferStation device10 = DEVICE.GetDevice<BufferStation>(m_placeRoutine.Station.ToString());
- // if (device10.IsEnableTransferWafer(out reason))
- // {
- // return m_placeRoutine.Start(null);
- // }
- // }
- // }
- // else
- // {
- // if (ModuleHelper.IsLoadPort((ModuleName)firstWafer2.NextStation))
- // {
- // EV.PostAlarmLog("System", "Scheduler deadlock.");
- // return Result.FAIL;
- // }
- // if (firstWafer2.Slot == 0)
- // {
- // m_swaproutine.PlaceBlade = Hand.Blade1;
- // }
- // else
- // {
- // m_swaproutine.PlaceBlade = Hand.Blade2;
- // }
- // m_swaproutine.Source = (ModuleName)firstWafer2.NextStation;
- // m_swaproutine.Slot = firstWafer2.NextStationSlot;
- // if (ModuleHelper.IsLoadPort(m_swaproutine.Source))
- // {
- // LoadPortBaseDevice device11 = DEVICE.GetDevice<LoadPortBaseDevice>(m_swaproutine.Source.ToString());
- // if (device11.IsEnableTransferWafer(out reason))
- // {
- // return m_swaproutine.Start(null);
- // }
- // }
- // if (ModuleHelper.IsCoolingBuffer(m_swaproutine.Source))
- // {
- // return m_swaproutine.Start(null);
- // }
- // if (ModuleHelper.IsAligner(m_swaproutine.Source))
- // {
- // return m_swaproutine.Start(null);
- // }
- // if (ModuleHelper.IsBuffer(m_swaproutine.Source))
- // {
- // BufferStation device12 = DEVICE.GetDevice<BufferStation>(m_swaproutine.Source.ToString());
- // if (device12.IsEnableTransferWafer(out reason))
- // {
- // return m_swaproutine.Start(null);
- // }
- // }
- // if (ModuleHelper.IsLoadLock(m_swaproutine.Source))
- // {
- // LoadLockDevice device13 = DEVICE.GetDevice<LoadLockDevice>(m_swaproutine.Source.ToString());
- // if (device13.IsEnableTransferWafer(out reason))
- // {
- // return m_swaproutine.Start(null);
- // }
- // }
- // }
- // }
- // return Result.RUN;
- //}
- //private Result SinglaArmMoveDispatch()
- //{
- // string reason;
- // if (IsRobotEnableArmEmpty())
- // {
- // WaferInfo firstWafer = GetFirstWafer(new List<ModuleName> { _originStation }, EnumE90Status.InProcess);
- // if (firstWafer != null && Singleton<WaferManager>.Instance.CheckNoWafer((ModuleName)firstWafer.NextStation, firstWafer.NextStationSlot))
- // {
- // m_pickRoutine.Blade = Hand.Blade1;
- // if (_isUpperArmEnable)
- // {
- // m_pickRoutine.Blade = Hand.Blade2;
- // }
- // m_pickRoutine.Source = _originStation;
- // m_pickRoutine.Slot = firstWafer.Slot;
- // if (m_soucelp.IsEnableTransferWafer(out reason))
- // {
- // return m_pickRoutine.Start(null);
- // }
- // }
- // firstWafer = GetFirstMovableWafer(_lstPassThrough, EnumE90Status.InProcess);
- // if (firstWafer != null && Singleton<WaferManager>.Instance.CheckNoWafer((ModuleName)firstWafer.NextStation, firstWafer.NextStationSlot))
- // {
- // m_pickRoutine.Blade = Hand.Blade1;
- // if (_isUpperArmEnable)
- // {
- // m_pickRoutine.Blade = Hand.Blade2;
- // }
- // m_pickRoutine.Source = (ModuleName)firstWafer.Station;
- // m_pickRoutine.Slot = firstWafer.Slot;
- // if (ModuleHelper.IsLoadPort(m_pickRoutine.Source))
- // {
- // LoadPortBaseDevice device = DEVICE.GetDevice<LoadPortBaseDevice>(m_pickRoutine.Source.ToString());
- // if (device.IsEnableTransferWafer(out reason))
- // {
- // return m_pickRoutine.Start(null);
- // }
- // }
- // if (ModuleHelper.IsCoolingBuffer(m_pickRoutine.Source))
- // {
- // return m_pickRoutine.Start(null);
- // }
- // if (ModuleHelper.IsAligner(m_pickRoutine.Source))
- // {
- // return m_pickRoutine.Start(null);
- // }
- // if (ModuleHelper.IsLoadLock(m_pickRoutine.Source))
- // {
- // LoadPortBaseDevice device2 = DEVICE.GetDevice<LoadPortBaseDevice>(m_pickRoutine.Source.ToString());
- // if (device2.IsEnableTransferWafer(out reason))
- // {
- // return m_pickRoutine.Start(null);
- // }
- // }
- // if (ModuleHelper.IsBuffer(m_pickRoutine.Source))
- // {
- // BufferStation device3 = DEVICE.GetDevice<BufferStation>(m_pickRoutine.Source.ToString());
- // if (device3.IsEnableTransferWafer(out reason))
- // {
- // return m_pickRoutine.Start(null);
- // }
- // }
- // }
- // }
- // else
- // {
- // WaferInfo wafer = Singleton<WaferManager>.Instance.GetWafer(ModuleName.Robot, 0);
- // if (_isUpperArmEnable)
- // {
- // wafer = Singleton<WaferManager>.Instance.GetWafer(ModuleName.Robot, 1);
- // }
- // if (wafer.IsEmpty)
- // {
- // EV.PostAlarmLog("System", "Wafer information on robot error");
- // return Result.FAIL;
- // }
- // if (Singleton<WaferManager>.Instance.CheckHasWafer((ModuleName)wafer.NextStation, wafer.NextStationSlot))
- // {
- // EV.PostAlarmLog("System", "Destination wafer on.");
- // return Result.FAIL;
- // }
- // m_placeRoutine.Blade = (Hand)wafer.Slot;
- // m_placeRoutine.Station = (ModuleName)wafer.NextStation;
- // m_placeRoutine.Slot = wafer.NextStationSlot;
- // if (ModuleHelper.IsLoadPort(m_placeRoutine.Station))
- // {
- // LoadPortBaseDevice device4 = DEVICE.GetDevice<LoadPortBaseDevice>(m_placeRoutine.Station.ToString());
- // if (device4.IsEnableTransferWafer(out reason))
- // {
- // return m_placeRoutine.Start(null);
- // }
- // }
- // if (ModuleHelper.IsCoolingBuffer(m_placeRoutine.Station))
- // {
- // return m_placeRoutine.Start(null);
- // }
- // if (ModuleHelper.IsAligner(m_placeRoutine.Station))
- // {
- // return m_placeRoutine.Start(null);
- // }
- // if (ModuleHelper.IsLoadLock(m_placeRoutine.Station))
- // {
- // LoadPortBaseDevice device5 = DEVICE.GetDevice<LoadPortBaseDevice>(m_placeRoutine.Station.ToString());
- // if (device5.IsEnableTransferWafer(out reason))
- // {
- // return m_placeRoutine.Start(null);
- // }
- // }
- // if (ModuleHelper.IsBuffer(m_placeRoutine.Station))
- // {
- // BufferStation device6 = DEVICE.GetDevice<BufferStation>(m_placeRoutine.Station.ToString());
- // if (device6.IsEnableTransferWafer(out reason))
- // {
- // return m_placeRoutine.Start(null);
- // }
- // }
- // }
- // return Result.RUN;
- //}
- //private WaferInfo GetFirstMovableWafer(List<ModuleName> mnames, EnumE90Status e90status)
- //{
- // foreach (ModuleName mname in mnames)
- // {
- // WaferInfo[] wafers = Singleton<WaferManager>.Instance.GetWafers(mname);
- // WaferInfo[] array = wafers;
- // foreach (WaferInfo waferInfo in array)
- // {
- // if (!waferInfo.IsEmpty && !Singleton<WaferManager>.Instance.CheckHasWafer((ModuleName)waferInfo.NextStation, waferInfo.NextStationSlot) && waferInfo.SubstE90Status == e90status)
- // {
- // return waferInfo;
- // }
- // }
- // }
- // return null;
- //}
- //private bool IsRobotEnableArmEmpty()
- //{
- // if (_isLowerArmEnable)
- // {
- // return Singleton<WaferManager>.Instance.CheckNoWafer(ModuleName.Robot, 0);
- // }
- // if (_isUpperArmEnable)
- // {
- // return Singleton<WaferManager>.Instance.CheckNoWafer(ModuleName.Robot, 1);
- // }
- // return false;
- //}
- //private WaferInfo GetFirstWafer(List<ModuleName> mnames, EnumE90Status e90status)
- //{
- // foreach (ModuleName mname in mnames)
- // {
- // WaferInfo[] wafers = Singleton<WaferManager>.Instance.GetWafers(mname);
- // WaferInfo[] array = wafers;
- // foreach (WaferInfo waferInfo in array)
- // {
- // if (!waferInfo.IsEmpty && waferInfo.SubstE90Status == e90status)
- // {
- // return waferInfo;
- // }
- // }
- // }
- // return null;
- //}
- //private void UpdateWaferNextStation()
- //{
- // WaferInfo[] wafers = Singleton<WaferManager>.Instance.GetWafers(_originStation);
- // WaferInfo[] array = wafers;
- // foreach (WaferInfo waferInfo in array)
- // {
- // if (!waferInfo.IsEmpty && waferInfo.SubstE90Status == EnumE90Status.InProcess)
- // {
- // if (_lstPassThrough.Count != 0)
- // {
- // waferInfo.NextStation = (int)_lstPassThrough[0];
- // waferInfo.NextStationSlot = 0;
- // Singleton<WaferManager>.Instance.UpdateWaferProcessStatus((ModuleName)waferInfo.Station, waferInfo.Slot, EnumWaferProcessStatus.Idle);
- // }
- // else
- // {
- // waferInfo.NextStation = waferInfo.DestinationStation;
- // waferInfo.NextStationSlot = waferInfo.DestinationSlot;
- // Singleton<WaferManager>.Instance.UpdateWaferProcessStatus((ModuleName)waferInfo.Station, waferInfo.Slot, EnumWaferProcessStatus.Idle);
- // }
- // }
- // }
- // for (int j = 0; j < _lstPassThrough.Count; j++)
- // {
- // WaferInfo wafer = Singleton<WaferManager>.Instance.GetWafer(_lstPassThrough[j], 0);
- // if (!wafer.IsEmpty && wafer.SubstE90Status == EnumE90Status.InProcess)
- // {
- // if (j == _lstPassThrough.Count - 1)
- // {
- // wafer.NextStation = wafer.DestinationStation;
- // wafer.NextStationSlot = wafer.DestinationSlot;
- // }
- // else
- // {
- // wafer.NextStation = (int)_lstPassThrough[j + 1];
- // }
- // }
- // }
- //}
- //private bool WaferDispatch()
- //{
- // int value = SC.GetValue<int>("Process.CyclePlaceMode");
- // if (IsAllWaferProcessed(_originStation))
- // {
- // ModuleName originStation = _originStation;
- // _originStation = _toStation;
- // _toStation = originStation;
- // _cycleTaskRunningCounter++;
- // if (DEVICE.GetDevice<LoadPortBaseDevice>(_originStation.ToString()).DockState == FoupDockState.Docked && DEVICE.GetDevice<LoadPortBaseDevice>(_originStation.ToString()).IsMapWaferByLoadPort)
- // {
- // m_sourceUnloadRoutine.Chamber = _originStation;
- // m_sourceUnloadRoutine.Start(null);
- // }
- // if (m_soucelp.Name != m_destlp.Name && DEVICE.GetDevice<LoadPortBaseDevice>(_toStation.ToString()).DockState == FoupDockState.Docked && DEVICE.GetDevice<LoadPortBaseDevice>(_toStation.ToString()).IsMapWaferByLoadPort)
- // {
- // m_destUnloadRoutine.Chamber = _toStation;
- // m_destUnloadRoutine.Start(null);
- // }
- // if (DEVICE.GetDevice<LoadPortBaseDevice>(_originStation.ToString()).IsMapWaferByLoadPort || DEVICE.GetDevice<LoadPortBaseDevice>(_toStation.ToString()).IsMapWaferByLoadPort)
- // {
- // return true;
- // }
- // }
- // WaferInfo[] wafers = Singleton<WaferManager>.Instance.GetWafers(_originStation);
- // WaferInfo[] wafers2 = Singleton<WaferManager>.Instance.GetWafers(_toStation);
- // int num = wafers.Length;
- // if (num != wafers2.Length)
- // {
- // return false;
- // }
- // List<int> list = new List<int>();
- // list.Clear();
- // for (int i = 0; i < num; i++)
- // {
- // if (wafers[i].IsEmpty || wafers[i].Status != WaferStatus.Normal)
- // {
- // continue;
- // }
- // if (value == 1)
- // {
- // if (!wafers2[num - 1 - i].IsEmpty)
- // {
- // continue;
- // }
- // wafers[i].SubstE90Status = EnumE90Status.InProcess;
- // wafers[i].DestinationStation = (int)_toStation;
- // wafers[i].DestinationSlot = num - 1 - i;
- // }
- // if (value == 2)
- // {
- // if (_originStation != _toStation)
- // {
- // if (!wafers2[i].IsEmpty)
- // {
- // continue;
- // }
- // wafers[i].SubstE90Status = EnumE90Status.InProcess;
- // wafers[i].DestinationStation = (int)_toStation;
- // wafers[i].DestinationSlot = i;
- // }
- // else
- // {
- // wafers[i].SubstE90Status = EnumE90Status.InProcess;
- // wafers[i].DestinationStation = (int)_toStation;
- // wafers[i].DestinationSlot = i;
- // }
- // }
- // if (value == 3)
- // {
- // for (int num2 = num - 1; num2 >= 0; num2--)
- // {
- // if (wafers2[num2].IsEmpty && !list.Contains(num2))
- // {
- // wafers[i].SubstE90Status = EnumE90Status.InProcess;
- // wafers[i].DestinationStation = (int)_toStation;
- // wafers[i].DestinationSlot = num2;
- // list.Add(num2);
- // break;
- // }
- // }
- // }
- // if (value != 4)
- // {
- // continue;
- // }
- // for (int j = 0; j < num; j++)
- // {
- // if (wafers2[j].IsEmpty && !list.Contains(j))
- // {
- // wafers[i].SubstE90Status = EnumE90Status.InProcess;
- // wafers[i].DestinationStation = (int)_toStation;
- // wafers[i].DestinationSlot = j;
- // list.Add(j);
- // break;
- // }
- // }
- // }
- // return true;
- //}
- //private bool IsAllWaferProcessed(ModuleName lpname)
- //{
- // WaferInfo[] wafers = Singleton<WaferManager>.Instance.GetWafers(lpname);
- // WaferInfo[] array = wafers;
- // foreach (WaferInfo waferInfo in array)
- // {
- // if (!waferInfo.IsEmpty && waferInfo.Status == WaferStatus.Normal && waferInfo.SubstE90Status != EnumE90Status.Processed)
- // {
- // return false;
- // }
- // }
- // return true;
- //}
- //private bool IsAnyWaferInProcess(ModuleName lpname)
- //{
- // WaferInfo[] wafers = Singleton<WaferManager>.Instance.GetWafers(lpname);
- // WaferInfo[] array = wafers;
- // foreach (WaferInfo waferInfo in array)
- // {
- // if (!waferInfo.IsEmpty && waferInfo.SubstE90Status == EnumE90Status.InProcess)
- // {
- // return true;
- // }
- // }
- // return false;
- //}
- //private bool IsModulesEmpty(List<ModuleName> lstPassThrough)
- //{
- // foreach (ModuleName item in lstPassThrough)
- // {
- // if (Singleton<WaferManager>.Instance.CheckHasWafer(item, 0))
- // {
- // return false;
- // }
- // }
- // return true;
- //}
- //private bool IsRobotEmpty()
- //{
- // return Singleton<WaferManager>.Instance.CheckNoWafer(ModuleName.Robot, 0) && Singleton<WaferManager>.Instance.CheckNoWafer(ModuleName.Robot, 1);
- //}
- //private bool IsRobotFull()
- //{
- // return Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot, 0) && Singleton<WaferManager>.Instance.CheckHasWafer(ModuleName.Robot, 1);
- //}
- //internal void Clear()
- //{
- // _cycleTaskCount = 0;
- // _cycleTaskRunningCounter = 0;
- // CycleWaferCount = 0;
- //}
- //public void Stop()
- //{
- // _cycleTaskRunningCounter = _cycleTaskCount;
- //}
- }
|