VceEntity.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. using Aitex.Core.RT.DataCenter;
  2. using Aitex.Core.RT.Device;
  3. using Aitex.Core.RT.Fsm;
  4. using Aitex.Core.RT.Log;
  5. using Aitex.Core.RT.OperationCenter;
  6. using Aitex.Core.RT.SCCore;
  7. using Aitex.Core.Util;
  8. using Aitex.Core.Utilities;
  9. using MECF.Framework.Common.Equipment;
  10. using MECF.Framework.Common.Schedulers;
  11. using MECF.Framework.Common.SubstrateTrackings;
  12. using MECF.Framework.RT.ModuleLibrary.VceModules;
  13. using System;
  14. using System.Collections.Generic;
  15. using System.Linq;
  16. using System.Reflection;
  17. using System.Text;
  18. using System.Threading.Tasks;
  19. using System.Windows;
  20. using Venus_Core;
  21. using Venus_RT.Devices;
  22. using Venus_RT.Devices.SMIF;
  23. using Venus_RT.Devices.VCE;
  24. using Venus_RT.Modules.PMs;
  25. using Venus_RT.Modules.TM;
  26. using Venus_RT.Modules.TM.VenusEntity;
  27. namespace Venus_RT.Modules.VCE
  28. {
  29. #region 状态和消息
  30. public enum VceMSG
  31. {
  32. Home,
  33. Error,
  34. DoorOpen,
  35. DoorClose,
  36. Map,
  37. ReadMap,
  38. Load,
  39. UnLoad,
  40. LoadPrepare,
  41. LoadWithSMIF,
  42. UnLoadWithSMIF,
  43. Reset,
  44. Goto,
  45. GotoLP,
  46. SafeLoad,
  47. SafeUnload,
  48. Pump,
  49. Vent,
  50. Abort,
  51. None,
  52. ClearError
  53. }
  54. #endregion
  55. public class VceEntity : Entity, IEntity, IModuleEntity
  56. {
  57. private ModuleName _modulename;
  58. private readonly VceModuleBase _vce;
  59. private readonly ISMIF _smif;
  60. private bool _CassetteArrive;
  61. public bool IsIdle => fsm.State == (int)VceSTATE.Idle;
  62. public bool IsInit => fsm.State == (int)VceSTATE.Init || fsm.State == (int)VceSTATE.Unknown;
  63. public bool IsBusy => !IsInit && !IsError && !IsIdle;
  64. public bool IsError => fsm.State == (int)VceSTATE.Error;
  65. public bool VCEOutDoorClosed => !_vce.OutDoorIsOpen;
  66. public bool CassetteArrive => _CassetteArrive;
  67. public int CurrentSlot => currentSlot;
  68. private int currentSlot;
  69. private int targetSlot;
  70. private LoadRoutine _loadRoutine;
  71. private LoadPrepareRoutine _prepareRoutine;
  72. private UnloadRoutine _unloadRoutine;
  73. private LoadWithSMIFRoutine _loadwithSMIFRoutine;
  74. private UnloadWithSMIFRoutine _unloadwithSMIFRoutine;
  75. private readonly SEMFPumpRoutine _pumpRoutine;
  76. private readonly SEMFVentRoutine _ventRoutine;
  77. public VceEntity(ModuleName moduleName)
  78. {
  79. currentSlot = 0;
  80. _modulename = moduleName;
  81. _vce = new HongHuVce(25, _modulename);
  82. _smif = new FortrendPLUS500(_modulename);
  83. _loadRoutine = new LoadRoutine(_modulename, _vce);
  84. _prepareRoutine = new LoadPrepareRoutine(_modulename, _vce);
  85. _unloadRoutine = new UnloadRoutine(_modulename, _vce);
  86. _loadwithSMIFRoutine = new LoadWithSMIFRoutine(_modulename, _vce, _smif);
  87. _unloadwithSMIFRoutine = new UnloadWithSMIFRoutine(_modulename, _vce, _smif);
  88. _pumpRoutine = new SEMFPumpRoutine(DEVICE.GetDevice<HongHuTM>("SETM"), _modulename);
  89. _ventRoutine = new SEMFVentRoutine(DEVICE.GetDevice<HongHuTM>("SETM"), _modulename);
  90. InitFsmMap();
  91. }
  92. protected override bool Init()
  93. {
  94. DATA.Subscribe($"{_modulename}.VCEOutDoorClosed", () => !VCEOutDoorClosed);
  95. DATA.Subscribe($"{_modulename}.CurrentSlot", () => currentSlot);
  96. DATA.Subscribe($"{_modulename}.FsmState", () => ((VceSTATE)fsm.State).ToString());
  97. DATA.Subscribe($"{_modulename}.CassetteArrive", () => CassetteArrive);
  98. //DATA.Subscribe($"{_modulename}.IsRunning", () => IsIdle);
  99. OP.Subscribe($"{_modulename}.HOME", (cmd, args) => { PostMsg(VceMSG.Home); return true; });
  100. OP.Subscribe($"{_modulename}.DoorOpen", (cmd, args) => { PostMsg(VceMSG.DoorOpen); return true; });
  101. OP.Subscribe($"{_modulename}.DoorClose", (cmd, args) => { PostMsg(VceMSG.DoorClose); return true; });
  102. OP.Subscribe($"{_modulename}.Map", (cmd, args) => { PostMsg(VceMSG.Map); return true; });
  103. OP.Subscribe($"{_modulename}.ReadMap", (cmd, args) => { PostMsg(VceMSG.ReadMap); return true; });
  104. OP.Subscribe($"{_modulename}.Load", (cmd, args) => { PostMsg(VceMSG.Load); return true; });
  105. OP.Subscribe($"{_modulename}.UnLoad", (cmd, args) => { PostMsg(VceMSG.UnLoad); return true; });
  106. OP.Subscribe($"{_modulename}.Reset", (cmd, args) => { PostMsg(VceMSG.Reset); return true; });
  107. OP.Subscribe($"{_modulename}.Goto", (cmd, args) => { PostMsg(VceMSG.Goto, args[0]); return true; });
  108. OP.Subscribe($"{_modulename}.GotoLP", (cmd, args) => { PostMsg(VceMSG.GotoLP); return true; });
  109. OP.Subscribe($"{_modulename}.Abort", (cmd, args) => { PostMsg(VceMSG.Abort); return true; });
  110. OP.Subscribe($"{_modulename}.PumpDown", (cmd, args) => { PostMsg(VceMSG.Pump); return true; });
  111. OP.Subscribe($"{_modulename}.Vent", (cmd, args) => { PostMsg(VceMSG.Vent); return true; });
  112. OP.Subscribe($"{_modulename}.ClearError", (cmd, args) => { PostMsg(VceMSG.ClearError); return true; });
  113. OP.Subscribe($"{_modulename}.LoadPrepare", (cmd, args) => { PostMsg(VceMSG.LoadPrepare); return true; });
  114. OP.Subscribe($"{_modulename}.SafeLoad", (cmd, args) => { PostMsg(VceMSG.SafeLoad); return true; });
  115. OP.Subscribe($"{_modulename}.SafeUnload", (cmd, args) => { PostMsg(VceMSG.SafeUnload); return true; });
  116. OP.Subscribe($"{_modulename}.LoadWithSMIF", (cmd, args) => { PostMsg(VceMSG.LoadWithSMIF); return true; });
  117. OP.Subscribe($"{_modulename}.UnLoadWithSMIF", (cmd, args) => { PostMsg(VceMSG.UnLoadWithSMIF); return true; });
  118. return true;
  119. }
  120. /// <summary>
  121. /// 定义状态机的迁移表
  122. /// </summary>
  123. private void InitFsmMap()
  124. {
  125. fsm = new StateMachine<VceEntity>(_modulename.ToString(), (int)VceSTATE.Init, 50);
  126. fsm.EnableRepeatedMsg(true);
  127. AnyStateTransition(VceMSG.Error, fnError, VceSTATE.Error);
  128. //AnyStateTransition(VceMSG.Abort, fnAbort, VceSTATE.Idle);
  129. AnyStateTransition(VceMSG.Home, fnStartHome, VceSTATE.Homing);
  130. AnyStateTransition(VceMSG.DoorOpen, fnStartOpenDoor, VceSTATE.DoorOpenning);
  131. //HOME init->homing idle->homing
  132. Transition(VceSTATE.Init, VceMSG.Home, fnStartHome, VceSTATE.Homing);
  133. Transition(VceSTATE.Idle, VceMSG.Home, fnStartHome, VceSTATE.Homing);
  134. Transition(VceSTATE.Error, VceMSG.Home, fnStartHome, VceSTATE.Homing);
  135. Transition(VceSTATE.Homing, FSM_MSG.TIMER, fnHomeTimeout, VceSTATE.Idle);
  136. //clear Error
  137. Transition(VceSTATE.Error, VceMSG.ClearError, fnStartClearError,VceSTATE.ClearError);
  138. Transition(VceSTATE.ClearError, FSM_MSG.TIMER, fnClearErrorTimeout, VceSTATE.Idle);
  139. //Open Door 开门
  140. Transition(VceSTATE.Idle, VceMSG.DoorOpen, fnStartOpenDoor, VceSTATE.DoorOpenning);
  141. Transition(VceSTATE.DoorOpenning, FSM_MSG.TIMER, fnOpenDoorTimeout, VceSTATE.Idle);
  142. //Close Door 关门
  143. Transition(VceSTATE.Idle, VceMSG.DoorClose, fnStartCloseDoor, VceSTATE.DoorClosing);
  144. Transition(VceSTATE.DoorClosing, FSM_MSG.TIMER, fnCloseDoorTimeout, VceSTATE.Idle);
  145. //Map 扫片
  146. Transition(VceSTATE.Idle, VceMSG.Map, fnStartMapping, VceSTATE.Mapping);
  147. Transition(VceSTATE.Mapping, FSM_MSG.TIMER, fnMappingTimeout, VceSTATE.Idle);
  148. //Load 取cassette
  149. Transition(VceSTATE.Idle, VceMSG.Load, fnStartLoading, VceSTATE.Loading);
  150. Transition(VceSTATE.Loading, FSM_MSG.TIMER, fnLoadingTimeout, VceSTATE.Idle);
  151. //UnLoad 放cassette
  152. Transition(VceSTATE.Idle, VceMSG.UnLoad, fnStartUnLoading, VceSTATE.UnLoading);
  153. Transition(VceSTATE.UnLoading, FSM_MSG.TIMER, fnUnLoadingTimeout, VceSTATE.Idle);
  154. //Goto 指定槽对准窗口
  155. Transition(VceSTATE.Idle, VceMSG.Goto, fnStartGoto, VceSTATE.Goting);
  156. Transition(VceSTATE.Goting, FSM_MSG.TIMER, fnGotingTimeout, VceSTATE.Idle);
  157. //ReadMap
  158. Transition(VceSTATE.Idle, VceMSG.ReadMap, fnStartReadingMap, VceSTATE.ReadingMap);
  159. Transition(VceSTATE.ReadingMap, FSM_MSG.TIMER, fnReadingMapTimeout, VceSTATE.Idle);
  160. //Load Prepare
  161. Transition(VceSTATE.Idle, VceMSG.LoadPrepare, fnStartLoadPrepare, VceSTATE.LoadPreparing);
  162. Transition(VceSTATE.LoadPreparing, FSM_MSG.TIMER, fnLoadingPrepareTimeout, VceSTATE.Idle);
  163. //Safe Load
  164. Transition(VceSTATE.Idle, VceMSG.SafeLoad, fnStartSafeLoad, VceSTATE.SafeLoading);
  165. Transition(VceSTATE.SafeLoading, FSM_MSG.TIMER, fnSafeLoadTimeout, VceSTATE.Idle);
  166. //LoadWithSMIF => LoadPrepare & SMIF Load & Load
  167. Transition(VceSTATE.Idle, VceMSG.LoadWithSMIF, fnStartLoadWithSMIF, VceSTATE.LoadingWithSMIF);
  168. Transition(VceSTATE.LoadingWithSMIF, FSM_MSG.TIMER, fnLoadWithSMIFTimeout, VceSTATE.Idle);
  169. //Safe UnLoad
  170. Transition(VceSTATE.Idle, VceMSG.SafeUnload, fnStartSafeUnLoad, VceSTATE.SafeUnloading);
  171. Transition(VceSTATE.SafeUnloading, FSM_MSG.TIMER, fnSafeUnLoadTimeout, VceSTATE.Idle);
  172. //UnLoad With SMIF => UnLoad with smif
  173. Transition(VceSTATE.Idle, VceMSG.UnLoadWithSMIF, fnStartUnLoadWithSMIF, VceSTATE.UnLoadingWithSMIF);
  174. Transition(VceSTATE.UnLoadingWithSMIF, FSM_MSG.TIMER, fnUnLoadWithSMIFTimeout, VceSTATE.Idle);
  175. //Goto LP
  176. Transition(VceSTATE.Idle, VceMSG.GotoLP, fnStartGotoLP, VceSTATE.GotingLP);
  177. Transition(VceSTATE.GotingLP, FSM_MSG.TIMER, fnGotoLPTimeout, VceSTATE.Idle);
  178. //Pump
  179. Transition(VceSTATE.Idle, VceMSG.Pump, fnStartPump, VceSTATE.Pumping);
  180. Transition(VceSTATE.Pumping, FSM_MSG.TIMER, fnPumpTimeout, VceSTATE.Idle);
  181. Transition(VceSTATE.Pumping, VceMSG.Abort, fnAbortPump, VceSTATE.Idle);
  182. //Vent
  183. Transition(VceSTATE.Idle, VceMSG.Vent, fnStartVent, VceSTATE.Venting);
  184. Transition(VceSTATE.Venting, FSM_MSG.TIMER, fnVentTimeout, VceSTATE.Idle);
  185. Transition(VceSTATE.Venting, VceMSG.Abort, fnAbortVent, VceSTATE.Idle);
  186. EnumLoop<VceSTATE>.ForEach((item) => { fsm.MapState((int)item, item.ToString()); });
  187. EnumLoop<VceMSG>.ForEach((item) => { fsm.MapMessage((int)item, item.ToString()); });
  188. Running = true;
  189. }
  190. private bool fnAbortVent(object[] param)
  191. {
  192. _ventRoutine.Abort();
  193. return true;
  194. }
  195. private bool fnVentTimeout(object[] param)
  196. {
  197. RState ret = _ventRoutine.Monitor();
  198. if (ret == RState.Timeout || ret == RState.Failed)
  199. {
  200. PostMsg(VceMSG.Error);
  201. return false;
  202. }
  203. return ret == RState.End;
  204. }
  205. private bool fnStartVent(object[] param)
  206. {
  207. return _ventRoutine.Start(param) == RState.Running;
  208. }
  209. private bool fnAbortPump(object[] param)
  210. {
  211. _pumpRoutine.Abort();
  212. return true;
  213. }
  214. private bool fnPumpTimeout(object[] param)
  215. {
  216. RState ret = _pumpRoutine.Monitor();
  217. if (ret == RState.Timeout || ret == RState.Failed)
  218. {
  219. PostMsg(VceMSG.Error);
  220. return false;
  221. }
  222. return ret == RState.End;
  223. }
  224. private bool fnStartPump(object[] param)
  225. {
  226. return _pumpRoutine.Start(param) == RState.Running;
  227. }
  228. private bool fnGotoLPTimeout(object[] param)
  229. {
  230. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  231. {
  232. PostMsg(VceMSG.Error);
  233. return false;
  234. }
  235. if (_vce.Status == RState.End)
  236. {
  237. currentSlot = targetSlot;
  238. }
  239. return _vce.Status == RState.End;
  240. }
  241. private bool fnStartGotoLP(object[] param)
  242. {
  243. if (_vce.GotoLP())
  244. {
  245. targetSlot = -1;
  246. return true;
  247. }
  248. else
  249. return false;
  250. }
  251. private bool fnSafeUnLoadTimeout(object[] param)
  252. {
  253. RState ret = _unloadRoutine.Monitor();
  254. if (ret == RState.Timeout || ret == RState.Failed)
  255. {
  256. PostMsg(VceMSG.Error);
  257. return false;
  258. }
  259. if (ret == RState.End)
  260. {
  261. _CassetteArrive = false;
  262. WaferManager.Instance.DeleteWafer(_modulename, 0, 25);
  263. }
  264. return ret == RState.End;
  265. }
  266. private bool fnStartClearError(object[] param)
  267. {
  268. if (_vce.ClearError())
  269. {
  270. return true;
  271. }
  272. else
  273. return false;
  274. }
  275. private bool fnClearErrorTimeout(object[] param)
  276. {
  277. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  278. {
  279. PostMsg(VceMSG.Error);
  280. return false;
  281. }
  282. if (_vce.Status == RState.End)
  283. {
  284. currentSlot = targetSlot;
  285. }
  286. return _vce.Status == RState.End;
  287. }
  288. private bool fnStartSafeUnLoad(object[] param)
  289. {
  290. return _unloadRoutine.Start(param) == RState.Running;
  291. }
  292. private bool fnSafeLoadTimeout(object[] param)
  293. {
  294. RState ret = _loadRoutine.Monitor();
  295. if (ret == RState.Timeout || ret == RState.Failed)
  296. {
  297. PostMsg(VceMSG.Error);
  298. return false;
  299. }
  300. if (ret == RState.End)
  301. {
  302. _CassetteArrive = true;
  303. }
  304. return ret == RState.End;
  305. }
  306. private bool fnStartLoadWithSMIF(object[] param)
  307. {
  308. return _loadwithSMIFRoutine.Start(param) == RState.Running;
  309. }
  310. private bool fnLoadWithSMIFTimeout(object[] param)
  311. {
  312. RState ret = _loadwithSMIFRoutine.Monitor();
  313. if (ret == RState.Timeout || ret == RState.Failed)
  314. {
  315. PostMsg(VceMSG.Error);
  316. return false;
  317. }
  318. if (ret == RState.End)
  319. {
  320. _CassetteArrive = true;
  321. }
  322. return ret == RState.End;
  323. }
  324. private bool fnStartUnLoadWithSMIF(object[] param)
  325. {
  326. return _unloadwithSMIFRoutine.Start(param) == RState.Running;
  327. }
  328. private bool fnUnLoadWithSMIFTimeout(object[] param)
  329. {
  330. RState ret = _unloadwithSMIFRoutine.Monitor();
  331. if (ret == RState.Timeout || ret == RState.Failed)
  332. {
  333. PostMsg(VceMSG.Error);
  334. return false;
  335. }
  336. if (ret == RState.End)
  337. {
  338. _CassetteArrive = false;
  339. WaferManager.Instance.DeleteWafer(_modulename, 0, 25);
  340. }
  341. return ret == RState.End;
  342. }
  343. private bool fnStartSafeLoad(object[] param)
  344. {
  345. return _loadRoutine.Start(param) == RState.Running;
  346. }
  347. private bool fnLoadingPrepareTimeout(object[] param)
  348. {
  349. RState ret = _prepareRoutine.Monitor();
  350. if (ret == RState.Timeout || ret == RState.Failed)
  351. {
  352. PostMsg(VceMSG.Error);
  353. return false;
  354. }
  355. return ret == RState.End;
  356. }
  357. private bool fnStartLoadPrepare(object[] param)
  358. {
  359. return _prepareRoutine.Start(param) == RState.Running;
  360. }
  361. private bool fnReadingMapTimeout(object[] param)
  362. {
  363. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  364. {
  365. PostMsg(VceMSG.Error);
  366. return false;
  367. }
  368. return _vce.Status == RState.End;
  369. }
  370. private bool fnStartReadingMap(object[] param)
  371. {
  372. return _vce.ReadMap();
  373. }
  374. //急停
  375. private bool fnAbort(object[] param)
  376. {
  377. return true;
  378. }
  379. //升降到槽位
  380. private bool fnStartGoto(object[] param)
  381. {
  382. if (_vce.Goto(Convert.ToInt32(param[0])))
  383. {
  384. targetSlot = Convert.ToInt32(param[0]);
  385. return true;
  386. }
  387. else
  388. return false;
  389. }
  390. private bool fnGotingTimeout(object[] param)
  391. {
  392. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  393. {
  394. PostMsg(VceMSG.Error);
  395. return false;
  396. }
  397. if(_vce.Status == RState.End)
  398. currentSlot = targetSlot;
  399. return _vce.Status == RState.End;
  400. }
  401. private bool fnError(object[] param)
  402. {
  403. return true;
  404. }
  405. private bool fnStartHome(object[] param)
  406. {
  407. return _vce.HomeALL();
  408. }
  409. private bool fnHomeTimeout(object[] param)
  410. {
  411. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  412. {
  413. PostMsg(VceMSG.Error);
  414. return false;
  415. }
  416. return _vce.Status == RState.End;
  417. }
  418. private bool fnStartOpenDoor(object[] param)
  419. {
  420. //卡压差
  421. if (Singleton<RouteManager>.Instance.seTM.VCEIsATM &&
  422. Singleton<RouteManager>.Instance.seTM.VCEPressure >= SC.GetValue<int>($"{_modulename}.OutDoorOpenPressure"))
  423. {
  424. //卡状态
  425. if (IsIdle || IsError && _vce.IsDashWaferError)
  426. return _vce.OpenDoor();
  427. else
  428. {
  429. LOG.Write(eEvent.WARN_VCE_COMMON_WARN,_modulename,$"Current Status is {(VceSTATE)fsm.State} && not Dash Wafer Error Cannot Open Door.");
  430. return false;
  431. }
  432. }
  433. else
  434. {
  435. LOG.Write(eEvent.ERR_VCE_COMMON_Failed, _modulename, $"{_modulename} is not ATM or Pressure not arrive {SC.GetValue<int>($"{_modulename}.OutDoorOpenPressure")}");
  436. return false;
  437. }
  438. }
  439. private bool fnOpenDoorTimeout(object[] param)
  440. {
  441. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  442. {
  443. PostMsg(VceMSG.Error);
  444. return false;
  445. }
  446. return _vce.Status == RState.End;
  447. }
  448. private bool fnStartCloseDoor(object[] param)
  449. {
  450. return _vce.CloseDoor();
  451. }
  452. private bool fnCloseDoorTimeout(object[] param)
  453. {
  454. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  455. {
  456. PostMsg(VceMSG.Error);
  457. return false;
  458. }
  459. return _vce.Status == RState.End;
  460. }
  461. private bool fnStartMapping(object[] param)
  462. {
  463. return _vce.Map();
  464. }
  465. private bool fnMappingTimeout(object[] param)
  466. {
  467. if(_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  468. {
  469. PostMsg(VceMSG.Error);
  470. return false;
  471. }
  472. return _vce.Status == RState.End;
  473. }
  474. private bool fnStartLoading(object[] param)
  475. {
  476. return _vce.Load();
  477. }
  478. private bool fnLoadingTimeout(object[] param)
  479. {
  480. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  481. {
  482. PostMsg(VceMSG.Error);
  483. return false;
  484. }
  485. return _vce.Status == RState.End;
  486. }
  487. private bool fnStartUnLoading(object[] param)
  488. {
  489. return _vce.UnLoad();
  490. }
  491. private bool fnUnLoadingTimeout(object[] param)
  492. {
  493. if (_vce.Status == RState.Timeout || _vce.Status == RState.Failed)
  494. {
  495. PostMsg(VceMSG.Error);
  496. return false;
  497. }
  498. return _vce.Status == RState.End;
  499. }
  500. public bool Check(int msg, out string reason, params object[] args)
  501. {
  502. reason = "";
  503. return true;
  504. }
  505. public int Invoke(string function, params object[] args)
  506. {
  507. switch (function)
  508. {
  509. case "Home":
  510. CheckToPostMessage((int)VceMSG.Home);
  511. return (int)VceMSG.Home;
  512. }
  513. return (int)VceMSG.None;
  514. }
  515. public bool CheckToPostMessage(int msg, params object[] args)
  516. {
  517. if (!fsm.FindTransition(fsm.State, msg))
  518. {
  519. LOG.Write(eEvent.WARN_FSM_WARN, _modulename, $"{_modulename} is in {(VceSTATE)fsm.State} state,can not do {(VceMSG)msg}");
  520. return false;
  521. }
  522. Running = true;
  523. fsm.PostMsg(msg, args);
  524. return true;
  525. }
  526. public bool CheckAcked(int msg)
  527. {
  528. return fsm.CheckExecuted(msg);
  529. }
  530. public bool IsPrepareTransferReady(ModuleName module, EnumTransferType transferType, int slot)
  531. {
  532. return false;
  533. }
  534. }
  535. }