HongHuVce.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. using Aitex.Core.Common;
  2. using Aitex.Core.RT.Log;
  3. using Aitex.Core.RT.SCCore;
  4. using Aitex.Core.Util;
  5. using MECF.Framework.Common.Communications;
  6. using MECF.Framework.Common.Equipment;
  7. using MECF.Framework.Common.SubstrateTrackings;
  8. using MECF.Framework.RT.ModuleLibrary.VceModules;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.IO.Ports;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Text.RegularExpressions;
  15. using System.Threading.Tasks;
  16. using Venus_Core;
  17. namespace Venus_RT.Devices.VCE
  18. {
  19. //定义Vce动作
  20. public enum VceCommand
  21. {
  22. Home,
  23. DoorClose,
  24. DoorOpen,
  25. CheckGoto,
  26. Goto,
  27. GotoLP,
  28. Load,
  29. UnLoad,
  30. Map,
  31. ReadMap,
  32. ClearError,
  33. }
  34. public enum VceMessageHead
  35. {
  36. Action,
  37. Read,
  38. Set,
  39. Petrify
  40. }
  41. public sealed class VceMessage
  42. {
  43. private Dictionary<VceCommand, string> _Command2Msg = new Dictionary<VceCommand, string>()
  44. {
  45. //Action
  46. {VceCommand.Home, "HM" },
  47. {VceCommand.Load, "LOAD" },
  48. {VceCommand.UnLoad, "UNLOAD"},
  49. {VceCommand.Map, "MP" },
  50. {VceCommand.CheckGoto, "GC" },
  51. {VceCommand.Goto, "GO" },
  52. {VceCommand.GotoLP, "LP" },
  53. {VceCommand.DoorOpen, "DO" },
  54. {VceCommand.DoorClose, "DC" },
  55. //Read
  56. {VceCommand.ReadMap, "MI" },
  57. //Set
  58. {VceCommand.ClearError, "ER" },
  59. };
  60. private Dictionary<VceMessageHead, string> _Type2Head = new Dictionary<VceMessageHead, string>()
  61. {
  62. {VceMessageHead.Action, "A"},
  63. {VceMessageHead.Read, "R"},
  64. {VceMessageHead.Set, "S"},
  65. {VceMessageHead.Petrify, "P"},
  66. };
  67. public VceMessageHead Head { get; set; }
  68. public VceCommand Command { get; set; }
  69. public string Param { get; set; }
  70. public string toString()
  71. {
  72. if (string.IsNullOrEmpty(Param))//含尾参
  73. return $"00,{_Type2Head[Head]},{_Command2Msg[Command]}";
  74. else//不含尾参 目前只允许一个
  75. return $"00,{_Type2Head[Head]},{_Command2Msg[Command]},{Param}";
  76. }
  77. }
  78. /// <summary>
  79. /// 泓浒Vce驱动 下发指令等
  80. /// </summary>
  81. public class HongHuVce : VceModuleBase
  82. {
  83. #region 私有变量
  84. private AsyncSerialPort _serialport;
  85. private string _portname;
  86. private string _newline = "\r";//终止符 0D
  87. private object _locker = new object();
  88. private bool _IsAsciiMode;
  89. private LinkedList<string> _lstAsciiMsgs = new LinkedList<string>();
  90. private PeriodicJob _thread;
  91. private Regex _match_ReadMsg = new Regex(@"\d\d,X,.*");
  92. private Regex _matchErrorCode = new Regex(@"(?<=_BKGERR )(.*)");
  93. private ModuleName _moduleName;
  94. private RState _status;
  95. private string _currentMsg;
  96. private VceMessage _currentVceMessage;
  97. private bool _HasReceiveMsg;
  98. //待补充
  99. private Dictionary<string, string> _ErrorCode2Reason = new Dictionary<string, string>()
  100. {
  101. {"A1","Action Timeout" },
  102. {"A3","Hardware (CAN or VCN) or configuration failed" },
  103. {"A4","Open Door Prevented Motion" },
  104. {"A5","Platform Action Time-out" },
  105. {"A6","Door Action Timeout" },
  106. {"A7","由于动作连锁导致的异常" },
  107. {"A8","Wafer Slideout" },
  108. {"A9","Door safety LED is blocked" },
  109. {"A11","No cassette present" },
  110. {"A12","Cassette present prior PICK" },
  111. {"A13","Cassette NOT present during PICK" },
  112. {"A14","Cassette NOT present prior PLACE" },
  113. {"A15","Cassette present after PLACE" },
  114. {"A16","Cassette Present on VCE platform (Servo Arm)" },
  115. {"A17","No new cassette at station after Load" },
  116. {"A18","Proximity sensor blocked but Cassette A not present" },
  117. {"A19","Cassette present at station A (Fixed Buffer)" },
  118. {"A20","Proximity sensor A is blocked (Fixed Buffer)" },
  119. {"A21","Cassette NOT at station A" },
  120. {"A34","Door Clamped sensor is not ON after clamp (only VCE4!)" },
  121. {"A36","Door Not Covered (sensor)" },
  122. {"C0","Illegal Slot Number" },
  123. {"C1","设备收到非法的操作指令" },
  124. {"C2","Illegal pitch value (too big)" },
  125. {"C3","Illegal Cassette type offset" },
  126. {"C4","Illegal number of Slots" },
  127. {"C5","Illegal Partial step size" },
  128. {"C7","Illegal Find Bias" },
  129. {"C8","Unknown Configuration" },
  130. {"C9","Bad command: command cannot be executed with current HW configuration" },
  131. {"C10","VCE is busy" },
  132. {"C12","Bad Fixture Thickness" },
  133. {"C13","Command is NOT executable (file's operation exception)" },
  134. {"C19","VCEConfig.xml is corrupted" },
  135. {"C20","VCEDefaultSettting.xml is corrupted" },
  136. {"CAN1","CAN Error,Replace the board (MCC2B or MCC-GEN5 or MCC-GEN5 EN)" },
  137. {"CAN2","CAN Abort,Replace the board (MCC2B or MCC-GEN5 or MCC-GEN5 EN)" },
  138. {"CAN3","CAN Timeout,Replace the board (MCC2B or MCC-GEN5 or MCC-GEN5 EN)" },
  139. {"H1","Two hand safety switch are not OFF before R-axis motion" },
  140. {"H2","Two hands safety switch timeout" },
  141. {"H3","One or both safety switches are release before R-axis motion is complete" },
  142. {"M0","VCE is NOT Referenced" },
  143. {"M1","Motion Timeout" },
  144. {"M4","Door over speed" },
  145. {"M10","Motion was Aborted" },
  146. {"M11","FET over Temperature" },
  147. {"M12","FET over Current" },
  148. {"M13","Torque Limit" },
  149. {"M14","Hard Track Error Codes" },
  150. {"M16","Hardware (servo) Motion Error Codes" },
  151. {"M17","Safety Motion Button was Pushed" },
  152. {"M20","Z-brake request before ENABLE_Z_MOVE" },
  153. {"M21","CPLD Detected a difference from the Dual Up Sensors" },
  154. {"M22","Door Closed Error" },
  155. {"M23","Z-brake chip U8 has an output fault" },
  156. {"M24","Unsafe to move: See a safety node (ENABLE_Z_MOVE) or servo following error" },
  157. {"M25","Servo Following Error" },
  158. {"NO_ACT","No actions" },
  159. {"P2","Map NOT Available" },
  160. {"P3","SPS Excessive Offset" },
  161. {"P4","SPS Excessive Thickness" },
  162. {"P12","FB is too large to map" },
  163. {"P13","FB is too small to map" },
  164. {"R1","R-axis is not referenced" },
  165. {"R2","Extended position is NOT defined" },
  166. {"R3","Door NOT Opened" },
  167. {"R4","Wrong Z-axis position: platform must be between UP and DOWN position" },
  168. {"R5","R-axis Limit is exceeded" },
  169. {"R6","R-axis is NOT Homed (it is not IN)" },
  170. {"R7","R-axis Orientation is NOT set" },
  171. {"R9","R-axis is NOT Extended" },
  172. {"S0","Cannot configure Main VCN" },
  173. {"S1","Cannot configure R-axis VCN" },
  174. {"S4","Command String Error: Bad command or parameter, invalid value, etc." },
  175. {"S5","Illegal data entry" },
  176. {"S10","VCEDefaultSetting.XML file is corrupted. Configuration stop" },
  177. {"S11","Not valid for current configuration" },
  178. {"S20","MiscOutput is already in use" },
  179. {"S21","MiscOutput is used by current configuration" },
  180. {"S22","MiscOutput was deleted: it is used by current configuration" },
  181. {"T5","VCN timeout" },
  182. {"U1","USB not found or ‘Upgrade’ directory doesn’t exist" },
  183. {"U2","Script file couldn't be opened" },
  184. {"U3","Script file not found" },
  185. {"U4","File from the list is not found" },
  186. {"U5","Couldn’t create ‘Upgrade’ directory" },
  187. {"U6","Couldn’t copy files" },
  188. {"U10"," upgrade.txt file is missing" },
  189. {"V2","Cannot disable VCN" },
  190. {"230","Robot Extended" },
  191. {"231","Front buffer extended" },
  192. {"232","Valve drive fault" },
  193. {"236","Door Safety LED is broken" },
  194. {"250","FET Q10 is open circuit" },
  195. {"251","FET Q10 is shorted" },
  196. {"260","Atmospheric Robot is Extended" },
  197. {"261","ERGO Obstructs the Door" },
  198. {"262","Door drive fault" },
  199. {"263","Vacuum Robot is Extended" },
  200. {"264","User Misc Output Drive Fault" },
  201. {"265","Safety Hub Output Fault" },
  202. {"306","Illegal command ID number" },
  203. {"309","Command ID is not supported in thatCOMM FLOW" },
  204. {"390","Invalid Checksum" },
  205. {"414","Command ID in use" },
  206. {"673","GEN5 EN: inputs are in ERROR state" },
  207. {"674","GEN5 EN: inputs are in HALT state" },
  208. {"675","GEN5 EN: inputs are in illegal transition" },
  209. {"L13","由于检测到突片,动作被禁止" },
  210. {"L14","检测到安全开关错误" },
  211. {"K114","防夹光栅报警" },
  212. {"K115","舱门上限报警" },
  213. {"K116","舱门下限报警 " },
  214. {"K118","位置未被引用" },
  215. {"K119","Z 轴报警" },
  216. {"K120","R 轴报警 " },
  217. {"K123","Z 轴未使能" },
  218. {"K124","R 轴未使能" },
  219. };
  220. //
  221. #endregion
  222. #region 暴露变量
  223. public override bool IsConnected => _serialport.IsOpen();
  224. public override RState Status => _status;
  225. public override bool IsReady => _status == RState.Init || _status == RState.End;
  226. public override bool IsError => _status == RState.Failed || _status == RState.Timeout;
  227. public override bool IsInit => _status == RState.Init;
  228. private string[] _slotMap = new string[25];
  229. public string SlotMap
  230. {
  231. get
  232. {
  233. WaferInfo[] wafers = WaferManager.Instance.GetWafers(ModuleHelper.Converter(Name));
  234. string slot = "";
  235. for (int i = 0; i < 25; i++)
  236. {
  237. slot += wafers[i].IsEmpty ? "0" : "1";
  238. }
  239. return slot;
  240. }
  241. }
  242. private bool _OutDoorIsOpen = false;
  243. public override bool OutDoorIsOpen => _OutDoorIsOpen;
  244. #endregion
  245. //传入slot数量
  246. public HongHuVce(int slot, ModuleName moduleName) : base(slot, moduleName)
  247. {
  248. _moduleName = moduleName;
  249. _IsAsciiMode = true;
  250. _portname = SC.GetStringValue($"{moduleName}.Port");
  251. //_portname = "COM162";
  252. _serialport = new AsyncSerialPort(_portname, 9600, 8, Parity.None, StopBits.One, _newline, _IsAsciiMode);
  253. _serialport.Open();
  254. _status = RState.Init;
  255. _serialport.OnDataChanged += onDataChange;
  256. _thread = new PeriodicJob(50, fnTimer, "VCE", true);
  257. CarrierManager.Instance.DeleteCarrier(_moduleName.ToString());
  258. WaferManager.Instance.DeleteWafer(_moduleName, 0, 25);
  259. CarrierManager.Instance.SubscribeLocation(_moduleName.ToString(), 1);
  260. Action<ModuleName, int> _subscribeLoc = (ModuleName module, int waferCount) => {
  261. if (ModuleHelper.IsInstalled(module))
  262. {
  263. WaferManager.Instance.SubscribeLocation(module, waferCount);
  264. }
  265. };
  266. _subscribeLoc(_moduleName, slot);
  267. }
  268. /// <summary>
  269. /// 对处理过的数据list进行处理
  270. /// 将每条数据进行解析
  271. /// </summary>
  272. /// <returns></returns>
  273. private bool fnTimer()
  274. {
  275. lock (_locker)
  276. {
  277. //采用ascii传输
  278. if (_IsAsciiMode)
  279. {
  280. //有数据尚未处理
  281. while (_lstAsciiMsgs.Count > 0)
  282. {
  283. string _needHandle = _lstAsciiMsgs.First.Value;
  284. HandleSingleMsg(_needHandle);
  285. _lstAsciiMsgs.RemoveFirst();
  286. }
  287. }
  288. //采用binary
  289. else
  290. {
  291. }
  292. }
  293. return true;
  294. }
  295. /// <summary>
  296. /// 处理单条信息的函数
  297. /// 1、判断结束 2、判断错误
  298. /// </summary>
  299. /// <param name="msg">需要处理的单条回复</param>
  300. private void HandleSingleMsg(string msg)
  301. {
  302. //
  303. msg = msg.Trim();
  304. if (!string.IsNullOrEmpty(msg))
  305. {
  306. //action set petrify _BKGRDY结束
  307. switch (_currentVceMessage.Head)
  308. {
  309. case VceMessageHead.Action:
  310. case VceMessageHead.Set:
  311. case VceMessageHead.Petrify:
  312. switch (msg)
  313. {
  314. //设备收到 开始运行 目前状态在下发
  315. case "_RDY":
  316. LOG.Write(eEvent.EV_VCE_COMMON_INFO, _moduleName, $"vce start {_currentVceMessage.Head}");
  317. break;
  318. //设备执行完毕
  319. case "_BKGRDY":
  320. if (_currentVceMessage.Command == VceCommand.DoorOpen)
  321. {
  322. _OutDoorIsOpen = true;
  323. }
  324. if (_currentVceMessage.Command == VceCommand.DoorClose)
  325. {
  326. _OutDoorIsOpen = false;
  327. }
  328. LOG.Write(eEvent.EV_VCE_COMMON_INFO, _moduleName, $"vce {_currentVceMessage.Head} over");
  329. _status = RState.End;
  330. break;
  331. //异常处理
  332. default:
  333. _status = RState.Failed;
  334. string reason;
  335. Errorhandle(msg, out reason);
  336. LOG.Write(eEvent.ERR_VCE_COMMON_Failed, _moduleName, reason);
  337. break;
  338. }
  339. break;
  340. case VceMessageHead.Read:
  341. //如果收到的信息符合
  342. if (_match_ReadMsg.IsMatch(msg))
  343. {
  344. //收到消息 用于结束
  345. _HasReceiveMsg = true;
  346. switch (_currentVceMessage.Command)
  347. {
  348. //处理wafer 信息为map数据
  349. case VceCommand.ReadMap:
  350. ReadMapData(msg);
  351. break;
  352. }
  353. }
  354. //_RDY查询结束
  355. else
  356. {
  357. if (msg == "_RDY")
  358. {
  359. if (_HasReceiveMsg)
  360. {
  361. _status = RState.End;
  362. }
  363. else
  364. {
  365. LOG.Write(eEvent.ERR_VCE_COMMON_Failed, _moduleName, $"Read Message is over but not receive msg! raw message:{_currentMsg}");
  366. _status = RState.Failed;
  367. }
  368. }
  369. else
  370. {
  371. _status = RState.Failed;
  372. LOG.Write(eEvent.ERR_VCE_COMMON_Failed, _moduleName, $"Read Message is invalid: receive message {msg} and send message {_currentMsg}");
  373. }
  374. }
  375. break;
  376. }
  377. }
  378. }
  379. private void ReadMapData(string msg)
  380. {
  381. string waferinfo = "";
  382. string[] waferitems = msg.Split(',');
  383. //智能模式 可以识别叠片
  384. for (int i = 3; i < waferitems.Length - 1; ++i)
  385. {
  386. //如果包含只需要逐个检查
  387. if (waferitems[i].Contains('?'))
  388. {
  389. foreach (char j in waferitems[i])
  390. {
  391. if (j == '?')
  392. break;
  393. else
  394. waferinfo += j;
  395. }
  396. }
  397. else
  398. waferinfo += waferitems[i];
  399. }
  400. for (int i = 0; i < waferinfo.Length; ++i)
  401. {
  402. int slotnum = i;
  403. if (slotnum < 25)
  404. {
  405. switch (waferinfo[i])
  406. {
  407. case '0':
  408. WaferManager.Instance.CreateWafer(_moduleName, slotnum, WaferStatus.Empty);
  409. break;
  410. case 'X':
  411. WaferManager.Instance.CreateWafer(_moduleName, slotnum, WaferStatus.Normal);
  412. break;
  413. case 'C':
  414. WaferManager.Instance.CreateWafer(_moduleName, slotnum, WaferStatus.Crossed);
  415. break;
  416. }
  417. }
  418. }
  419. //2进制模式
  420. //for (int i = 3; i < waferitems.Length - 1; i++)
  421. //{
  422. // //从16进制字符转义回二进制
  423. // string wafersingleinfo = Convert.ToString(Convert.ToInt32(waferitems[i], 16), 2);
  424. // if (wafersingleinfo.Length < 4)
  425. // wafersingleinfo = wafersingleinfo.PadLeft(4, '0');//补位
  426. // waferinfo = wafersingleinfo + waferinfo;//添加到数据中
  427. //}
  428. ////请将数据按照反向槽位进行解析存入到wafermanager中
  429. //for (int i = waferinfo.Length - 1; i > 0; i--)
  430. //{
  431. // int slotnum = waferinfo.Length - i - 1;
  432. // if (slotnum < 25)
  433. // {
  434. // if (waferinfo[i] == '1')
  435. // {
  436. // WaferManager.Instance.CreateWafer(_moduleName, slotnum, WaferStatus.Normal);
  437. // }
  438. // else
  439. // {
  440. // WaferManager.Instance.CreateWafer(_moduleName, slotnum, WaferStatus.Empty);
  441. // }
  442. // }
  443. //}
  444. }
  445. private void Errorhandle(string msg,out string reason)
  446. {
  447. if (_matchErrorCode.IsMatch(msg))
  448. {
  449. //若是匹配
  450. //包含原因
  451. string errorcode = _matchErrorCode.Match(msg).Value;
  452. if (_ErrorCode2Reason.ContainsKey(errorcode))
  453. {
  454. reason = _ErrorCode2Reason[errorcode];
  455. }
  456. else
  457. {
  458. reason = "未找到相关Error Code";
  459. }
  460. }
  461. else
  462. {
  463. //若不匹配
  464. reason = "回复消息不符合标准格式";
  465. }
  466. }
  467. /// <summary>
  468. /// 处理新到的数据
  469. /// 利用linkedlist处理拆包 粘包情况
  470. /// </summary>
  471. /// <param name="newline">新到数据</param>
  472. private void onDataChange(string oneLineMessage)
  473. {
  474. lock (_locker)
  475. {
  476. if (string.IsNullOrEmpty(_newline))//没有CR
  477. {
  478. _lstAsciiMsgs.AddLast(oneLineMessage);//将消息添加到最后
  479. return;
  480. }
  481. string[] array = oneLineMessage.Split(_newline.ToCharArray());//按照cr分开通讯数据
  482. foreach (string text in array)
  483. {
  484. if (!string.IsNullOrEmpty(text))
  485. {
  486. _lstAsciiMsgs.AddLast(text + _newline);//存进list中等待处理
  487. }
  488. }
  489. }
  490. }
  491. public override bool HomeALL()
  492. {
  493. _currentVceMessage = new VceMessage { Head = VceMessageHead.Action, Command = VceCommand.Home ,Param = "ALL" };
  494. _currentMsg = _currentVceMessage.toString() + _newline ;
  495. _status = RState.Running;
  496. return _serialport.Write(_currentMsg);
  497. }
  498. public override bool Home(string axis)
  499. {
  500. _currentVceMessage = new VceMessage { Head = VceMessageHead.Action, Command = VceCommand.Home, Param = axis };
  501. _currentMsg = _currentVceMessage.toString() + _newline;
  502. _status = RState.Running;
  503. return _serialport.Write(_currentMsg);
  504. }
  505. public override bool CloseDoor()
  506. {
  507. if (!CheckVceStatus())
  508. return false;
  509. _currentVceMessage = new VceMessage { Head = VceMessageHead.Action, Command = VceCommand.DoorClose };
  510. _currentMsg = _currentVceMessage.toString() + _newline;
  511. _status = RState.Running;
  512. return _serialport.Write(_currentMsg);
  513. }
  514. /// <summary>
  515. /// 开门提示
  516. /// 在honghuVCE中没有ATM信号的内部卡控 可能会导致开门的压差
  517. /// 因此每一次都要增加判断,只要引用此处功能的,前面都需要有判断
  518. ///
  519. /// </summary>
  520. /// <returns></returns>
  521. public override bool OpenDoor()
  522. {
  523. if (!CheckVceStatus())
  524. return false;
  525. _currentVceMessage = new VceMessage { Head = VceMessageHead.Action, Command = VceCommand.DoorOpen };
  526. _currentMsg = _currentVceMessage.toString() + _newline;
  527. _status = RState.Running;
  528. return _serialport.Write(_currentMsg);
  529. }
  530. public override bool Load()
  531. {
  532. if (!CheckVceStatus())
  533. return false;
  534. _currentVceMessage = new VceMessage { Head = VceMessageHead.Action, Command = VceCommand.Load };
  535. _currentMsg = _currentVceMessage.toString() + _newline;
  536. _status = RState.Running;
  537. return _serialport.Write(_currentMsg);
  538. }
  539. public override bool UnLoad()
  540. {
  541. if (!CheckVceStatus())
  542. return false;
  543. _currentVceMessage = new VceMessage { Head = VceMessageHead.Action, Command = VceCommand.UnLoad };
  544. _currentMsg = _currentVceMessage.toString() + _newline;
  545. _status = RState.Running;
  546. return _serialport.Write(_currentMsg);
  547. }
  548. public override bool Map()
  549. {
  550. if (!CheckVceStatus())
  551. return false;
  552. _currentVceMessage = new VceMessage { Head = VceMessageHead.Action, Command = VceCommand.Map };
  553. _currentMsg = _currentVceMessage.toString() + _newline;
  554. _status = RState.Running;
  555. return _serialport.Write(_currentMsg);
  556. }
  557. public override bool ReadMap()
  558. {
  559. if (!CheckVceStatus())
  560. return false;
  561. _currentVceMessage = new VceMessage { Head = VceMessageHead.Read, Command = VceCommand.ReadMap, Param = "S" };
  562. _currentMsg = _currentVceMessage.toString() + _newline;
  563. _status = RState.Running;
  564. _HasReceiveMsg = false;
  565. return _serialport.Write(_currentMsg);
  566. }
  567. public override bool Goto(int Targetslot)
  568. {
  569. if (!CheckVceStatus())
  570. return false;
  571. LOG.Write(eEvent.EV_VCE_COMMON_INFO,ModuleName.VCE1, $"SlotNum:{Targetslot}");
  572. _currentVceMessage = new VceMessage { Head = VceMessageHead.Action, Command = VceCommand.Goto, Param = (Targetslot+1).ToString().PadLeft(2,'0') };
  573. _currentMsg = _currentVceMessage.toString() + _newline;
  574. _status = RState.Running;
  575. return _serialport.Write(_currentMsg);
  576. }
  577. public override bool GotoLP()
  578. {
  579. if (!CheckVceStatus())
  580. return false;
  581. _currentVceMessage = new VceMessage { Head = VceMessageHead.Action, Command = VceCommand.GotoLP };
  582. _currentMsg = _currentVceMessage.toString() + _newline;
  583. _status = RState.Running;
  584. return _serialport.Write(_currentMsg);
  585. }
  586. public override bool ClearError()
  587. {
  588. _currentVceMessage = new VceMessage { Head = VceMessageHead.Set, Command = VceCommand.ClearError };
  589. _currentMsg = _currentVceMessage.toString() + _newline;
  590. _status = RState.Running;
  591. return _serialport.Write(_currentMsg);
  592. }
  593. }
  594. }