123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- using Aitex.Common.Util;
- using Aitex.Core.RT.RecipeCenter;
- using Aitex.Core.Util;
- using CyberX8_Core;
- using MECF.Framework.Common.Equipment;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace MECF.Framework.Common.RecipeCenter
- {
- public class SequenceRecipeManager : Singleton<SequenceRecipeManager>
- {
- #region 常量
- private const string PRODUCTION = "Production";
- #endregion
- /// <summary>
- /// 获取Recipe类型
- /// </summary>
- /// <param name="item"></param>
- /// <returns></returns>
- public RecipeType GetRecipeType(string item)
- {
- string str = item.ToLower();
- if (str.EndsWith("srd.rcp"))
- {
- return RecipeType.SRD;
- }
- else if(str.EndsWith("hvd.rcp"))
- {
- return RecipeType.HVD;
- }
- else if(str.EndsWith("pwt.rcp"))
- {
- return RecipeType.PWT;
- }
- else if(str.EndsWith("qdr.rcp"))
- {
- return RecipeType.QDR;
- }
- else if(str.EndsWith("dep.rcp"))
- {
- return RecipeType.DEP;
- }
- else
- {
- return RecipeType.RES;
- }
- }
- /// <summary>
- /// 获取模块类型
- /// </summary>
- /// <param name="item"></param>
- /// <returns></returns>
- public ModuleType GetModuleType(string item)
- {
- string str = item.ToLower();
- if (str.EndsWith("srd.rcp"))
- {
- return ModuleType.SRD;
- }
- else if (str.EndsWith("hvd.rcp"))
- {
- return ModuleType.Dryer;
- }
- else if (str.EndsWith("pwt.rcp"))
- {
- return ModuleType.Prewet;
- }
- else if (str.EndsWith("qdr.rcp"))
- {
- return ModuleType.Rinse;
- }
- else if (str.EndsWith("dep.rcp"))
- {
- return ModuleType.Metal;
- }
- else
- {
- return ModuleType.None;
- }
- }
- /// <summary>
- /// 加载Recipe对象
- /// </summary>
- /// <param name="sequenceType"></param>
- /// <param name="recipeName"></param>
- /// <returns></returns>
- public object LoadSequenceTypeRecipe(string sequenceType,string recipeName,RecipeType recipeType)
- {
- string strDirectory = sequenceType == PRODUCTION ? PathManager.GetProductionRecipeDir() : PathManager.GetEngineeringRecipeDir();
- string strProduction = strDirectory + "\\" + recipeName;
- switch (recipeType)
- {
- case RecipeType.HVD:
- return RecipeFileManager.Instance.LoadGenericityRecipe<HvdRecipe>(strProduction);
- case RecipeType.RES:
- return RecipeFileManager.Instance.LoadGenericityRecipe<ResRecipe>(strProduction);
- case RecipeType.SRD:
- return RecipeFileManager.Instance.LoadGenericityRecipe<SrdRecipe>(strProduction);
- case RecipeType.PWT:
- return RecipeFileManager.Instance.LoadGenericityRecipe<PwtRecipe>(strProduction);
- case RecipeType.QDR:
- return RecipeFileManager.Instance.LoadGenericityRecipe<QdrRecipe>(strProduction);
- case RecipeType.DEP:
- return RecipeFileManager.Instance.LoadGenericityRecipe<DepRecipe>(strProduction);
- case RecipeType.RDS:
- return RecipeFileManager.Instance.LoadGenericityRecipe<ResRecipe>(strProduction);
- default:
- return null;
- }
- }
- /// <summary>
- /// 是否包含SRD
- /// </summary>
- /// <param name="recipe"></param>
- /// <returns></returns>
- public bool IsContainedSrd(SequenceRecipe recipe)
- {
- return recipe.Recipes.FindIndex(O => O.ToLower().Contains("srd.rcp")) >=0;
- }
- /// <summary>
- /// 是否包含PWT
- /// </summary>
- /// <param name="recipe"></param>
- /// <returns></returns>
- public bool IsContainedPwt(SequenceRecipe recipe)
- {
- return recipe.Recipes.FindIndex(O => O.ToLower().Contains("pwt.rcp")) >= 0;
- }
- /// <summary>
- /// 获取SRD recipe
- /// </summary>
- /// <param name="recipe"></param>
- /// <returns></returns>
- public SrdRecipe GetSrdRecipeBySequenceRecipe(SequenceRecipe recipe)
- {
- int index = recipe.Recipes.FindIndex(O => O.ToLower().Contains("srd.rcp"));
- if(index>=0)
- {
- string srd=recipe.Recipes[index];
- string strProduction = (recipe.SequenceType == PRODUCTION ? PathManager.GetProductionRecipeDir() : PathManager.GetEngineeringRecipeDir()) + "\\" + srd;
- return RecipeFileManager.Instance.LoadGenericityRecipe<SrdRecipe>(strProduction);
- }
- else
- {
- return null;
- }
- }
-
- }
- }
|