12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196 |
- using MECF.Framework.Common.RecipeCenter;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using MECF.Framework.Common.Equipment;
- using MECF.Framework.Common.Schedulers;
- using Aitex.Core.Common;
- using MECF.Framework.Common.WaferHolder;
- using MECF.Framework.Common.CommonData;
- using System.Windows;
- using Aitex.Core.RT.IOCore;
- using Aitex.Core.RT.Log;
- using Aitex.Core.Util;
- using MECF.Framework.Common.Routine;
- using CyberX8_RT.Modules;
- using Aitex.Core.RT.Fsm;
- using CyberX8_RT.Modules.PUF;
- using CyberX8_RT.Modules.Dummy;
- using MECF.Framework.Common.SubstrateTrackings;
- using MECF.Framework.Common.ToolLayout;
- using CyberX8_RT.Modules.Metal;
- using CyberX8_RT.Modules.Rinse;
- using MECF.Framework.RT.Core.Equipments;
- using MECF.Framework.Common.ProcessCell;
- using SecsGem.Core.ItemModel;
- using CyberX8_RT.Modules.Transporter;
- using CyberX8_Core;
- using Aitex.Core.RT.SCCore;
- using CyberX8_RT.Modules.Dryer;
- using CyberX8_RT.Modules.Prewet;
- using CyberX8_RT.Modules.SRD;
- using CyberX8_RT.Modules.Reservoir;
- using CyberX8_RT.Schedulers.Puf;
- using CyberX8_RT.Devices.EFEM;
- using Aitex.Core.RT.Device;
- namespace CyberX8_RT.Schedulers
- {
- public class SchedulerSequenceManager : Singleton<SchedulerSequenceManager>
- {
- #region 常量
- private const string ENGINEERING = "Engineering";
- private const string PRODUCTION = "Production";
- #endregion
- /// <summary>
- /// 解析Wafer所有调度工序
- /// </summary>
- /// <param name="sequenceRecipe"></param>
- /// <returns></returns>
- public List<SchedulerSequence> AnalyWaferAllSchedulerSequence(WaferInfo waferInfo,ModuleName pufModule,string side,WaferHolderInfo waferHolderInfo,SequenceRecipe sequenceRecipe)
- {
- List<SchedulerSequence> schedulerSequences = new List<SchedulerSequence>();
- int index = 0;
- MoveItem moveItem = new MoveItem((ModuleName)waferInfo.OriginStation, waferInfo.OriginSlot, ModuleName.Aligner1, 0, Aitex.Sorter.Common.Hand.Blade1);
- List<SchedulerSyncModuleMessage> synModules = new List<SchedulerSyncModuleMessage>();
- SchedulerSyncModuleMessage pufModuleMessage = new SchedulerSyncModuleMessage();
- pufModuleMessage.ModuleEntity = Singleton<RouteManager>.Instance.GetModule<IModuleEntity>(pufModule.ToString());
- pufModuleMessage.ModuleMsg = PUFMSG.ReadyForRobotPlace.ToString();
- synModules.Add(pufModuleMessage);
- SchedulerSequence efemRobotSequence = CreateEfemRobotSequence(moveItem,synModules,ref index);
- schedulerSequences.Add(efemRobotSequence);
- SchedulerSequence alignerSequence=CreateAlignerSequence(sequenceRecipe.AlignmentAngle,ref index);
- schedulerSequences.Add(alignerSequence);
- //从Aligner至Puf B面
- MoveItem moveItem2 = new MoveItem(ModuleName.Aligner1, 0, pufModule, 1, Aitex.Sorter.Common.Hand.Blade1);
- SchedulerSequence secondEfemRobotSequence = CreateEfemRobotSequence(moveItem2,null,ref index);
- schedulerSequences.Add(secondEfemRobotSequence);
- SchedulerSequence pufSequence=CreatePufSequence(pufModule,sequenceRecipe,side,true,ref index);
- schedulerSequences.Add(pufSequence);
- ////Loader
- //SchedulerSequence loaderSequence = CreateLoaderSequence(ref index);
- //schedulerSequences.Add(loaderSequence);
- ////wafer holder装载后的recipe工序
- //List<SchedulerSequence> waferHolderAfterLoadedAllSequences = WaferHolderAfterLoadedAllSchedulerSequences(waferHolderInfo, sequenceRecipe, ref index);
- //schedulerSequences.AddRange(waferHolderAfterLoadedAllSequences);
- ////buffer模块至Loader
- //ModuleName bufferModule = ConvertToBufferModule(waferHolderInfo.BufferId);
- //WaferHolderMoveItem bufferToLoaderItem = new WaferHolderMoveItem(bufferModule,ModuleType.Buffer , ModuleName.Loader1, ModuleType.Loader);
- //SchedulerSequence bufferToLoaderSequence = CreateLoaderTransporterSequence(bufferToLoaderItem, ref index);
- //schedulerSequences.Add(bufferToLoaderSequence);
- ////Loader
- //SchedulerSequence backLoaderSequence = CreateLoaderSequence(ref index);
- //schedulerSequences.Add(backLoaderSequence);
- //puf模块
- SchedulerSequence backPufSequence = CreatePufSequence(pufModule,sequenceRecipe,"",false, ref index);
- schedulerSequences.Add(backPufSequence);
- //若经过srd
- if(SequenceRecipeManager.Instance.IsContainedSrd(sequenceRecipe))
- {
- SrdRecipe srdRecipe=SequenceRecipeManager.Instance.GetSrdRecipeBySequenceRecipe(sequenceRecipe);
- if(srdRecipe!=null)
- {
- MoveItem pufToSrdItem = new MoveItem();
- pufToSrdItem.SourceModule = pufModule;
- //A面
- pufToSrdItem.SourceSlot = 0;
- pufToSrdItem.DestinationType = ModuleType.SRD;
- pufToSrdItem.SourceSlot = 0;
- pufToSrdItem.DestinationModule = ModuleName.Unknown;
- pufToSrdItem.RobotHand = Aitex.Sorter.Common.Hand.Blade1;
- SchedulerSequence backEfemRobotSequence = CreateEfemRobotSequence(pufToSrdItem,null, ref index);
- schedulerSequences.Add(backEfemRobotSequence);
- SchedulerSequence srdSequence = CreateSRDSequence(srdRecipe, ref index);
- schedulerSequences.Add(srdSequence);
-
- MoveItem srdToLoadPortItem = new MoveItem();
- srdToLoadPortItem.SourceModule = ModuleName.Unknown;
- srdToLoadPortItem.SourceType = ModuleType.SRD;
- srdToLoadPortItem.SourceSlot = 0;
- srdToLoadPortItem.DestinationType = ModuleType.LoadPort;
- srdToLoadPortItem.DestinationModule = (ModuleName)waferInfo.OriginStation;
- srdToLoadPortItem.DestinationSlot = waferInfo.OriginSlot;
- srdToLoadPortItem.RobotHand = Aitex.Sorter.Common.Hand.Blade1;
- SchedulerSequence srdToLoadPortSequence = CreateEfemRobotSequence(srdToLoadPortItem,null, ref index);
- schedulerSequences.Add(srdToLoadPortSequence);
- }
- else
- {
- LOG.WriteLog(eEvent.ERR_SEQUENCE, "System", $"{sequenceRecipe.Ppid} srd recipe is invalid");
- return new List<SchedulerSequence>();
- }
- }
- else
- {
- MoveItem pufToLoadPortItem=new MoveItem(pufModule,0,(ModuleName)waferInfo.OriginStation,
- waferInfo.OriginSlot,Aitex.Sorter.Common.Hand.Blade1);
- SchedulerSequence pufToLoaderSequence=CreateEfemRobotSequence(pufToLoadPortItem,null, ref index);
- schedulerSequences.Add(pufToLoaderSequence);
- }
- return schedulerSequences;
- }
- /// <summary>
- /// 解析WaferHolder的所有工序
- /// </summary>
- /// <param name="waferHolderInfo"></param>
- /// <param name="sequenceRecipe"></param>
- /// <returns></returns>
- public List<SchedulerSequence> AnalyWaferHolderAllSchedulerSequence(WaferHolderInfo waferHolderInfo, SequenceRecipe sequenceRecipe,int waferCount)
- {
- int index = 0;
- List<SchedulerSequence> schedulerSequences = new List<SchedulerSequence>();
- //Buffer To Loader
- ModuleName currentLocationModuleName = (ModuleName)Enum.Parse(typeof(ModuleName), waferHolderInfo.CurrentLocation);
- WaferHolderMoveItem bufferMoveToLoaderItem = new WaferHolderMoveItem(currentLocationModuleName, ModuleType.Buffer, ModuleName.Loader1, ModuleType.Loader);
- SchedulerSequence bufferToLoaderSequence = CreateLoaderTransporterSequence(bufferMoveToLoaderItem,sequenceRecipe, ref index);
- schedulerSequences.Add(bufferToLoaderSequence);
- //Loader
- SchedulerSequence loaderSequence = CreateLoaderSequence(waferCount,ref index);
- schedulerSequences.Add(loaderSequence);
- //wafer holder装载后的recipe工序
- List<SchedulerSequence> waferHolderAfterLoadedAllSequences = WaferHolderAfterLoadedAllSchedulerSequences(waferHolderInfo, sequenceRecipe,ref index);
- schedulerSequences.AddRange(waferHolderAfterLoadedAllSequences);
- return schedulerSequences;
- }
- /// <summary>
- /// Dummy Wafer对应WaferHolder任务
- /// </summary>
- /// <param name="waferHolderInfo"></param>
- /// <returns></returns>
- public List<SchedulerSequence> AnalyseDummyWaferHolderAllSchedulerSequence(WaferHolderInfo waferHolderInfo,int waferCount)
- {
- int index = 0;
- List<SchedulerSequence> schedulerSequences = new List<SchedulerSequence>();
- //Buffer To Loader
- ModuleName currentLocationModuleName = (ModuleName)Enum.Parse(typeof(ModuleName), waferHolderInfo.CurrentLocation);
- ModuleName bufferModule = (ModuleName)Enum.Parse(typeof(ModuleName), waferHolderInfo.OriginalBuffer);
- WaferHolderMoveItem bufferMoveToLoaderItem = new WaferHolderMoveItem(currentLocationModuleName, ModuleType.Buffer, ModuleName.Loader1, ModuleType.Loader);
- SchedulerSequence bufferToLoaderSequence = CreateLoaderTransporterSequence(bufferMoveToLoaderItem,waferHolderInfo.SequenceRecipe, ref index);
- schedulerSequences.Add(bufferToLoaderSequence);
- //Loader
- SchedulerSequence loaderSequence = CreateLoaderSequence(waferCount,ref index);
- schedulerSequences.Add(loaderSequence);
- //Loader To Buffer
- WaferHolderMoveItem loaderMoveToBufferItem = new WaferHolderMoveItem(ModuleName.Loader1, ModuleType.Loader,
- bufferModule, ModuleType.Buffer);
- SchedulerSequence loaderToBufferSequence = CreateLoaderTransporterSequence(loaderMoveToBufferItem,waferHolderInfo.SequenceRecipe, ref index);
- schedulerSequences.Add(loaderToBufferSequence);
- return schedulerSequences;
- }
- /// <summary>
- /// 解析Dummy Wafer所有调度工序
- /// </summary>
- /// <param name="sequenceRecipe"></param>
- /// <returns></returns>
- public List<SchedulerSequence> AnalyDummyWaferAllSchedulerSequence(SequenceRecipe sequenceRecipe,WaferInfo waferInfo, ModuleName pufModule,string side)
- {
- List<SchedulerSequence> schedulerSequences = new List<SchedulerSequence>();
- int index = 0;
- //DummyCassete至Aligner
- MoveItem moveItem = new MoveItem((ModuleName)waferInfo.Station, waferInfo.Slot, ModuleName.Aligner1, 0, Aitex.Sorter.Common.Hand.Blade1);
- SchedulerSequence secondEfemRobotSequence = CreateEfemRobotSequence(moveItem, null, ref index);
- schedulerSequences.Add(secondEfemRobotSequence);
- //Aligner
- SchedulerSequence alignerSequence = null;
- if (sequenceRecipe == null)
- {
- alignerSequence= CreateAlignerSequence(0, ref index);
- }
- else
- {
- alignerSequence=CreateAlignerSequence(sequenceRecipe.AlignmentAngle, ref index);
- }
- schedulerSequences.Add(alignerSequence);
- //Aligner至Puf
- MoveItem alignerToPufMoveItem = new MoveItem(ModuleName.Aligner1, 0, pufModule, 1, Aitex.Sorter.Common.Hand.Blade1);
- SchedulerSequence alignerToPufEfemRobotSequence = CreateEfemRobotSequence(alignerToPufMoveItem, null, ref index);
- schedulerSequences.Add(alignerToPufEfemRobotSequence);
- SchedulerSequence pufSequence = CreatePufSequence(pufModule,sequenceRecipe, side,true, ref index);
- schedulerSequences.Add(pufSequence);
- return schedulerSequences;
- }
- /// <summary>
- /// Loader装载后Recipe工序
- /// </summary>
- /// <param name="waferHolderInfo"></param>
- /// <param name="sequenceRecipe"></param>
- /// <param name="index"></param>
- /// <returns></returns>
- private List<SchedulerSequence> WaferHolderAfterLoadedAllSchedulerSequences(WaferHolderInfo waferHolderInfo,SequenceRecipe sequenceRecipe,ref int index)
- {
- List<SchedulerSequence> schedulerSequences = new List<SchedulerSequence>();
- if(!Enum.TryParse(waferHolderInfo.OriginalBuffer,out ModuleName moduleName))
- {
- return schedulerSequences;
- }
- //Loader To Buffer
- WaferHolderMoveItem loaderMoveToBufferItem = new WaferHolderMoveItem(ModuleName.Loader1, ModuleType.Loader,
- moduleName, ModuleType.Buffer);
- SchedulerSequence loaderToBufferSequence = CreateLoaderTransporterSequence(loaderMoveToBufferItem,sequenceRecipe, ref index);
- schedulerSequences.Add(loaderToBufferSequence);
- //解析sequence recipe后续的工序
- var result = AnalyseSequenceRecipeScheduler(sequenceRecipe);
- //buffer to recipe第一个工序
- WaferHolderMoveItem bufferToFirstItem = new WaferHolderMoveItem(moduleName, ModuleType.Buffer, ModuleName.Unknown, result.firstModuleType);
- SchedulerSequence bufferSequence = CreateLoaderTransporterSequence(bufferToFirstItem,sequenceRecipe, ref index);
- schedulerSequences.Add(bufferSequence);
- //调整工序后面的索引
- foreach (SchedulerSequence item in result.sequences)
- {
- item.SequenceIndex = index;
- index++;
- }
- schedulerSequences.AddRange(result.sequences);
- //从recipe最后工序
- WaferHolderMoveItem lastToBufferItem = new WaferHolderMoveItem(ModuleName.Unknown, result.lastModuleType, moduleName, ModuleType.Buffer);
- SchedulerSequence lastToBufferSequence = CreateLoaderTransporterSequence(lastToBufferItem,sequenceRecipe, ref index);
- schedulerSequences.Add(lastToBufferSequence);
- return schedulerSequences;
- }
- /// <summary>
- /// 分析Sequence recipe对应的调度步骤
- /// </summary>
- /// <param name="sequenceRecipe"></param>
- /// <returns></returns>
- private (ModuleType firstModuleType,List<SchedulerSequence> sequences,ModuleType lastModuleType) AnalyseSequenceRecipeScheduler(SequenceRecipe sequenceRecipe)
- {
- ModuleType firstModuleType = default;
- ModuleType lastModuleType = default;
- List<SchedulerSequence> schedulerSequences= new List<SchedulerSequence>();
- List<SchedulerSequence> tmpLst = new List<SchedulerSequence>();
- var processResult = AnalyseLastProcessRecipeIndex(sequenceRecipe.Recipes);
- bool isExistSrd = sequenceRecipe.Recipes.FindIndex(O=>O.ToLower().EndsWith("srd.rcp"))!=-1;
- int lastIndex = isExistSrd ? sequenceRecipe.Recipes.Count - 2 : sequenceRecipe.Recipes.Count - 1;
- for(int i=0;i<sequenceRecipe.Recipes.Count;i++)
- {
- string item = sequenceRecipe.Recipes[i];
- if(item.ToLower().EndsWith("srd.rcp"))//跳过SRD
- {
- continue;
- }
- SchedulerSequence schedulerSequence = new SchedulerSequence();
- schedulerSequence.ModuleName = ModuleName.Unknown;
- schedulerSequence.ModuleType=SequenceRecipeManager.Instance.GetModuleType(item);
- schedulerSequence.SequenceIndex=i;
- MECF.Framework.Common.RecipeCenter.RecipeType recipeType =SequenceRecipeManager.Instance.GetRecipeType(item);
- schedulerSequence.Recipe = SequenceRecipeManager.Instance.LoadSequenceTypeRecipe(sequenceRecipe.SequenceType,item, recipeType);
- schedulerSequence.SequenceType = sequenceRecipe.SequenceType;
- schedulerSequence.State = RState.Init;
- schedulerSequence.MaterialType = MaterialType.WaferHolder;
- tmpLst.Add(schedulerSequence);
- if (i == 0)
- {
- firstModuleType = schedulerSequence.ModuleType;
- }
- if(i==lastIndex)
- {
- lastModuleType = schedulerSequence.ModuleType;
- }
- else
- {
- string nextModule = sequenceRecipe.Recipes[i + 1];
- schedulerSequence.NextModuleType= SequenceRecipeManager.Instance.GetModuleType(nextModule);
- MECF.Framework.Common.RecipeCenter.RecipeType nextRecipeType = SequenceRecipeManager.Instance.GetRecipeType(nextModule);
- schedulerSequence.NextRecipe= SequenceRecipeManager.Instance.LoadSequenceTypeRecipe(sequenceRecipe.SequenceType,nextModule,nextRecipeType);
- }
- schedulerSequence.IsProcessSequece = true;
- if(i==processResult.lastIndex)
- {
- schedulerSequence.IsLastProcessSequence = true;
- }
-
- }
- int index = 0;
- for(int i=0;i<tmpLst.Count;i++)
- {
- tmpLst[i].SequenceIndex = 0;
- schedulerSequences.Add(tmpLst[i]);
- index++;
- if(i<tmpLst.Count-1)
- {
- WaferHolderMoveItem moveItem = new WaferHolderMoveItem(ModuleName.Unknown, tmpLst[i].ModuleType, ModuleName.Unknown, tmpLst[i + 1].ModuleType);
- SchedulerSequence schedulerSequence=CreateProcessTransporterSequence(moveItem,ref index);
- schedulerSequences.Add(schedulerSequence);
- }
- }
- return (firstModuleType,schedulerSequences,lastModuleType);
- }
- /// <summary>
- /// 分析最后加工recipe索引
- /// </summary>
- /// <param name="recipes"></param>
- /// <returns></returns>
- private (int lastIndex,List<int> processIndexList) AnalyseLastProcessRecipeIndex(List<string> recipes)
- {
- int index = 0;
- List<int> lst = new List<int>();
- for(int i=0;i<recipes.Count; i++)
- {
- string item=recipes[i];
- if(item.ToLower().EndsWith("dep.rcp"))
- {
- index = i;
- if(lst.Contains(i))
- {
- lst.Add(i);
- }
- }
- }
- if(lst.Count==0)
- {
- lst.Add(0);
- }
- return (index,lst);
- }
- /// <summary>
- /// 创建EFEM Robot步骤
- /// </summary>
- /// <param name="index"></param>
- /// <returns></returns>
- private SchedulerSequence CreateEfemRobotSequence(MoveItem moveItem,List<SchedulerSyncModuleMessage> synModules,ref int index)
- {
- SchedulerSequence sequence = new SchedulerSequence();
- sequence.SchedulerModule = SchedulerManager.Instance.GetScheduler(ModuleName.EfemRobot);
- sequence.SequenceIndex= index;
- sequence.ModuleName=ModuleName.EfemRobot;
- sequence.State = RState.Init;
- sequence.Recipe = null;
- sequence.ModuleType=ModuleType.EfemRobot;
- sequence.Parameters =moveItem;
- sequence.MaterialType = MaterialType.Wafer;
- sequence.SynchronousModuleMessages = synModules;
- index++;
- return sequence;
- }
- /// <summary>
- /// 创建Aligner步骤
- /// </summary>
- /// <param name="index"></param>
- /// <returns></returns>
- private SchedulerSequence CreateAlignerSequence(double angle,ref int index)
- {
- SchedulerSequence sequence = new SchedulerSequence();
- sequence.SchedulerModule = SchedulerManager.Instance.GetScheduler(ModuleName.Aligner1);
- sequence.SequenceIndex = index;
- sequence.ModuleName = ModuleName.Aligner1;
- sequence.State = RState.Init;
- sequence.Recipe = null;
- sequence.ModuleType = ModuleType.Aligner;
- sequence.Parameters = angle;
- sequence.MaterialType = MaterialType.Wafer;
- index++;
- return sequence;
- }
- /// <summary>
- /// 创建PUF步骤
- /// </summary>
- /// <param name="pufModuleName"></param>
- /// <param name="index"></param>
- /// <returns></returns>
- private SchedulerSequence CreatePufSequence(ModuleName pufModuleName,SequenceRecipe sequenceRecipe,string side,bool forward,ref int index)
- {
- SchedulerSequence sequence = new SchedulerSequence();
- sequence.SchedulerModule = SchedulerManager.Instance.GetScheduler(pufModuleName);
- sequence.SequenceIndex = index;
- sequence.ModuleName = pufModuleName;
- sequence.State = RState.Init;
- sequence.Recipe = sequenceRecipe;
- PufSchedulerParameter parameter = new PufSchedulerParameter()
- {
- IsForward = forward,
- Side = side,
- };
- sequence.Parameters = parameter;
- sequence.IsWaitNotify = !forward;
- sequence.ModuleType = ModuleType.PUF;
- sequence.MaterialType = MaterialType.Wafer;
- index++;
- return sequence;
- }
- /// <summary>
- /// 创建Loader步骤
- /// </summary>
- /// <param name="index"></param>
- /// <returns></returns>
- private SchedulerSequence CreateLoaderSequence(int waferCount,ref int index)
- {
- SchedulerSequence sequence = new SchedulerSequence();
- sequence.SchedulerModule = SchedulerManager.Instance.GetScheduler(ModuleName.Loader1);
- sequence.SequenceIndex = index;
- sequence.ModuleName = ModuleName.Loader1;
- sequence.State = RState.Init;
- sequence.Recipe = null;
- sequence.Parameters = waferCount;
- sequence.ModuleType = ModuleType.Loader;
- sequence.MaterialType = MaterialType.WaferHolder;
- index++;
- return sequence;
- }
- /// <summary>
- /// 创建Loader步骤
- /// </summary>
- /// <param name="index"></param>
- /// <returns></returns>
- private SchedulerSequence CreateSRDSequence(SrdRecipe recipe,ref int index)
- {
- SchedulerSequence sequence = new SchedulerSequence();
- sequence.SequenceIndex = index;
- sequence.State = RState.Init;
- sequence.Recipe = recipe;
- sequence.ModuleType = ModuleType.SRD;
- sequence.MaterialType = MaterialType.Wafer;
- index++;
- return sequence;
- }
- /// <summary>
- /// 创建LoaderTransporter步骤
- /// </summary>
- /// <param name="index"></param>
- /// <returns></returns>
- private SchedulerSequence CreateLoaderTransporterSequence(WaferHolderMoveItem waferHolderMoveItem,SequenceRecipe sequenceRecipe, ref int index)
- {
- SchedulerSequence sequence = new SchedulerSequence();
- sequence.ModuleType = ModuleType.Transporter;
- sequence.ModuleName = ModuleName.Transporter2;
- sequence.SequenceIndex = index;
- sequence.State = RState.Init;
- sequence.Recipe = sequenceRecipe;
- sequence.SchedulerModule = SchedulerManager.Instance.GetScheduler(ModuleName.Transporter2);
- sequence.Parameters = waferHolderMoveItem;
- sequence.MaterialType = MaterialType.WaferHolder;
- index++;
- return sequence;
- }
- /// <summary>
- /// 创建LoaderTransporter步骤
- /// </summary>
- /// <param name="index"></param>
- /// <returns></returns>
- private SchedulerSequence CreateProcessTransporterSequence(WaferHolderMoveItem waferHolderMoveItem,ref int index)
- {
- SchedulerSequence sequence = new SchedulerSequence();
- sequence.ModuleType = ModuleType.Transporter;
- sequence.ModuleName = ModuleName.Transporter1;
- sequence.SequenceIndex = index;
- sequence.State = RState.Init;
- sequence.Recipe = null;
- sequence.SchedulerModule = SchedulerManager.Instance.GetScheduler(ModuleName.Transporter1);
- sequence.Parameters= waferHolderMoveItem;
- sequence.MaterialType = MaterialType.WaferHolder;
- index++;
- return sequence;
- }
- /// <summary>
- /// 获取可用Dummy slot
- /// </summary>
- /// <param name="moduleType"></param>
- /// <returns></returns>
- public (ModuleName moduleName,int slot) GetAvaibleDummySlots(WaferSize waferSize)
- {
- if(ModuleHelper.IsInstalled(ModuleName.Dummy1))
- {
- DummyEntity dummyEntity = Singleton<RouteManager>.Instance.GetModule<DummyEntity>(ModuleName.Dummy1.ToString());
- DummyDevice dummyDevice = Singleton<RouteManager>.Instance.EFEM.GetDummyDevice(0);
- if (dummyDevice != null && dummyDevice.HasCassette&&dummyDevice.WaferSize==waferSize)
- {
- for (int i = 0; i < dummyEntity.MaxSlotNumber; i++)
- {
- if (WaferManager.Instance.CheckNoWafer(ModuleName.Dummy1, i))
- {
- return (ModuleName.Dummy1, i);
- }
- }
- }
- }
- if(ModuleHelper.IsInstalled(ModuleName.Dummy2))
- {
- DummyEntity dummyEntity = Singleton<RouteManager>.Instance.GetModule<DummyEntity>(ModuleName.Dummy2.ToString());
- DummyDevice dummyDevice = Singleton<RouteManager>.Instance.EFEM.GetDummyDevice(1);
- if (dummyDevice != null && dummyDevice.HasCassette&& dummyDevice.WaferSize == waferSize)
- {
- for (int i = 0; i < dummyEntity.MaxSlotNumber; i++)
- {
- if (WaferManager.Instance.CheckNoWafer(ModuleName.Dummy2, i))
- {
- return (ModuleName.Dummy2, i);
- }
- }
- }
- }
- return (ModuleName.Unknown, -1);
- }
- /// <summary>
- /// 根据模块类型获取可用模块
- /// </summary>
- /// <param name="moduleType"></param>
- /// <returns></returns>
- public ModuleName GetAvaibleModuleCell(string sequenceType,ModuleType moduleType, ModuleName moduleName = ModuleName.Unknown)
- {
- if (ModuleHelper.IsMetal(moduleName))
- {
- List<IModuleEntity> entities = Singleton<RouteManager>.Instance.GetModulesByModuleType(moduleType);
- return GetMetalAvaibleRinseModule(entities, moduleName);
- }
- else
- {
- List<IModuleEntity> entities = Singleton<RouteManager>.Instance.GetModulesByModuleType(moduleType);
- List<IModuleEntity> avaibles = new List<IModuleEntity>();
- foreach (var item in entities)
- {
- bool result = CheckAvaibleModule(item,moduleType,sequenceType);
- if (result)
- {
- avaibles.Add(item);
- }
- }
- return GetMinTimeToReadyModule(avaibles,moduleType);
- }
- }
- /// <summary>
- /// 根据模块类型获取可用模块(不包含WH)
- /// </summary>
- /// <param name="moduleType"></param>
- /// <returns></returns>
- public ModuleName GetAvaibleEmptyModuleCell(ModuleType moduleType,string sequenceType, ModuleName moduleName = ModuleName.Unknown)
- {
- if (ModuleHelper.IsMetal(moduleName))
- {
- List<IModuleEntity> entities = Singleton<RouteManager>.Instance.GetModulesByModuleType(moduleType);
- return GetMetalAvaibleEmptyRinseModule(entities, moduleName);
- }
- else
- {
- List<IModuleEntity> entities = Singleton<RouteManager>.Instance.GetModulesByModuleType(moduleType);
- List<IModuleEntity> avaibles = new List<IModuleEntity>();
- foreach (var item in entities)
- {
- bool result = CheckAvaibleModule(item,moduleType,sequenceType);
- if (result&&!WaferHolderManager.Instance.HasWaferHolder(item.Module.ToString()))
- {
- avaibles.Add(item);
- }
- }
- return avaibles.Count != 0 ? avaibles[0].Module : ModuleName.Unknown;
- }
- }
- /// <summary>
- /// 根据化学液计算时间获取可用MetalCell(参考其他Metal剩余时间)
- /// </summary>
- /// <param name="chemistry"></param>
- /// <returns></returns>
- public ModuleName CalculateAvaibleMetalCellByChemistry(string chemistry,string startRinse,string sequenceType,ref bool isExistEnableMetal)
- {
- if(!Enum.TryParse(startRinse,out ModuleName startRinseModule)||!ModuleHelper.IsRinse(startRinseModule))
- {
- startRinse = "";
- }
- isExistEnableMetal = false;
- List<MetalEntity> moduleEntities = GetAvaibleMetalList(chemistry,sequenceType,true);
- List<IModuleEntity> avaibleMetalEntities = new List<IModuleEntity>();
- foreach (var item in moduleEntities)
- {
- if(CheckAvaibleModule(item,ModuleType.Metal,sequenceType))
- {
- if (item.WaferHolderInfo == null)
- {
- if (CheckMetalModuleRinseAvaible(item, startRinse))
- {
- avaibleMetalEntities.Add(item);
- }
- }
- isExistEnableMetal = true;
- }
- }
- if (avaibleMetalEntities.Count > 0)
- {
- return GetMinUsageMetal(avaibleMetalEntities);
- }
- return ModuleName.Unknown;
- }
- /// <summary>
- /// 根据化学液获取可用Metal
- /// </summary>
- /// <param name="chemistry"></param>
- /// <param name="sequenceType"></param>
- /// <returns></returns>
- public bool CalculateAvaibleMetalCellByChemistry(string chemistry,string sequenceType)
- {
- List<MetalEntity> moduleEntities = GetAvaibleMetalList(chemistry, sequenceType, false);
- return moduleEntities.Count != 0;
- }
- /// <summary>
- /// 检验Metal模块Rinse可用性
- /// </summary>
- /// <param name="item"></param>
- /// <returns></returns>
- private bool CheckMetalModuleRinseAvaible(MetalEntity item,string startRinse)
- {
- List<LayoutCellItem> rinseItems = CellItemManager.Instance.GetRinseItemsByMetal(item.Module.ToString());
- List<string> sharedRinseItems = new List<string>();
- List<string> singleRinseItems = new List<string>();
- foreach (var cellItem in rinseItems)
- {
- RinseEntity rinseEntity = Singleton<RouteManager>.Instance.GetModule<RinseEntity>(cellItem.ModuleName);
- if (!CellItemManager.Instance.CheckRinseIsShared(cellItem.ModuleName))
- {
- if (CheckAvaibleModule(rinseEntity, ModuleType.Rinse, "") && rinseEntity.WaferHolderInfo == null)
- {
- singleRinseItems.Add(cellItem.ModuleName);
- }
- }
- else
- {
- if (CheckAvaibleModule(rinseEntity,ModuleType.Rinse,"") && rinseEntity.WaferHolderInfo == null)
- {
- sharedRinseItems.Add(cellItem.ModuleName);
- }
- //增加自己
- if (cellItem.ModuleName == startRinse && rinseEntity != null && (rinseEntity.IsIdle||rinseEntity.State==(int)RinseState.KeepWeting))
- {
- sharedRinseItems.Add(startRinse);
- }
- }
- }
- //独立的Rinse集合
- if(singleRinseItems.Count!=0)
- {
- bool result = CheckSingleRinseItemsCanUsed(singleRinseItems, item.Module.ToString());
- if(result)
- {
- return true;
- }
- }
- //仅剩下共享Rinse
- List<string> avaibleSharedList = new List<string>();
- if (sharedRinseItems.Count != 0)
- {
- foreach (string sharedRinse in sharedRinseItems)
- {
- RinseEntity rinseEntity = Singleton<RouteManager>.Instance.GetModule<RinseEntity>(sharedRinse);
- if (rinseEntity.IsBusy&&sharedRinse!=startRinse)
- {
- continue;
- }
- //检验共享Rinse是否可用
- if (CheckShardRinseCanUse(sharedRinse, item.Module.ToString(),startRinse))
- {
- avaibleSharedList.Add(sharedRinse);
- }
- }
- }
- if (avaibleSharedList.Count != 0)
- {
- var result = CalculateMetalReservoirAllBusyMetalCount(item.Module.ToString());
- if (result.success)
- {
- bool transporterTransfering = CheckProcessTransporterTransfering(avaibleSharedList);
- if(transporterTransfering)
- {
- return result.busyCount + 1 < avaibleSharedList.Count;
- }
- else
- {
- return result.busyCount < avaibleSharedList.Count+singleRinseItems.Count;
- }
- }
- }
- return false;
- }
- /// <summary>
- /// 检验Process transporter正在Transfer WH移动至Rinse
- /// </summary>
- /// <returns></returns>
- private bool CheckProcessTransporterTransfering(List<string> rinseList)
- {
- TransporterEntity processTransporterEntity = Singleton<RouteManager>.Instance.GetModule<TransporterEntity>(ModuleName.Transporter1.ToString());
- if(processTransporterEntity!=null)
- {
- if (processTransporterEntity.IsBusy)
- {
- string targetCell = processTransporterEntity.TargetCell;
- if (rinseList.Contains(targetCell))
- {
- return true;
- }
- }
- }
- return false;
- }
- /// <summary>
- /// 计算Metal所在Reservoir Busy Metal数量
- /// </summary>
- /// <param name="item"></param>
- /// <returns></returns>
- private (bool success,int busyCount) CalculateMetalReservoirAllBusyMetalCount(string metalName)
- {
- string reservoirName = ReservoirItemManager.Instance.GetReservoirByMetal(metalName);
- if (string.IsNullOrEmpty(reservoirName))
- {
- return (false,0);
- }
- List<string> metals = ReservoirItemManager.Instance.GetMetalsByReservoir(reservoirName);
- int count = 0;
- foreach (string item in metals)
- {
- if (metalName == item)
- {
- continue;
- }
- MetalEntity metalEntity = Singleton<RouteManager>.Instance.GetModule<MetalEntity>(item);
- if (metalEntity.IsBusy || metalEntity.WaferHolderInfo != null)
- {
- count++;
- }
- }
- return (true,count);
- }
- /// <summary>
- /// 检验独立Rinse是否可用
- /// </summary>
- /// <param name="singleRinseItems"></param>
- /// <param name="metalName"></param>
- /// <returns></returns>
- private bool CheckSingleRinseItemsCanUsed(List<string> singleRinseItems, string metalName)
- {
- var result = CalculateMetalReservoirAllBusyMetalCount(metalName);
- if(result.success)
- {
- bool transporterTransfering = CheckProcessTransporterTransfering(singleRinseItems);
- if (transporterTransfering)
- {
- return result.busyCount + 1 < singleRinseItems.Count;
- }
- else
- {
- return result.busyCount < singleRinseItems.Count;
- }
- }
- return false;
- }
- /// <summary>
- /// 检验共享Rinse是否可用
- /// </summary>
- /// <param name="sharedRinse"></param>
- /// <param name="metalName"></param>
- /// <returns></returns>
- private bool CheckShardRinseCanUse(string sharedRinse, string metalName,string startRinse)
- {
- string reservoirName = ReservoirItemManager.Instance.GetReservoirByMetal(metalName);
- List<string> shardReservoirs = CellItemManager.Instance.GetReservoirsBySharedRinse(sharedRinse);
- if (shardReservoirs == null || shardReservoirs.Count == 0)
- {
- return false;
- }
- foreach (string reservoir in shardReservoirs)
- {
- if (reservoir==reservoirName)
- {
- continue;
- }
- List<string> metals=ReservoirItemManager.Instance.GetMetalsByReservoir(reservoir);
- int metalCount = 0;
- int busyMetalCount = 0;
- foreach(string metal in metals)
- {
- MetalEntity metalEntity = Singleton<RouteManager>.Instance.GetModule<MetalEntity>(metal);
- if(metalEntity.IsAuto&&metalEntity.IsInitialized)
- {
- metalCount++;
- }
- if(metalEntity.IsBusy||metalEntity.WaferHolderInfo!=null)
- {
- busyMetalCount++;
- }
- }
- List<string> reservoirRinseLst = CellItemManager.Instance.GetRinsesByReservoir(reservoir);
- int rinseCount = 0;
- int busyRinseCount = 0;
- foreach(string rinseItem in reservoirRinseLst)
- {
- RinseEntity rinseEntity = Singleton<RouteManager>.Instance.GetModule<RinseEntity>(rinseItem);
- if(rinseEntity.IsAuto&&rinseEntity.IsInitialized)
- {
- rinseCount++;
- }
- if (rinseItem == sharedRinse)
- {
- continue;
- }
- if (rinseItem == startRinse)
- {
- continue;
- }
- if(rinseEntity.IsBusy||rinseEntity.WaferHolderInfo!=null)
- {
- busyRinseCount++;
- }
- }
- int resRinseCount=rinseCount- busyRinseCount;
- //计算剩余Rinse数量小于等于busy metal数量,则不可用
- if (resRinseCount <= busyMetalCount)
- {
- return false;
- }
- }
- return true;
- }
- /// <summary>
- /// 检验模块是否可用(不包含WH)
- /// </summary>
- /// <param name="item"></param>
- /// <returns></returns>
- private bool CheckAvaibleEmptyModule(IModuleEntity item,ModuleType moduleType,string sequenceType)
- {
- if (!CheckAvaibleModule(item, moduleType, sequenceType))
- {
- return false;
- }
- if (!ModuleHelper.IsSRD(item.Module))
- {
- WaferHolderInfo waferHolderInfo = WaferHolderManager.Instance.GetWaferHolder(item.Module.ToString());
- if (waferHolderInfo == null)
- {
- return true;
- }
- }
- else
- {
- if (!WaferManager.Instance.CheckHasWafer(item.Module, 0))
- {
- return true;
- }
- }
- return false;
- }
- /// <summary>
- /// 检验模块是否可用
- /// </summary>
- /// <param name="item"></param>
- /// <returns></returns>
- public bool CheckAvaibleModule(IModuleEntity item,ModuleType moduleType,string sequenceType)
- {
- if (item.IsDisable)
- {
- return false;
- }
- if (!item.IsAuto)
- {
- return false;
- }
- if (item.IsError)
- {
- return false;
- }
- if (item.IsInit)
- {
- return false;
- }
- if (moduleType==ModuleType.Metal)
- {
- if(item.IsProduction && sequenceType == ENGINEERING)
- return false;
- if (item.IsEngineering && sequenceType == PRODUCTION)
- return false;
- }
- return true;
- }
- /// <summary>
- /// 获取剩余时间最小的模块
- /// </summary>
- /// <param name="avaibles"></param>
- /// <returns></returns>
- private ModuleName GetMinTimeToReadyModule(List<IModuleEntity> avaibles,ModuleType moduleType)
- {
- if (avaibles.Count == 1)
- {
- return avaibles[0].Module;
- }
- int timeToReady = int.MaxValue;
- IModuleEntity selectedModule = null;
- List<IModuleEntity> idleModuleEtities = new List<IModuleEntity>();
- foreach (var item in avaibles)
- {
- if (item.IsIdle)
- {
- if(moduleType!=ModuleType.Metal)
- {
- return item.Module;
- }
- idleModuleEtities.Add(item);
- }
- if (item.TimeToReady < timeToReady&&idleModuleEtities.Count==0)
- {
- timeToReady = item.TimeToReady;
- selectedModule = item;
- }
- }
- if (idleModuleEtities.Count != 0)
- {
- return GetMinUsageMetal(idleModuleEtities);
- }
- if (selectedModule != null)
- {
- return selectedModule.Module;
- }
- return ModuleName.Unknown;
- }
- /// <summary>
- /// 获取电量最小的Metal
- /// </summary>
- /// <param name="idleModuleEntities"></param>
- /// <returns></returns>
- private ModuleName GetMinUsageMetal(List<IModuleEntity> idleModuleEntities)
- {
- double usage = double.MaxValue;
- ModuleName selectedModuleName = ModuleName.Unknown;
- foreach (var item in idleModuleEntities)
- {
- MetalEntity metalEntity= item as MetalEntity;
- if(metalEntity!=null)
- {
- MetalUsage metalUsage = metalEntity.MetalUsage;
- if (metalUsage == null)
- {
- return metalEntity.Module;
- }
- if (metalUsage.TotalUsage < usage)
- {
- usage= metalUsage.TotalUsage;
- selectedModuleName = metalEntity.Module;
- }
- }
- }
- return selectedModuleName;
- }
- /// <summary>
- /// 获取Metal可用的Rinse模块
- /// </summary>
- /// <param name="metalName"></param>
- /// <returns></returns>
- private ModuleName GetMetalAvaibleRinseModule(List<IModuleEntity> items, ModuleName metalName)
- {
- int metalId = CellItemManager.Instance.GetCellIdByModuleName(metalName.ToString());
- if (metalId == 0)
- {
- return ModuleName.Unknown;
- }
- List<LayoutCellItem> rinseItems = CellItemManager.Instance.GetRinseItemsByMetal(metalName.ToString());
- if (rinseItems.Count == 0)
- {
- return ModuleName.Unknown;
- }
- List<IModuleEntity> avaibles = new List<IModuleEntity>();
- foreach (var item in items)
- {
- LayoutCellItem cellItem = rinseItems.Find(O => O.ModuleName == item.Module.ToString());
- if (cellItem != null)
- {
- RinseEntity rinseEntity = (RinseEntity)item;
- if (rinseEntity.IsInitialized && rinseEntity.IsAuto)
- {
- avaibles.Add(rinseEntity);
- }
- }
- }
- int minInterval = int.MaxValue;
- IModuleEntity moduleEntity = null;
- foreach (var item in avaibles)
- {
- LayoutCellItem cellItem = rinseItems.Find(O => O.ModuleName == item.Module.ToString());
- if (cellItem != null)
- {
- int abiasId = Math.Abs(metalId - cellItem.CellID);
- if (abiasId < minInterval)
- {
- minInterval = abiasId;
- moduleEntity = item;
- }
- }
- }
- if (moduleEntity != null)
- {
- return moduleEntity.Module;
- }
- return ModuleName.Unknown;
- }
- /// <summary>
- /// 检验Metal可用的Rinse模块
- /// </summary>
- /// <param name="metalName"></param>
- /// <returns></returns>
- private ModuleName GetMetalAvaibleEmptyRinseModule(List<IModuleEntity> items, ModuleName metalName)
- {
- int metalId = CellItemManager.Instance.GetCellIdByModuleName(metalName.ToString());
- if (metalId == 0)
- {
- return ModuleName.Unknown;
- }
- List<LayoutCellItem> rinseItems = CellItemManager.Instance.GetRinseItemsByMetal(metalName.ToString());
- if (rinseItems.Count == 0)
- {
- return ModuleName.Unknown;
- }
- List<IModuleEntity> avaibles = new List<IModuleEntity>();
- List<ModuleName> sharedRinseList = new List<ModuleName>();
- foreach (var item in items)
- {
- LayoutCellItem cellItem = rinseItems.Find(O => O.ModuleName == item.Module.ToString());
- if (cellItem != null)
- {
- RinseEntity rinseEntity = (RinseEntity)item;
- if (rinseEntity.IsIdle && rinseEntity.IsAuto && rinseEntity.WaferHolderInfo == null)
- {
- avaibles.Add(rinseEntity);
- if(CellItemManager.Instance.CheckRinseIsShared(rinseEntity.Module.ToString()))
- {
- sharedRinseList.Add(rinseEntity.Module);
- }
- }
- }
- }
- int minInterval = int.MaxValue;
- IModuleEntity moduleEntity = null;
- foreach (var item in avaibles)
- {
- if (sharedRinseList.Contains(item.Module))
- {
- continue;
- }
- LayoutCellItem cellItem = rinseItems.Find(O => O.ModuleName == item.Module.ToString());
- if (cellItem != null)
- {
- int abiasId = Math.Abs(metalId - cellItem.CellID);
- if (abiasId < minInterval)
- {
- minInterval = abiasId;
- moduleEntity = item;
- }
- }
- }
- if (moduleEntity != null)
- {
- return moduleEntity.Module;
- }
- else if(sharedRinseList.Count!=0)
- {
- return sharedRinseList[0];
- }
- return ModuleName.Unknown;
- }
- /// <summary>
- /// 检验Metal cell recipe时间是否可用
- /// </summary>
- /// <param name="depRecipe"></param>
- /// <returns></returns>
- public bool CheckMetalCellRecipeTimeAvaible(IModuleEntity metalEntity,DepRecipe depRecipe)
- {
- List<IModuleEntity> metalEntities=Singleton<RouteManager>.Instance.GetModulesByModuleType(ModuleType.Metal);
- int maxTimeToReady = 0;
- foreach (MetalEntity item in metalEntities)
- {
- if (metalEntity.Module == item.Module)
- {
- continue;
- }
- if(item.IsBusy)
- {
- if(maxTimeToReady>item.TimeToReady)
- {
- maxTimeToReady = item.TimeToReady;
- }
- }
- }
- int transferOffSecond = SC.GetValue<int>("Transporter.TransporterTransferOffSeconds");
- int recipeTotalTime = depRecipe.CalculateRecipeTotalTime();
- //增加了Transporter最大传输时间和最小传输时间的差值
- if (recipeTotalTime>=maxTimeToReady+transferOffSecond)
- {
- return true;
- }
- return false;
- }
- /// <summary>
- /// 根据化学液获取可用的metal集合
- /// </summary>
- /// <param name="chemistry"></param>
- /// <returns></returns>
- public List<MetalEntity> GetAvaibleMetalList(string chemistry, string sequenceType, bool isEmpty)
- {
- List<IModuleEntity> reservoirEntities = Singleton<RouteManager>.Instance.GetModulesByModuleType(ModuleType.Reservoir);
- List<string> avaibles = new List<string>();
- foreach (IModuleEntity item in reservoirEntities)
- {
- ReservoirEntity entity = item as ReservoirEntity;
- if (entity.Chemistry == chemistry && entity.IsAuto && entity.IsInitialized)
- {
- avaibles.Add(entity.Module.ToString());
- }
- }
- List<MetalEntity> metals = new List<MetalEntity>();
- foreach (string item in avaibles)
- {
- ReservoirItem reservoirItem = ReservoirItemManager.Instance.GetReservoirItem(item);
- if (reservoirItem == null)
- {
- continue;
- }
- foreach (MetalItem subItem in reservoirItem.MetalCells)
- {
- MetalEntity entity = Singleton<RouteManager>.Instance.GetModule<MetalEntity>($"Metal{subItem.MetalID}");
- if (!CheckAvaibleModule(entity, ModuleType.Metal, sequenceType))
- {
- continue;
- }
- if (!isEmpty || (isEmpty && entity.WaferHolderInfo == null))
- {
- metals.Add(entity);
- }
- }
- }
- return metals;
- }
- /// <summary>
- /// 获取上一个Metal
- /// </summary>
- /// <param name="sequenceIndex"></param>
- /// <param name="sequences"></param>
- /// <returns></returns>
- public ModuleName GetPreMetalModuleName(int sequenceIndex,List<SchedulerSequence> sequences)
- {
- for(int i = sequenceIndex - 1; i >= 0; i--)
- {
- SchedulerSequence schedulerSequence= sequences[i];
- if (schedulerSequence.ModuleType == ModuleType.Metal && ModuleHelper.IsMetal(schedulerSequence.ModuleName))
- {
- return schedulerSequence.ModuleName;
- }
- }
- return ModuleName.Unknown;
- }
- }
- }
|