EquipmentManager.cs 68 KB

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