RouteManager.cs 68 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using Aitex.Core.RT.Fsm;
  8. using Aitex.Core.Common;
  9. using Aitex.Core.RT.DataCenter;
  10. using Aitex.Core.RT.Event;
  11. using Aitex.Core.RT.OperationCenter;
  12. using Aitex.Core.RT.Routine;
  13. using Aitex.Core.RT.SCCore;
  14. using Aitex.Core.Util;
  15. using MECF.Framework.Common.Jobs;
  16. using MECF.Framework.Common.Equipment;
  17. using MECF.Framework.Common.SubstrateTrackings;
  18. using Venus_Core;
  19. using Venus_RT.Modules.PMs;
  20. using Aitex.Core.RT.Log;
  21. //using Venus_RT.Modules.VCE;
  22. using Venus_RT.Devices.PreAligner;
  23. //using Venus_RT.Modules.TM.VenusEntity;
  24. using SecsGem.Core.Application;
  25. using Aitex.Core.RT.RecipeCenter;
  26. using System.Reflection;
  27. using Venus_RT.Modules.LPs;
  28. using System.Runtime.InteropServices;
  29. using Venus_RT.Devices.EFEM;
  30. using Venus_RT.Modules.Schedulers;
  31. using Venus_Unity;
  32. using Newtonsoft.Json;
  33. using Newtonsoft.Json.Linq;
  34. using System.Xml;
  35. using System.IO;
  36. using Venus_RT.Devices.YASKAWA;
  37. namespace Venus_RT.Modules
  38. {
  39. class RouteManager : Entity, IEntity, IEquipmentCommand
  40. {
  41. public enum MSG
  42. {
  43. MoveWafer,
  44. ReturnWafer,
  45. HomeUnit,
  46. PauseAuto,
  47. ResumeAuto,
  48. Stop,
  49. StartCycle,
  50. StopCycle,
  51. HOME,
  52. RESET,
  53. ABORT,
  54. ERROR,
  55. SetAutoMode,
  56. SetManualMode,
  57. ResetIdleCleanTime,
  58. ResetIdlePurgeTime,
  59. CreateJob,
  60. PauseJob,
  61. ResumeJob,
  62. StartJob,
  63. StopJob,
  64. AbortJob,
  65. JobDone,
  66. CassetteLeave, //For unload light control off afer job done
  67. Map,
  68. ReturnAllWafer,
  69. TMCycle,
  70. SETMCycle,
  71. StopSECycle,
  72. CreateSEJob,
  73. StartSEJob,
  74. AbortSEJob,
  75. SEMoveWafer,
  76. SEReturnWafer,
  77. SEAbort,
  78. StartEAPJob //kepler与Venus共用
  79. }
  80. public PMEntity PMA { get; private set; }
  81. public PMEntity PMB { get; private set; }
  82. public PMEntity PMC { get; private set; }
  83. public PMEntity PMD { get; private set; }
  84. public TMEntity TM { get; private set; }
  85. public LLEntity LLA { get; private set; }
  86. public LLEntity LLB { get; private set; }
  87. public EfemEntity EFEM { get; private set; }
  88. //public VceEntity VCE { get; private set; }
  89. //public VceEntity VCEA { get; private set; }
  90. //public VceEntity VCEB { get; private set; }
  91. //public SETMEntity seTM { get; private set; }
  92. public string Name { get; set; }
  93. public bool IsAutoMode
  94. {
  95. get
  96. {
  97. return fsm.State == (int)RtState.AutoRunning || fsm.State == (int)RtState.AutoIdle;
  98. }
  99. }
  100. public bool IsAutoRunning
  101. {
  102. get
  103. {
  104. return fsm.State == (int)RtState.AutoRunning;
  105. }
  106. }
  107. public bool IsInit
  108. {
  109. get { return fsm.State == (int)RtState.Init; }
  110. }
  111. public bool IsIdle
  112. {
  113. get { return fsm.State == (int)RtState.Idle || fsm.State == (int)RtState.AutoIdle; }
  114. }
  115. public bool IsAlarm
  116. {
  117. get { return fsm.State == (int)RtState.Error; }
  118. }
  119. public bool IsPaused
  120. {
  121. get { return _AutoCycle.CycleState == RState.Paused; }
  122. }
  123. public bool IsEntityError
  124. {
  125. get
  126. {
  127. return (EFEM?.IsError ?? false)
  128. || (PMA?.IsError ?? false)
  129. || (PMB?.IsError ?? false)
  130. || (PMC?.IsError ?? false)
  131. || (PMD?.IsError ?? false);
  132. }
  133. }
  134. public bool IsRunning
  135. {
  136. get
  137. {
  138. return !IsInit && !IsAlarm && !IsIdle;
  139. }
  140. }
  141. public static bool IsATMMode
  142. {
  143. get
  144. {
  145. if (_isATMMode == -1)
  146. {
  147. _isATMMode = SC.GetValue<bool>("System.IsATMMode") ? 1 : 0;
  148. }
  149. return _isATMMode == 1;
  150. }
  151. }
  152. public SequenceLLInOutPath LLInOutPath => _AutoCycle.LLInOutPath;
  153. private TMCycle _TMCycle;
  154. private ICycle _AutoCycle;
  155. private ManualTransfer _manualTransfer;
  156. //private SETMCycle _seTMCycle;
  157. //private SEManualTransfer _setransfer;
  158. //private SEReturnWafer _sereturnWafer;
  159. private bool _isWaitUnload = true;
  160. private static int _isATMMode = -1;
  161. public RouteManager()
  162. {
  163. Name = "System";
  164. if (ModuleHelper.IsInstalled(ModuleName.PMA))
  165. PMA = new PMEntity(ModuleName.PMA);
  166. if (ModuleHelper.IsInstalled(ModuleName.PMB))
  167. PMB = new PMEntity(ModuleName.PMB);
  168. if (ModuleHelper.IsInstalled(ModuleName.PMC))
  169. PMC = new PMEntity(ModuleName.PMC);
  170. if (ModuleHelper.IsInstalled(ModuleName.PMD))
  171. PMD = new PMEntity(ModuleName.PMD);
  172. if (ModuleHelper.IsInstalled(ModuleName.TM))
  173. {
  174. if (RtInstance.ConfigType == ConfigType.Kepler2200 || RtInstance.ConfigType == ConfigType.Kepler2300)
  175. TM = new TMEntity();
  176. //if (RtInstance.ConfigType == ConfigType.VenusDE || RtInstance.ConfigType == ConfigType.VenusSE)
  177. // seTM = new SETMEntity(ModuleName.TM);
  178. }
  179. if (ModuleHelper.IsInstalled(ModuleName.LLA))
  180. LLA = new LLEntity(ModuleName.LLA);
  181. if (ModuleHelper.IsInstalled(ModuleName.LLB))
  182. LLB = new LLEntity(ModuleName.LLB);
  183. if (ModuleHelper.IsInstalled(ModuleName.EFEM))
  184. EFEM = new EfemEntity();
  185. //if (ModuleHelper.IsInstalled(ModuleName.VCE1))
  186. //{
  187. // //临时加 后改为配置项
  188. // VCE = new VceEntity(ModuleName.VCE1);
  189. //}
  190. //if (ModuleHelper.IsInstalled(ModuleName.VCEA))
  191. //{
  192. // //临时加 后改为配置项
  193. // VCEA = new VceEntity(ModuleName.VCEA);
  194. //}
  195. //if (ModuleHelper.IsInstalled(ModuleName.VCEB))
  196. //{
  197. // //临时加 后改为配置项
  198. // VCEB = new VceEntity(ModuleName.VCEB);
  199. //}
  200. fsm = new StateMachine<RouteManager>(Name, (int)RtState.Init, 200);
  201. SubscribeOperation();
  202. SubscribeDataVariable();
  203. }
  204. public bool Check(int msg, out string reason, params object[] args)
  205. {
  206. if (!fsm.FindTransition(fsm.State, msg))
  207. {
  208. reason = String.Format("{0} is in {1} state,can not do {2}", Name, 0, (MSG)msg);
  209. return false;
  210. }
  211. if (msg == (int)MSG.StartCycle)
  212. {
  213. if (!IsAutoMode)
  214. {
  215. reason = String.Format("can not do {0}, isn't auto mode.", msg.ToString());
  216. return false;
  217. }
  218. }
  219. reason = "";
  220. return true;
  221. }
  222. void SubscribeDataVariable()
  223. {
  224. DATA.Subscribe("Rt.Status", () => ((RtState)fsm.State).ToString(), SubscriptionAttribute.FLAG.IgnoreSaveDB);
  225. DATA.Subscribe(ModuleName.System.ToString(), "AlarmEvent", EV.GetAlarmEvent, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  226. DATA.Subscribe("System.IsAutoMode", () => IsAutoMode, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  227. DATA.Subscribe("System.IsIdle", () => IsIdle || IsInit, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  228. DATA.Subscribe("System.IsAlarm", () => IsAlarm || IsEntityError, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  229. DATA.Subscribe("System.IsBusy", () => IsRunning, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  230. DATA.Subscribe("System.IsWaitUnload", () => _isWaitUnload && IsAutoMode, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  231. //DATA.Subscribe("System.IsConnectedWithHost", () => Singleton<SecGemApplication>.Instance., SubscriptionAttribute.FLAG.IgnoreSaveDB);
  232. DATA.Subscribe("System.IsAutoRunning", () => fsm.State == (int)RtState.AutoRunning, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  233. DATA.Subscribe("EquipmentMode", () => IsAutoMode ? 0 : 1, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  234. DATA.Subscribe("EquipmentStatus", () =>
  235. {
  236. //"0 = Uninit
  237. //1 = Idle
  238. //2 = Running
  239. //3 = Error
  240. //4 = Pause
  241. //"
  242. if (IsInit) return 0;
  243. if (IsIdle) return 1;
  244. if (IsAlarm) return 3;
  245. if (IsPaused) return 4;
  246. return 2;
  247. }, SubscriptionAttribute.FLAG.IgnoreSaveDB);
  248. }
  249. void SubscribeOperation()
  250. {
  251. OP.Subscribe("CreateWafer", InvokeCreateWafer);
  252. OP.Subscribe("DeleteWafer", InvokeDeleteWafer);
  253. OP.Subscribe("System.Home", (cmd, args) => CheckToPostMessage((int)MSG.HOME, args));
  254. OP.Subscribe("TMCycle.Start", (cmd, args) => CheckToPostMessage((int)MSG.TMCycle, args));
  255. OP.Subscribe("TMCycle.Abort", (cmd, args) => CheckToPostMessage((int)MSG.StopCycle, args));
  256. OP.Subscribe("System.StopSECycle", (cmd, args) => CheckToPostMessage((int)MSG.StopSECycle, args));
  257. DATA.Subscribe("SYSTEM.FsmState", () => (((RtState)fsm.State).ToString()));
  258. DATA.Subscribe("TMCycle.CycleIndex", () => (_TMCycle?.CycleIndex));
  259. DATA.Subscribe("System.IsConnectedWithHost", () => CheckSecsGemOnline(Singleton<SecGemApplication>.Instance.ControlState));
  260. DATA.Subscribe("System.IsDisconnectWithHost", () => CheckSecsGemOnline(Singleton<SecGemApplication>.Instance.ControlState));
  261. OP.Subscribe("ReturnWafer", InvokeReturnWafer);
  262. OP.Subscribe("System.ReturnAllWafer", (string cmd, object[] args) =>
  263. {
  264. //if (seTM != null && (VCE != null || VCEA != null || VCEB != null))
  265. // return CheckToPostMessage((int)MSG.SEReturnWafer, args);
  266. //else
  267. // return CheckToPostMessage((int)MSG.ReturnAllWafer, args[0], args[1], args[2], args[3]);
  268. return CheckToPostMessage((int)MSG.ReturnAllWafer, args[0], args[1], args[2], args[3]);
  269. });
  270. OP.Subscribe("System.MoveWafer", (string cmd, object[] args) =>
  271. {
  272. if (!Enum.TryParse((string)args[0], out ModuleName source))
  273. {
  274. EV.PostWarningLog(Name, $"Parameter source {(string)args[0]} not valid");
  275. return false;
  276. }
  277. if (!Enum.TryParse((string)args[2], out ModuleName destination))
  278. {
  279. EV.PostWarningLog(Name, $"Parameter destination {(string)args[1]} not valid");
  280. return false;
  281. }
  282. //if (seTM != null && (VCE != null || VCEA != null || VCEB != null))
  283. // return CheckToPostMessage((int)MSG.SEMoveWafer,
  284. // source, (int)args[1],
  285. // destination, (int)args[3],
  286. // args[4], args[5],
  287. // args[6], args[7], (string)args[8]);
  288. //else
  289. // return CheckToPostMessage((int)MSG.MoveWafer,
  290. // source, (int)args[1],
  291. // destination, (int)args[3],
  292. // args[4], args[5],
  293. // args[6], args[7], (string)args[8]);
  294. return CheckToPostMessage((int)MSG.MoveWafer,
  295. source, (int)args[1],
  296. destination, (int)args[3],
  297. args[4], args[5],
  298. args[6], args[7], (string)args[8]);
  299. });
  300. OP.Subscribe("System.HomeAll", (string cmd, object[] args) =>
  301. {
  302. return CheckToPostMessage((int)MSG.HOME);
  303. });
  304. OP.Subscribe("System.Abort", (string cmd, object[] args) =>
  305. {
  306. return CheckToPostMessage((int)MSG.ABORT);
  307. });
  308. OP.Subscribe("System.Reset", (string cmd, object[] args) =>
  309. {
  310. return CheckToPostMessage((int)MSG.RESET);
  311. });
  312. OP.Subscribe("System.SetAutoMode", (string cmd, object[] args) =>
  313. {
  314. return CheckToPostMessage((int)MSG.SetAutoMode);
  315. });
  316. OP.Subscribe("System.SetManualMode", (string cmd, object[] args) =>
  317. {
  318. return CheckToPostMessage((int)MSG.SetManualMode);
  319. });
  320. OP.Subscribe("System.CreateJob", (string cmd, object[] args) =>
  321. {
  322. return CheckToPostMessage((int)MSG.CreateJob, args[0]);
  323. });
  324. OP.Subscribe("System.StartJob", (string cmd, object[] args) =>
  325. {
  326. return CheckToPostMessage((int)MSG.StartJob, args[0]);
  327. });
  328. OP.Subscribe("System.PauseJob", (string cmd, object[] args) =>
  329. {
  330. return CheckToPostMessage((int)MSG.PauseJob, args[0]);
  331. });
  332. OP.Subscribe("System.ResumeJob", (string cmd, object[] args) =>
  333. {
  334. return CheckToPostMessage((int)MSG.ResumeJob, args[0]);
  335. });
  336. OP.Subscribe("System.StopJob", (string cmd, object[] args) =>
  337. {
  338. return CheckToPostMessage((int)MSG.StopJob, args[0]);
  339. });
  340. OP.Subscribe("System.AbortJob", (string cmd, object[] args) =>
  341. {
  342. return CheckToPostMessage((int)MSG.AbortJob, args[0]);
  343. });
  344. OP.Subscribe("SE.AbortJob", (string cmd, object[] args) =>
  345. {
  346. return CheckToPostMessage((int)MSG.AbortSEJob, args[0]);
  347. });
  348. OP.Subscribe("LP1.Map", (string cmd, object[] args) =>
  349. {
  350. if (IsAutoMode)
  351. {
  352. return CheckToPostMessage((int)MSG.Map, ModuleName.LP1.ToString());
  353. }
  354. return EFEM.InvokeMap(ModuleName.LP1.ToString()) != (int)FSM_MSG.NONE;
  355. });
  356. OP.Subscribe("LP2.Map", (string cmd, object[] args) =>
  357. {
  358. if (IsAutoMode)
  359. {
  360. return CheckToPostMessage((int)MSG.Map, ModuleName.LP2.ToString());
  361. }
  362. return EFEM.InvokeMap(ModuleName.LP2.ToString()) != (int)FSM_MSG.NONE;
  363. });
  364. OP.Subscribe(RtOperation.SetConfig.ToString(), (name, args) =>
  365. {
  366. string sc_key = args[0] as string;
  367. if (!string.IsNullOrWhiteSpace(sc_key) && args.Length > 1)
  368. {
  369. SC.SetItemValue(sc_key, args[1]);
  370. }
  371. return true;
  372. });
  373. OP.Subscribe("System.ResetIdleCleanTime", (string cmd, object[] args) =>
  374. {
  375. return CheckToPostMessage((int)MSG.ResetIdleCleanTime, args[0]);
  376. });
  377. OP.Subscribe("System.ResetIdlePurgeTime", (string cmd, object[] args) =>
  378. {
  379. return CheckToPostMessage((int)MSG.ResetIdlePurgeTime, args[0]);
  380. });
  381. OP.Subscribe("System.SetWaferSize", (string cmd, object[] args) =>
  382. {
  383. string module = (string)args[0];
  384. string size = (string)args[1];
  385. switch (size)
  386. {
  387. case "3":
  388. WaferManager.Instance.UpdateWaferSize(ModuleHelper.Converter(module), 0, WaferSize.WS3);
  389. break;
  390. case "4":
  391. WaferManager.Instance.UpdateWaferSize(ModuleHelper.Converter(module), 0, WaferSize.WS4);
  392. break;
  393. case "6":
  394. WaferManager.Instance.UpdateWaferSize(ModuleHelper.Converter(module), 0, WaferSize.WS6);
  395. break;
  396. default:
  397. EV.PostWarningLog("System", $"wafer size {size} not valid");
  398. break;
  399. }
  400. return true;
  401. });
  402. OP.Subscribe("System.CassetteLeave", (string cmd, object[] args) =>
  403. {
  404. return CheckToPostMessage((int)MSG.CassetteLeave);
  405. });
  406. OP.Subscribe("System.IsModuleInstalled", (string cmd, object[] args) =>
  407. {
  408. return ModuleHelper.IsInstalled((ModuleName)args[0]);
  409. });
  410. OP.Subscribe("System.SETMCycle", (cmd, args) => CheckToPostMessage((int)MSG.SETMCycle, args));
  411. OP.Subscribe("System.CreateSEJob", (cmd, args) => CheckToPostMessage((int)MSG.CreateJob, args));
  412. OP.Subscribe("System.StartSEJob", (cmd, args) => CheckToPostMessage((int)MSG.StartJob, args));
  413. OP.Subscribe("System.ReturnAllSEWafer", (cmd, args) => CheckToPostMessage((int)MSG.ReturnAllWafer, args));
  414. OP.Subscribe("System.SEAbort", (cmd, args) => CheckToPostMessage((int)MSG.ABORT, args));
  415. }
  416. public bool CheckToPostMessage(int msg, params object[] args)
  417. {
  418. if (!fsm.FindTransition(fsm.State, msg))
  419. {
  420. LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"System is in {(RtState)fsm.State} state,can not do {(MSG)msg}");
  421. return false;
  422. }
  423. Running = true;
  424. fsm.PostMsg(msg, args);
  425. return true;
  426. }
  427. public bool InvokeAbort(object[] args)
  428. {
  429. return CheckToPostMessage((int)MSG.ABORT, args);
  430. }
  431. private bool InvokeCreateWafer(string arg1, object[] args)
  432. {
  433. ModuleName chamber = ModuleHelper.Converter(args[0].ToString());
  434. int slot = (int)args[1];
  435. WaferStatus state = WaferStatus.Normal;
  436. if (WaferManager.Instance.IsWaferSlotLocationValid(chamber, slot))
  437. {
  438. if (WaferManager.Instance.CheckHasWafer(chamber, slot))
  439. {
  440. LOG.Write(eEvent.EV_ROUTER, "System", string.Format("{0} slot {1} already has wafer.create wafer is not valid", chamber, slot));
  441. }
  442. else if (WaferManager.Instance.CreateWafer(chamber, slot, state) != null)
  443. {
  444. LOG.Write(eEvent.EV_WAFER_CREATE, ModuleName.System, chamber.ToString(), (slot + 1).ToString(), state.ToString());
  445. }
  446. }
  447. else
  448. {
  449. LOG.Write(eEvent.WARN_ROUTER, "System", string.Format("Invalid position,{0},{1}", chamber.ToString(), slot.ToString()));
  450. return false;
  451. }
  452. return true;
  453. }
  454. private bool InvokeDeleteWafer(string arg1, object[] args)
  455. {
  456. ModuleName chamber = ModuleHelper.Converter(args[0].ToString());
  457. int slot = (int)args[1];
  458. if (WaferManager.Instance.IsWaferSlotLocationValid(chamber, slot))
  459. {
  460. if (WaferManager.Instance.CheckHasWafer(chamber, slot))
  461. {
  462. WaferManager.Instance.DeleteWafer(chamber, slot);
  463. EV.PostMessage(ModuleName.System.ToString(), EventEnum.WaferDelete, chamber.ToString(), slot + 1);
  464. }
  465. else
  466. {
  467. LOG.Write(eEvent.EV_ROUTER, "System", string.Format("No wafer at {0} {1}, delete not valid", chamber.ToString(), slot + 1));
  468. }
  469. }
  470. else
  471. {
  472. LOG.Write(eEvent.WARN_ROUTER, "System", string.Format("Invalid position,{0},{1}", chamber.ToString(), slot.ToString()));
  473. return false;
  474. }
  475. return true;
  476. }
  477. private bool InvokeReturnWafer(string arg1, object[] args)
  478. {
  479. ModuleName target = ModuleHelper.Converter(args[0].ToString());
  480. int slot = (int)args[1];
  481. //if (seTM != null && (VCE != null || VCEA != null || VCEB != null))
  482. //{
  483. // if (ModuleHelper.IsVCE(target))
  484. // {
  485. // LOG.Write(eEvent.WARN_ROUTER, "System", string.Format("Wafer already at vce {0} {1}, return operation is not valid", target.ToString(), slot + 1));
  486. // return false;
  487. // }
  488. // WaferInfo wafer = WaferManager.Instance.GetWafer(target, slot);
  489. // if (wafer.IsEmpty)
  490. // {
  491. // LOG.Write(eEvent.WARN_ROUTER, "System", string.Format("No wafer at {0} {1}, return operation is not valid", target.ToString(), slot + 1));
  492. // return false;
  493. // }
  494. // return CheckToPostMessage((int)MSG.SEMoveWafer,
  495. // target, slot,
  496. // (ModuleName)wafer.OriginStation, wafer.OriginSlot,
  497. // false, 0, false, 0, "Blade1");
  498. //}
  499. //else
  500. //{
  501. // if (ModuleHelper.IsLoadPort(target))
  502. // {
  503. // LOG.Write(eEvent.WARN_ROUTER, "System", string.Format("Wafer already at LoadPort {0} {1}, return operation is not valid", target.ToString(), slot + 1));
  504. // return false;
  505. // }
  506. // if (!WaferManager.Instance.IsWaferSlotLocationValid(target, slot))
  507. // {
  508. // LOG.Write(eEvent.WARN_ROUTER, "System", string.Format("Invalid position,{0},{1}", target.ToString(), slot.ToString()));
  509. // return false;
  510. // }
  511. // WaferInfo wafer = WaferManager.Instance.GetWafer(target, slot);
  512. // if (wafer.IsEmpty)
  513. // {
  514. // LOG.Write(eEvent.WARN_ROUTER, "System", string.Format("No wafer at {0} {1}, return operation is not valid", target.ToString(), slot + 1));
  515. // return false;
  516. // }
  517. // return CheckToPostMessage((int)MSG.MoveWafer,
  518. // target, slot,
  519. // (ModuleName)wafer.OriginStation, wafer.OriginSlot,
  520. // false, 0, false, 0, "Blade1");
  521. //}
  522. if (ModuleHelper.IsLoadPort(target))
  523. {
  524. LOG.Write(eEvent.WARN_ROUTER, "System", string.Format("Wafer already at LoadPort {0} {1}, return operation is not valid", target.ToString(), slot + 1));
  525. return false;
  526. }
  527. if (!WaferManager.Instance.IsWaferSlotLocationValid(target, slot))
  528. {
  529. LOG.Write(eEvent.WARN_ROUTER, "System", string.Format("Invalid position,{0},{1}", target.ToString(), slot.ToString()));
  530. return false;
  531. }
  532. WaferInfo wafer = WaferManager.Instance.GetWafer(target, slot);
  533. if (wafer.IsEmpty)
  534. {
  535. LOG.Write(eEvent.WARN_ROUTER, "System", string.Format("No wafer at {0} {1}, return operation is not valid", target.ToString(), slot + 1));
  536. return false;
  537. }
  538. return CheckToPostMessage((int)MSG.MoveWafer,
  539. target, slot,
  540. (ModuleName)wafer.OriginStation, wafer.OriginSlot,
  541. false, 0, false, 0, "Blade1");
  542. }
  543. public PMEntity GetPM(ModuleName mod)
  544. {
  545. if (ModuleHelper.IsInstalled(mod))
  546. {
  547. switch (mod)
  548. {
  549. case ModuleName.PMA:
  550. return PMA;
  551. case ModuleName.PMB:
  552. return PMB;
  553. case ModuleName.PMC:
  554. return PMC;
  555. case ModuleName.PMD:
  556. return PMD;
  557. }
  558. }
  559. return null;
  560. }
  561. public LLEntity GetLL(ModuleName mod)
  562. {
  563. if (ModuleHelper.IsInstalled(mod))
  564. {
  565. switch (mod)
  566. {
  567. case ModuleName.LLA:
  568. return LLA;
  569. case ModuleName.LLB:
  570. return LLB;
  571. }
  572. }
  573. return null;
  574. }
  575. //public VceEntity GetVCE(ModuleName mod)
  576. //{
  577. // if (ModuleHelper.IsInstalled(mod))
  578. // {
  579. // switch (mod)
  580. // {
  581. // case ModuleName.VCE1:
  582. // return VCE;
  583. // case ModuleName.VCEA:
  584. // return VCEA;
  585. // case ModuleName.VCEB:
  586. // return VCEB;
  587. // }
  588. // }
  589. // return null;
  590. //}
  591. public bool IsTMIdle()
  592. {
  593. //if (RtInstance.ConfigType == ConfigType.VenusSE || RtInstance.ConfigType == ConfigType.VenusDE)
  594. // return seTM.IsIdle;
  595. if (RtInstance.ConfigType == ConfigType.Kepler2200 || RtInstance.ConfigType == ConfigType.Kepler2300)
  596. return TM.IsIdle;
  597. return false;
  598. }
  599. public TMEntity GetTM()
  600. {
  601. return TM;
  602. }
  603. protected override bool Init()
  604. {
  605. PMA?.Initialize();
  606. PMB?.Initialize();
  607. PMC?.Initialize();
  608. PMD?.Initialize();
  609. LLA?.Initialize();
  610. LLB?.Initialize();
  611. EFEM?.Initialize();
  612. //VCE?.Initialize();
  613. //VCEA?.Initialize();
  614. //VCEB?.Initialize();
  615. //if (RtInstance.ConfigType == ConfigType.VenusSE || RtInstance.ConfigType == ConfigType.VenusDE)
  616. //{
  617. // seTM?.Initialize();
  618. // _seTMCycle = new SETMCycle(ModuleName.TM);
  619. // _setransfer = new SEManualTransfer();
  620. // _sereturnWafer = new SEReturnWafer(_setransfer);
  621. // _AutoCycle = new VenusDispatcher();
  622. //}
  623. //else
  624. //{
  625. // TM?.Initialize();
  626. // _TMCycle = new TMCycle();
  627. // _manualTransfer = new ManualTransfer();
  628. // _AutoCycle = new SystemDispatcher();
  629. //}
  630. TM?.Initialize();
  631. _TMCycle = new TMCycle();
  632. _manualTransfer = new ManualTransfer();
  633. _AutoCycle = new SystemDispatcher();
  634. BuildTransitionTable();
  635. return true;
  636. }
  637. private void BuildTransitionTable()
  638. {
  639. //Init sequence
  640. Transition(RtState.Init, MSG.HOME, FsmStartHome, RtState.Initializing);
  641. Transition(RtState.Idle, MSG.HOME, FsmStartHome, RtState.Initializing);
  642. Transition(RtState.Error, MSG.HOME, FsmStartHome, RtState.Initializing);
  643. EnterExitTransition<RtState, FSM_MSG>(RtState.AutoRunning, FsmEnterAutoRunning, FSM_MSG.NONE, FsmExitAutoTransfer);
  644. EnterExitTransition<RtState, FSM_MSG>(RtState.Transfer, null, FSM_MSG.NONE, FsmExitTransfer);
  645. EnterExitTransition<RtState, FSM_MSG>(RtState.ReturnWafer, null, FSM_MSG.NONE, FsmExitReturnWafer);
  646. AnyStateTransition(MSG.ERROR, FsmError, RtState.Error);
  647. Transition(RtState.Idle, FSM_MSG.TIMER, FsmMonitor, RtState.Idle);
  648. Transition(RtState.Init, FSM_MSG.TIMER, FsmMonitor, RtState.Init);
  649. Transition(RtState.Initializing, FSM_MSG.TIMER, FsmMonitorHome, RtState.Idle);
  650. Transition(RtState.Initializing, MSG.ERROR, FsmError, RtState.Error);
  651. Transition(RtState.Initializing, MSG.ABORT, FsmAbort, RtState.Init);
  652. // TM Cycle
  653. Transition(RtState.Idle, MSG.TMCycle, FsmStartTMCycle, RtState.TMCycle);
  654. Transition(RtState.TMCycle, FSM_MSG.TIMER, FsmMonitorTMCycle, RtState.Idle);
  655. Transition(RtState.TMCycle, MSG.StopCycle, FsmStopTMCycle, RtState.Idle);
  656. //Auto/manual
  657. Transition(RtState.Idle, MSG.SetAutoMode, FsmStartAutoTransfer, RtState.AutoIdle);
  658. Transition(RtState.AutoRunning, FSM_MSG.TIMER, FsmAutoTransfer, RtState.AutoIdle);
  659. Transition(RtState.AutoRunning, MSG.ABORT, FsmAbortAutoTransfer, RtState.Idle);
  660. //Transition(RtState.AutoRunning, MSG.SetManualMode, FsmStartSetManualMode, RtState.Idle);
  661. Transition(RtState.AutoRunning, MSG.JobDone, FsmJobDone, RtState.AutoIdle);
  662. //Transition(RtState.AutoRunning, MSG.CassetteLeave, fCassetteLeave, RtState.AutoRunning); //For unload light control off afer job done
  663. Transition(RtState.AutoRunning, MSG.CreateJob, FsmCreateJob, RtState.AutoRunning);
  664. Transition(RtState.AutoRunning, MSG.StartJob, FsmStartJob, RtState.AutoRunning);
  665. Transition(RtState.AutoRunning, MSG.PauseJob, FsmPauseJob, RtState.AutoRunning);
  666. Transition(RtState.AutoRunning, MSG.ResumeJob, FsmResumeJob, RtState.AutoRunning);
  667. Transition(RtState.AutoRunning, MSG.StopJob, FsmStopJob, RtState.AutoRunning);
  668. Transition(RtState.AutoRunning, MSG.AbortJob, FsmAbortJob, RtState.AutoRunning);
  669. Transition(RtState.AutoRunning, MSG.MoveWafer, FsmAutoReturnWafer, RtState.AutoRunning);
  670. Transition(RtState.AutoRunning, MSG.Map, FsmMap, RtState.AutoRunning);
  671. Transition(RtState.AutoRunning, MSG.ResetIdleCleanTime, FsmResetIdleCleanTime, RtState.AutoRunning);
  672. Transition(RtState.AutoRunning, MSG.ResetIdlePurgeTime, FsmResetIdlePurgeTime, RtState.AutoRunning);
  673. Transition(RtState.AutoIdle, FSM_MSG.TIMER, FsmMonitorAutoIdle, RtState.AutoIdle);
  674. Transition(RtState.AutoIdle, MSG.SetManualMode, FsmStartSetManualMode, RtState.Idle);
  675. Transition(RtState.AutoIdle, MSG.CreateJob, FsmCreateJob, RtState.AutoIdle);
  676. Transition(RtState.AutoIdle, MSG.StartJob, FsmStartJob, RtState.AutoRunning);
  677. Transition(RtState.AutoIdle, MSG.PauseJob, FsmPauseJob, RtState.AutoIdle);
  678. Transition(RtState.AutoIdle, MSG.ResumeJob, FsmResumeJob, RtState.AutoIdle);
  679. Transition(RtState.AutoIdle, MSG.StopJob, FsmStopJob, RtState.AutoIdle);
  680. Transition(RtState.AutoIdle, MSG.AbortJob, FsmAbortJob, RtState.AutoIdle);
  681. Transition(RtState.AutoIdle, MSG.Map, FsmMap, RtState.AutoIdle);
  682. Transition(RtState.AutoIdle, MSG.StartEAPJob, FsmStartJob, RtState.AutoRunning);
  683. Transition(RtState.AutoRunning, MSG.StartEAPJob, FsmStartJob, RtState.AutoRunning);
  684. //Transfer
  685. Transition(RtState.Idle, MSG.MoveWafer, FsmStartTransfer, RtState.Transfer);
  686. Transition(RtState.Transfer, FSM_MSG.TIMER, FsmMonitorTransfer, RtState.Idle);
  687. Transition(RtState.Transfer, MSG.ABORT, FsmAbort, RtState.Idle);
  688. //Return Wafer
  689. Transition(RtState.Idle, MSG.ReturnAllWafer, FsmStartReturnWafer, RtState.ReturnWafer);
  690. Transition(RtState.ReturnWafer, FSM_MSG.TIMER, FsmMonitorReturnWafer, RtState.Idle);
  691. Transition(RtState.ReturnWafer, MSG.ABORT, FsmAbort, RtState.Idle);
  692. // SETM Cycle
  693. Transition(RtState.Idle, MSG.SETMCycle, FsmStartSETMCycle, RtState.SETMCycle);
  694. Transition(RtState.SETMCycle, FSM_MSG.TIMER, FsmMonitorSETMCycle, RtState.Idle);
  695. Transition(RtState.SETMCycle, MSG.SEAbort, SEAbort, RtState.Idle);
  696. Transition(RtState.SETMCycle, MSG.AbortSEJob, SEAbortJob, RtState.Idle);
  697. // SETM CreateCycle
  698. Transition(RtState.Idle, MSG.CreateSEJob, FsmStartCreateSEJob, RtState.Idle);
  699. // SETM StartCycle
  700. Transition(RtState.Idle, MSG.StartSEJob, FsmStartSEJob, RtState.SERunning);
  701. Transition(RtState.SERunning, FSM_MSG.TIMER, FsmSEJobMonitor, RtState.Idle);
  702. Transition(RtState.SERunning, MSG.SEAbort, SEAbort, RtState.Idle);
  703. Transition(RtState.SERunning, MSG.AbortSEJob, SEAbortJob, RtState.Idle);
  704. Transition(RtState.Idle, MSG.AbortSEJob, SEAbortJob, RtState.Idle);
  705. //// SE Transfer
  706. //Transition(RtState.Idle, MSG.SEMoveWafer, FsmStartSEMoveWafer, RtState.SETransfer);
  707. //Transition(RtState.SETransfer, FSM_MSG.TIMER, FsmMonitorSEMoveWafer, RtState.Idle);
  708. //Transition(RtState.SETransfer, MSG.ABORT, SEAbort, RtState.Idle);
  709. //// SE ReturnWafer
  710. //Transition(RtState.Idle, MSG.SEReturnWafer, FsmStartSEReturnWafer, RtState.SEReturnWafer);
  711. //Transition(RtState.SEReturnWafer, FSM_MSG.TIMER, FsmMonitorSEReturnWafer, RtState.Idle);
  712. //Transition(RtState.SEReturnWafer, MSG.SEAbort, SEAbort, RtState.Idle);
  713. }
  714. private bool FsmMonitor(object[] objs)
  715. {
  716. _debugRoutine();
  717. return true;
  718. }
  719. private bool FsmStartHome(object[] objs)
  720. {
  721. TM?.Invoke("Home");
  722. EFEM?.Invoke("Home");
  723. //seTM?.Invoke("Home");
  724. //VCE?.Invoke("Home");
  725. //VCEA?.Invoke("Home");
  726. //VCEB?.Invoke("Home");
  727. foreach (var mod in ModuleHelper.InstalledModules)
  728. {
  729. if (ModuleHelper.IsPm(mod))
  730. {
  731. if (GetPM(mod).IsInclude)
  732. {
  733. GetPM(mod).Invoke("Home");
  734. }
  735. }
  736. else if (ModuleHelper.IsLoadLock(mod))
  737. {
  738. if (GetLL(mod).IsInclude)
  739. {
  740. GetLL(mod).Invoke("Home");
  741. }
  742. }
  743. }
  744. return true;
  745. }
  746. private bool FsmMonitorHome(object[] objs)
  747. {
  748. ModuleName notReadyModule = ModuleName.System;
  749. foreach (var mod in ModuleHelper.InstalledModules)
  750. {
  751. if ((ModuleHelper.IsPm(mod) && GetPM(mod).IsInclude && !GetPM(mod).IsIdle) ||
  752. (ModuleHelper.IsLoadLock(mod) && GetLL(mod).IsInclude && !GetLL(mod).IsIdle) ||
  753. (ModuleHelper.IsTM(mod) && !IsTMIdle()) ||
  754. //(ModuleHelper.IsVCE(mod) && !GetVCE(mod).IsIdle) ||
  755. (ModuleHelper.IsEFEM(mod) && !EFEM.IsIdle))
  756. {
  757. notReadyModule = mod;
  758. break;
  759. }
  760. }
  761. if (notReadyModule != ModuleName.System)
  762. {
  763. if (fsm.ElapsedTime > 100 * 1000)
  764. {
  765. LOG.Write(eEvent.ERR_ROUTER, ModuleName.System, $"{notReadyModule} home timeout");
  766. PostMsg(MSG.ERROR);
  767. return true;
  768. }
  769. else
  770. return false;
  771. }
  772. return true;
  773. }
  774. private bool FsmEnterAutoRunning(object[] objs)
  775. {
  776. return true;
  777. }
  778. private bool FsmExitAutoTransfer(object[] objs)
  779. {
  780. _AutoCycle.Clear();
  781. //if (RtInstance.ConfigType == ConfigType.VenusDE || RtInstance.ConfigType == ConfigType.VenusSE)
  782. //{
  783. // seTM.PostMsg(SETMEntity.MSG.Home);
  784. //}
  785. return true;
  786. }
  787. private bool FsmExitTransfer(object[] objs)
  788. {
  789. _manualTransfer.Clear();
  790. return true;
  791. }
  792. private bool FsmExitReturnWafer(object[] objs)
  793. {
  794. return true;
  795. }
  796. private bool FsmError(object[] objs)
  797. {
  798. return true;
  799. }
  800. private bool FsmAbort(object[] objs)
  801. {
  802. _manualTransfer?.Clear();
  803. //_setransfer?.Abort();
  804. _AutoCycle.Clear();
  805. return true;
  806. }
  807. private bool FsmStartTMCycle(object[] objs)
  808. {
  809. return _TMCycle.Start(objs) == RState.Running;
  810. }
  811. private bool FsmMonitorTMCycle(object[] objs)
  812. {
  813. RState ret = _TMCycle.Monitor();
  814. if (ret == RState.Failed || ret == RState.Timeout)
  815. {
  816. PostMsg(MSG.ERROR);
  817. return false;
  818. }
  819. return ret == RState.End;
  820. }
  821. private bool FsmStopTMCycle(object[] objs)
  822. {
  823. _TMCycle.Abort();
  824. return true;
  825. }
  826. private bool FsmStartAutoTransfer(object[] objs)
  827. {
  828. return _AutoCycle.Start(objs) == RState.Running;
  829. }
  830. private bool FsmAutoTransfer(object[] objs)
  831. {
  832. if (_AutoCycle.CheckAllJobDone())
  833. {
  834. if (!CheckToPostMessage((int)MSG.JobDone))
  835. return false;
  836. }
  837. RState ret = _AutoCycle.Monitor();
  838. if (_AutoCycle.CheckJobJustDone(out string jobInfo))
  839. {
  840. //EV.PostPopDialogMessage(EventLevel.InformationNoDelay, "Job complete", jobInfo);
  841. LOG.Write(eEvent.EV_ROUTER, ModuleName.System, $"Job complete,{jobInfo}");
  842. }
  843. if (ret == RState.Failed)
  844. {
  845. if (!CheckToPostMessage((int)MSG.ERROR))
  846. return false;
  847. }
  848. //_isWaitUnload = (bool)DATA.Poll("LP1.NotifyJobDone") || (bool)DATA.Poll("LP2.NotifyJobDone");
  849. return ret == RState.End;
  850. }
  851. private bool FsmAbortAutoTransfer(object[] objs)
  852. {
  853. _AutoCycle.Clear();
  854. return true;
  855. }
  856. private bool FsmJobDone(object[] objs)
  857. {
  858. _isWaitUnload = true;
  859. return true;
  860. }
  861. private bool FsmCreateJob(object[] objs)
  862. {
  863. Dictionary<string, object> obj = (Dictionary<string, object>)objs[0];
  864. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), obj["Module"].ToString());
  865. if ((Singleton<TransferModule>.Instance.GetScheduler(moduleName) as SchedulerLoadPort).IsLoaded)
  866. {
  867. return _AutoCycle.CreateJob(obj, out var reason);
  868. }
  869. else
  870. {
  871. LOG.Write(eEvent.WARN_ROUTER, ModuleName.System, $"{obj["Module"]} is unload,can not create job");
  872. return false;
  873. }
  874. }
  875. private bool FsmStartJob(object[] objs)
  876. {
  877. _AutoCycle.StartJob((string)objs[0], out var reason);
  878. return true;
  879. }
  880. private bool FsmPauseJob(object[] objs)
  881. {
  882. _AutoCycle.PauseJob((string)objs[0], out var reason);
  883. return true;
  884. }
  885. private bool FsmResumeJob(object[] objs)
  886. {
  887. _AutoCycle.ResumeJob((string)objs[0], out var reason);
  888. return true;
  889. }
  890. private bool FsmStopJob(object[] objs)
  891. {
  892. _AutoCycle.StopJob((string)objs[0], out var reason);
  893. return true;
  894. }
  895. private bool FsmAbortJob(object[] objs)
  896. {
  897. _AutoCycle.AbortJob((string)objs[0], out var reason);
  898. return true;
  899. }
  900. private bool FsmStartTransfer(object[] objs)
  901. {
  902. return _manualTransfer.Start(objs) == RState.Running;
  903. }
  904. private bool FsmMonitorTransfer(object[] objs)
  905. {
  906. RState ret = _manualTransfer.Monitor();
  907. if (ret == RState.Failed || ret == RState.Timeout)
  908. {
  909. PostMsg(MSG.ERROR);
  910. return false;
  911. }
  912. return ret == RState.End;
  913. }
  914. private bool FsmStartReturnWafer(object[] objs)
  915. {
  916. //return _returnWafer.Start(objs) == RState.Running;
  917. return _AutoCycle.CheckManualReturnWafer() == RState.Running;
  918. }
  919. private bool FsmMonitorReturnWafer(object[] objs)
  920. {
  921. //RState ret = _returnWafer.Monitor();
  922. RState ret = _AutoCycle.ReturnAllWafers();
  923. if (ret == RState.Failed || ret == RState.Timeout)
  924. {
  925. PostMsg(MSG.ERROR);
  926. return false;
  927. }
  928. return ret == RState.End;
  929. }
  930. private bool FsmMap(object[] objs)
  931. {
  932. return true;
  933. }
  934. private bool FsmResetIdleCleanTime(object[] objs)
  935. {
  936. return true;
  937. }
  938. private bool FsmResetIdlePurgeTime(object[] objs)
  939. {
  940. return true;
  941. }
  942. private bool FsmAutoReturnWafer(object[] objs)
  943. {
  944. return _AutoCycle.ManualReturnWafer(objs);
  945. }
  946. private bool FsmMonitorAutoIdle(object[] objs)
  947. {
  948. RState ret = _AutoCycle.Monitor();
  949. //if (_AutoCycle.CheckAllJobDone())
  950. //{
  951. // if (!CheckToPostMessage((int)MSG.JobDone))
  952. // return false;
  953. //}
  954. //_isWaitUnload = (bool)DATA.Poll("LP1.NotifyJobDone") || (bool)DATA.Poll("LP2.NotifyJobDone");
  955. _debugRoutine();
  956. return ret == RState.End;
  957. }
  958. private bool FsmStartSetManualMode(object[] objs)
  959. {
  960. if (_AutoCycle.HasJobRunning)
  961. {
  962. LOG.Write(eEvent.WARN_ROUTER, "System", "Can not change to manual mode, abort running job first");
  963. return false;
  964. }
  965. return true;
  966. }
  967. private void _debugRoutine()
  968. {
  969. int flag = 0;
  970. // Test Home routine
  971. if (flag == 1)
  972. {
  973. PostMsg(MSG.HOME);
  974. }
  975. else if (flag == 2)
  976. {
  977. PostMsg(MSG.TMCycle);
  978. }
  979. else if (flag == 3)
  980. {
  981. PostMsg(MSG.SetAutoMode);
  982. }
  983. else if (flag == 4)
  984. {
  985. PostMsg(MSG.ReturnAllWafer);
  986. }
  987. else if (flag == 5)
  988. {
  989. PostMsg(MSG.StartJob, "CJ_Local_LP1");
  990. }
  991. }
  992. private bool FsmStartSETMCycle(object[] objs)
  993. {
  994. //return _seTMCycle.Start(objs) == RState.Running;
  995. return _AutoCycle.Start(objs) == RState.Running;
  996. }
  997. private bool FsmMonitorSETMCycle(object[] objs)
  998. {
  999. RState ret = _AutoCycle.Monitor();
  1000. if (ret == RState.Failed || ret == RState.Timeout)
  1001. {
  1002. PostMsg(MSG.ERROR);
  1003. return false;
  1004. }
  1005. return ret == RState.End;
  1006. }
  1007. private bool FsmStopSETMCycle(object[] objs)
  1008. {
  1009. _AutoCycle.Abort();
  1010. return true;
  1011. }
  1012. private bool FsmStartCreateSEJob(object[] objs)
  1013. {
  1014. _AutoCycle.CreateJob((Dictionary<string, object>)objs[0], out string reason);
  1015. return true;
  1016. }
  1017. private bool FsmStartSEJob(object[] objs)
  1018. {
  1019. //return _seTMCycle.StartJob(objs[0].ToString()) == RState.Running;
  1020. return _AutoCycle.StartJob(objs[0].ToString(), out string reason);
  1021. }
  1022. private bool FsmSEJobMonitor(object[] objs)
  1023. {
  1024. RState ret = _AutoCycle.Monitor();
  1025. return ret == RState.End;
  1026. }
  1027. //private bool FsmStartSEMoveWafer(object[] objs)
  1028. //{
  1029. // return _setransfer.Start(objs) == RState.Running;
  1030. //}
  1031. //private bool FsmMonitorSEMoveWafer(object[] objs)
  1032. //{
  1033. // RState ret = _setransfer.Monitor();
  1034. // if (ret == RState.Failed || ret == RState.Timeout)
  1035. // {
  1036. // PostMsg(MSG.ERROR);
  1037. // return false;
  1038. // }
  1039. // return ret == RState.End;
  1040. //}
  1041. //private bool FsmStartSEReturnWafer(object[] objs)
  1042. //{
  1043. // return _sereturnWafer.Start(objs) == RState.Running;
  1044. //}
  1045. //private bool FsmMonitorSEReturnWafer(object[] objs)
  1046. //{
  1047. // RState ret = _sereturnWafer.Monitor();
  1048. // if (ret == RState.Failed || ret == RState.Timeout)
  1049. // {
  1050. // PostMsg(MSG.ERROR);
  1051. // return false;
  1052. // }
  1053. // return ret == RState.End;
  1054. //}
  1055. private bool SEAbortJob(object[] objs)
  1056. {
  1057. _AutoCycle.AbortJob((string)objs[0], out var reason);
  1058. return true;
  1059. }
  1060. private bool SEAbort(object[] objs)
  1061. {
  1062. //_seTMCycle.Abort();
  1063. //_setransfer.Abort();
  1064. //_sereturnWafer.Abort();
  1065. //seTM.CheckToPostMessage((int)SETMEntity.MSG.Abort);
  1066. return true;
  1067. }
  1068. #region Fa接口
  1069. /// <summary>
  1070. /// 接口指令
  1071. /// </summary>
  1072. /// <param name="command"></param>
  1073. /// <param name="paras"></param>
  1074. /// <param name="reason"></param>
  1075. /// <returns></returns>
  1076. public bool ExcuteCommand(string command, object[] paras, out string reason)
  1077. {
  1078. reason = "";
  1079. switch (command.ToUpper())
  1080. {
  1081. case "PP-SELECT":
  1082. if (RtInstance.ConfigType == ConfigType.Kepler2200)
  1083. {
  1084. return FaKepler2200CreateJob(paras, out reason);
  1085. }
  1086. else
  1087. {
  1088. return FaCreateJob(paras, out reason);
  1089. }
  1090. case "STARTJOB":
  1091. //return FaStartJob(paras[0].ToString(), out reason);
  1092. return CheckToPostMessage((int)MSG.StartEAPJob, paras);
  1093. case "STOPJOB":
  1094. return FaStopJob(paras[0].ToString(), out reason);
  1095. case "ABORTJOB":
  1096. return FaAbortob(paras[0].ToString(), out reason);
  1097. case "PAUSEJOB":
  1098. return FaPauseJob(paras[0].ToString(), out reason);
  1099. case "RESUMEJOB":
  1100. return FaResumeJob(paras[0].ToString(), out reason);
  1101. case "MAPCASSETTE":
  1102. return FaMapCassete(paras[0].ToString(), out reason);
  1103. case "LOAD":
  1104. return FaLoad(paras[0].ToString(), out reason);
  1105. case "UNLOAD":
  1106. return FaUnLoad(paras[0].ToString(), out reason);
  1107. case "READID":
  1108. return FaReadId(paras[0].ToString(), out reason);
  1109. case "WRITEID":
  1110. return FaWriteId(paras[0].ToString(), paras[1].ToString(), out reason);
  1111. }
  1112. return true;
  1113. }
  1114. /// <summary>
  1115. /// Fa创建任务
  1116. /// </summary>
  1117. /// <param name="paras"></param>
  1118. /// <param name="reason"></param>
  1119. /// <returns></returns>
  1120. private bool FaCreateJob(object[] paras, out string reason)
  1121. {
  1122. if (!CheckAuto())
  1123. {
  1124. reason = "System is not in Auto,cannot create job";
  1125. return false;
  1126. }
  1127. else
  1128. {
  1129. Dictionary<string, object> createParams = new Dictionary<string, object>();
  1130. createParams["Module"] = $"LP{paras[0]}";
  1131. createParams["JobId"] = paras[1].ToString();
  1132. createParams["LotId"] = paras[2].ToString();
  1133. object[] tmpArys=(object[])paras[3];
  1134. string[] strAry = new string[tmpArys.Length];
  1135. for (int i = 0; i < tmpArys.Length; i++)
  1136. {
  1137. strAry[i] = tmpArys[i].ToString();
  1138. }
  1139. createParams["SlotSequence"] = strAry;
  1140. createParams["AutoStart"] = true;
  1141. if (paras.Length >= 5)
  1142. {
  1143. createParams["PreCleanRecipeName"] = paras[4].ToString();
  1144. }
  1145. if (paras.Length >= 6)
  1146. {
  1147. createParams["PostCleabRecipeName"] = paras[5].ToString();
  1148. }
  1149. return _AutoCycle.CreateJob(createParams, out reason);
  1150. }
  1151. }
  1152. /// <summary>
  1153. /// Fa创建任务
  1154. /// </summary>
  1155. /// <param name="paras"></param>
  1156. /// <param name="reason"></param>
  1157. /// <returns></returns>
  1158. private bool FaKepler2200CreateJob(object[] paras, out string reason)
  1159. {
  1160. if (!CheckAuto())
  1161. {
  1162. reason = "System is not in Auto,cannot create job";
  1163. return false;
  1164. }
  1165. else
  1166. {
  1167. Dictionary<string, object> createParams = new Dictionary<string, object>();
  1168. createParams["Module"] = $"LP{paras[0]}";
  1169. createParams["JobId"] = paras[1].ToString();
  1170. createParams["LotId"] = paras[2].ToString();
  1171. object[] tmpArys = (object[])paras[3];
  1172. string[] strAry = new string[tmpArys.Length];
  1173. if (SC.GetValue<int>("System.Job.PPSelectFoupMode") == 0)
  1174. {
  1175. for (int i = 0; i < tmpArys.Length; i++)
  1176. {
  1177. strAry[i] = tmpArys[tmpArys.Length - 1 - i].ToString();
  1178. }
  1179. }
  1180. else
  1181. {
  1182. for (int i = 0; i < tmpArys.Length; i++)
  1183. {
  1184. strAry[i] = tmpArys[i].ToString();
  1185. }
  1186. }
  1187. string[] stringWaferIds = new string[tmpArys.Length];
  1188. //string lotType = "";
  1189. if (paras.Length >= 5)
  1190. {
  1191. object[] waferIdArys = (object[])paras[4];
  1192. if (RtInstance.ConfigType == ConfigType.Kepler2200 && SC.GetValue<int>("System.Job.PPSelectFoupMode") == 0)
  1193. {
  1194. for (int i = 0; i < waferIdArys.Length; i++)
  1195. {
  1196. stringWaferIds[i] = waferIdArys[waferIdArys.Length - 1 - i].ToString();
  1197. }
  1198. }
  1199. else
  1200. {
  1201. for (int i = 0; i < waferIdArys.Length; i++)
  1202. {
  1203. stringWaferIds[i] = waferIdArys[i].ToString();
  1204. }
  1205. }
  1206. }
  1207. if (paras.Length >= 6)
  1208. {
  1209. createParams["LotType"] = paras[5].ToString();
  1210. }
  1211. createParams["SlotSequence"] = strAry;
  1212. createParams["WaferId"] = stringWaferIds;
  1213. createParams["AutoStart"] = true;
  1214. return _AutoCycle.CreateJob(createParams, out reason);
  1215. }
  1216. }
  1217. /// <summary>
  1218. /// Fa启动任务
  1219. /// </summary>
  1220. /// <param name="jobName"></param>
  1221. /// <param name="reason"></param>
  1222. /// <returns></returns>
  1223. private bool FaStartJob(string jobName, out string reason)
  1224. {
  1225. return _AutoCycle.StartJob(jobName, out reason);
  1226. }
  1227. /// <summary>
  1228. /// Fa停止任务
  1229. /// </summary>
  1230. /// <param name="jobName"></param>
  1231. /// <param name="reason"></param>
  1232. /// <returns></returns>
  1233. private bool FaStopJob(string jobName, out string reason)
  1234. {
  1235. return _AutoCycle.StopJob(jobName, out reason);
  1236. }
  1237. /// <summary>
  1238. /// Fa中止任务
  1239. /// </summary>
  1240. /// <param name="jobName"></param>
  1241. /// <param name="reason"></param>
  1242. /// <returns></returns>
  1243. private bool FaAbortob(string jobName, out string reason)
  1244. {
  1245. return _AutoCycle.AbortJob(jobName, out reason);
  1246. }
  1247. /// <summary>
  1248. /// Fa暂停任务
  1249. /// </summary>
  1250. /// <param name="jobName"></param>
  1251. /// <param name="reason"></param>
  1252. /// <returns></returns>
  1253. private bool FaPauseJob(string jobName, out string reason)
  1254. {
  1255. return _AutoCycle.PauseJob(jobName, out reason);
  1256. }
  1257. /// <summary>
  1258. /// Fa恢复任务
  1259. /// </summary>
  1260. /// <param name="jobName"></param>
  1261. /// <param name="reason"></param>
  1262. /// <returns></returns>
  1263. private bool FaResumeJob(string jobName, out string reason)
  1264. {
  1265. return _AutoCycle.ResumeJob(jobName, out reason);
  1266. }
  1267. /// <summary>
  1268. /// Fa Load
  1269. /// </summary>
  1270. /// <param name="lp"></param>
  1271. /// <returns></returns>
  1272. private bool FaLoad(string lp, out string reason)
  1273. {
  1274. reason = "";
  1275. //if (RtInstance.ConfigType == ConfigType.VenusSE || RtInstance.ConfigType == ConfigType.VenusDE)
  1276. //{
  1277. // VceEntity vce = GetVceEntity(lp, out reason);
  1278. // return vce.CheckToPostMessage((int)VceMSG.SafeLoad);
  1279. //}
  1280. //else
  1281. //{
  1282. // Loadport loadport = FaGetLoadPort(lp, out reason);
  1283. // if (loadport != null)
  1284. // {
  1285. // loadport.Load();
  1286. // return true;
  1287. // }
  1288. // else
  1289. // {
  1290. // return false;
  1291. // }
  1292. //}
  1293. Loadport loadport = FaGetLoadPort(lp, out reason);
  1294. if (loadport != null)
  1295. {
  1296. loadport.Load();
  1297. return true;
  1298. }
  1299. else
  1300. {
  1301. return false;
  1302. }
  1303. }
  1304. /// <summary>
  1305. /// 获取VCE实体
  1306. /// </summary>
  1307. /// <param name="lp"></param>
  1308. /// <param name="reason"></param>
  1309. /// <returns></returns>
  1310. //private VceEntity GetVceEntity(string lp, out string reason)
  1311. //{
  1312. // reason = "";
  1313. // if (int.TryParse(lp, out var lpValue))
  1314. // {
  1315. // if (lpValue == 1)
  1316. // {
  1317. // return VCEA;
  1318. // }
  1319. // else
  1320. // {
  1321. // return VCEB;
  1322. // }
  1323. // }
  1324. // else
  1325. // {
  1326. // reason = $"{lp} is invalid data";
  1327. // return null;
  1328. // }
  1329. //}
  1330. /// <summary>
  1331. /// 获取LoadPort对象
  1332. /// </summary>
  1333. /// <param name="lp"></param>
  1334. /// <param name="reason"></param>
  1335. /// <returns></returns>
  1336. private Loadport FaGetLoadPort(string lp, out string reason)
  1337. {
  1338. reason = "";
  1339. if (int.TryParse(lp, out var lpValue))
  1340. {
  1341. LoadPortModule loadPortModule = EFEM.GetLoadportModule(lpValue);
  1342. if (loadPortModule != null)
  1343. {
  1344. if (loadPortModule.LPDevice.HasCassette)
  1345. {
  1346. return loadPortModule.LPDevice;
  1347. }
  1348. else
  1349. {
  1350. reason = $"LP{lpValue} not found carrier, can not load";
  1351. return null;
  1352. }
  1353. }
  1354. else
  1355. {
  1356. reason = $"LP{lp} is null";
  1357. return null;
  1358. }
  1359. }
  1360. else
  1361. {
  1362. reason = $"{lp} is invalid data";
  1363. return null;
  1364. }
  1365. }
  1366. /// <summary>
  1367. /// 读取Id
  1368. /// </summary>
  1369. /// <param name="lp"></param>
  1370. /// <returns></returns>
  1371. private bool FaMapCassete(string lp, out string reason)
  1372. {
  1373. reason = "";
  1374. //if (RtInstance.ConfigType == ConfigType.VenusSE || RtInstance.ConfigType == ConfigType.VenusDE)
  1375. //{
  1376. // VceEntity vce = GetVceEntity(lp, out reason);
  1377. // return vce.CheckToPostMessage((int)VceMSG.Map);
  1378. //}
  1379. //else
  1380. //{
  1381. // Loadport loadport = FaGetLoadPort(lp, out reason);
  1382. // if (loadport != null)
  1383. // {
  1384. // loadport.Map();
  1385. // return true;
  1386. // }
  1387. // else
  1388. // {
  1389. // return false;
  1390. // }
  1391. //}
  1392. Loadport loadport = FaGetLoadPort(lp, out reason);
  1393. if (loadport != null)
  1394. {
  1395. loadport.Map();
  1396. return true;
  1397. }
  1398. else
  1399. {
  1400. return false;
  1401. }
  1402. }
  1403. /// <summary>
  1404. /// 读取Id
  1405. /// </summary>
  1406. /// <param name="lp"></param>
  1407. /// <returns></returns>
  1408. private bool FaReadId(string lp, out string reason)
  1409. {
  1410. reason = "";
  1411. if (RtInstance.ConfigType == ConfigType.VenusSE || RtInstance.ConfigType == ConfigType.VenusDE)
  1412. {
  1413. reason = "VCE device not support readId Command";
  1414. return false;
  1415. }
  1416. else
  1417. {
  1418. Loadport loadport = FaGetLoadPort(lp, out reason);
  1419. if (loadport != null)
  1420. {
  1421. loadport.ReadCarrierID();
  1422. return true;
  1423. }
  1424. else
  1425. {
  1426. return false;
  1427. }
  1428. }
  1429. }
  1430. /// <summary>
  1431. /// 读取Id
  1432. /// </summary>
  1433. /// <param name="lp"></param>
  1434. /// <returns></returns>
  1435. private bool FaWriteId(string lp, string carrierId, out string reason)
  1436. {
  1437. reason = "";
  1438. if (RtInstance.ConfigType == ConfigType.VenusSE || RtInstance.ConfigType == ConfigType.VenusDE)
  1439. {
  1440. reason = "VCE device not support readId Command";
  1441. return false;
  1442. }
  1443. else
  1444. {
  1445. Loadport loadport = FaGetLoadPort(lp, out reason);
  1446. if (loadport != null)
  1447. {
  1448. loadport.WriteCarrierID(carrierId);
  1449. return true;
  1450. }
  1451. else
  1452. {
  1453. return false;
  1454. }
  1455. }
  1456. }
  1457. /// <summary>
  1458. /// Fa Unload
  1459. /// </summary>
  1460. /// <param name="lp"></param>
  1461. /// <returns></returns>
  1462. private bool FaUnLoad(string lp, out string reason)
  1463. {
  1464. reason = "";
  1465. Loadport loadport = FaGetLoadPort(lp, out reason);
  1466. if (loadport!=null && !loadport.IsLoaded)
  1467. {
  1468. var dvid = new SerializableDictionary<string, string>
  1469. {
  1470. ["CarrierID"] = loadport.CarrierId ?? "",
  1471. ["PortID"] = loadport.PortId.ToString()
  1472. };
  1473. EV.Notify("CARRIER_UNLOADED", dvid);
  1474. }
  1475. //if (RtInstance.ConfigType == ConfigType.VenusSE || RtInstance.ConfigType == ConfigType.VenusDE)
  1476. //{
  1477. // VceEntity vce = GetVceEntity(lp, out reason);
  1478. // return vce.CheckToPostMessage((int)VceMSG.SafeUnload);
  1479. //}
  1480. //else
  1481. //{
  1482. // if (loadport != null)
  1483. // {
  1484. // loadport.Unload();
  1485. // return true;
  1486. // }
  1487. // else
  1488. // {
  1489. // return false;
  1490. // }
  1491. //}
  1492. if (loadport != null)
  1493. {
  1494. loadport.Unload();
  1495. return true;
  1496. }
  1497. else
  1498. {
  1499. return false;
  1500. }
  1501. }
  1502. /// <summary>
  1503. /// 获取所有Sequence
  1504. /// </summary>
  1505. /// <returns></returns>
  1506. public string[] GetSequenceList()
  1507. {
  1508. return RecipeFileManager.Instance.GetSequenceNameList().ToArray();
  1509. }
  1510. public string GetSequenceBody(string ppid)
  1511. {
  1512. return RecipeFileManager.Instance.GetSequence(ppid, false);
  1513. }
  1514. public List<string> GetFormatedSequence(string ppid)
  1515. {
  1516. List<string> result = new List<string>();
  1517. string reason = string.Empty;
  1518. try
  1519. {
  1520. string content = "";
  1521. if (ppid.StartsWith("PMA") || ppid.StartsWith("PMB") || ppid.StartsWith("PMC") || ppid.StartsWith("PMD"))
  1522. {
  1523. string[] info = ppid.Split('\\');
  1524. if (info.Length > 1)
  1525. {
  1526. var item = RecipeFileManager.Instance.LoadEAPRecipe(info[0], info[1], false);
  1527. JObject jObject = JObject.Parse(item);
  1528. XmlDocument xmlDocument = new XmlDocument();
  1529. xmlDocument.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\" ?><Root></Root>");
  1530. XmlNode root = xmlDocument.SelectSingleNode("Root");
  1531. AddJObjectToXmlNode(jObject, root);
  1532. content = xmlDocument.InnerXml;
  1533. //File.WriteAllText("Test.xml", content,Encoding.UTF8);
  1534. }
  1535. }
  1536. else
  1537. {
  1538. content = RecipeFileManager.Instance.GetSequence(ppid, false);
  1539. }
  1540. result.Add(content);
  1541. }
  1542. catch (Exception ex)
  1543. {
  1544. reason = ex.Message;
  1545. }
  1546. return result;
  1547. }
  1548. private void AddJObjectToXmlNode(JObject jObject, XmlNode parent)
  1549. {
  1550. foreach (var property in jObject.Properties())
  1551. {
  1552. var name = property.Name;
  1553. var value = property.Value;
  1554. if (value is JArray)
  1555. {
  1556. foreach (var item in (JArray)value)
  1557. {
  1558. if (item is JObject)
  1559. {
  1560. var objectElement = parent.OwnerDocument.CreateElement(name);
  1561. parent.AppendChild(objectElement);
  1562. AddJObjectToXmlNode((JObject)item, objectElement);
  1563. }
  1564. else
  1565. {
  1566. var textElement = parent.OwnerDocument.CreateElement(name);
  1567. textElement.InnerText = item.ToString();
  1568. parent.AppendChild(textElement);
  1569. }
  1570. }
  1571. }
  1572. else if (value is JObject)
  1573. {
  1574. var objectElement = parent.OwnerDocument.CreateElement(name);
  1575. parent.AppendChild(objectElement);
  1576. AddJObjectToXmlNode((JObject)value, objectElement);
  1577. }
  1578. else
  1579. {
  1580. var textElement = parent.OwnerDocument.CreateElement(name);
  1581. textElement.InnerText = value.ToString();
  1582. parent.AppendChild(textElement);
  1583. }
  1584. }
  1585. }
  1586. public bool deleteSequence(string ppid)
  1587. {
  1588. return false;
  1589. //return RecipeFileManager.Instance.DeleteSequence(ppid);
  1590. }
  1591. public bool UpdateSequence(string ppid, string body)
  1592. {
  1593. return false;
  1594. //return RecipeFileManager.Instance.SaveSequence(ppid, body, false);
  1595. }
  1596. public void ShowTerminalMessage(string message)
  1597. {
  1598. }
  1599. public bool CreateProcessJob(string processJobId, string sequenceName, string carrierId, out string reason)
  1600. {
  1601. reason = "";
  1602. return true;
  1603. }
  1604. public void UpdateProcessJobCarrierSlot(string processJobId, string moduleName, List<int> slots)
  1605. {
  1606. }
  1607. public void CreateControlJob(string controlJobId, string carrierId, List<string> processJobs)
  1608. {
  1609. }
  1610. public bool CheckCreateControlJobCondition(List<string> modules, out string reason)
  1611. {
  1612. reason = "";
  1613. return true;
  1614. }
  1615. public bool StartControlJob(string controlJob)
  1616. {
  1617. return true;
  1618. }
  1619. public bool StopControlJob(string controlJob)
  1620. {
  1621. return true;
  1622. }
  1623. public bool AbortControlJob(string controlJob)
  1624. {
  1625. return true;
  1626. }
  1627. public bool PauseControlJob(string controlJob)
  1628. {
  1629. return true;
  1630. }
  1631. public bool ResumeControlJob(string controlJob)
  1632. {
  1633. return true;
  1634. }
  1635. public bool CheckAuto()
  1636. {
  1637. return fsm.State == (int)RtState.AutoIdle || fsm.State == (int)RtState.AutoRunning;
  1638. }
  1639. public void UpdateControlJobModule(string controlJobId, string moduleName)
  1640. {
  1641. }
  1642. /// <summary>
  1643. /// 告警日志
  1644. /// </summary>
  1645. /// <param name="message"></param>
  1646. public void WriteWarningLog(string message)
  1647. {
  1648. LOG.Write(eEvent.WARN_FA, ModuleName.System, message);
  1649. }
  1650. /// <summary>
  1651. /// 错误日志
  1652. /// </summary>
  1653. /// <param name="message"></param>
  1654. public void WriteErrorLog(string message)
  1655. {
  1656. LOG.Write(eEvent.ERR_FA, ModuleName.System, message);
  1657. }
  1658. /// <summary>
  1659. /// 正常日志
  1660. /// </summary>
  1661. /// <param name="message"></param>
  1662. public void WriteInfoLog(string message)
  1663. {
  1664. LOG.Write(eEvent.INFO_FA, ModuleName.System, message);
  1665. }
  1666. /// <summary>
  1667. /// 检验Secsgem在线情况
  1668. /// </summary>
  1669. /// <param name="controlState"></param>
  1670. /// <returns></returns>
  1671. private bool CheckSecsGemOnline(SecsGem.Core.EnumData.ControlState controlState)
  1672. {
  1673. if (controlState == SecsGem.Core.EnumData.ControlState.OnlineLocal || controlState == SecsGem.Core.EnumData.ControlState.OnlineRemote)
  1674. {
  1675. return true;
  1676. }
  1677. return false;
  1678. }
  1679. #endregion
  1680. }
  1681. }