123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- using System;
- using System.Collections.Generic;
- using System.Threading.Tasks;
- using Aitex.Common.Util;
- using Aitex.Core.RT.DataCenter;
- using Aitex.Core.RT.Event;
- using Aitex.Core.RT.Log;
- using Aitex.Core.RT.OperationCenter;
- using Aitex.Core.RT.RecipeCenter;
- using Aitex.Core.Util;
- using Aitex.RT.Properties;
- using Aitex.Triton160.Common;
- using Aitex.Triton160.RT.Module;
- namespace Aitex.RT.FactoryAutomation
- {
- class FaManager : FaHost, IHostCallback
- {
-
- public void Initialize()
- {
- base.Initialize(this, PathManager.GetCfgDir()+"GemModel.xml");
- OP.Subscribe("FACommand", InvokeFaCommand );
- DATA.Subscribe("System.CommunicationStatus", () => FaCommunicationState);
- DATA.Subscribe("System.ControlStatus", () => FaControlState);
- DATA.Subscribe("System.ControlSubStatus", () => FaControlSubState);
- DATA.Subscribe("System.SpoolingState", () => SpoolingState);
- DATA.Subscribe("System.SpoolingActual", () => SpoolingActual);
- DATA.Subscribe("System.SpoolingTotal", () => SpoolingTotal);
- DATA.Subscribe("System.SpoolingFullTime", () => SpoolingFullTime);
- DATA.Subscribe("System.SpoolingStartTime", () => SpoolingStartTime);
- DATA.Subscribe("System.IsSpoolingEnable", () => IsSpoolingEnable);
-
- }
- private bool InvokeFaCommand(string arg1, object[] arg2)
- {
- Invoke(arg2[0].ToString(), null);
- return true;
- }
-
- public string GetSvidValue(string svName)
- {
- object data = DATA.Poll(svName);
- if (data != null)
- {
- return data.ToString();
- }
- return "";
- }
- public List<string> GetListSvidValue(string svName)
- {
- List<string> result = new List<string>();
- if (svName == "RecipeList")
- {
- result = (List<string>) DATA.Poll(svName);
- }
- return result;
- }
- bool IHostCallback.Start(out string reason)
- {
- reason = "";
- return true;
- }
- public bool Pause(out string reason)
- {
- reason = "";
- return true;
- }
- public bool Resume(out string reason)
- {
- reason = "";
- return true;
- }
- public bool Abort(out string reason)
- {
- reason = "";
- return true;
- }
- public bool RunRecipe(string lotId, string jobId, string recipeName, out string reason)
- {
-
- var recipeContent = RecipeFileManager.Instance.LoadRecipe(ModuleName.System.ToString(), recipeName, true);
- if (string.IsNullOrEmpty(recipeContent))
- {
- reason = $"Recipe file {recipeName} not valid";
- return false;
- }
- List<string> reasons;
- if (!RecipeFileManager.Instance.CheckRecipe(ModuleName.System.ToString(), recipeContent, out reasons))
- {
- EV.PostMessage(ModuleName.System.ToString(), EventEnum.PrepareProcessErr, ModuleName.System.ToString(), string.Format(Resources.RTEntity_Invoke_RecipeFileContentNotValid0, recipeName));
- string info = "";
- foreach (var item in reasons)
- info += item;
- reason = $"Recipe file {recipeName} not valid, " + info;
- return false; //Recipe content check.
- }
- Singleton<PMEntity>.Instance.PostMsg((int)PMEntity.MSG.RunRecipe, recipeName, recipeContent, lotId, jobId);
- reason = "";
- return true;
- }
- }
- }
|