HongHuVce.cs 28 KB

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