EquipmentManager.cs 68 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Threading.Tasks;
  6. using System.Windows.Media;
  7. using System.Xml;
  8. using Aitex.Common.Util;
  9. using Aitex.Core.Common;
  10. using Aitex.Core.RT.DataCenter;
  11. using Aitex.Core.RT.Device;
  12. using Aitex.Core.RT.Event;
  13. using Aitex.Core.RT.Fsm;
  14. using Aitex.Core.RT.Log;
  15. using Aitex.Core.RT.OperationCenter;
  16. using Aitex.Core.RT.RecipeCenter;
  17. using Aitex.Core.RT.Routine;
  18. using Aitex.Core.RT.SCCore;
  19. using Aitex.Core.Util;
  20. using Aitex.Core.Utilities;
  21. using FurnaceRT.Devices;
  22. using FurnaceRT.Equipments.CarrierRobots;
  23. using FurnaceRT.Equipments.FIMSs;
  24. using FurnaceRT.Equipments.Jobs;
  25. using FurnaceRT.Equipments.LPs;
  26. using FurnaceRT.Equipments.PMs;
  27. using FurnaceRT.Equipments.PMs.RecipeExecutions;
  28. using FurnaceRT.Equipments.Schedulers;
  29. using FurnaceRT.Equipments.Stockers;
  30. using FurnaceRT.Equipments.WaferRobots;
  31. using FurnaceRT.Instances;
  32. using MECF.Framework.Common.Alarms;
  33. using MECF.Framework.Common.DataCenter;
  34. using MECF.Framework.Common.Device.Bases;
  35. using MECF.Framework.Common.Equipment;
  36. using MECF.Framework.Common.FAServices;
  37. using MECF.Framework.Common.Jobs;
  38. using MECF.Framework.Common.SCCore;
  39. using MECF.Framework.Common.SubstrateTrackings;
  40. using MECF.Framework.FA.Core.FAControl;
  41. using MECF.Framework.RT.Core.Applications;
  42. using MECF.Framework.RT.Core.IoProviders;
  43. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.PMs;
  44. using AutoTransfer = FurnaceRT.Equipments.Jobs.AutoTransfer;
  45. using ReturnAllWafer = FurnaceRT.Equipments.Jobs.ReturnAllWafer;
  46. namespace FurnaceRT.Equipments.Systems
  47. {
  48. public enum RtState
  49. {
  50. Init,
  51. Initializing,
  52. Idle,
  53. Transfer,
  54. AutoRunning,
  55. AutoIdle,
  56. ReturnAllWafer,
  57. Error,
  58. Loading,
  59. Unloading,
  60. ChargeProcessDischarging,
  61. LoadProcessStockering,
  62. LoadProcessUnloading,
  63. ReturnWafer,
  64. }
  65. public enum TransferJobState
  66. {
  67. Idle,
  68. Error,
  69. Loading,
  70. Unloading,
  71. }
  72. public enum ProcessJobState
  73. {
  74. Idle,
  75. Error,
  76. Charging,
  77. Processing,
  78. Cooling,
  79. Discharging,
  80. }
  81. public partial class EquipmentManager : FsmDevice
  82. {
  83. public enum MSG
  84. {
  85. MoveWafer,
  86. ReturnAllWafer,
  87. Stop,
  88. HOME,
  89. RESET,
  90. ABORT,
  91. ERROR,
  92. ToInit,
  93. SetAutoMode,
  94. SetManualMode,
  95. FAJobCommand,
  96. CreateJob,
  97. PauseJob,
  98. ResumeJob,
  99. StartJob,
  100. StopJob,
  101. AbortJob,
  102. JobAutoStart,
  103. JobDone,
  104. ModuleError,
  105. Map,
  106. Load,
  107. Unload,
  108. ChargeProcessDischarge,
  109. LoadProcessStocker,
  110. LoadProcessUnload,
  111. CancelUnloadingJob,
  112. ToUnloading,
  113. ToLoading,
  114. CreateTransferJob,
  115. AbortTransferJob,
  116. }
  117. public Dictionary<ModuleName, ModuleFsmDevice> Modules { get; set; }
  118. public bool IsAutoMode
  119. {
  120. get
  121. {
  122. return FsmState == (int)RtState.AutoRunning || FsmState == (int)RtState.AutoIdle;
  123. }
  124. }
  125. public bool IsReturnWafer
  126. {
  127. get
  128. {
  129. return FsmState == (int)RtState.ReturnAllWafer || FsmState == (int)RtState.ReturnWafer;
  130. }
  131. }
  132. public bool IsInit
  133. {
  134. get { return FsmState == (int)RtState.Init; }
  135. }
  136. public bool IsIdle
  137. {
  138. get { return FsmState == (int)RtState.Idle; }
  139. }
  140. public bool IsAlarm
  141. {
  142. get { return FsmState == (int)RtState.Error; }
  143. }
  144. public bool IsRunning
  145. {
  146. get
  147. {
  148. return !IsAlarm && !IsIdle && !IsInit && (FsmState != (int)RtState.AutoIdle);
  149. }
  150. }
  151. public bool IsReturnWaferMode
  152. {
  153. get
  154. {
  155. return FsmState == (int)RtState.ReturnAllWafer || FsmState == (int)RtState.ReturnWafer;
  156. }
  157. }
  158. public bool IsAlarmConditionBuzzerOn { get; set; }
  159. public TransferJobState TransferJobStatus { get; set; } = TransferJobState.Idle;
  160. public ProcessJobState ProcessJobStatus { get; set; } = ProcessJobState.Idle;
  161. public object JsonConvert { get; private set; }
  162. private bool _isInited;
  163. protected IRoutine _manualTransfer;
  164. private AutoTransfer _auto = null;
  165. private TransferJob _transferJob = null;
  166. protected IRoutine _homeAll;
  167. protected IRoutine _returnAll;
  168. private string _batchType;
  169. private string _processJob;
  170. private string _processRecipe;
  171. private DeviceTimer _coolTimer = new DeviceTimer();
  172. private int _cycledCount = 0;
  173. private int _jobMSG = 0;
  174. private object[] _jobParas;
  175. private object _locker = new object();
  176. private List<string> _modules;
  177. private PeriodicJob _cycleJob;
  178. private RD_TRIG _plcConnectTrig = new RD_TRIG();
  179. public List<ModuleName> StockerNameForFATJob = new List<ModuleName>();
  180. public EquipmentManager()
  181. {
  182. Module = "System";
  183. Name = "System";
  184. Modules = new Dictionary<ModuleName, ModuleFsmDevice>();
  185. _modules = new List<string>() { "System" };
  186. }
  187. public override bool Initialize()
  188. {
  189. InitDevices();
  190. InitModules();
  191. EnumLoop<RtState>.ForEach((item) =>
  192. {
  193. MapState((int)item, item.ToString());
  194. });
  195. EnumLoop<MSG>.ForEach((item) =>
  196. {
  197. MapMessage((int)item, item.ToString());
  198. });
  199. EnableFsm(50, RtState.Init);
  200. BuildTransitionTable();
  201. SubscribeDataVariable();
  202. SubscribeOperation();
  203. InitRoutine();
  204. InitAlarmDefine();
  205. _auto = new AutoTransfer();
  206. _transferJob = new TransferJob();
  207. _cycleJob = new PeriodicJob(100, OnCycleTimer, Name, true);
  208. Singleton<EventManager>.Instance.OnAlarmEvent += Instance_OnAlarmEvent;
  209. return true;
  210. }
  211. protected void BuildModules(params ModuleFsmDevice[] modules)
  212. {
  213. if (modules != null && modules.Length > 0)
  214. {
  215. foreach (var moduleFsmDevice in modules)
  216. {
  217. Modules[ModuleHelper.Converter(moduleFsmDevice.Module)] = moduleFsmDevice;
  218. }
  219. foreach (var modulesKey in Modules.Keys)
  220. {
  221. _modules.Add(modulesKey.ToString());
  222. }
  223. foreach (var modulesValue in Modules.Values)
  224. {
  225. modulesValue.Initialize();
  226. }
  227. }
  228. }
  229. protected virtual void InitRoutine()
  230. {
  231. _homeAll = new HomeAll();
  232. _returnAll = new ReturnAllWafer();
  233. _dbCallback = new SchedulerDBCallback();
  234. }
  235. //private PeriodicJob _job1;
  236. //Stopwatch _sw = new Stopwatch();
  237. //private bool OnJob1()
  238. //{
  239. // _sw.Restart();
  240. // BufferModule buffer = Modules[ModuleName.Buffer] as BufferModule;
  241. // if (!buffer.CheckToPostMessage(BufferModule.MSG.InTransfer))
  242. // {
  243. // System.Diagnostics.Trace.Assert(false)
  244. // System.Diagnostics.Trace.WriteLine("fail to in transfer");
  245. // }
  246. // if (buffer.IsIdle)
  247. // {
  248. // System.Diagnostics.Trace.Assert(false);
  249. // System.Diagnostics.Trace.WriteLine("!!!==========>IsIdle");
  250. // }
  251. // //System.Diagnostics.Trace.Assert(buffer.IsIdle, $"in {buffer.StringFsmStatus}");
  252. // while (buffer.IsIdle)
  253. // {
  254. // Thread.Sleep(5);
  255. // }
  256. // //buffer.NoteTransferStop(ModuleName.EfemRobot, Hand.Blade1, 0, EnumTransferType.Place);
  257. // //Thread.Sleep(15);
  258. // if (!buffer.CheckToPostMessage(BufferModule.MSG.TransferComplete))
  259. // {
  260. // System.Diagnostics.Trace.Assert(false);
  261. // System.Diagnostics.Trace.WriteLine("fail to complete");
  262. // }
  263. // //if (!buffer.IsIdle)
  264. // //{
  265. // // System.Diagnostics.Trace.WriteLine("not idle");
  266. // //}
  267. // System.Diagnostics.Trace.WriteLine($" === {_sw.ElapsedMilliseconds}");
  268. // while (!buffer.IsIdle)
  269. // {
  270. // Thread.Sleep(5);
  271. // }
  272. // return true;
  273. //}
  274. private void BuildTransitionTable()
  275. {
  276. //Init sequence
  277. Transition(RtState.Init, MSG.HOME, FsmStartHome, RtState.Initializing);
  278. Transition(RtState.Idle, MSG.HOME, FsmStartHome, RtState.Initializing);
  279. Transition(RtState.Error, MSG.HOME, FsmStartHome, RtState.Initializing);
  280. Transition(RtState.Error, MSG.ToInit, null, RtState.Init);
  281. Transition(RtState.Initializing, FSM_MSG.TIMER, FsmMonitorHome, RtState.Idle);
  282. Transition(RtState.Initializing, MSG.ERROR, fError, RtState.Error);
  283. Transition(RtState.Initializing, MSG.ABORT, FsmAbort, RtState.Init);
  284. //Reset
  285. AnyStateTransition(MSG.ERROR, fError, RtState.Error);
  286. AnyStateTransition((int)FSM_MSG.ALARM, fError, (int)RtState.Error);
  287. Transition(RtState.Error, MSG.RESET, fStartReset, RtState.Idle);
  288. Transition(RtState.Init, MSG.RESET, fStartReset, RtState.Init);
  289. Transition(RtState.Idle, MSG.RESET, fStartReset, RtState.Idle);
  290. Transition(RtState.AutoIdle, MSG.RESET, fStartReset, RtState.AutoIdle);
  291. Transition(RtState.AutoRunning, MSG.RESET, fStartReset, RtState.AutoRunning);
  292. Transition(RtState.ReturnWafer, MSG.RESET, fStartReset, RtState.ReturnWafer);
  293. //Auto/manual sequence
  294. Transition(RtState.Idle, MSG.SetAutoMode, fStartAutoTransfer, RtState.AutoIdle);
  295. Transition(RtState.AutoRunning, FSM_MSG.TIMER, fAutoTransfer, RtState.AutoRunning);
  296. Transition(RtState.AutoRunning, MSG.JobAutoStart, FsmJobAutoStart, RtState.Idle);
  297. Transition(RtState.AutoRunning, MSG.ABORT, FsmAbort, RtState.Idle);
  298. Transition(RtState.AutoRunning, MSG.JobDone, null, RtState.AutoIdle);
  299. Transition(RtState.Idle, MSG.CreateJob, FsmCreateJob, RtState.AutoRunning);
  300. Transition(RtState.Idle, MSG.LoadProcessUnload, FsmStartLoadProcessUnload, RtState.AutoRunning);
  301. Transition(RtState.Idle, MSG.LoadProcessStocker, FsmStartLoadProcessStocker, RtState.AutoRunning);
  302. Transition(RtState.AutoRunning, MSG.FAJobCommand, FsmFAJobCommand, RtState.AutoRunning);
  303. Transition(RtState.AutoRunning, MSG.CreateJob, FsmCreateJob, RtState.AutoRunning);
  304. Transition(RtState.AutoRunning, MSG.StartJob, FsmStartJob, RtState.AutoRunning);
  305. Transition(RtState.AutoRunning, MSG.PauseJob, FsmPauseJob, RtState.AutoRunning);
  306. Transition(RtState.AutoRunning, MSG.ResumeJob, FsmResumeJob, RtState.AutoRunning);
  307. Transition(RtState.AutoRunning, MSG.StopJob, FsmStopJob, RtState.AutoRunning);
  308. Transition(RtState.AutoRunning, MSG.AbortJob, FsmAbortJob, RtState.AutoRunning);
  309. Transition(RtState.AutoRunning, MSG.ModuleError, FsmModuleError, RtState.AutoRunning);
  310. Transition(RtState.AutoRunning, MSG.Load, FsmStartLoad, RtState.AutoRunning);
  311. Transition(RtState.AutoRunning, MSG.Unload, FsmStartUnload, RtState.AutoRunning);
  312. Transition(RtState.Idle, MSG.CreateTransferJob, FsmCreateTransferJob, RtState.AutoRunning);
  313. Transition(RtState.AutoRunning, MSG.CreateTransferJob, FsmCreateTransferJob, RtState.AutoRunning);
  314. Transition(RtState.AutoRunning, MSG.AbortTransferJob, FsmAbortTransferJob, RtState.AutoRunning);
  315. Transition(RtState.AutoRunning, MSG.CancelUnloadingJob, FsmCancelUnloadingJob, RtState.AutoRunning);
  316. Transition(RtState.AutoRunning, MSG.LoadProcessUnload, FsmStartLoadProcessUnload, RtState.AutoRunning);
  317. Transition(RtState.AutoRunning, MSG.LoadProcessStocker, FsmStartLoadProcessStocker, RtState.AutoRunning);
  318. Transition(RtState.AutoIdle, MSG.FAJobCommand, FsmFAJobCommand, RtState.AutoRunning);
  319. Transition(RtState.AutoIdle, FSM_MSG.TIMER, FsmMonitorAutoIdle, RtState.AutoIdle);
  320. Transition(RtState.AutoIdle, MSG.SetManualMode, FsmStartSetManualMode, RtState.Idle);
  321. Transition(RtState.AutoIdle, MSG.CreateJob, FsmCreateJob, RtState.AutoRunning);
  322. Transition(RtState.AutoIdle, MSG.StartJob, FsmStartJob, RtState.AutoRunning);
  323. Transition(RtState.AutoIdle, MSG.ABORT, FsmAbort, RtState.Idle);
  324. Transition(RtState.AutoIdle, MSG.AbortJob, FsmAbortJob, RtState.AutoIdle);
  325. Transition(RtState.AutoIdle, MSG.Load, FsmStartLoad, RtState.AutoIdle);
  326. Transition(RtState.AutoIdle, MSG.Unload, FsmStartUnload, RtState.AutoIdle);
  327. Transition(RtState.AutoIdle, MSG.CreateTransferJob, FsmCreateTransferJob, RtState.AutoRunning);
  328. Transition(RtState.AutoIdle, MSG.AbortTransferJob, FsmAbortTransferJob, RtState.AutoIdle);
  329. Transition(RtState.AutoIdle, MSG.LoadProcessUnload, FsmStartLoadProcessUnload, RtState.AutoRunning);
  330. Transition(RtState.AutoIdle, MSG.LoadProcessStocker, FsmStartLoadProcessStocker, RtState.AutoRunning);
  331. EnterExitTransition<RtState, FSM_MSG>(RtState.AutoRunning, null, FSM_MSG.NONE, fExitAutoTransfer);
  332. //return all wafer
  333. //Transition(RtState.Idle, MSG.ReturnAllWafer, FsmStartReturnAllWafer, RtState.ReturnAllWafer);
  334. //Transition(RtState.ReturnAllWafer, FSM_MSG.TIMER, FsmMonitorReturnAllWafer, RtState.Idle);
  335. //Transition(RtState.ReturnAllWafer, MSG.ABORT, FsmAbortReturnAllWafer, RtState.Idle);
  336. //Return wafer
  337. Transition(RtState.Idle, MSG.ReturnAllWafer, FsmStartReturnWafer, RtState.ReturnWafer);
  338. Transition(RtState.AutoIdle, MSG.ReturnAllWafer, FsmStartReturnWafer, RtState.ReturnWafer);
  339. Transition(RtState.ReturnWafer, FSM_MSG.TIMER, FsmMonitorReturnWafer, RtState.Idle);
  340. Transition(RtState.ReturnWafer, MSG.ABORT, FsmAbort, RtState.Idle);
  341. //Transfer sequence
  342. Transition(RtState.Idle, MSG.MoveWafer, fStartTransfer, RtState.Transfer);
  343. Transition(RtState.Transfer, FSM_MSG.TIMER, fTransfer, RtState.Idle);
  344. EnterExitTransition<RtState, FSM_MSG>(RtState.Transfer, null, FSM_MSG.NONE, fExitTransfer);
  345. Transition(RtState.Transfer, MSG.ABORT, FsmAbort, RtState.Idle);
  346. }
  347. void SubscribeDataVariable()
  348. {
  349. DATA.Subscribe("System.FFUKeyDict", () => GetDeviceKeyDict(DeviceName.IoFFUNameKey), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  350. DATA.Subscribe("System.NameKeyDict", () => GetALLDeviceKeyDict(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  351. DATA.Subscribe("Rt.Status", () => StringFsmStatus);
  352. DATA.Subscribe("System.IsInitialized", () => _isInited);
  353. DATA.Subscribe("System.IsIdle", () => IsIdle || IsInit || (FsmState == (int)RtState.AutoIdle));
  354. DATA.Subscribe("System.IsAlarm", () => IsAlarm);
  355. DATA.Subscribe("System.IsBusy", () => IsRunning);
  356. DATA.Subscribe("System.IsAutoRunning", () => IsRunning);
  357. DATA.Subscribe("System.IsAlarmConditionBuzzerOn", () => IsAlarmConditionBuzzerOn);
  358. DATA.Subscribe("System.Modules", () => _modules);
  359. }
  360. List<string> GetDeviceKeyDict(string key)
  361. {
  362. List<string> result = null;
  363. if (SC.GetStringValue("System.SetUp.ToolType") != "ELK") return null;
  364. GetXmlElement("DeviceModelPM", key, ref result);
  365. return result;
  366. }
  367. Dictionary<string, List<string>> GetALLDeviceKeyDict()
  368. {
  369. return GetXmlElement("DeviceModelPM");
  370. }
  371. public void GetXmlElement(string fileName, string type, ref List<string> result, bool isSystem = false)
  372. {
  373. result = new List<string>();
  374. XmlDocument xmlDoc = new XmlDocument();
  375. var cfDirPath = PathManager.GetCfgDir();
  376. var path = cfDirPath + $"IO\\{SC.GetStringValue("System.SetUp.ToolType")}\\{fileName}.xml";
  377. if (!File.Exists(path)) return;
  378. xmlDoc.Load(path);
  379. XmlNode node = xmlDoc.SelectSingleNode("DeviceModelDefine");
  380. foreach (XmlNode item in node.ChildNodes)
  381. {
  382. if (item.NodeType != XmlNodeType.Element) continue;
  383. var element = item as XmlElement;
  384. var classType = element.GetAttribute("classType");
  385. if (classType == null) continue;
  386. classType = classType.Split('.').LastOrDefault();
  387. if (classType == type)
  388. {
  389. foreach (XmlNode children in item.ChildNodes)
  390. {
  391. if (children is XmlElement childElement)
  392. {
  393. if (result.Contains(childElement.GetAttribute("id"))) continue;
  394. var key = isSystem ? $"System.{childElement.GetAttribute("id")}.DeviceData" : $"PM1.{childElement.GetAttribute("id")}.DeviceData";
  395. result.Add(key);
  396. }
  397. }
  398. }
  399. }
  400. }
  401. public Dictionary<string, List<string>> GetXmlElement(string fileName, bool isSystem = false)
  402. {
  403. Dictionary<string, List<string>> result = new Dictionary<string, List<string>>();
  404. XmlDocument xmlDoc = new XmlDocument();
  405. var cfDirPath = PathManager.GetCfgDir();
  406. var path = cfDirPath + $"IO\\{SC.GetStringValue("System.SetUp.ToolType")}\\{fileName}.xml";
  407. if (!File.Exists(path)) return result;
  408. xmlDoc.Load(path);
  409. XmlNode node = xmlDoc.SelectSingleNode("DeviceModelDefine");
  410. foreach (XmlNode item in node.ChildNodes)
  411. {
  412. if (item.NodeType != XmlNodeType.Element) continue;
  413. var element = item as XmlElement;
  414. var classType = element.GetAttribute("classType");
  415. if (classType == null) continue;
  416. classType = classType.Split('.').LastOrDefault();
  417. result[classType] = new List<string>();
  418. foreach (XmlNode children in item.ChildNodes)
  419. {
  420. if (children.Name != classType) continue;//类型限定一致
  421. if (children is XmlElement childElement)
  422. {
  423. if (result[classType].Contains(childElement.GetAttribute("id"))) continue;
  424. var key = isSystem ? $"System.{childElement.GetAttribute("id")}.DeviceData" : $"PM1.{childElement.GetAttribute("id")}.DeviceData";
  425. result[classType].Add(key);
  426. }
  427. }
  428. }
  429. return result;
  430. }
  431. void SubscribeOperation()
  432. {
  433. OP.Subscribe("CreateWafer", InvokeCreateWafer);
  434. OP.Subscribe("System.UpdateWafer", InvokeUpdateWafer);
  435. OP.Subscribe("CreateWaferFromTo", InvokeCreateWaferFromTo);
  436. OP.Subscribe("DeleteWafer", InvokeDeleteWafer);
  437. OP.Subscribe("DeleteWaferFromTo", InvokeDeleteWaferFromTo);
  438. OP.Subscribe("CreateCassetteWafer", InvokeCreateCassetteWafer);
  439. OP.Subscribe("DeleteCassetteWafer", InvokeDeleteCassetteWafer);
  440. OP.Subscribe("System.CreateCarrier", InvokeCreateCarrier);
  441. OP.Subscribe("System.DeleteCarrier", InvokeDeleteCarrier);
  442. OP.Subscribe("System.SetLotID", InvokeSetLotID);
  443. OP.Subscribe("System.DeleteAllWafer", InvokeDeleteAllWafer);
  444. OP.Subscribe("System.DeleteAllCarrier", InvokeDeleteAllCarrier);
  445. OP.Subscribe("ReturnWafer", InvokeReturnWafer);
  446. OP.Subscribe("System.SignalTower.SwitchOffBuzzer", InvokeSwitchOffBuzzer);
  447. OP.Subscribe("System.ReturnAllWafer", (string cmd, object[] args) =>
  448. {
  449. return CheckToPostMessage((int)MSG.ReturnAllWafer);
  450. });
  451. OP.Subscribe("System.MoveWafer", (string cmd, object[] args) =>
  452. {
  453. if (!Enum.TryParse((string)args[0], out ModuleName source))
  454. {
  455. EV.PostWarningLog(Name, $"Parameter source {(string)args[0]} not valid");
  456. return false;
  457. }
  458. if (!Enum.TryParse((string)args[2], out ModuleName destination))
  459. {
  460. EV.PostWarningLog(Name, $"Parameter destination {(string)args[1]} not valid");
  461. return false;
  462. }
  463. if (args.Length > 8)
  464. {
  465. return CheckToPostMessage((int)MSG.MoveWafer, source, (int)args[1], destination, (int)args[3],
  466. (bool)args[4], (int)args[5], (bool)args[6], (int)args[7]);
  467. }
  468. else if (args.Length > 5)
  469. {
  470. return CheckToPostMessage((int)MSG.MoveWafer, source, (int)args[1], destination, (int)args[3], (bool)args[4]);
  471. }
  472. return CheckToPostMessage((int)MSG.MoveWafer, source, (int)args[1], destination, (int)args[3]);
  473. });
  474. OP.Subscribe("System.HomeAll", (string cmd, object[] args) =>
  475. {
  476. return CheckToPostMessage((int)MSG.HOME);
  477. });
  478. OP.Subscribe("System.Abort", (string cmd, object[] args) =>
  479. {
  480. return CheckToPostMessage((int)MSG.ABORT);
  481. });
  482. OP.Subscribe("System.Reset", (string cmd, object[] args) =>
  483. {
  484. return CheckToPostMessage((int)MSG.RESET);
  485. });
  486. OP.Subscribe("System.SetAutoMode", (string cmd, object[] args) =>
  487. {
  488. return CheckToPostMessage((int)MSG.SetAutoMode);
  489. });
  490. OP.Subscribe("System.SetManualMode", (string cmd, object[] args) =>
  491. {
  492. return CheckToPostMessage((int)MSG.SetManualMode);
  493. });
  494. OP.Subscribe("System.CreateJob", (string cmd, object[] args) =>
  495. {
  496. return CheckToPostMessage((int)MSG.CreateJob, args[0]);
  497. });
  498. OP.Subscribe("System.StartJob", (string cmd, object[] args) =>
  499. {
  500. return CheckToPostMessage((int)MSG.StartJob, args[0]);
  501. });
  502. OP.Subscribe("System.PauseJob", (string cmd, object[] args) =>
  503. {
  504. return CheckToPostMessage((int)MSG.PauseJob, args[0]);
  505. });
  506. OP.Subscribe("System.ResumeJob", (string cmd, object[] args) =>
  507. {
  508. return CheckToPostMessage((int)MSG.ResumeJob, args[0]);
  509. });
  510. OP.Subscribe("System.StopJob", (string cmd, object[] args) =>
  511. {
  512. return CheckToPostMessage((int)MSG.StopJob, args[0]);
  513. });
  514. OP.Subscribe("System.AbortJob", (string cmd, object[] args) =>
  515. {
  516. return CheckToPostMessage((int)MSG.AbortJob, args[0]);
  517. });
  518. OP.Subscribe("System.CoolingSkip", (string cmd, object[] args) =>
  519. {
  520. CoolingSkip();
  521. return true;
  522. });
  523. OP.Subscribe("System.ShutDown", InvokeShutDown);
  524. OP.Subscribe($"System.Load", (string cmd, object[] args) => CheckToPostJobMessage((int)MSG.CreateTransferJob, args));
  525. OP.Subscribe($"System.Unload", (string cmd, object[] args) => CheckToPostJobMessage((int)MSG.CreateTransferJob, args));
  526. OP.Subscribe($"System.ChargeProcessDischarge", (string cmd, object[] args) => CheckToPostJobMessage((int)MSG.CreateJob, args));
  527. OP.Subscribe($"System.LoadProcessUnload", (string cmd, object[] args) => CheckToPostJobMessage((int)MSG.LoadProcessUnload, args));
  528. OP.Subscribe($"System.LoadProcessStocker", (string cmd, object[] args) => CheckToPostJobMessage((int)MSG.LoadProcessStocker, args));
  529. OP.Subscribe($"System.MonitorLoad", (string cmd, object[] args) => CheckToPostJobMessage((int)MSG.CreateTransferJob, args));
  530. OP.Subscribe($"System.MonitorUnload", (string cmd, object[] args) => CheckToPostJobMessage((int)MSG.CreateTransferJob, args));
  531. OP.Subscribe($"System.SDLoad", (string cmd, object[] args) => CheckToPostJobMessage((int)MSG.CreateTransferJob, args));
  532. OP.Subscribe($"System.SDUnload", (string cmd, object[] args) => CheckToPostJobMessage((int)MSG.CreateTransferJob, args));
  533. OP.Subscribe($"{Module}.AlarmAction", (string cmd, object[] args) =>
  534. {
  535. Enum.TryParse(args[0].ToString(), out AlarmAction alarmAction);
  536. if (alarmAction == AlarmAction.ClearAll)
  537. {
  538. CheckToPostMessage((int)MSG.RESET);
  539. return true;
  540. }
  541. string eventName = null;
  542. if (args.Length > 1)
  543. eventName = args[1].ToString();
  544. if (eventName != null)
  545. {
  546. EV.ClearAlarmEvent(eventName);
  547. var item = _triggeredAlarmList.FirstOrDefault(x => x.EventEnum == eventName);
  548. if (item != null)
  549. {
  550. item.Reset();
  551. _triggeredAlarmList.Remove(item);
  552. }
  553. if (item != null)
  554. {
  555. switch (alarmAction)
  556. {
  557. case AlarmAction.Retry:
  558. {
  559. CheckToPostMessage((int)item.RetryMessage, item.RetryMessageParas);
  560. }
  561. break;
  562. case AlarmAction.Abort:
  563. {
  564. CheckToPostMessage((int)MSG.ABORT);
  565. }
  566. break;
  567. case AlarmAction.Clear:
  568. {
  569. int alarmCount = 0;
  570. var alarms = EV.GetAlarmEvent();
  571. foreach (var alarm in alarms)
  572. {
  573. if (alarm.Level == EventLevel.Alarm && alarm.Source == Name)
  574. alarmCount++;
  575. }
  576. if (alarmCount == 0)
  577. CheckToPostMessage((int)MSG.RESET);
  578. }
  579. break;
  580. case AlarmAction.Continue:
  581. {
  582. int alarmCount = 0;
  583. var alarms = EV.GetAlarmEvent();
  584. foreach (var alarm in alarms)
  585. {
  586. if (alarm.Level == EventLevel.Alarm && alarm.Source == Name)
  587. alarmCount++;
  588. }
  589. if (alarmCount == 0)
  590. CheckToPostMessage((int)MSG.RESET);
  591. }
  592. break;
  593. }
  594. }
  595. }
  596. return true;
  597. });
  598. }
  599. private void Instance_OnAlarmEvent(EventItem item)
  600. {
  601. if (item != null && item.Level == EventLevel.Alarm && (item.Source == Name || item.Source == Module))
  602. {
  603. DEVICE.GetDevice<SignalTowerBase>("System.SignalTower")?.Reset();
  604. LOG.Write($"{item.Source} {item.EventEnum} {item.Description}\n");
  605. PostMsg(MSG.ERROR);
  606. }
  607. }
  608. #region Init
  609. private bool FsmStartHome(object[] objs)
  610. {
  611. _isInited = false;
  612. return _homeAll.Start() == Result.RUN;
  613. }
  614. private bool FsmMonitorHome(object[] objs)
  615. {
  616. Result ret = _homeAll.Monitor();
  617. if (ret == Result.DONE)
  618. {
  619. _isInited = true;
  620. return true;
  621. }
  622. if (ret == Result.FAIL)
  623. {
  624. PostMsg(MSG.ERROR);
  625. }
  626. return false;
  627. }
  628. private bool fError(object[] objs)
  629. {
  630. if (FsmState == (int)RtState.Transfer)
  631. {
  632. }
  633. return true;
  634. }
  635. #endregion
  636. #region job
  637. private bool FsmStartLoad(object[] param)
  638. {
  639. if (_transferJob.CreateJob(param) != Result.RUN)
  640. {
  641. return false;
  642. }
  643. return true;
  644. }
  645. private bool FsmStartUnload(object[] param)
  646. {
  647. if (_transferJob.CreateJob(param) != Result.RUN)
  648. {
  649. return false;
  650. }
  651. return true;
  652. }
  653. private bool FsmStartLoadProcessStocker(object[] param)
  654. {
  655. var paramDic = (Dictionary<string, object>)param[0];
  656. if (paramDic == null)
  657. {
  658. LoadProcessStockerStartFailedWarning.Set("Parameter not valid");
  659. return false;
  660. }
  661. paramDic["TransferType"] = "Loading";
  662. param[0] = paramDic;
  663. if (_transferJob.CreateJob(param) != Result.RUN)
  664. {
  665. return false;
  666. }
  667. if (_auto.CreateJob(param) != Result.RUN)
  668. {
  669. return false;
  670. }
  671. return true;
  672. }
  673. private bool FsmStartLoadProcessUnload(object[] param)
  674. {
  675. var paramDic = (Dictionary<string, object>)param[0];
  676. if (paramDic == null)
  677. {
  678. LoadProcessUnloadStartFailedWarning.Set("Parameter not valid");
  679. return false;
  680. }
  681. paramDic["TransferType"] = "Loading";
  682. param[0] = paramDic;
  683. if (_transferJob.CreateJob(param) != Result.RUN)
  684. {
  685. return false;
  686. }
  687. if (_auto.CreateJob(param) != Result.RUN)
  688. {
  689. return false;
  690. }
  691. paramDic["TransferType"] = "Unloading";
  692. param[0] = paramDic;
  693. if (_transferJob.CreateJob(param) != Result.RUN)
  694. {
  695. return false;
  696. }
  697. return true;
  698. }
  699. #endregion
  700. #region AutoTransfer
  701. private bool FsmMonitorAutoIdle(object[] param)
  702. {
  703. Result ret = _transferJob.Monitor();
  704. _auto.Monitor();
  705. if (!_auto.CheckAllJobDone() || !_transferJob.CheckAllJobDone())
  706. {
  707. return false;
  708. }
  709. return ret == Result.DONE;
  710. }
  711. private bool FsmStartSetManualMode(object[] objs)
  712. {
  713. if (_auto.HasJobRunning)
  714. {
  715. EV.PostWarningLog("System", "Can not change to manual mode, abort running job first");
  716. return false;
  717. }
  718. return true;
  719. }
  720. private bool fStartAutoTransfer(object[] objs)
  721. {
  722. Result ret = _auto.Start(objs);
  723. return ret == Result.RUN;
  724. }
  725. private bool fAutoTransfer(object[] objs)
  726. {
  727. Result ret = _transferJob.Monitor();
  728. _auto.Monitor();
  729. if (_auto.CheckAllJobDone() && _transferJob.CheckAllJobDone())
  730. {
  731. if (!CheckToPostMessage((int)MSG.JobDone))
  732. return false;
  733. }
  734. return ret == Result.DONE;
  735. }
  736. private bool fExitAutoTransfer(object[] objs)
  737. {
  738. _auto.Clear();
  739. _transferJob.Clear();
  740. return true;
  741. }
  742. private bool fAbortAutoTransfer(object[] objs)
  743. {
  744. _auto.Clear();
  745. _transferJob.Clear();
  746. return true;
  747. }
  748. #endregion
  749. #region return all wafer
  750. private bool FsmAbortReturnAllWafer(object[] param)
  751. {
  752. return true;
  753. }
  754. private bool FsmMonitorReturnAllWafer(object[] param)
  755. {
  756. return _returnAll.Monitor() == Result.DONE;
  757. }
  758. private bool FsmStartReturnAllWafer(object[] param)
  759. {
  760. return _returnAll.Start() == Result.RUN;
  761. }
  762. #endregion
  763. #region Transfer
  764. private bool fStartTransfer(object[] objs)
  765. {
  766. Result ret = _manualTransfer.Start(objs);
  767. if (ret == Result.FAIL || ret == Result.DONE)
  768. return false;
  769. return ret == Result.RUN;
  770. }
  771. private bool fTransfer(object[] objs)
  772. {
  773. Result ret = _manualTransfer.Monitor();
  774. if (ret == Result.FAIL)
  775. {
  776. PostMsg(MSG.ERROR);
  777. return false;
  778. }
  779. return ret == Result.DONE;
  780. }
  781. private bool fExitTransfer(object[] objs)
  782. {
  783. return true;
  784. }
  785. private bool fAbortTransfer(object[] objs)
  786. {
  787. return true;
  788. }
  789. #endregion
  790. #region reset
  791. private bool fStartReset(object[] objs)
  792. {
  793. EV.ClearAlarmEvent();
  794. Singleton<DeviceEntity>.Instance.PostMsg(DeviceEntity.MSG.RESET);
  795. Singleton<FAJobController>.Instance.ClearAlarm();
  796. IoProviderManager.Instance.Reset();
  797. foreach (var modulesValue in Modules.Values)
  798. {
  799. modulesValue.Reset();
  800. }
  801. _triggeredAlarmList.ForEach(x => x.Reset());
  802. _triggeredAlarmList.Clear();
  803. if (FsmState == (int)RtState.Error)
  804. {
  805. if (!_isInited)
  806. {
  807. PostMsg(MSG.ToInit);
  808. return false;
  809. }
  810. return true;
  811. }
  812. return false;
  813. }
  814. #endregion
  815. private bool FsmCreateJob(object[] param)
  816. {
  817. if (FsmState != (int)RtState.AutoRunning && CarrierManager.Instance.CheckHasCarrier(ModuleName.CarrierRobot, 0))
  818. {
  819. EV.PostWarningLog("System", $"FOUP robot already has a FOUP, create job failed");
  820. return false;
  821. }
  822. _auto.CreateJob((Dictionary<string, object>)param[0]);
  823. return true;
  824. }
  825. private bool FsmAbortJob(object[] param)
  826. {
  827. _auto.AbortJob((string)param[0]);
  828. return true;
  829. }
  830. private bool FsmStopJob(object[] param)
  831. {
  832. _auto.StopJob((string)param[0]);
  833. Singleton<FAJobController>.Instance.CJAbort((string)param[0]);
  834. //CheckToPostMessage((int)MSG.StopJob);//
  835. return true;
  836. }
  837. private bool FsmResumeJob(object[] param)
  838. {
  839. _auto.ResumeJob((string)param[0]);
  840. return true;
  841. }
  842. private bool FsmPauseJob(object[] param)
  843. {
  844. _auto.PauseJob((string)param[0]);
  845. return true;
  846. }
  847. private bool FsmStartJob(object[] param)
  848. {
  849. return _auto.StartJob((string)param[0]);
  850. }
  851. private bool FsmCreateTransferJob(object[] param)
  852. {
  853. if (FsmState != (int)RtState.AutoRunning && CarrierManager.Instance.CheckHasCarrier(ModuleName.CarrierRobot, 0))
  854. {
  855. EV.PostWarningLog("System", $"FOUP robot already has a FOUP, create job failed");
  856. return false;
  857. }
  858. _transferJob.CreateJob(param);
  859. return true;
  860. }
  861. private bool FsmAbortTransferJob(object[] param)
  862. {
  863. _transferJob.AbortJob((string)param[0]);
  864. return true;
  865. }
  866. private bool FsmCancelUnloadingJob(object[] param)
  867. {
  868. _transferJob.CancelUnloadingJob((string)param[0], (string)param[1]);
  869. return true;
  870. }
  871. private bool FsmJobAutoStart(object[] param)
  872. {
  873. _auto.PauseJob((string)param[0]);
  874. _auto.Clear();
  875. return true;
  876. }
  877. private bool FsmAbort(object[] param)
  878. {
  879. if (FsmState == (int)RtState.Transfer)
  880. {
  881. // _manualTransfer.Clear();
  882. }
  883. if (FsmState == (int)RtState.ChargeProcessDischarging || FsmState == (int)RtState.LoadProcessStockering || FsmState == (int)RtState.LoadProcessUnloading)
  884. {
  885. _auto.PjUpdated();
  886. _auto.PjFinished("Job Abort");
  887. }
  888. if (FsmState == (int)RtState.AutoRunning)
  889. {
  890. _auto.FACallBack(Gem300Events.CJ_ABORTED);
  891. _auto.Clear();
  892. }
  893. if (FsmState == (int)RtState.Initializing)
  894. {
  895. _homeAll.Abort();
  896. }
  897. return true;
  898. }
  899. private bool FsmModuleError(object[] param)
  900. {
  901. //_auto.ModuleError((string)param[0]);
  902. return true;
  903. }
  904. private bool FsmStartReturnWafer(object[] objs)
  905. {
  906. Result ret = _returnAll.Start();
  907. if (ret == Result.FAIL)
  908. {
  909. PostMsg(MSG.ERROR);
  910. return false;
  911. }
  912. return ret == Result.RUN;
  913. }
  914. private bool FsmMonitorReturnWafer(object[] objs)
  915. {
  916. Result ret = _returnAll.Monitor();
  917. if (ret == Result.FAIL)
  918. {
  919. PostMsg(MSG.ERROR);
  920. return false;
  921. }
  922. if (ret == Result.DONE)
  923. {
  924. _batchType = "";
  925. _processJob = "";
  926. _processRecipe = "";
  927. (Modules[ModuleName.CarrierRobot] as CarrierRobotModule).Home(out _);
  928. (Modules[ModuleName.WaferRobot] as WaferRobotModule).Home(out _);
  929. }
  930. return ret == Result.DONE;
  931. }
  932. private bool InvokeSwitchOffBuzzer(string arg1, object[] args)
  933. {
  934. DEVICE.GetDevice<SignalTowerBase>("System.SignalTower")?.SwitchOffBuzzer(true);
  935. IsAlarmConditionBuzzerOn = false;
  936. return true;
  937. }
  938. private bool InvokeReturnWafer(string arg1, object[] args)
  939. {
  940. ModuleName target = ModuleHelper.Converter(args[0].ToString());
  941. int slot = (int)args[1];
  942. if (ModuleHelper.IsLoadPort(target))
  943. {
  944. EV.PostInfoLog("System", string.Format("Wafer already at LoadPort {0} {1}, return operation is not valid", target.ToString(), slot + 1));
  945. return false;
  946. }
  947. if (!WaferManager.Instance.IsWaferSlotLocationValid(target, slot))
  948. {
  949. EV.PostWarningLog("System", string.Format("Invalid position,{0},{1}", target.ToString(), slot.ToString()));
  950. return false;
  951. }
  952. WaferInfo wafer = WaferManager.Instance.GetWafer(target, slot);
  953. if (wafer.IsEmpty)
  954. {
  955. EV.PostInfoLog("System", string.Format("No wafer at {0} {1}, return operation is not valid", target.ToString(), slot + 1));
  956. return false;
  957. }
  958. return CheckToPostMessage((int)MSG.MoveWafer,
  959. target, slot,
  960. (ModuleName)wafer.OriginStation, wafer.OriginSlot,
  961. false, 0, false, 0);
  962. }
  963. private bool InvokeDeleteAllWafer(string arg1, object[] args)
  964. {
  965. foreach (var item in Modules.Values)
  966. {
  967. if ((item as PMModule) != null || (item as WaferRobotModule) != null)
  968. {
  969. var wafers = WaferManager.Instance.GetWafers(ModuleHelper.Converter(item.Module));
  970. for (int i = 0; i < wafers.Length; i++)
  971. {
  972. if (!wafers[i].IsEmpty)
  973. WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(item.Module), i);
  974. }
  975. }
  976. }
  977. return true;
  978. }
  979. private bool InvokeDeleteAllCarrier(string arg1, object[] args)
  980. {
  981. foreach (var item in Modules.Values)
  982. {
  983. if ((item as LoadPortModule) != null || (item as StockerModule) != null || (item as FIMSModule) != null || (item as CarrierRobotModule) != null)
  984. {
  985. if (CarrierManager.Instance.HasCarrier(item.Module.ToString()))
  986. {
  987. CarrierManager.Instance.DeleteCarrier(item.Module.ToString());
  988. var wafers = WaferManager.Instance.GetWafers(ModuleHelper.Converter(item.Module));
  989. for (int i = 0; i < wafers.Length; i++)
  990. {
  991. if (!wafers[i].IsEmpty)
  992. WaferManager.Instance.DeleteWafer(ModuleHelper.Converter(item.Module), i);
  993. }
  994. }
  995. }
  996. }
  997. return true;
  998. }
  999. private bool InvokeDeleteWaferFromTo(string arg1, object[] args)
  1000. {
  1001. ModuleName chamber = ModuleHelper.Converter(args[0].ToString());
  1002. int slotFrom = (int)args[1];
  1003. int slotTo = (int)args[2];
  1004. for (int slot = slotTo - 1; slot >= slotFrom - 1; slot--)
  1005. {
  1006. if (WaferManager.Instance.IsWaferSlotLocationValid(chamber, slot))
  1007. {
  1008. if (WaferManager.Instance.CheckHasWafer(chamber, slot))
  1009. {
  1010. WaferManager.Instance.DeleteWafer(chamber, slot);
  1011. EV.PostMessage(ModuleName.System.ToString(), EventEnum.WaferDelete, chamber.ToString(), slot + 1);
  1012. }
  1013. else
  1014. {
  1015. EV.PostInfoLog("System", string.Format("No wafer at {0} {1}, delete not valid", chamber.ToString(), slot + 1));
  1016. }
  1017. }
  1018. else
  1019. {
  1020. DeleteWaferFailedWarning.Set(string.Format("Invalid position,{0},{1}", chamber.ToString(), slot.ToString()));
  1021. return false;
  1022. }
  1023. }
  1024. var carrier = CarrierManager.Instance.GetCarrier(chamber);
  1025. if (carrier != null)
  1026. {
  1027. CarrierManager.Instance.UpdateWaferIn(chamber, 0, false);
  1028. }
  1029. var wafers = WaferManager.Instance.GetWafers(chamber);
  1030. if (wafers != null && carrier != null)
  1031. {
  1032. foreach (var wafer in wafers)
  1033. {
  1034. if (wafer != null && !wafer.IsEmpty)
  1035. {
  1036. CarrierManager.Instance.UpdateWaferIn(chamber, 0, true);
  1037. break;
  1038. }
  1039. }
  1040. }
  1041. return true;
  1042. }
  1043. private bool InvokeDeleteWafer(string arg1, object[] args)
  1044. {
  1045. ModuleName chamber = ModuleHelper.Converter(args[0].ToString());
  1046. int slot = (int)args[1];
  1047. if (WaferManager.Instance.IsWaferSlotLocationValid(chamber, slot))
  1048. {
  1049. if (WaferManager.Instance.CheckHasWafer(chamber, slot))
  1050. {
  1051. WaferManager.Instance.DeleteWafer(chamber, slot);
  1052. EV.PostMessage(ModuleName.System.ToString(), EventEnum.WaferDelete, chamber.ToString(), slot + 1);
  1053. }
  1054. else
  1055. {
  1056. EV.PostInfoLog("System", string.Format("No wafer at {0} {1}, delete not valid", chamber.ToString(), slot + 1));
  1057. }
  1058. }
  1059. else
  1060. {
  1061. DeleteWaferFailedWarning.Set(string.Format("Invalid position,{0},{1}", chamber.ToString(), slot.ToString()));
  1062. return false;
  1063. }
  1064. var carrier = CarrierManager.Instance.GetCarrier(chamber);
  1065. if (carrier != null)
  1066. {
  1067. CarrierManager.Instance.UpdateWaferIn(chamber, 0, false);
  1068. }
  1069. var wafers = WaferManager.Instance.GetWafers(chamber);
  1070. if (wafers != null && carrier != null)
  1071. {
  1072. foreach (var wafer in wafers)
  1073. {
  1074. if (wafer != null && !wafer.IsEmpty)
  1075. {
  1076. CarrierManager.Instance.UpdateWaferIn(chamber, 0, true);
  1077. break;
  1078. }
  1079. }
  1080. }
  1081. return true;
  1082. }
  1083. private bool InvokeCreateWaferFromTo(string arg1, object[] args)
  1084. {
  1085. ModuleName chamber = ModuleHelper.Converter(args[0].ToString());
  1086. ModuleName originChamber = chamber;
  1087. int slotFrom = (int)args[1];
  1088. int slotTo = (int)args[2];
  1089. int originSlot = 1;
  1090. WaferStatus state = WaferStatus.Normal;
  1091. WaferType waferTye = WaferType.None;
  1092. var strs = (string[])args[3];
  1093. Enum.TryParse(strs[0].ToString(), out waferTye);
  1094. originChamber = ModuleHelper.Converter(strs[1].ToString());
  1095. originSlot = int.Parse(strs[2]);
  1096. for (int slot = slotTo - 1; slot >= slotFrom - 1; slot--)
  1097. {
  1098. if (WaferManager.Instance.IsWaferSlotLocationValid(chamber, slot))
  1099. {
  1100. if (WaferManager.Instance.CheckHasWafer(chamber, slot))
  1101. {
  1102. EV.PostInfoLog("System", string.Format("{0} slot {1} already has wafer.create wafer is not valid", chamber, slot + 1));
  1103. }
  1104. else
  1105. {
  1106. if (originChamber == chamber && WaferManager.Instance.CreateWafer(chamber, slot, state, waferTye) != null)
  1107. {
  1108. EV.PostMessage(ModuleName.System.ToString(), EventEnum.WaferCreate, chamber.ToString(), slot + 1, state.ToString());
  1109. }
  1110. else if (originChamber != chamber && WaferManager.Instance.CreateWafer(chamber, slot, originChamber, originSlot, state, waferTye) != null)
  1111. {
  1112. EV.PostMessage(ModuleName.System.ToString(), EventEnum.WaferCreate, chamber.ToString(), slot + 1, state.ToString());
  1113. }
  1114. }
  1115. }
  1116. else
  1117. {
  1118. EV.PostWarningLog("System", string.Format("Invalid position,{0},{1}", chamber.ToString(), slot.ToString()));
  1119. return false;
  1120. }
  1121. }
  1122. var carrier = CarrierManager.Instance.GetCarrier(chamber);
  1123. if (carrier != null)
  1124. {
  1125. CarrierManager.Instance.UpdateWaferIn(chamber, 0, true);
  1126. }
  1127. return true;
  1128. }
  1129. private bool InvokeCreateWafer(string arg1, object[] args)
  1130. {
  1131. ModuleName chamber = ModuleHelper.Converter(args[0].ToString());
  1132. ModuleName originChamber = chamber;
  1133. int slot = (int)args[1];
  1134. int originSlot = 1;
  1135. WaferStatus state = WaferStatus.Normal;
  1136. WaferType waferTye = WaferType.None;
  1137. if (args.Length > 2)
  1138. Enum.TryParse(args[2].ToString(), out waferTye);
  1139. if (args.Length > 3)
  1140. originChamber = ModuleHelper.Converter(args[3].ToString());
  1141. if (args.Length > 4)
  1142. originSlot = (int)args[4];
  1143. if (ModuleHelper.IsLoadPort(chamber))
  1144. {
  1145. //var lp = Modules[chamber] as LoadPortModule;
  1146. //if (lp.LPDevice.CassetteState != LoadportCassetteState.Normal)
  1147. //{
  1148. // EV.PostWarningLog("System", $"Can not create wafer at {chamber}.{slot + 1}, Cassette not placed.");
  1149. // return false;
  1150. //}
  1151. }
  1152. if (WaferManager.Instance.IsWaferSlotLocationValid(chamber, slot))
  1153. {
  1154. if (WaferManager.Instance.CheckHasWafer(chamber, slot))
  1155. {
  1156. EV.PostInfoLog("System", string.Format("{0} slot {1} already has wafer.create wafer is not valid", chamber, slot + 1));
  1157. }
  1158. else
  1159. {
  1160. if (originChamber == chamber && WaferManager.Instance.CreateWafer(chamber, slot, state, waferTye) != null)
  1161. {
  1162. EV.PostMessage(ModuleName.System.ToString(), EventEnum.WaferCreate, chamber.ToString(), slot + 1, state.ToString());
  1163. }
  1164. else if (originChamber != chamber && WaferManager.Instance.CreateWafer(chamber, slot, originChamber, originSlot, state, waferTye) != null)
  1165. {
  1166. EV.PostMessage(ModuleName.System.ToString(), EventEnum.WaferCreate, chamber.ToString(), slot + 1, state.ToString());
  1167. }
  1168. }
  1169. }
  1170. else
  1171. {
  1172. EV.PostWarningLog("System", string.Format("Invalid position,{0},{1}", chamber.ToString(), slot.ToString()));
  1173. return false;
  1174. }
  1175. var carrier = CarrierManager.Instance.GetCarrier(chamber);
  1176. if (carrier != null)
  1177. {
  1178. CarrierManager.Instance.UpdateWaferIn(chamber, 0, true);
  1179. }
  1180. return true;
  1181. }
  1182. private bool InvokeUpdateWafer(string arg1, params object[] args)
  1183. {
  1184. if (args == null || args.Length == 0) return false;
  1185. ModuleName chamber = ModuleHelper.Converter(args[0].ToString());
  1186. var carrier = CarrierManager.Instance.GetCarrier(chamber);
  1187. if (carrier == null || carrier.IsEmpty)
  1188. {
  1189. EV.PostInfoLog(Module, $"{chamber} update wafer fail for carrier not exist.");
  1190. return false;
  1191. }
  1192. if (args.Length > 3 && !carrier.CarrierType.ToString().Equals(CarrierType.None.ToString()) && !carrier.CarrierType.ToString().Equals(args[2].ToString()))
  1193. {
  1194. EV.PostInfoLog(Module, $"{chamber} type mismatch!");
  1195. return false;
  1196. }
  1197. int slot = 0;
  1198. if (args.Length > 1)
  1199. {
  1200. int.TryParse(args[1].ToString(), out slot);
  1201. slot = slot - 1;
  1202. }
  1203. WaferType waferTye = WaferType.None;
  1204. if (args.Length > 2)
  1205. {
  1206. Enum.TryParse(args[2].ToString(), out waferTye);
  1207. }
  1208. float useCount = 0, useThick = 0, UseTime = 0;
  1209. if (args.Length > 3)
  1210. {
  1211. float.TryParse(args[3].ToString(), out useCount);
  1212. }
  1213. if (args.Length > 4)
  1214. {
  1215. float.TryParse(args[4].ToString(), out useThick);
  1216. }
  1217. if (args.Length > 5)
  1218. {
  1219. float.TryParse(args[5].ToString(), out UseTime);
  1220. }
  1221. if (WaferManager.Instance.IsWaferSlotLocationValid(chamber, slot))
  1222. {
  1223. if (WaferManager.Instance.CheckHasWafer(chamber, slot))
  1224. {
  1225. WaferManager.Instance.UpdateWaferStatistics(chamber, slot, useCount, useThick, UseTime);
  1226. (Singleton<EquipmentManager>.Instance.Modules[ModuleName.PM1] as PMModule).UpdateSEDWafer(WaferManager.Instance.GetAllWafers());
  1227. }
  1228. }
  1229. if (carrier != null)
  1230. {
  1231. CarrierManager.Instance.UpdateWaferIn(chamber, 0, true);
  1232. }
  1233. return true;
  1234. }
  1235. private bool InvokeCreateCassetteWafer(string arg1, object[] args)
  1236. {
  1237. ModuleName chamber = ModuleHelper.Converter(args[0].ToString());
  1238. var carrier = CarrierManager.Instance.GetCarrier(chamber);
  1239. if (carrier == null || carrier.IsEmpty)
  1240. {
  1241. EV.PostInfoLog(Module, $"{chamber} create wafer fail for carrier not exist.");
  1242. return false;
  1243. }
  1244. if (args.Length > 3 && !carrier.CarrierType.ToString().Equals(CarrierType.None.ToString()) && !carrier.CarrierType.ToString().Equals(args[3].ToString()))
  1245. {
  1246. EV.PostInfoLog(Module, $"{chamber} type mismatch!");
  1247. return false;
  1248. }
  1249. int slotFrom = (int)args[1];
  1250. int slotTo = (int)args[2];
  1251. WaferStatus state = WaferStatus.Normal;
  1252. WaferType waferTye = WaferType.None;
  1253. if (args.Length > 3)
  1254. Enum.TryParse(args[3].ToString(), out waferTye);
  1255. for (int slot = slotTo - 1; slot >= slotFrom - 1; slot--)
  1256. {
  1257. if (WaferManager.Instance.IsWaferSlotLocationValid(chamber, slot))
  1258. {
  1259. if (WaferManager.Instance.CheckHasWafer(chamber, slot))
  1260. {
  1261. EV.PostInfoLog(Module, string.Format("{0} slot {1} already has wafer.", chamber, slot + 1));
  1262. continue;
  1263. }
  1264. else if (WaferManager.Instance.CreateWafer(chamber, slot, state, waferTye) == null)
  1265. {
  1266. CreateWaferFailedWarning.Set(string.Format($"Create slot {slot + 1} wafer failed."));
  1267. return false;
  1268. }
  1269. }
  1270. else
  1271. {
  1272. CreateWaferFailedWarning.Set(string.Format("Invalid slot,{0},{1}", chamber.ToString(), (slot + 1).ToString()));
  1273. return false;
  1274. }
  1275. }
  1276. if (carrier != null)
  1277. {
  1278. CarrierManager.Instance.UpdateWaferIn(chamber, 0, true);
  1279. }
  1280. EV.PostInfoLog(Module, $"Create wafer from {slotFrom} to {slotTo} successed.");
  1281. return true;
  1282. }
  1283. private bool InvokeDeleteCassetteWafer(string arg1, object[] args)
  1284. {
  1285. ModuleName chamber = ModuleHelper.Converter(args[0].ToString());
  1286. int slotFrom = (int)args[1];
  1287. int slotTo = (int)args[2];
  1288. if (WaferManager.Instance.IsWaferSlotLocationValid(chamber, slotFrom - 1) && WaferManager.Instance.IsWaferSlotLocationValid(chamber, slotTo - 1))
  1289. {
  1290. WaferManager.Instance.DeleteWafer(chamber, slotFrom - 1, slotTo - slotFrom + 1);
  1291. }
  1292. else
  1293. {
  1294. DeleteWaferFailedWarning.Set(string.Format($"Invalid slot,{chamber} slot from {slotFrom}, slot to {slotTo}"));
  1295. return false;
  1296. }
  1297. var carrier = CarrierManager.Instance.GetCarrier(chamber);
  1298. if (carrier != null)
  1299. {
  1300. CarrierManager.Instance.UpdateWaferIn(chamber, 0, false);
  1301. }
  1302. var wafers = WaferManager.Instance.GetWafers(chamber);
  1303. if (wafers != null && carrier != null)
  1304. {
  1305. foreach (var wafer in wafers)
  1306. {
  1307. if (wafer != null && !wafer.IsEmpty)
  1308. {
  1309. CarrierManager.Instance.UpdateWaferIn(chamber, 0, true);
  1310. break;
  1311. }
  1312. }
  1313. }
  1314. EV.PostInfoLog(Module, $"Delete wafer from {slotFrom} to {slotTo} successed.");
  1315. return true;
  1316. }
  1317. private CarrierType GetStockerType(string name)
  1318. {
  1319. var result = CarrierType.SD;
  1320. var scName = name.Contains("LP") ? $"{name}Type" : $"{name}WaferType";
  1321. string configType = SC.GetStringValue($"System.Stocker.{scName}");
  1322. if (string.IsNullOrEmpty(configType))
  1323. {
  1324. return result;
  1325. }
  1326. result = configType.StartsWith(CarrierType.P.ToString()) ? CarrierType.P : (CarrierType)Enum.Parse(typeof(CarrierType), configType);
  1327. return result;
  1328. }
  1329. public bool InvokeCreateCarrier(string arg1, object[] args)
  1330. {
  1331. ModuleName chamber = ModuleHelper.Converter(args[0].ToString());
  1332. int slot = (int)args[1];
  1333. CarrierType carrierTye = GetStockerType(chamber.ToString());
  1334. bool isCheckType = true;
  1335. if (args.Length > 2)
  1336. {
  1337. if (args.Length > 3)
  1338. {
  1339. isCheckType = bool.Parse(args[3].ToString());
  1340. }
  1341. var inputType = args[2].ToString();
  1342. if (!carrierTye.ToString().Equals(CarrierType.None.ToString()) && !carrierTye.ToString().Equals(inputType) && isCheckType)
  1343. {
  1344. EV.PostInfoLog(Module, $"{chamber} type mismatch!");
  1345. return false;
  1346. }
  1347. Enum.TryParse(args[2].ToString(), out carrierTye);
  1348. }
  1349. if (CarrierManager.Instance.HasCarrier(args[0].ToString(), slot))
  1350. {
  1351. EV.PostInfoLog("System", $"{chamber} already has carrier.create is not valid");
  1352. }
  1353. else
  1354. {
  1355. CarrierManager.Instance.CreateCarrier(args[0].ToString(), carrierTye, args[0].ToString());
  1356. EV.PostInfoLog("System", $"{chamber} create carrier");
  1357. }
  1358. var wafers = WaferManager.Instance.GetWafers(chamber);
  1359. if (wafers != null)
  1360. {
  1361. foreach (var wafer in wafers)
  1362. {
  1363. if (wafer != null && !wafer.IsEmpty)
  1364. {
  1365. CarrierManager.Instance.UpdateWaferIn(chamber, 0, true);
  1366. break;
  1367. }
  1368. }
  1369. }
  1370. return true;
  1371. }
  1372. private bool InvokeDeleteCarrier(string arg1, object[] args)
  1373. {
  1374. ModuleName chamber = ModuleHelper.Converter(args[0].ToString());
  1375. if (CarrierManager.Instance.HasCarrier(chamber.ToString()))
  1376. {
  1377. CarrierManager.Instance.DeleteCarrier(chamber.ToString());
  1378. EV.PostInfoLog("System", $"Carrier deleted from {chamber}");
  1379. var wafers = WaferManager.Instance.GetWafers(chamber);
  1380. for (int i = 0; i < wafers.Length; i++)
  1381. {
  1382. if (!wafers[i].IsEmpty)
  1383. WaferManager.Instance.DeleteWafer(chamber, i);
  1384. }
  1385. }
  1386. else
  1387. {
  1388. EV.PostInfoLog("System", string.Format("No carrier at {0}, delete not valid", chamber.ToString()));
  1389. }
  1390. return true;
  1391. }
  1392. private bool InvokeSetLotID(string arg1, object[] args)
  1393. {
  1394. ModuleName chamber = ModuleHelper.Converter(args[0].ToString());
  1395. List<string> lotIdLst = new List<string>();
  1396. foreach (var module in Modules.Keys)
  1397. {
  1398. if ((Modules[module] as StockerModule) == null)
  1399. continue;
  1400. if (CarrierManager.Instance.HasCarrier(module.ToString()))
  1401. {
  1402. lotIdLst.Add(CarrierManager.Instance.GetCarrier(module.ToString()).CarrierId);
  1403. }
  1404. }
  1405. if (lotIdLst.Any(x => x == args[1].ToString()))
  1406. {
  1407. SetLotIDFailedWarning.Set($"Carrier ID={args[1]} of {chamber} is already exist");
  1408. return false;
  1409. }
  1410. if (CarrierManager.Instance.HasCarrier(chamber.ToString()))
  1411. {
  1412. CarrierManager.Instance.UpdateCarrierId(chamber.ToString(), args[1].ToString());
  1413. EV.PostInfoLog("System", $"Carrier {chamber} update carrier ID {args[1]}");
  1414. }
  1415. else
  1416. {
  1417. EV.PostInfoLog("System", string.Format("No carrier at {0}, update carrier ID not valid", chamber.ToString()));
  1418. }
  1419. return true;
  1420. }
  1421. private bool InvokeShutDown(string arg1, object[] arg2)
  1422. {
  1423. if (IsAlarm || IsIdle || IsInit)
  1424. {
  1425. EV.PostWarningLog(Module, $"System start shut down");
  1426. EV.PostKickoutMessage("ShutDown");
  1427. RtApplication.Instance.Terminate();
  1428. return true;
  1429. }
  1430. EV.PostWarningLog(Module, $"System in {StringFsmStatus} mode, can not shut down");
  1431. return false;
  1432. }
  1433. private void OnModuleError(string module)
  1434. {
  1435. if (FsmState == (int)RtState.AutoRunning)
  1436. {
  1437. ModuleName mod = ModuleHelper.Converter(module);
  1438. PostMsg(MSG.ModuleError, module);
  1439. }
  1440. }
  1441. public override void Monitor()
  1442. {
  1443. base.Monitor();
  1444. }
  1445. private bool CheckPWaferBatch(ModuleName module, string batch)
  1446. {
  1447. string stockerWaferType = batch == "A" ? "P1" : "P2";
  1448. return SC.GetStringValue($"System.Stocker.{module}WaferType") == stockerWaferType;
  1449. }
  1450. private bool CheckMWaferBatch(ModuleName module, string batch)
  1451. {
  1452. string stockerWaferType = batch == "A" ? "M1" : "M2";
  1453. return SC.GetStringValue($"System.Stocker.{module}WaferType") == stockerWaferType;
  1454. }
  1455. private bool CheckJobPause()
  1456. {
  1457. return _pauseTrig.R;
  1458. }
  1459. private bool CheckToPostJobMessage(int msg, params object[] args)
  1460. {
  1461. _cycledCount = 0;
  1462. //只有LoadProcessUnload和ChargeProcessDischarge有cycle模式
  1463. if (SC.GetValue<bool>("System.IsCycleMode") && (msg == (int)MSG.LoadProcessUnload || msg == (int)MSG.ChargeProcessDischarge))
  1464. {
  1465. lock (_locker)
  1466. {
  1467. _jobMSG = msg;
  1468. _jobParas = args;
  1469. }
  1470. }
  1471. else
  1472. {
  1473. lock (_locker)
  1474. {
  1475. _jobMSG = 0;
  1476. _jobParas = null;
  1477. }
  1478. }
  1479. return CheckToPostMessage(msg, args);
  1480. }
  1481. private bool OnCycleTimer()
  1482. {
  1483. fMonitorFAJob();
  1484. if (!SC.GetValue<bool>("System.IsSimulatorMode"))
  1485. {
  1486. //_plcConnectTrig.CLK = !(IoProviderManager.Instance.Providers[0] as AdsPlcAdapter).IsPlcConnected;
  1487. //if (_plcConnectTrig.R)
  1488. //{
  1489. // PLCDisconnectAlarm.Set();
  1490. //}
  1491. //if (_plcConnectTrig.T)
  1492. //{
  1493. // EV.ClearAlarmEvent(PLCDisconnectAlarm.Id);
  1494. // PLCDisconnectAlarm.Reset();
  1495. // PLCConnectRecoveryWarning.Set();
  1496. //}
  1497. }
  1498. _cassetteRobotModule.Monitor();
  1499. _waferRobotModule.Monitor();
  1500. _lp1Module.Monitor();
  1501. _lp2Module.Monitor();
  1502. _lp3Module.Monitor();
  1503. _lp4Module.Monitor();
  1504. _fims1Module.Monitor();
  1505. _fims2Module.Monitor();
  1506. _boatModule.Monitor();
  1507. foreach (var module in Modules.Keys)
  1508. {
  1509. if (!(Modules[module] is StockerModule))
  1510. continue;
  1511. Modules[module].Monitor();
  1512. }
  1513. return true;
  1514. }
  1515. public List<ProcessJobInfo> GetProcessJobInfo()
  1516. {
  1517. return _auto.LstProcessJobs;
  1518. }
  1519. public List<Tuple<string, string, List<int>>> GetProcessingStockers()
  1520. {
  1521. return _auto.GetProcessingStockers();
  1522. }
  1523. public List<Tuple<string, string, List<int>>> GetAllPJStockers()
  1524. {
  1525. return _auto.GetAllPJStockers();
  1526. }
  1527. public List<CarrierPara> GetTransferJobStockers()
  1528. {
  1529. return _transferJob.GetTransferJobStockers();
  1530. }
  1531. public void ResetTask(ModuleName module)
  1532. {
  1533. _auto.ResetTask(module);
  1534. _transferJob.ResetTask(module);
  1535. (_returnAll as ReturnAllWafer).ResetTask(module);
  1536. }
  1537. private void CoolingSkip()
  1538. {
  1539. _auto.CoolingSkip();
  1540. }
  1541. public void SetVisibility(CarrierInfo carrierInfo, bool setValue, string moduleName = null)
  1542. {
  1543. if (carrierInfo == null)
  1544. {
  1545. return;
  1546. }
  1547. carrierInfo.UIExitFoup = setValue;
  1548. carrierInfo.UICarrierColorVisibility = setValue;
  1549. carrierInfo.UICarrierStatusVisibility = setValue;
  1550. carrierInfo.UICarrierTypeVisibility = setValue;
  1551. carrierInfo.UICarrierWaferCountVisibility = setValue;
  1552. }
  1553. public void SetUIWaferCount(CarrierInfo carrierInfo, ModuleName name, out WaferInfo[] wafers)
  1554. {
  1555. wafers = WaferManager.Instance.GetWafers(name);
  1556. if (carrierInfo == null)
  1557. {
  1558. return;
  1559. }
  1560. var count = wafers == null ? 0 : wafers.Count(a => !a.IsEmpty);
  1561. carrierInfo.UICarrierWaferCount = $"({count})";
  1562. }
  1563. public string GetActivePjStatus()
  1564. {
  1565. return _auto.GetFirstPJStatus();
  1566. }
  1567. public void PjFinished(string endStatus = "Normal")
  1568. {
  1569. _auto.PjFinished(endStatus);
  1570. }
  1571. #region FA
  1572. private bool FsmFAJobCommand(object[] param)
  1573. {
  1574. switch ((string)param[0])
  1575. {
  1576. case "CreateProcessJob":
  1577. _auto.CreateProcessJob(out var pj, (Dictionary<string, object>)param[1]);
  1578. break;
  1579. case "CreateControlJob":
  1580. _auto.CreateControlJob((string)param[1], (List<string>)param[2], out var cj);
  1581. //_auto.StartJob((string)param[1]);
  1582. //CheckToPostMessage((int)MSG.StartJob, (string)param[1]);
  1583. break;
  1584. }
  1585. return true;
  1586. }
  1587. #endregion
  1588. }
  1589. }