Robot.cs 72 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text.RegularExpressions;
  4. using Aitex.Core.Common;
  5. using Aitex.Core.RT.Log;
  6. using Aitex.Core.RT.Event;
  7. using Aitex.Core.RT.DataCenter;
  8. using Aitex.Core.Util;
  9. using Aitex.Sorter.Common;
  10. using TSC = Aitex.Sorter.Common;
  11. using Aitex.Core.RT.Device;
  12. using Aitex.Core.RT.SCCore;
  13. using MECF.Framework.Common.Equipment;
  14. using MECF.Framework.Common.SubstrateTrackings;
  15. using Aitex.Core.RT.OperationCenter;
  16. using MECF.Framework.Common.CommonData;
  17. using MECF.Framework.Common.Communications;
  18. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot
  19. {
  20. public enum RobotType
  21. {
  22. SR100,
  23. NX100,
  24. MAG7,
  25. DAIHEN,
  26. HAtm,
  27. HIRATA_R4
  28. }
  29. public class Robot : BaseDevice, IDevice, IConnection
  30. {
  31. public event Action<ModuleName, string> OnSlotMapRead;
  32. public event Action<bool> ActionDone;
  33. public string Address
  34. {
  35. get { return _addr; }
  36. }
  37. public virtual bool IsConnected
  38. {
  39. get { return _socket.IsConnected; }
  40. }
  41. public bool Disconnect()
  42. {
  43. _commErr = true;
  44. _socket.Dispose();
  45. return true;
  46. }
  47. public bool IsOnline
  48. {
  49. get { return _isOnline; }
  50. }
  51. public const string delimiter = "\r";
  52. private bool _isOnline;
  53. public int LastErrorCode { get; set; }
  54. public int Status { get; set; }
  55. public int ErrorCode { get; set; }
  56. public int ElapseTime { get; set; }
  57. public int Speed { get; set; }
  58. public int Rotation { get; set; }
  59. public int Extension { get; set; }
  60. public int Wrist1 { get; set; }
  61. public int Wrist2 { get; set; }
  62. public int Evevation { get; set; }
  63. public bool StateWaferOnBlade1 { get; set; }
  64. public bool StateWaferOnBlade2 { get; set; }
  65. public bool StateBlade1Gripped { get; set; }
  66. public bool StateBlade2Gripped { get; set; }
  67. public bool StateInterlock1 { get; set; }
  68. public bool StateInterlock2 { get; set; }
  69. public bool StateInterlock3 { get; set; }
  70. public bool StateInterlock4 { get; set; }
  71. public bool StateInterlock5 { get; set; }
  72. public bool StateInterlock6 { get; set; }
  73. public bool StateInterlock7 { get; set; }
  74. public bool StateInterlock8 { get; set; }
  75. public bool Swap { get; set; }
  76. public Hand PlaceBalde { get; set; }
  77. public ModuleName Blade1Target
  78. {
  79. get;
  80. set;
  81. }
  82. public ModuleName Blade2Target { get; set; }
  83. public RobotMoveInfo MoveInfo { get; set; }
  84. //naming follow PM1.A LL1.A PM2.B
  85. public string CmdBladeTarget { get; set; }
  86. //naming follow 0 1
  87. public string CmdBlade1Extend { get; set; }
  88. //naming follow 0 1
  89. public string CmdBlade2Extend { get; set; }
  90. public bool Blade1Enable
  91. {
  92. get
  93. {
  94. if (SC.ContainsItem($"{Name}.Blade1Enable"))
  95. {
  96. return SC.GetValue<bool>($"{Name}.Blade1Enable");
  97. }
  98. return SC.GetValue<bool>($"Robot.Blade1Enable");
  99. }
  100. set
  101. {
  102. if (SC.ContainsItem($"{Name}.Blade1Enable"))
  103. {
  104. SC.SetItemValue($"{Name}.Blade1Enable", value);
  105. }else if (SC.ContainsItem($"Robot.Blade1Enable"))
  106. {
  107. SC.SetItemValue($"Robot.Blade1Enable", value);
  108. }
  109. }
  110. }
  111. public bool Blade2Enable
  112. {
  113. get
  114. {
  115. if (SC.ContainsItem($"{Name}.Blade2Enable"))
  116. {
  117. return SC.GetValue<bool>($"{Name}.Blade2Enable");
  118. }
  119. return SC.GetValue<bool>($"Robot.Blade2Enable");
  120. }
  121. set
  122. {
  123. if (SC.ContainsItem($"{Name}.Blade2Enable"))
  124. {
  125. SC.SetItemValue($"{Name}.Blade2Enable", value);
  126. }
  127. else if (SC.ContainsItem($"Robot.Blade2Enable"))
  128. {
  129. SC.SetItemValue($"Robot.Blade2Enable", value);
  130. }
  131. }
  132. }
  133. public int Blade2Slots
  134. {
  135. get
  136. {
  137. if (SC.ContainsItem($"{Name}.Blade2Slots"))
  138. {
  139. return Math.Max(SC.GetValue<int>($"{Name}.Blade2Slots"), 1);
  140. }
  141. if (SC.ContainsItem($"Robot.Blade2Slots"))
  142. {
  143. return Math.Max(SC.GetValue<int>($"Robot.Blade2Slots"), 1);
  144. }
  145. return 1;
  146. }
  147. }
  148. public bool Initalized { get; set; }
  149. public bool Communication
  150. {
  151. get
  152. {
  153. return !_commErr;
  154. }
  155. }
  156. public virtual bool Busy
  157. {
  158. get { return _backgroundHandler != null || _foregroundHandler != null; }
  159. }
  160. public virtual bool Moving
  161. {
  162. get { return _backgroundHandler != null; }
  163. }
  164. public virtual bool Error
  165. {
  166. get
  167. {
  168. return ErrorCode > 0 || _commErr || _exceuteErr;
  169. }
  170. }
  171. public DeviceState State
  172. {
  173. get
  174. {
  175. if (!Initalized)
  176. {
  177. return DeviceState.Unknown;
  178. }
  179. if (Error)
  180. {
  181. return DeviceState.Error;
  182. }
  183. if (Busy)
  184. return DeviceState.Busy;
  185. return DeviceState.Idle;
  186. }
  187. }
  188. //public string ErrorMessage
  189. //{
  190. // get
  191. // {
  192. // return _factory.GetError(LastErrorCode);
  193. // }
  194. //}
  195. public virtual bool WaferOnBlade1 { get { return (Status & (int)StateBit.WaferOnBlade1) > 0; } }
  196. public virtual bool WaferOnBlade2 { get { return (Status & (int)StateBit.WaferOnBlade2) > 0; } }
  197. public bool WaferPresentOnBlade1 { get; set; }
  198. public bool WaferPresentOnBlade2 { get; set; }
  199. public Hand TransferBlade {
  200. get
  201. {
  202. if (!Blade1Enable) return Hand.Blade2;
  203. if (!Blade2Enable) return Hand.Blade1;
  204. return Hand.Both;
  205. }
  206. }
  207. protected static Object _locker = new Object();
  208. protected AsyncSocket _socket;
  209. protected IHandler _eventHandler = null;
  210. protected IHandler _backgroundHandler = null; //moving
  211. protected IHandler _foregroundHandler = null; //current handler
  212. private IRobotHandlerFactory _factory = null;
  213. private DeviceTimer _timerQuery = new DeviceTimer();
  214. //private int _queryPeriod = 5000; //ms
  215. //private bool _queryState = true;
  216. protected bool _exceuteErr = false;
  217. protected bool _commErr = false;
  218. protected string _addr;
  219. protected RobotType _type = RobotType.SR100;
  220. private string AlarmRobotError = "RobotMotionError";
  221. //Active wafer Center finder Data R
  222. public int CenterOffsetR { get; private set; }
  223. //Active wafer Center finder Data T
  224. public int CenterOffsetT { get; private set; }
  225. private int _bufferMaxSlot = 6;
  226. public int BufferMaxSlot
  227. {
  228. set
  229. {
  230. _bufferMaxSlot = value;
  231. }
  232. get
  233. {
  234. return _bufferMaxSlot;
  235. }
  236. }
  237. public Robot(string module, string name, string display, string deviceId, string address, RobotType type = RobotType.SR100)
  238. : base(module, name, display, deviceId)
  239. {
  240. _addr = address;
  241. if (!string.IsNullOrEmpty(_addr))
  242. {
  243. _socket = new AsyncSocket(address);
  244. _socket.OnDataChanged += new AsyncSocket.MessageHandler(OnDataChanged);
  245. _socket.OnErrorHappened += new AsyncSocket.ErrorHandler(OnErrorHandler);
  246. }
  247. _type = type;
  248. Initalized = false;
  249. MoveInfo = new RobotMoveInfo()
  250. {
  251. Action = RobotAction.Moving,
  252. ArmTarget = RobotArm.Both,
  253. BladeTarget = "ArmA.System",
  254. };
  255. WaferManager.Instance.SubscribeLocation(name, 1+ Blade2Slots);
  256. }
  257. public Robot(string module, string name, string address, RobotType type = RobotType.SR100, int bufferMaxSlot = 6)
  258. : this(module, name, name, name, address, type)
  259. {
  260. }
  261. public virtual bool Initialize()
  262. {
  263. switch (_type)
  264. {
  265. case RobotType.NX100:
  266. _factory = new NX100.NX100RobotHandlerFactory(this);
  267. break;
  268. case RobotType.SR100:
  269. _factory = new SR100.SR100RobotHandlerFactory(this);
  270. break;
  271. case RobotType.MAG7:
  272. _factory = new MAG7.Mag7RobotHandlerFactory(this);
  273. break;
  274. //case RobotType.DAIHEN:
  275. // _factory = new Daihen.DaihenRobotHandlerFactory(this);
  276. // break;
  277. }
  278. ConnectionManager.Instance.Subscribe(Name, this);
  279. if (!string.IsNullOrEmpty(_addr))
  280. Connect();
  281. DEVICE.Register(String.Format("{0}.{1}", ModuleName.Robot.ToString(), "Init"), (out string reason, int time, object[] param) =>
  282. {
  283. bool ret = Init(out reason);
  284. if (ret)
  285. {
  286. reason = string.Format("{0} {1}", Name, "Initializing");
  287. return true;
  288. }
  289. return false;
  290. });
  291. DEVICE.Register(String.Format("{0}.{1}", ModuleName.Robot.ToString(), "Home"), (out string reason, int time, object[] param) =>
  292. {
  293. bool ret = Home(out reason);
  294. if (ret)
  295. {
  296. reason = string.Format("{0} {1}", Name, "Homing");
  297. return true;
  298. }
  299. return false;
  300. });
  301. DEVICE.Register(String.Format("{0}.{1}", ModuleName.Robot.ToString(), "RobotHome"), (out string reason, int time, object[] param) =>
  302. {
  303. bool ret = Home(out reason);
  304. if (ret)
  305. {
  306. reason = string.Format("{0} {1}", Name, "Homing");
  307. return true;
  308. }
  309. return false;
  310. });
  311. DEVICE.Register(String.Format("{0}.{1}", Name, "Reset"), (out string reason, int time, object[] param) =>
  312. {
  313. bool ret = Clear(out reason);
  314. if (ret)
  315. {
  316. reason = string.Format("{0} {1}", Name, "Reset");
  317. return true;
  318. }
  319. return false;
  320. });
  321. DEVICE.Register(String.Format("{0}.{1}", Name, "RobotReset"), (out string reason, int time, object[] param) =>
  322. {
  323. bool ret = Clear(out reason);
  324. if (ret)
  325. {
  326. reason = string.Format("{0} {1}", Name, "Reset");
  327. return true;
  328. }
  329. return false;
  330. });
  331. DEVICE.Register(String.Format("{0}.{1}", Name, "Grip"), (out string reason, int time, object[] param) =>
  332. {
  333. Hand hand = (Hand)Enum.Parse(typeof(Hand), (string)param[0], true);
  334. bool ret = Grip(hand,out reason);
  335. //bool ret = WaferMapping(ModuleName.LP1, out reason);
  336. if (ret)
  337. {
  338. reason = string.Format("{0} {1}", Name, "Grip");
  339. return true;
  340. }
  341. return false;
  342. });
  343. DEVICE.Register(String.Format("{0}.{1}", Name, "RobotGrip"), (out string reason, int time, object[] param) =>
  344. {
  345. Hand hand = (Hand)Enum.Parse(typeof(Hand), (string)param[0], true);
  346. bool ret = Grip(hand, out reason);
  347. //bool ret = WaferMapping(ModuleName.LP1, out reason);
  348. if (ret)
  349. {
  350. reason = string.Format("{0} {1}", Name, "Grip");
  351. return true;
  352. }
  353. return false;
  354. });
  355. DEVICE.Register(String.Format("{0}.{1}", Name, "Release"), (out string reason, int time, object[] param) =>
  356. {
  357. Hand hand = (Hand)Enum.Parse(typeof(Hand), (string)param[0], true);
  358. bool ret = Release(hand, out reason);
  359. //bool ret = QueryWaferMap(ModuleName.LP1, out reason);
  360. if (ret)
  361. {
  362. reason = string.Format("{0} {1}", Name, "Release");
  363. return true;
  364. }
  365. return false;
  366. });
  367. DEVICE.Register(String.Format("{0}.{1}", Name, "RobotRelease"), (out string reason, int time, object[] param) =>
  368. {
  369. Hand hand = (Hand)Enum.Parse(typeof(Hand), (string)param[0], true);
  370. bool ret = Release(hand, out reason);
  371. //bool ret = QueryWaferMap(ModuleName.LP1, out reason);
  372. if (ret)
  373. {
  374. reason = string.Format("{0} {1}", Name, "Release");
  375. return true;
  376. }
  377. return false;
  378. });
  379. DEVICE.Register(String.Format("{0}.{1}", Name, "Stop"), (out string reason, int time, object[] param) =>
  380. {
  381. bool ret = Stop(false, out reason);
  382. if (ret)
  383. {
  384. reason = string.Format("{0} {1}", Name, "Stopping");
  385. return true;
  386. }
  387. return false;
  388. });
  389. DEVICE.Register(String.Format("{0}.{1}", Name, "RobotStop"), (out string reason, int time, object[] param) =>
  390. {
  391. bool ret = Stop(false, out reason);
  392. if (ret)
  393. {
  394. reason = string.Format("{0} {1}", Name, "Stopping");
  395. return true;
  396. }
  397. return false;
  398. });
  399. DEVICE.Register(String.Format("{0}.{1}", Name, "Pick"), (out string reason, int time, object[] param) =>
  400. {
  401. ModuleName chamber = (ModuleName)Enum.Parse(typeof(ModuleName), (string)param[0], true);
  402. int slot = int.Parse((string)param[1]);
  403. Hand hand = (Hand)Enum.Parse(typeof(Hand), (string)param[2], true);
  404. bool ret = Pick(chamber, slot, hand, out reason);
  405. if (ret)
  406. {
  407. reason = string.Format("{0} {1}", Name, "Pick wafer");
  408. return true;
  409. }
  410. return false;
  411. });
  412. DEVICE.Register(String.Format("{0}.{1}", Name, "RobotPick"), (out string reason, int time, object[] param) =>
  413. {
  414. ModuleName chamber = (ModuleName)Enum.Parse(typeof(ModuleName), (string)param[0], true);
  415. int slot = int.Parse((string)param[1]);
  416. Hand hand = (Hand)Enum.Parse(typeof(Hand), (string)param[2], true);
  417. bool ret = Pick(chamber, slot, hand, out reason);
  418. if (ret)
  419. {
  420. reason = string.Format("{0} {1}", Name, "Pick wafer");
  421. return true;
  422. }
  423. return false;
  424. });
  425. DEVICE.Register(String.Format("{0}.{1}", Name, "Place"), (out string reason, int time, object[] param) =>
  426. {
  427. ModuleName chamber = (ModuleName)Enum.Parse(typeof(ModuleName), (string)param[0], true);
  428. int slot = int.Parse((string)param[1]);
  429. Hand hand = (Hand)Enum.Parse(typeof(Hand), (string)param[2], true);
  430. bool ret = Place(chamber, slot, hand, out reason);
  431. if (ret)
  432. {
  433. reason = string.Format("{0} {1}", Name, "Place wafer");
  434. return true;
  435. }
  436. return false;
  437. });
  438. DEVICE.Register(String.Format("{0}.{1}", Name, "RobotPlace"), (out string reason, int time, object[] param) =>
  439. {
  440. ModuleName chamber = (ModuleName)Enum.Parse(typeof(ModuleName), (string)param[0], true);
  441. int slot = int.Parse((string)param[1]);
  442. Hand hand = (Hand)Enum.Parse(typeof(Hand), (string)param[2], true);
  443. bool ret = Place(chamber, slot, hand, out reason);
  444. if (ret)
  445. {
  446. reason = string.Format("{0} {1}", Name, "Place wafer");
  447. return true;
  448. }
  449. return false;
  450. });
  451. DEVICE.Register(String.Format("{0}.{1}", Name, "Exchange"), (out string reason, int time, object[] param) =>
  452. {
  453. ModuleName chamber = (ModuleName)Enum.Parse(typeof(ModuleName), (string)param[0], true);
  454. int slot = int.Parse((string)param[1]);
  455. Hand hand = (Hand)Enum.Parse(typeof(Hand), (string)param[2], true);
  456. bool ret = Exchange(chamber, slot, hand, out reason);
  457. if (ret)
  458. {
  459. reason = string.Format("{0} {1}", Name, "Swap wafer");
  460. return true;
  461. }
  462. return false;
  463. });
  464. DEVICE.Register(String.Format("{0}.{1}", Name, "RobotExchange"), (out string reason, int time, object[] param) =>
  465. {
  466. ModuleName chamber = (ModuleName)Enum.Parse(typeof(ModuleName), (string)param[0], true);
  467. int slot = int.Parse((string)param[1]);
  468. Hand hand = (Hand)Enum.Parse(typeof(Hand), (string)param[2], true);
  469. bool ret = Exchange(chamber, slot, hand, out reason);
  470. if (ret)
  471. {
  472. reason = string.Format("{0} {1}", Name, "Swap wafer");
  473. return true;
  474. }
  475. return false;
  476. });
  477. DEVICE.Register(String.Format("{0}.{1}", Name, "Goto"), (out string reason, int time, object[] param) =>
  478. {
  479. ModuleName chamber = (ModuleName)Enum.Parse(typeof(ModuleName), (string)param[0], true);
  480. int slot = int.Parse((string)param[1]);
  481. Hand hand = (Hand)Enum.Parse(typeof(Hand), (string)param[2], true);
  482. Motion next = (Motion)Enum.Parse(typeof(Motion), (string)param[3], true);
  483. int x = int.Parse((string)param[4]);
  484. int y = int.Parse((string)param[5]);
  485. int z = int.Parse((string)param[6]);
  486. bool ret = Goto(chamber, slot, next, hand, x,y,z, out reason);
  487. if (ret)
  488. {
  489. reason = string.Format("{0}{1}", Name, "Goto");
  490. return true;
  491. }
  492. return false;
  493. });
  494. DEVICE.Register(String.Format("{0}.{1}", Name, "RobotGoto"), (out string reason, int time, object[] param) =>
  495. {
  496. ModuleName chamber = (ModuleName)Enum.Parse(typeof(ModuleName), (string)param[0], true);
  497. int slot = int.Parse((string)param[1]);
  498. Hand hand = (Hand)Enum.Parse(typeof(Hand), (string)param[2], true);
  499. Motion next = (Motion)Enum.Parse(typeof(Motion), (string)param[3], true);
  500. int x = int.Parse((string)param[4]);
  501. int y = int.Parse((string)param[5]);
  502. int z = int.Parse((string)param[6]);
  503. bool ret = Goto(chamber, slot, next, hand, x, y, z, out reason);
  504. if (ret)
  505. {
  506. reason = string.Format("{0}{1}", Name, "Goto");
  507. return true;
  508. }
  509. return false;
  510. });
  511. DEVICE.Register(String.Format("{0}.{1}", Name, "BladeEnable"), (out string reason, int time, object[] param) =>
  512. {
  513. Hand hand = (Hand)Enum.Parse(typeof(Hand), (string)param[0], true);
  514. bool bEnable = bool.Parse((string)param[1]);
  515. bool ret = Enable(hand, bEnable, out reason);
  516. if (ret)
  517. {
  518. reason = string.Format("{0}{1}", Name, "Disable robot arm");
  519. return true;
  520. }
  521. return false;
  522. });
  523. DEVICE.Register(String.Format("{0}.{1}", Name, "RobotBladeEnable"), (out string reason, int time, object[] param) =>
  524. {
  525. Hand hand = (Hand)Enum.Parse(typeof(Hand), (string)param[0], true);
  526. bool bEnable = bool.Parse((string)param[1]);
  527. bool ret = Enable(hand, bEnable, out reason);
  528. if (ret)
  529. {
  530. reason = string.Format("{0}{1}", Name, "Disable robot arm");
  531. return true;
  532. }
  533. return false;
  534. });
  535. OP.Subscribe($"{Name}.Reconnect", (string cmd, object[] args) =>
  536. {
  537. return Connect();
  538. });
  539. OP.Subscribe($"{Name}.TestRobotPosition", (string cmd, object[] param) =>
  540. {
  541. //int setValue = 0;
  542. Hand _hand = Hand.Blade1;
  543. Axis axis;
  544. if (param == null || param.Length < 2) return false;
  545. int moveValue = (int)(double.Parse(param[1].ToString()));
  546. switch (param[0].ToString())
  547. {
  548. case "TestRobotUp":
  549. axis = Axis.Z;
  550. break;
  551. case "TestRobotDown":
  552. moveValue = -moveValue;
  553. axis = Axis.Z;
  554. break;
  555. case "TestRobotArmLeft":
  556. moveValue = -moveValue;
  557. axis = Axis.S;// Axis.H;//H1
  558. break;
  559. case "TestRobotArmRight":
  560. axis = Axis.S;
  561. break;
  562. case "TestRobotArmUp":
  563. axis = Axis.A;// Axis.I;//H2
  564. break;
  565. case "TestRobotArmDown":
  566. moveValue = -moveValue;
  567. axis = Axis.A;
  568. break;
  569. case "TestRobotBlade1Left":
  570. _hand = Hand.Blade1;
  571. axis = Axis.H;
  572. break;
  573. case "TestRobotBlade1Right":
  574. moveValue = -moveValue;
  575. _hand = Hand.Blade1;
  576. axis = Axis.H;//TH
  577. break;
  578. case "TestRobotBlade2Left":
  579. _hand = Hand.Blade2;
  580. axis = Axis.I;
  581. break;
  582. case "TestRobotBlade2Right":
  583. moveValue = -moveValue;
  584. _hand = Hand.Blade2;
  585. axis = Axis.I;
  586. break;
  587. default:
  588. axis = Axis.A;
  589. break;
  590. }
  591. string reason;
  592. bool ret = PositionAdjustment(axis,_hand, moveValue, out reason);
  593. if (ret)
  594. {
  595. reason = string.Format("{0}{1}", Name, reason);
  596. return true;
  597. }
  598. return false;
  599. });
  600. OP.Subscribe($"{Name}.QueryPosition", (string cmd, object[] args) =>
  601. {
  602. string reason;
  603. bool ret = QueryPosition(out reason);
  604. if (ret)
  605. {
  606. reason = string.Format("{0}.QueryPosition,{1}", Name, reason);
  607. return true;
  608. }
  609. return false;
  610. });
  611. DATA.Subscribe($"{Name}.State", () => State);
  612. DATA.Subscribe($"{Name}.Busy", () => Busy);
  613. DATA.Subscribe($"{Name}.ErrorCode", () => ErrorCode);
  614. DATA.Subscribe($"{Name}.Blade1Target", () => Blade1Target);
  615. DATA.Subscribe($"{Name}.Blade2Target", () => Blade2Target);
  616. DATA.Subscribe($"{Name}.Blade1Enable", () => Blade1Enable);
  617. DATA.Subscribe($"{Name}.Blade2Enable", () => Blade2Enable);
  618. DATA.Subscribe($"{Name}.Swap", () => Swap);
  619. DATA.Subscribe($"{Name}.PlaceBalde", () => PlaceBalde);
  620. DATA.Subscribe($"{Name}.Speed", () => Speed);
  621. DATA.Subscribe($"{Name}.RobotSpeed", () => Speed.ToString());
  622. DATA.Subscribe($"{Name}.RobotState", () => State.ToString());
  623. DATA.Subscribe($"{Name}.Rotation", () => Rotation);
  624. DATA.Subscribe($"{Name}.Extension", () => Extension);
  625. DATA.Subscribe($"{Name}.Wrist1", () => Wrist1);
  626. DATA.Subscribe($"{Name}.Wrist2", () => Wrist2);
  627. DATA.Subscribe($"{Name}.Evevation", () => Evevation);
  628. DATA.Subscribe($"{Name}.CmdBladeTarget", () => CmdBladeTarget);
  629. DATA.Subscribe($"{Name}.CmdBlade1Extend", () => CmdBlade1Extend);
  630. DATA.Subscribe($"{Name}.CmdBlade2Extend", () => CmdBlade2Extend);
  631. DATA.Subscribe($"{Name}.RobotMoveInfo", () => MoveInfo);
  632. DATA.Subscribe($"{Name}.RobotBusy", () => Busy);
  633. DATA.Subscribe($"{Name}.RobotError", () => ErrorCode);
  634. DATA.Subscribe($"{Name}.RobotBlade1Traget", () => Blade1Target);
  635. DATA.Subscribe($"{Name}.RobotBlade2Traget", () => Blade2Target);
  636. DATA.Subscribe($"{Name}.RobotBlade1Enabled", () => Blade1Enable);
  637. DATA.Subscribe($"{Name}.RobotBlade2Enabled", () => Blade2Enable);
  638. DATA.Subscribe($"{Name}.RobotSwap", () => Swap);
  639. DATA.Subscribe($"{Name}.RobotSwapPlaceBlade", () => PlaceBalde);
  640. DATA.Subscribe($"{Name}.RobotPosRotationAxis", () => Rotation);
  641. DATA.Subscribe($"{Name}.RobotPosExtensionAxis", () => Extension);
  642. DATA.Subscribe($"{Name}.RobotPosWrist1Axis", () => Wrist1);
  643. DATA.Subscribe($"{Name}.RobotPosWrist2Axis", () => Wrist2);
  644. DATA.Subscribe($"{Name}.RobotPosEvevationAxis", () => Evevation);
  645. DATA.Subscribe($"{Name}.CenterOffsetR", () => CenterOffsetR);
  646. DATA.Subscribe($"{Name}.CenterOffsetT", () => CenterOffsetT);
  647. DATA.Subscribe($"{Name}.CommunicationStatus", () => _socket == null ? false : _socket.IsConnected);
  648. DATA.Subscribe($"{Name}.IsOnline", () => _isOnline);
  649. EV.Subscribe(new EventItem(60014,"Event", AlarmRobotError, "Robot error", EventLevel.Alarm, Aitex.Core.RT.Event.EventType.HostNotification));
  650. Reset();
  651. string str = string.Empty;
  652. if(_factory != null)
  653. _eventHandler = _factory.Event();
  654. return true;
  655. }
  656. public virtual void Terminate()
  657. {
  658. if (SC.ContainsItem("Robot.CloseSocketOnShutDown") && SC.GetValue<bool>("Robot.CloseSocketOnShutDown"))
  659. {
  660. LOG.Write($"Robot {Name} termination process: close socket");
  661. _socket.Dispose();
  662. }
  663. }
  664. public virtual void Monitor()
  665. {
  666. }
  667. public virtual void Reset()
  668. {
  669. if (Error)
  670. {
  671. lock (_locker)
  672. {
  673. _foregroundHandler = null;
  674. _backgroundHandler = null;
  675. }
  676. }
  677. _exceuteErr = false;
  678. if (_commErr)
  679. {
  680. Connect();
  681. }
  682. Swap = false;
  683. }
  684. public void SetOnline(bool online)
  685. {
  686. _isOnline = online;
  687. }
  688. public bool Enable(Hand hand, bool bEnable, out string reason)
  689. {
  690. reason = string.Empty;
  691. if (hand == Hand.Blade1)
  692. {
  693. Blade2Enable = bEnable;
  694. }
  695. else if (hand == Hand.Blade2)
  696. {
  697. Blade2Enable = bEnable;
  698. }
  699. else
  700. {
  701. reason = "Can't disable all blade";
  702. return false;
  703. }
  704. return true;
  705. }
  706. public virtual bool Connect()
  707. {
  708. _commErr = false;
  709. _socket.Connect(this._addr);
  710. return true;
  711. }
  712. #region Command
  713. public virtual bool Init(out string reason)
  714. {
  715. lock (_locker)
  716. {
  717. _foregroundHandler = null;
  718. _backgroundHandler = null;
  719. }
  720. reason = string.Empty;
  721. return execute(_factory.Init(), out reason);
  722. }
  723. public virtual bool Home(out string reason)
  724. {
  725. lock (_locker)
  726. {
  727. _foregroundHandler = null;
  728. _backgroundHandler = null;
  729. }
  730. reason = string.Empty;
  731. return execute(_factory.Home(), out reason);
  732. }
  733. public virtual bool ArmHome(out string reason)
  734. {
  735. lock (_locker)
  736. {
  737. _foregroundHandler = null;
  738. _backgroundHandler = null;
  739. }
  740. reason = string.Empty;
  741. return execute(_factory.ArmHome(), out reason);
  742. }
  743. public virtual bool Grip(Hand hand,out string reason)
  744. {
  745. reason = string.Empty;
  746. return execute(_factory.Grip(hand), out reason);
  747. }
  748. public virtual bool Release(Hand hand, out string reason)
  749. {
  750. reason = string.Empty;
  751. return execute(_factory.Release(hand), out reason);
  752. }
  753. public virtual bool WaferMapping(ModuleName loadport, out string reason)
  754. {
  755. reason = string.Empty;
  756. return execute(_factory.WaferMapping(loadport), out reason);
  757. }
  758. public virtual bool QueryWaferMap(ModuleName loadport, out string reason)
  759. {
  760. reason = string.Empty;
  761. return execute(_factory.QueryWaferMap(loadport), out reason);
  762. }
  763. public virtual bool QueryState(out string reason)
  764. {
  765. reason = string.Empty;
  766. return execute(_factory.QueryState(), out reason);
  767. }
  768. public virtual bool QueryPosition(out string reason)
  769. {
  770. reason = string.Empty;
  771. return execute(_factory.QueryPosition(), out reason);
  772. }
  773. public virtual bool Clear(out string reason)
  774. {
  775. reason = string.Empty;
  776. return execute(_factory.Clear(), out reason);
  777. }
  778. public virtual bool Stop(bool isEmergency, out string reason)
  779. {
  780. reason = string.Empty;
  781. lock (_locker)
  782. {
  783. _foregroundHandler = null;
  784. _backgroundHandler = null;
  785. }
  786. return execute(_factory.Stop(isEmergency), out reason);
  787. }
  788. public virtual bool Resume( out string reason)
  789. {
  790. reason = string.Empty;
  791. return execute(_factory.Resume(), out reason);
  792. }
  793. public virtual bool SetSpeed(int speed, out string reason)
  794. {
  795. reason = string.Empty;
  796. return execute(_factory.SetSpeed(speed), out reason);
  797. }
  798. public virtual bool SetCommunication( out string reason)
  799. {
  800. lock (_locker)
  801. {
  802. _foregroundHandler = null;
  803. _backgroundHandler = null;
  804. }
  805. reason = string.Empty;
  806. return execute(_factory.SetCommunication(), out reason);
  807. }
  808. public virtual bool SetLoad(Hand hand, out string reason)
  809. {
  810. lock (_locker)
  811. {
  812. _foregroundHandler = null;
  813. _backgroundHandler = null;
  814. }
  815. reason = string.Empty;
  816. return execute(_factory.SetLoad(hand), out reason);
  817. }
  818. public virtual bool CheckLoad(ModuleName chamber, int slot, out string reason)
  819. {
  820. reason = string.Empty;
  821. return execute(_factory.CheckLoad(chamber, slot), out reason);
  822. }
  823. public virtual bool RequestWaferAWCData(out string reason)
  824. {
  825. reason = string.Empty;
  826. return execute(_factory.RequestAWCData(), out reason);
  827. }
  828. public virtual bool RequestWaferPresent( out string reason)
  829. {
  830. reason = string.Empty;
  831. return execute(_factory.RequestWaferPresent(), out reason);
  832. }
  833. public virtual bool Goto(ModuleName chamber, int slot, Motion motion,Hand hand, int x, int y, int z,out string reason)
  834. {
  835. reason = string.Empty;
  836. if (chamber == ModuleName.Robot)
  837. {
  838. reason = string.Format("Pick invalid parameter, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  839. return false;
  840. }
  841. if (ModuleHelper.IsLoadPort(chamber))
  842. {
  843. if (hand == Hand.Both)
  844. {
  845. if (!checkslot(0, 25 - Blade2Slots, slot)) //0-20 | 20,21,22,23,24
  846. {
  847. reason = string.Format("Pick invalid parameter,double hand, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  848. return false;
  849. }
  850. }
  851. else if(hand == Hand.Blade2)
  852. {
  853. if (!checkslot(0, 25 - Blade2Slots + 1, slot)) //0 - 21| 21,22,23,24
  854. {
  855. reason = string.Format("Pick invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  856. return false;
  857. }
  858. }
  859. else
  860. {
  861. if (!checkslot(0, 25, slot))
  862. {
  863. reason = string.Format("Pick invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  864. return false;
  865. }
  866. }
  867. }
  868. else
  869. {
  870. if (hand == Hand.Both)
  871. {
  872. reason = string.Format("Pick invalid parameter, double pick,chamber is {0}, slot is {1}", chamber.ToString(), slot);
  873. return false;
  874. }
  875. }
  876. return execute(_factory.Goto( chamber, slot, motion, hand, x,y,z), out reason);
  877. }
  878. public virtual bool MoveTo(ModuleName chamber, int slot, Hand hand, bool isPick, int x, int y, int z,out string reason)
  879. {
  880. reason = string.Empty;
  881. if (chamber == ModuleName.Robot)
  882. {
  883. reason = string.Format("Pick invalid parameter, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  884. return false;
  885. }
  886. if (ModuleHelper.IsLoadPort(chamber))
  887. {
  888. if (hand == Hand.Both)
  889. {
  890. if (!checkslot(0, 25 - Blade2Slots, slot)) //0-20 | 20,21,22,23,24
  891. {
  892. reason = string.Format("Pick invalid parameter,double hand, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  893. return false;
  894. }
  895. }
  896. else if(hand == Hand.Blade2)
  897. {
  898. if (!checkslot(0, 25 - Blade2Slots + 1, slot)) //0 - 21| 21,22,23,24
  899. {
  900. reason = string.Format("Pick invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  901. return false;
  902. }
  903. }
  904. else
  905. {
  906. if (!checkslot(0, 25, slot))
  907. {
  908. reason = string.Format("Pick invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  909. return false;
  910. }
  911. }
  912. }
  913. else
  914. {
  915. if (hand == Hand.Both)
  916. {
  917. reason = string.Format("Pick invalid parameter, double pick,chamber is {0}, slot is {1}", chamber.ToString(), slot);
  918. return false;
  919. }
  920. }
  921. return execute(_factory.MoveTo( chamber, slot, hand, isPick, x,y,z), out reason);
  922. }
  923. public virtual bool Extend(ModuleName chamber, int slot, Hand hand, out string reason)
  924. {
  925. reason = string.Empty;
  926. if (chamber == ModuleName.Robot)
  927. {
  928. reason = string.Format("Extend invalid parameter, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  929. return false;
  930. }
  931. if (ModuleHelper.IsLoadPort(chamber))
  932. {
  933. if (hand == Hand.Both)
  934. {
  935. if (!checkslot(0, 25 - Blade2Slots, slot)) //0-20 | 20,21,22,23,24
  936. {
  937. reason = string.Format("Extend invalid parameter,double hand, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  938. return false;
  939. }
  940. }
  941. else if (hand == Hand.Blade2)
  942. {
  943. if (!checkslot(0, 25 - Blade2Slots + 1, slot)) //0 - 21| 21,22,23,24
  944. {
  945. reason = string.Format("Extend invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  946. return false;
  947. }
  948. }
  949. else
  950. {
  951. if (!checkslot(0, 25, slot))
  952. {
  953. reason = string.Format("Extend invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  954. return false;
  955. }
  956. }
  957. }
  958. else
  959. {
  960. if (hand == Hand.Both)
  961. {
  962. reason = string.Format("Extend invalid parameter, double pick,chamber is {0}, slot is {1}", chamber.ToString(), slot);
  963. return false;
  964. }
  965. }
  966. return execute(_factory.Extend(chamber, slot, hand), out reason);
  967. }
  968. public virtual bool Retract(ModuleName chamber, int slot, Hand hand, out string reason)
  969. {
  970. reason = string.Empty;
  971. if (chamber == ModuleName.Robot)
  972. {
  973. reason = string.Format("Retract invalid parameter, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  974. return false;
  975. }
  976. if (ModuleHelper.IsLoadPort(chamber))
  977. {
  978. if (hand == Hand.Both)
  979. {
  980. if (!checkslot(0, 25 - Blade2Slots, slot)) //0-20 | 20,21,22,23,24
  981. {
  982. reason = string.Format("Retract invalid parameter,double hand, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  983. return false;
  984. }
  985. }
  986. else if (hand == Hand.Blade2)
  987. {
  988. if (!checkslot(0, 25 - Blade2Slots + 1, slot)) //0 - 21| 21,22,23,24
  989. {
  990. reason = string.Format("Retract invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  991. return false;
  992. }
  993. }
  994. else
  995. {
  996. if (!checkslot(0, 25, slot))
  997. {
  998. reason = string.Format("Retract invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  999. return false;
  1000. }
  1001. }
  1002. }
  1003. else
  1004. {
  1005. if (hand == Hand.Both)
  1006. {
  1007. reason = string.Format("Retract invalid parameter, double pick,chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1008. return false;
  1009. }
  1010. }
  1011. return execute(_factory.Retract(chamber, slot, hand), out reason);
  1012. }
  1013. public virtual bool PickExtend(ModuleName chamber, int slot, Hand hand, out string reason)
  1014. {
  1015. reason = string.Empty;
  1016. if (chamber.ToString() == Name || chamber == ModuleName.System || ModuleHelper.IsLoadPort(chamber) || ModuleHelper.IsBuffer(chamber))
  1017. {
  1018. reason = $"Pick extend target not support, chamber is {chamber.ToString()}, slot is {slot}";
  1019. return false;
  1020. }
  1021. if (hand == Hand.Both)
  1022. {
  1023. reason = string.Format("Pick extend invalid parameter, do not support double arm extend ,chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1024. return false;
  1025. }
  1026. return execute(_factory.PickExtend(chamber, slot, hand), out reason);
  1027. }
  1028. public virtual bool PickRetract(ModuleName chamber, int slot, Hand hand, out string reason)
  1029. {
  1030. reason = string.Empty;
  1031. if (chamber.ToString() == Name || chamber == ModuleName.System || ModuleHelper.IsLoadPort(chamber) || ModuleHelper.IsBuffer(chamber))
  1032. {
  1033. reason = $"Pick retract target not support, chamber is {chamber.ToString()}, slot is {slot}";
  1034. return false;
  1035. }
  1036. if (hand == Hand.Both)
  1037. {
  1038. reason = string.Format("Pick retract invalid parameter, do not support double arm retract ,chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1039. return false;
  1040. }
  1041. return execute(_factory.PickRetract(chamber, slot, hand), out reason);
  1042. }
  1043. public virtual bool Pick(ModuleName chamber, int slot, Hand hand, out string reason)
  1044. {
  1045. reason = string.Empty;
  1046. if (chamber == ModuleName.Robot)
  1047. {
  1048. reason = string.Format("Pick invalid parameter, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1049. return false;
  1050. }
  1051. if (ModuleHelper.IsLoadPort(chamber))
  1052. {
  1053. if (hand == Hand.Both)
  1054. {
  1055. if (!checkslot(0, 25 - Blade2Slots, slot)) //0-20 | 20,21,22,23,24
  1056. {
  1057. reason = string.Format("Pick invalid parameter,double hand, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1058. return false;
  1059. }
  1060. }
  1061. else if (hand == Hand.Blade2)
  1062. {
  1063. if (!checkslot(0, 25 - Blade2Slots + 1, slot)) //0 - 21| 21,22,23,24
  1064. {
  1065. reason = string.Format("Pick invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1066. return false;
  1067. }
  1068. }
  1069. else
  1070. {
  1071. if (!checkslot(0, 25, slot))
  1072. {
  1073. reason = string.Format("Pick invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1074. return false;
  1075. }
  1076. }
  1077. }
  1078. else if(ModuleHelper.IsBuffer(chamber))
  1079. {
  1080. if (hand == Hand.Both)
  1081. {
  1082. if (!checkslot(0, _bufferMaxSlot - Blade2Slots, slot)) //0-20 | 20,21,22,23,24
  1083. {
  1084. reason = string.Format("Pick invalid parameter,double hand, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1085. return false;
  1086. }
  1087. }
  1088. else if (hand == Hand.Blade2)
  1089. {
  1090. if (!checkslot(0, _bufferMaxSlot - Blade2Slots + 1, slot)) //0 - 21| 21,22,23,24
  1091. {
  1092. reason = string.Format("Pick invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1093. return false;
  1094. }
  1095. }
  1096. else
  1097. {
  1098. if (!checkslot(0, _bufferMaxSlot, slot))
  1099. {
  1100. reason = string.Format("Pick invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1101. return false;
  1102. }
  1103. }
  1104. }
  1105. else
  1106. {
  1107. if (hand == Hand.Both)
  1108. {
  1109. reason = string.Format("Pick invalid parameter, double pick,chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1110. return false;
  1111. }
  1112. }
  1113. return execute(_factory.Pick(chamber, slot, hand), out reason);
  1114. }
  1115. public virtual bool PickReadyPosition(ModuleName chamber, int slot, Hand hand, out string reason)
  1116. {
  1117. reason = string.Empty;
  1118. if (chamber == ModuleName.Robot)
  1119. {
  1120. reason = string.Format("Pick invalid parameter, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1121. return false;
  1122. }
  1123. return execute(_factory.PickReadyPosition(chamber, slot, hand), out reason);
  1124. }
  1125. public virtual bool Place(ModuleName chamber, int slot, Hand hand, out string reason)
  1126. {
  1127. reason = string.Empty;
  1128. if (chamber == ModuleName.Robot)
  1129. {
  1130. reason = string.Format("Place invalid parameter, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1131. return false;
  1132. }
  1133. if (ModuleHelper.IsLoadPort(chamber))
  1134. {
  1135. if (hand == Hand.Both)
  1136. {
  1137. if (!checkslot(0, 25 - Blade2Slots, slot)) //0-20 | 20,21,22,23,24
  1138. {
  1139. reason = string.Format("Place invalid parameter,double hand, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1140. return false;
  1141. }
  1142. }
  1143. else if (hand == Hand.Blade2)
  1144. {
  1145. if (!checkslot(0, 25 - Blade2Slots + 1, slot)) //0 - 21| 21,22,23,24
  1146. {
  1147. reason = string.Format("Pick invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1148. return false;
  1149. }
  1150. }
  1151. else
  1152. {
  1153. if (!checkslot(0, 25, slot))
  1154. {
  1155. reason = string.Format("Place invalid parameter,place, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1156. return false;
  1157. }
  1158. }
  1159. }
  1160. else if (ModuleHelper.IsBuffer(chamber))
  1161. {
  1162. if (hand == Hand.Both)
  1163. {
  1164. if (!checkslot(0, _bufferMaxSlot - Blade2Slots, slot)) //0-6
  1165. {
  1166. reason = string.Format("Place invalid parameter,double hand, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1167. return false;
  1168. }
  1169. }
  1170. else if (hand == Hand.Blade2)
  1171. {
  1172. if (!checkslot(0, _bufferMaxSlot - Blade2Slots + 1, slot)) //0 - 6
  1173. {
  1174. reason = string.Format("Pick invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1175. return false;
  1176. }
  1177. }
  1178. else
  1179. {
  1180. if (!checkslot(0, _bufferMaxSlot, slot))
  1181. {
  1182. reason = string.Format("Place invalid parameter,place, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1183. return false;
  1184. }
  1185. }
  1186. }
  1187. else
  1188. {
  1189. if (hand == Hand.Both)
  1190. {
  1191. reason = string.Format("Place invalid parameter, double place,chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1192. return false;
  1193. }
  1194. }
  1195. return execute(_factory.Place(chamber, slot, hand), out reason);
  1196. }
  1197. public virtual bool PlaceReadyPosition(ModuleName chamber, int slot, Hand hand, out string reason)
  1198. {
  1199. reason = string.Empty;
  1200. if (chamber == ModuleName.Robot)
  1201. {
  1202. reason = string.Format("Place invalid parameter, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1203. return false;
  1204. }
  1205. return execute(_factory.PlaceReadyPosition(chamber, slot, hand), out reason);
  1206. }
  1207. public virtual bool PlaceExtend(ModuleName chamber, int slot, Hand hand, out string reason)
  1208. {
  1209. reason = string.Empty;
  1210. if (chamber.ToString() == Name || chamber == ModuleName.System || ModuleHelper.IsLoadPort(chamber) || ModuleHelper.IsBuffer(chamber))
  1211. {
  1212. reason = $"Place extend target not support, chamber is {chamber.ToString()}, slot is {slot}";
  1213. return false;
  1214. }
  1215. if (hand == Hand.Both)
  1216. {
  1217. reason =
  1218. $"Place extend invalid parameter, do not support double arm extend ,chamber is {chamber.ToString()}, slot is {slot}";
  1219. return false;
  1220. }
  1221. return execute(_factory.PlaceExtend(chamber, slot, hand), out reason);
  1222. }
  1223. public virtual bool PlaceRetract(ModuleName chamber, int slot, Hand hand, out string reason)
  1224. {
  1225. reason = string.Empty;
  1226. if (chamber.ToString() == Name || chamber == ModuleName.System || ModuleHelper.IsLoadPort(chamber) ||ModuleHelper.IsBuffer(chamber) )
  1227. {
  1228. reason = $"Place retract target not support, chamber is {chamber.ToString()}, slot is {slot}";
  1229. return false;
  1230. }
  1231. if (hand == Hand.Both)
  1232. {
  1233. reason =
  1234. $"Place retract invalid parameter, do not support double arm extend ,chamber is {chamber.ToString()}, slot is {slot}";
  1235. return false;
  1236. }
  1237. return execute(_factory.PlaceRetract(chamber, slot, hand), out reason);
  1238. }
  1239. public virtual bool Exchange(ModuleName chamber, int slot, Hand hand, out string reason)
  1240. {
  1241. reason = string.Empty;
  1242. if (chamber == ModuleName.Robot)
  1243. {
  1244. reason = string.Format("Exchange invalid parameter, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1245. return false;
  1246. }
  1247. if (Blade2Slots > 1)
  1248. {
  1249. reason = string.Format("this robot don't support exchange operation.");
  1250. return false;
  1251. }
  1252. if (hand == Hand.Both)
  1253. {
  1254. reason = string.Format("Exchange invalid parameter,double hand");
  1255. return false;
  1256. }
  1257. if (ModuleHelper.IsLoadPort(chamber))
  1258. {
  1259. if (!checkslot(0, 25, slot))
  1260. {
  1261. reason = string.Format("Exchange invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1262. return false;
  1263. }
  1264. }
  1265. return execute(_factory.Exchange(chamber, slot, hand), out reason);
  1266. }
  1267. public virtual bool ExchangeReadyPosition(ModuleName chamber, int slot, Hand pickHand, Hand placeHand, out string reason)
  1268. {
  1269. reason = string.Empty;
  1270. if (chamber == ModuleName.Robot)
  1271. {
  1272. reason = string.Format("ExchangeReadyPosition invalid parameter, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1273. return false;
  1274. }
  1275. if (Blade2Slots > 1)
  1276. {
  1277. reason = string.Format("this robot don't support exchange operation.");
  1278. return false;
  1279. }
  1280. if (pickHand == Hand.Both || placeHand == Hand.Both)
  1281. {
  1282. reason = string.Format("ExchangeReadyPosition invalid parameter,double hand");
  1283. return false;
  1284. }
  1285. if (ModuleHelper.IsLoadPort(chamber))
  1286. {
  1287. if (!checkslot(0, 25, slot))
  1288. {
  1289. reason = string.Format("ExchangeReadyPosition invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1290. return false;
  1291. }
  1292. }
  1293. return execute(_factory.ExchangeReadyPosition(chamber, slot, pickHand, placeHand), out reason);
  1294. }
  1295. public virtual bool ExchangeReadyPositionExtend(ModuleName chamber, int slot, Hand pickHand, Hand placeHand, out string reason)
  1296. {
  1297. reason = string.Empty;
  1298. if (chamber == ModuleName.Robot)
  1299. {
  1300. reason = string.Format("ExchangeReadyPosition invalid parameter, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1301. return false;
  1302. }
  1303. if (Blade2Slots > 1)
  1304. {
  1305. reason = string.Format("this robot don't support exchange operation.");
  1306. return false;
  1307. }
  1308. if (pickHand == Hand.Both || placeHand == Hand.Both)
  1309. {
  1310. reason = string.Format("ExchangeReadyPosition invalid parameter,double hand");
  1311. return false;
  1312. }
  1313. if (ModuleHelper.IsLoadPort(chamber))
  1314. {
  1315. if (!checkslot(0, 25, slot))
  1316. {
  1317. reason = string.Format("ExchangeReadyPosition invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1318. return false;
  1319. }
  1320. }
  1321. return execute(_factory.ExchangeReadyExtend(chamber, slot, pickHand, placeHand), out reason);
  1322. }
  1323. public virtual bool ExchangeAfterReadyPositionExtend(ModuleName chamber, int slot, Hand pickHand, Hand placeHand, out string reason)
  1324. {
  1325. reason = string.Empty;
  1326. if (chamber == ModuleName.Robot)
  1327. {
  1328. reason = string.Format("ExchangeReadyPosition invalid parameter, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1329. return false;
  1330. }
  1331. if (Blade2Slots > 1)
  1332. {
  1333. reason = string.Format("this robot don't support exchange operation.");
  1334. return false;
  1335. }
  1336. if (pickHand == Hand.Both || placeHand == Hand.Both)
  1337. {
  1338. reason = string.Format("ExchangeReadyPosition invalid parameter,double hand");
  1339. return false;
  1340. }
  1341. if (ModuleHelper.IsLoadPort(chamber))
  1342. {
  1343. if (!checkslot(0, 25, slot))
  1344. {
  1345. reason = string.Format("ExchangeReadyPosition invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1346. return false;
  1347. }
  1348. }
  1349. return execute(_factory.ExchangeAfterReadyExtend(chamber, slot, pickHand, placeHand), out reason);
  1350. }
  1351. public virtual bool ExchangePickExtend(ModuleName chamber, int slot, Hand pickHand, Hand placeHand, out string reason)
  1352. {
  1353. reason = string.Empty;
  1354. if (chamber == ModuleName.Robot)
  1355. {
  1356. reason = string.Format("ExchangePickExtend invalid parameter, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1357. return false;
  1358. }
  1359. if (Blade2Slots > 1)
  1360. {
  1361. reason = string.Format("this robot don't support exchange operation.");
  1362. return false;
  1363. }
  1364. if (pickHand == Hand.Both || placeHand == Hand.Both)
  1365. {
  1366. reason = string.Format("ExchangePickExtend invalid parameter,double hand");
  1367. return false;
  1368. }
  1369. if (ModuleHelper.IsLoadPort(chamber))
  1370. {
  1371. if (!checkslot(0, 25, slot))
  1372. {
  1373. reason = string.Format("ExchangePickExtend invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1374. return false;
  1375. }
  1376. }
  1377. return execute(_factory.ExchangePickExtend(chamber, slot, pickHand, placeHand), out reason);
  1378. }
  1379. public virtual bool ExchangePlaceExtend(ModuleName chamber, int slot, Hand pickHand, Hand placeHand, out string reason)
  1380. {
  1381. reason = string.Empty;
  1382. if (chamber == ModuleName.Robot)
  1383. {
  1384. reason = string.Format("ExchangePlaceExtend invalid parameter, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1385. return false;
  1386. }
  1387. if (Blade2Slots > 1)
  1388. {
  1389. reason = string.Format("this robot don't support exchange operation.");
  1390. return false;
  1391. }
  1392. if (pickHand == Hand.Both || placeHand == Hand.Both)
  1393. {
  1394. reason = string.Format("ExchangePlaceExtend invalid parameter,double hand");
  1395. return false;
  1396. }
  1397. if (ModuleHelper.IsLoadPort(chamber))
  1398. {
  1399. if (!checkslot(0, 25, slot))
  1400. {
  1401. reason = string.Format("ExchangePlaceExtend invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1402. return false;
  1403. }
  1404. }
  1405. return execute(_factory.ExchangePlaceExtend(chamber, slot, pickHand, placeHand), out reason);
  1406. }
  1407. public virtual bool ExchangePlaceRetract(ModuleName chamber, int slot, Hand pickHand, Hand placeHand, out string reason)
  1408. {
  1409. reason = string.Empty;
  1410. if (chamber == ModuleName.Robot)
  1411. {
  1412. reason = string.Format("ExchangePlaceRetract invalid parameter, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1413. return false;
  1414. }
  1415. if (Blade2Slots > 1)
  1416. {
  1417. reason = string.Format("this robot don't support exchange operation.");
  1418. return false;
  1419. }
  1420. if (pickHand == Hand.Both || placeHand == Hand.Both)
  1421. {
  1422. reason = string.Format("ExchangePlaceRetract invalid parameter,double hand");
  1423. return false;
  1424. }
  1425. if (ModuleHelper.IsLoadPort(chamber))
  1426. {
  1427. if (!checkslot(0, 25, slot))
  1428. {
  1429. reason = string.Format("ExchangePlaceRetract invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1430. return false;
  1431. }
  1432. }
  1433. return execute(_factory.ExchangePlaceRetract(chamber, slot, pickHand, placeHand), out reason);
  1434. }
  1435. public virtual bool SetWaferSize(int cmd, WaferSize size, out string reason)
  1436. {
  1437. reason = string.Empty;
  1438. return execute(_factory.SetWaferSize(cmd, size), out reason);
  1439. }
  1440. public virtual bool QueryParameter(int parameter, string parameterType, out string reason)
  1441. {
  1442. reason = string.Empty;
  1443. return execute(_factory.QueryParameter(parameter, parameterType), out reason);
  1444. }
  1445. public virtual bool SetServoOnOff(bool trueForOnFalseForOff, out string reason)
  1446. {
  1447. reason = string.Empty;
  1448. return execute(_factory.SetServoOnOff(trueForOnFalseForOff), out reason);
  1449. }
  1450. public virtual bool PickEx(ModuleName chamber, int slot, Hand hand, int x, int y, int z, out string reason)
  1451. {
  1452. reason = string.Empty;
  1453. if (chamber == ModuleName.Robot)
  1454. {
  1455. reason = string.Format("Pick invalid parameter, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1456. return false;
  1457. }
  1458. if (ModuleHelper.IsLoadPort(chamber))
  1459. {
  1460. if (hand == Hand.Both)
  1461. {
  1462. if (!checkslot(0, 25 - Blade2Slots, slot)) //0-20 | 20,21,22,23,24
  1463. {
  1464. reason = string.Format("Pick invalid parameter,double hand, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1465. return false;
  1466. }
  1467. }
  1468. else if (hand == Hand.Blade2)
  1469. {
  1470. if (!checkslot(0, 25 - Blade2Slots + 1, slot)) //0 - 21| 21,22,23,24
  1471. {
  1472. reason = string.Format("Pick invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1473. return false;
  1474. }
  1475. }
  1476. else
  1477. {
  1478. if (!checkslot(0, 25, slot))
  1479. {
  1480. reason = string.Format("Pick invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1481. return false;
  1482. }
  1483. }
  1484. }
  1485. else
  1486. {
  1487. if (hand == Hand.Both)
  1488. {
  1489. reason = string.Format("Pick invalid parameter, double pick,chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1490. return false;
  1491. }
  1492. }
  1493. return execute(_factory.PickEx(chamber, slot, hand, x,y,z), out reason);
  1494. }
  1495. public virtual bool PlaceEx(ModuleName chamber, int slot, Hand hand, int x, int y, int z, out string reason)
  1496. {
  1497. reason = string.Empty;
  1498. if (chamber == ModuleName.Robot)
  1499. {
  1500. reason = string.Format("Place invalid parameter, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1501. return false;
  1502. }
  1503. if (ModuleHelper.IsLoadPort(chamber))
  1504. {
  1505. if (hand == Hand.Both)
  1506. {
  1507. if (!checkslot(0, 25 - Blade2Slots, slot)) //0-20 | 20,21,22,23,24
  1508. {
  1509. reason = string.Format("Place invalid parameter,double hand, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1510. return false;
  1511. }
  1512. }
  1513. else if (hand == Hand.Blade2)
  1514. {
  1515. if (!checkslot(0, 25 - Blade2Slots + 1, slot)) //0 - 21| 21,22,23,24
  1516. {
  1517. reason = string.Format("Pick invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1518. return false;
  1519. }
  1520. }
  1521. else
  1522. {
  1523. if (!checkslot(0, 25, slot))
  1524. {
  1525. reason = string.Format("Place invalid parameter,place, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1526. return false;
  1527. }
  1528. }
  1529. }
  1530. else
  1531. {
  1532. if (hand == Hand.Both)
  1533. {
  1534. reason = string.Format("Place invalid parameter, double place,chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1535. return false;
  1536. }
  1537. }
  1538. return execute(_factory.PlaceEx(chamber, slot, hand,x,y,z), out reason);
  1539. }
  1540. public virtual bool ExchangeEx(ModuleName chamber, int slot, Hand hand, int x, int y, int z, out string reason)
  1541. {
  1542. reason = string.Empty;
  1543. if (chamber == ModuleName.Robot)
  1544. {
  1545. reason = string.Format("Exchange invalid parameter, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1546. return false;
  1547. }
  1548. if (Blade2Slots > 1)
  1549. {
  1550. reason = string.Format("this robot don't support exchange operation.");
  1551. return false;
  1552. }
  1553. if (hand == Hand.Both)
  1554. {
  1555. reason = string.Format("Exchange invalid parameter,double hand");
  1556. return false;
  1557. }
  1558. if (ModuleHelper.IsLoadPort(chamber))
  1559. {
  1560. if (!checkslot(0, 25, slot))
  1561. {
  1562. reason = string.Format("Exchange invalid parameter,pick, chamber is {0}, slot is {1}", chamber.ToString(), slot);
  1563. return false;
  1564. }
  1565. }
  1566. return execute(_factory.ExchangeEx(chamber, slot, hand, x, y, z), out reason);
  1567. }
  1568. #endregion
  1569. public virtual bool PositionAdjustment( Axis axis, Hand hand, int value, out string reason)
  1570. {
  1571. reason = string.Empty;
  1572. return execute(_factory.PositionAdjustment( axis,hand,value), out reason);
  1573. }
  1574. public virtual bool execute(IHandler handler, out string reason)
  1575. {
  1576. reason = string.Empty;
  1577. lock (_locker)
  1578. {
  1579. if (_foregroundHandler != null)
  1580. {
  1581. reason = "System busy, please wait or reset system.";
  1582. EV.PostMessage(Name, EventEnum.DefaultWarning, string.Format("{0} {1} {2}", this.DeviceID, handler.ToString(), reason));
  1583. return false;
  1584. }
  1585. if (_backgroundHandler != null && handler.IsBackground)
  1586. {
  1587. reason = "System busy,one background command is running, please wait or reset system.";
  1588. EV.PostMessage(Name, EventEnum.DefaultWarning, string.Format("{0} {1} {2}", this.DeviceID, handler.ToString(), reason));
  1589. //reason = "系统忙,后台命令正在处理,暂时不能处理新的后台命令";
  1590. return false;
  1591. }
  1592. handler.Unit = (int)Unit.Robot;
  1593. if(!handler.Execute(ref _socket))
  1594. {
  1595. reason = "Communication error,please check it.";
  1596. OnError(reason);
  1597. return false;
  1598. }
  1599. if (handler.IsBackground)
  1600. _backgroundHandler = handler;
  1601. else
  1602. _foregroundHandler = handler;
  1603. }
  1604. return true;
  1605. }
  1606. public virtual void OnDataChanged(string package)
  1607. {
  1608. try
  1609. {
  1610. if (!package.Contains("Gb") && !package.Contains("Pb"))
  1611. package = package.ToUpper();
  1612. string[] msgs = Regex.Split(package, delimiter);
  1613. foreach (string msg in msgs)
  1614. {
  1615. if (msg.Length > 0)
  1616. {
  1617. bool completed = false;
  1618. string resp = msg;
  1619. lock (_locker)
  1620. {
  1621. if (_foregroundHandler != null && _foregroundHandler.OnMessage(ref _socket, resp, out completed))
  1622. {
  1623. _foregroundHandler = null;
  1624. }
  1625. else if (_backgroundHandler != null && _backgroundHandler.OnMessage(ref _socket, resp, out completed))
  1626. {
  1627. if (completed)
  1628. {
  1629. //string reason = string.Empty;
  1630. //QueryState(out reason);
  1631. _backgroundHandler = null;
  1632. if (ActionDone != null)
  1633. ActionDone(true);
  1634. }
  1635. }
  1636. else
  1637. {
  1638. if (_eventHandler != null)
  1639. {
  1640. if (_eventHandler.OnMessage(ref _socket, resp, out completed))
  1641. {
  1642. if (completed)
  1643. {
  1644. EV.PostMessage("Robot", EventEnum.DefaultWarning, string.Format(" has error. {0:X}", ErrorCode));
  1645. OnError(string.Format("has error. {0:X}", ErrorCode));
  1646. _exceuteErr = true;
  1647. }
  1648. }
  1649. }
  1650. }
  1651. }
  1652. }
  1653. }
  1654. }
  1655. catch (ExcuteFailedException e)
  1656. {
  1657. EV.PostMessage("Robot", EventEnum.DefaultWarning, string.Format("executed failed. {0}",e.Message));
  1658. OnError(string.Format("executed failed. {0}", e.Message));
  1659. _exceuteErr = false;
  1660. }
  1661. catch (InvalidPackageException e)
  1662. {
  1663. EV.PostMessage("Robot", EventEnum.DefaultWarning, string.Format("receive invalid package. {0}", e.Message));
  1664. OnError(string.Format("receive invalid package. {0}", e.Message));
  1665. }
  1666. catch (System.Exception ex)
  1667. {
  1668. _commErr = true;
  1669. LOG.Write("Robot failed:" + ex.ToString());
  1670. }
  1671. }
  1672. private void OnErrorHandler(ErrorEventArgs args)
  1673. {
  1674. _commErr = true;
  1675. Initalized = false;
  1676. EV.PostMessage(Module, EventEnum.CommunicationError, Display, args.Reason);
  1677. OnError("CommunicationError");
  1678. }
  1679. private bool checkslot(int min, int max, int slot)
  1680. {
  1681. return slot >= min && slot < max;
  1682. }
  1683. public void NotifySlotMapResult(ModuleName module, string slotMap)
  1684. {
  1685. if (OnSlotMapRead != null)
  1686. {
  1687. OnSlotMapRead(module, slotMap);
  1688. }
  1689. }
  1690. public void OnError(string errorcode)
  1691. {
  1692. EV.Notify(AlarmRobotError,new SerializableDictionary<string, object> {
  1693. {
  1694. "AlarmText",errorcode
  1695. }
  1696. });
  1697. if (ActionDone != null)
  1698. ActionDone(false);
  1699. }
  1700. public void NotifyWaferPresent(Hand hand, WaferStatus status)
  1701. {
  1702. if (status == WaferStatus.Empty)
  1703. {
  1704. if (hand == Hand.Blade1)
  1705. {
  1706. WaferPresentOnBlade1 = status == WaferStatus.Empty;
  1707. }
  1708. if (hand == Hand.Blade2)
  1709. {
  1710. WaferPresentOnBlade2 = status == WaferStatus.Empty;
  1711. }
  1712. }
  1713. if (status == WaferStatus.Unknown)
  1714. {
  1715. EV.PostWarningLog(Module, "Wafer present unknown");
  1716. return;
  1717. }
  1718. if (hand == Hand.Blade1)
  1719. {
  1720. WaferPresentOnBlade1 = status == WaferStatus.Normal;
  1721. }
  1722. if (hand == Hand.Blade2)
  1723. {
  1724. WaferPresentOnBlade2 = status == WaferStatus.Normal;
  1725. }
  1726. }
  1727. //Active wafer Center finder Data
  1728. public void NotifyAWCData(int rOffset, int tOffset)
  1729. {
  1730. CenterOffsetR = rOffset;
  1731. CenterOffsetT = tOffset;
  1732. }
  1733. }
  1734. }