using Aitex.Core.RT.Fsm; using Aitex.Core.RT.Log; using Aitex.Core.Util; using MECF.Framework.Common.Equipment; using MECF.Framework.Common.RecipeCenter; using MECF.Framework.Common.ToolLayout; using PunkHPX8_RT.Modules; using PunkHPX8_RT.Modules.Reservoir; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PunkHPX8_RT.Schedulers { public class SchedulerSequenceRecipeManager : Singleton { /// /// 是否存在可用的cell /// /// /// public bool ExistAvaibleProcessCell(SequenceRecipe sequenceRecipe, bool showError, bool checkSrd = false) { if (sequenceRecipe == null) { if (showError) { LOG.WriteLog(eEvent.ERR_SEQUENCE, "System", "sequence recipe is null"); } return false; } int count = 0; for (int i = 0; i < sequenceRecipe.Recipes.Count; i++) { string item = sequenceRecipe.Recipes[i]; if (string.IsNullOrEmpty(item)) { continue; } if (item.ToLower().EndsWith("srd.rcp") && !checkSrd) { continue; } if (item.ToLower().EndsWith("srd.rcp") && !checkSrd) { continue; } if (i == 0 && item.ToLower().EndsWith("qdr.rcp")) { RinseItem rinseItem = RinseItemManager.Instance.GetPrewetRinseItem(); if (rinseItem == null) { if (showError) { LOG.WriteLog(eEvent.ERR_SEQUENCE, "System", $"sequence {sequenceRecipe.Ppid} has no pwt rinse cell"); } return false; } } ModuleType moduleType = SequenceRecipeManager.Instance.GetModuleType(item); if (moduleType == ModuleType.None) { if (showError) { LOG.WriteLog(eEvent.ERR_SEQUENCE, "System", $"sequence {sequenceRecipe.Ppid} item {item} is invalid type"); } return false; } if (moduleType == ModuleType.Metal) { DepRecipe depRecipe =(DepRecipe)SequenceRecipeManager.Instance.LoadSequenceTypeRecipe(sequenceRecipe.SequenceType,item, RecipeType.DEP); if (depRecipe == null) { if (showError) { LOG.WriteLog(eEvent.ERR_SEQUENCE, "System", $"sequece {sequenceRecipe.Ppid} metal recipe {depRecipe.Ppid} is invalid "); } return false; } } else { ModuleName moduleName= SchedulerSequenceManager.Instance.GetAvaibleModuleCell(sequenceRecipe.SequenceType,moduleType); if(moduleName==ModuleName.Unknown) { if (showError) { LOG.WriteLog(eEvent.ERR_SEQUENCE, "System", $"sequece {sequenceRecipe.Ppid} has not avaible {moduleType} module"); } return false; } } count++; } if (count == 0) { if (showError) { LOG.WriteLog(eEvent.ERR_SEQUENCE, "System", $"sequece {sequenceRecipe.Ppid} not set avaible cell"); } return false; } return true; } /// /// 获取sequence的化学液 /// /// /// public List GetSequenceChemistry(SequenceRecipe sequenceRecipe) { List chemistries = new List(); for (int i = 0; i < sequenceRecipe.Recipes.Count; i++) { string item = sequenceRecipe.Recipes[i]; if (string.IsNullOrEmpty(item)) { continue; } ModuleType moduleType = SequenceRecipeManager.Instance.GetModuleType(item); if (moduleType == ModuleType.Metal) { DepRecipe depRecipe = (DepRecipe)SequenceRecipeManager.Instance.LoadSequenceTypeRecipe(sequenceRecipe.SequenceType, item, RecipeType.DEP); if (!chemistries.Contains(depRecipe.Chemistry)) { chemistries.Add(depRecipe.Chemistry); } } } return chemistries; } /// /// 是否Sequence Recipe是否可用 /// /// /// public bool CheckSequenceRecipeAvaible(SequenceRecipe sequenceRecipe,ref string reason) { if (sequenceRecipe == null) { reason = "sequence recipe is null"; LOG.WriteLog(eEvent.ERR_SEQUENCE, "System", reason); return false; } for (int i = 0; i < sequenceRecipe.Recipes.Count; i++) { string item = sequenceRecipe.Recipes[i]; if (string.IsNullOrEmpty(item)) { continue; } RecipeType recipeType= SequenceRecipeManager.Instance.GetRecipeType(item); object recipe = SequenceRecipeManager.Instance.LoadSequenceTypeRecipe(sequenceRecipe.SequenceType, item, recipeType); if (recipe == null) { reason = $"{item} is not in {sequenceRecipe.SequenceType}"; LOG.WriteLog(eEvent.ERR_SEQUENCE, "System", reason); return false; } } return true; } } }