// 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 _lstPassThrough = new List(); //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("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.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("System.TotalWaferCount")); // DATA.Subscribe(ModuleName.System.ToString(), "CycleCount", () => _cycleTaskRunningCounter); // DATA.Subscribe(ModuleName.System.ToString(), "TotalCycleCount", () => _cycleTaskCount); //} //private void CycleOnEvent(EventItem obj) //{ // if (Singleton.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(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("Robot.Blade1Enable"); // _isUpperArmEnable = SC.GetValue("Robot.Blade2Enable"); // if (!_isLowerArmEnable && !_isUpperArmEnable) // { // return Result.FAIL; // } // _cycleTaskCount = SC.GetValue("Process.CycleCount"); // _cycleTaskRunningCounter = 0; // if (!ModuleHelper.IsLoadPort(originStation)) // { // return Result.FAIL; // } // if (!ModuleHelper.IsLoadPort(toStation)) // { // return Result.FAIL; // } // m_soucelp = DEVICE.GetDevice(originStation.ToString()); // m_destlp = DEVICE.GetDevice(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 { _originStation }, EnumE90Status.InProcess); // if (firstWafer != null) // { // m_pickRoutine.Blade = Hand.Blade1; // m_pickRoutine.Source = _originStation; // m_pickRoutine.Slot = firstWafer.Slot; // LoadPortBaseDevice device = DEVICE.GetDevice(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(m_pickRoutine.Source.ToString()); // if (device2.IsEnableTransferWafer(out reason)) // { // return m_pickRoutine.Start(null); // } // } // if (ModuleHelper.IsBuffer(m_pickRoutine.Source)) // { // BufferStation device3 = DEVICE.GetDevice(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(m_pickRoutine.Source.ToString()); // if (device4.IsEnableTransferWafer(out reason)) // { // return m_pickRoutine.Start(null); // } // } // } // } // else if (IsRobotFull()) // { // WaferInfo wafer = Singleton.Instance.GetWafer(ModuleName.Robot, 0); // if (Singleton.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(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(m_placeRoutine.Station.ToString()); // if (device6.IsEnableTransferWafer(out reason)) // { // return m_placeRoutine.Start(null); // } // } // if (ModuleHelper.IsBuffer(m_placeRoutine.Station)) // { // BufferStation device7 = DEVICE.GetDevice(m_placeRoutine.Station.ToString()); // if (device7.IsEnableTransferWafer(out reason)) // { // return m_placeRoutine.Start(null); // } // } // } // else // { // WaferInfo firstWafer2 = GetFirstWafer(new List { ModuleName.Robot }, EnumE90Status.InProcess); // if (firstWafer2 == null) // { // return Result.FAIL; // } // if (Singleton.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(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(m_placeRoutine.Station.ToString()); // if (device9.IsEnableTransferWafer(out reason)) // { // return m_placeRoutine.Start(null); // } // } // if (ModuleHelper.IsBuffer(m_placeRoutine.Station)) // { // BufferStation device10 = DEVICE.GetDevice(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(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(m_swaproutine.Source.ToString()); // if (device12.IsEnableTransferWafer(out reason)) // { // return m_swaproutine.Start(null); // } // } // if (ModuleHelper.IsLoadLock(m_swaproutine.Source)) // { // LoadLockDevice device13 = DEVICE.GetDevice(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 { _originStation }, EnumE90Status.InProcess); // if (firstWafer != null && Singleton.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.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(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(m_pickRoutine.Source.ToString()); // if (device2.IsEnableTransferWafer(out reason)) // { // return m_pickRoutine.Start(null); // } // } // if (ModuleHelper.IsBuffer(m_pickRoutine.Source)) // { // BufferStation device3 = DEVICE.GetDevice(m_pickRoutine.Source.ToString()); // if (device3.IsEnableTransferWafer(out reason)) // { // return m_pickRoutine.Start(null); // } // } // } // } // else // { // WaferInfo wafer = Singleton.Instance.GetWafer(ModuleName.Robot, 0); // if (_isUpperArmEnable) // { // wafer = Singleton.Instance.GetWafer(ModuleName.Robot, 1); // } // if (wafer.IsEmpty) // { // EV.PostAlarmLog("System", "Wafer information on robot error"); // return Result.FAIL; // } // if (Singleton.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(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(m_placeRoutine.Station.ToString()); // if (device5.IsEnableTransferWafer(out reason)) // { // return m_placeRoutine.Start(null); // } // } // if (ModuleHelper.IsBuffer(m_placeRoutine.Station)) // { // BufferStation device6 = DEVICE.GetDevice(m_placeRoutine.Station.ToString()); // if (device6.IsEnableTransferWafer(out reason)) // { // return m_placeRoutine.Start(null); // } // } // } // return Result.RUN; //} //private WaferInfo GetFirstMovableWafer(List mnames, EnumE90Status e90status) //{ // foreach (ModuleName mname in mnames) // { // WaferInfo[] wafers = Singleton.Instance.GetWafers(mname); // WaferInfo[] array = wafers; // foreach (WaferInfo waferInfo in array) // { // if (!waferInfo.IsEmpty && !Singleton.Instance.CheckHasWafer((ModuleName)waferInfo.NextStation, waferInfo.NextStationSlot) && waferInfo.SubstE90Status == e90status) // { // return waferInfo; // } // } // } // return null; //} //private bool IsRobotEnableArmEmpty() //{ // if (_isLowerArmEnable) // { // return Singleton.Instance.CheckNoWafer(ModuleName.Robot, 0); // } // if (_isUpperArmEnable) // { // return Singleton.Instance.CheckNoWafer(ModuleName.Robot, 1); // } // return false; //} //private WaferInfo GetFirstWafer(List mnames, EnumE90Status e90status) //{ // foreach (ModuleName mname in mnames) // { // WaferInfo[] wafers = Singleton.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.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.Instance.UpdateWaferProcessStatus((ModuleName)waferInfo.Station, waferInfo.Slot, EnumWaferProcessStatus.Idle); // } // else // { // waferInfo.NextStation = waferInfo.DestinationStation; // waferInfo.NextStationSlot = waferInfo.DestinationSlot; // Singleton.Instance.UpdateWaferProcessStatus((ModuleName)waferInfo.Station, waferInfo.Slot, EnumWaferProcessStatus.Idle); // } // } // } // for (int j = 0; j < _lstPassThrough.Count; j++) // { // WaferInfo wafer = Singleton.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("Process.CyclePlaceMode"); // if (IsAllWaferProcessed(_originStation)) // { // ModuleName originStation = _originStation; // _originStation = _toStation; // _toStation = originStation; // _cycleTaskRunningCounter++; // if (DEVICE.GetDevice(_originStation.ToString()).DockState == FoupDockState.Docked && DEVICE.GetDevice(_originStation.ToString()).IsMapWaferByLoadPort) // { // m_sourceUnloadRoutine.Chamber = _originStation; // m_sourceUnloadRoutine.Start(null); // } // if (m_soucelp.Name != m_destlp.Name && DEVICE.GetDevice(_toStation.ToString()).DockState == FoupDockState.Docked && DEVICE.GetDevice(_toStation.ToString()).IsMapWaferByLoadPort) // { // m_destUnloadRoutine.Chamber = _toStation; // m_destUnloadRoutine.Start(null); // } // if (DEVICE.GetDevice(_originStation.ToString()).IsMapWaferByLoadPort || DEVICE.GetDevice(_toStation.ToString()).IsMapWaferByLoadPort) // { // return true; // } // } // WaferInfo[] wafers = Singleton.Instance.GetWafers(_originStation); // WaferInfo[] wafers2 = Singleton.Instance.GetWafers(_toStation); // int num = wafers.Length; // if (num != wafers2.Length) // { // return false; // } // List list = new List(); // 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.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.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 lstPassThrough) //{ // foreach (ModuleName item in lstPassThrough) // { // if (Singleton.Instance.CheckHasWafer(item, 0)) // { // return false; // } // } // return true; //} //private bool IsRobotEmpty() //{ // return Singleton.Instance.CheckNoWafer(ModuleName.Robot, 0) && Singleton.Instance.CheckNoWafer(ModuleName.Robot, 1); //} //private bool IsRobotFull() //{ // return Singleton.Instance.CheckHasWafer(ModuleName.Robot, 0) && Singleton.Instance.CheckHasWafer(ModuleName.Robot, 1); //} //internal void Clear() //{ // _cycleTaskCount = 0; // _cycleTaskRunningCounter = 0; // CycleWaferCount = 0; //} //public void Stop() //{ // _cycleTaskRunningCounter = _cycleTaskCount; //} }