TMViewModel.cs 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349
  1. using Aitex.Sorter.Common;
  2. using MECF.Framework.Common.CommonData;
  3. using MECF.Framework.Common.DataCenter;
  4. using MECF.Framework.Common.Equipment;
  5. using MECF.Framework.Common.OperationCenter;
  6. using MECF.Framework.Common.Schedulers;
  7. using OpenSEMI.ClientBase;
  8. using Prism.Commands;
  9. using Prism.Mvvm;
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Collections.ObjectModel;
  13. using System.Linq;
  14. using System.Threading.Tasks;
  15. using System.Windows.Threading;
  16. using Venus_Core;
  17. using Venus_MainPages.Unity;
  18. using Venus_Themes.CustomControls;
  19. using Venus_Themes.Unity;
  20. using static Venus_Core.NiceRobotAction;
  21. namespace Venus_MainPages.ViewModels
  22. {
  23. public enum TMModule
  24. {
  25. PMA, PMB, PMC, PMD, LLA, LLB
  26. }
  27. public enum TMBlade
  28. {
  29. Blade1, Blade2
  30. }
  31. internal class TMViewModel : BindableBase
  32. {
  33. #region 私有字段
  34. //private ModuleInfo m_PMAWafer;
  35. private ModuleInfo m_LLAModuleInfo;
  36. private ModuleInfo m_LLBModuleInfo;
  37. private ModuleInfo m_TMModuleInfo;
  38. private bool m_TMIsOFFline;
  39. private bool m_LLIsOFFline;
  40. private WaferInfo m_PMAWafer;
  41. private WaferInfo m_PMBWafer;
  42. private WaferInfo m_PMCWafer;
  43. private WaferInfo m_PMDWafer;
  44. private WaferInfo m_LLAWafer;
  45. private WaferInfo m_LLBWafer;
  46. private WaferInfo m_BladeAWafer;
  47. private WaferInfo m_BladeBWafer;
  48. private bool m_PMADoorIsOpen;
  49. //private bool m_PMBDoorIsOpen;
  50. //private bool m_PMCDoorIsOpen;
  51. //private bool m_PMDDoorIsOpen;
  52. private bool m_LLADoorIsOpen;
  53. //private WaferRobotTAction m_WaferRobotTAction;
  54. //private WaferRobotTAction m_Robot1TAction;
  55. //private WaferRobotXAction m_Robot1XAction;
  56. //private WaferRobotTAction m_Robot2TAction;
  57. //private WaferRobotXAction m_Robot2XAction;
  58. private TMModule m_PickSelectedModule;
  59. private TMModule m_PlaceSelectedModule;
  60. private TMModule m_ExtendSelectedModule;
  61. private TMModule m_RetractSelectedModule;
  62. private TMBlade m_PickSelectedBlade;
  63. private TMBlade m_PlaceSelectedBlade;
  64. private TMBlade m_ExtendSelectedBlade;
  65. private TMBlade m_RetractSelectedBlade;
  66. private TMBlade m_GoToSelectedBlade;
  67. private ObservableCollection<int> m_PlaceSoltItemsSource = new ObservableCollection<int>();
  68. private ObservableCollection<int> m_PickSoltItemsSource = new ObservableCollection<int>();
  69. private ObservableCollection<int> m_ExtendSoltItemsSource = new ObservableCollection<int>();
  70. private ObservableCollection<int> m_RetractSoltItemsSource = new ObservableCollection<int>();
  71. private int m_PickSoltSelectedIndex;
  72. private int m_PlaceSoltSelectedIndex;
  73. private int m_ExtendSoltSelectedIndex;
  74. private int m_RetractSoltSelectedIndex;
  75. private List<string> m_RtDataKeys=new List<string> ();
  76. private Dictionary<string, object> m_RtDataValues;
  77. private string m_ModuleCheckedName="TM";
  78. private string m_RobotAction;
  79. private string m_RobotTarget;
  80. private string m_RobotArm;
  81. private bool m_PMAIsInstalled;
  82. private bool m_PMBIsInstalled;
  83. private bool m_PMCIsInstalled;
  84. private bool m_PMDIsInstalled;
  85. private bool m_LLAIsInstalled;
  86. private bool m_LLBIsInstalled;
  87. private bool m_TMIsInstalled;
  88. private List<string> m_OriginalCycle=new List<string> ();
  89. private List<string> m_ToCycle = new List<string>();
  90. private List<TMModule> m_TMModules= new List<TMModule>();
  91. private bool m_CycleEnable;
  92. private string m_OriginalCycleSelectedItem;
  93. private string m_ToCycleSelectedItem;
  94. private bool m_PMAIsCycle;
  95. private bool m_PMBIsCycle;
  96. private bool m_PMCIsCycle;
  97. private bool m_PMDIsCycle;
  98. private int m_CycleCount;
  99. private PressureType m_PressureType;
  100. private bool m_firstFlag = true;
  101. DispatcherTimer timer;
  102. private NiceXinSongWaferRobotTAction m_BladeNiceXinSongWaferRobotTAction;
  103. //private NiceXinSongWaferRobotTAction m_Blade2NiceXinSongWaferRobotTAction;
  104. private NiceXinSongWaferRobotXAction m_Blade1NiceXinSongWaferRobotXAction;
  105. private NiceXinSongWaferRobotXAction m_Blade2NiceXinSongWaferRobotXAction;
  106. #endregion
  107. #region 属性
  108. public PressureType PressureType
  109. {
  110. get { return m_PressureType; }
  111. set { SetProperty(ref m_PressureType, value); }
  112. }
  113. public List<string> OriginalCycle
  114. {
  115. get { return m_OriginalCycle; }
  116. set { SetProperty(ref m_OriginalCycle, value); }
  117. }
  118. public List<string> ToCycle
  119. {
  120. get { return m_ToCycle; }
  121. set { SetProperty(ref m_ToCycle, value); }
  122. }
  123. public string RobotAction2
  124. {
  125. get { return m_RobotAction; }
  126. set
  127. {
  128. //RobotActiont(m_RobotAction, value);
  129. SetProperty(ref m_RobotAction, value);
  130. }
  131. }
  132. public RobotMoveInfo m_robotMoveInfo;
  133. public RobotMoveInfo RobotMoveInfo
  134. {
  135. get { return m_robotMoveInfo; }
  136. set
  137. {
  138. TMRobotMoveInfoChanged(m_robotMoveInfo, value);
  139. SetProperty(ref m_robotMoveInfo, value);
  140. }
  141. }
  142. public string RobotTarget
  143. {
  144. get { return m_RobotTarget; }
  145. set
  146. {
  147. SetProperty(ref m_RobotTarget, value);
  148. }
  149. }
  150. public string RobotArm
  151. {
  152. get { return m_RobotArm; }
  153. set
  154. {
  155. SetProperty(ref m_RobotArm, value);
  156. }
  157. }
  158. public NiceXinSongWaferRobotTAction BladeNiceXinSongWaferRobotTAction
  159. {
  160. get { return m_BladeNiceXinSongWaferRobotTAction; }
  161. set
  162. {
  163. SetProperty(ref m_BladeNiceXinSongWaferRobotTAction, value);
  164. }
  165. }
  166. //public NiceXinSongWaferRobotTAction Blade2NiceXinSongWaferRobotTAction
  167. //{
  168. // get { return m_Blade2NiceXinSongWaferRobotTAction; }
  169. // set
  170. // {
  171. // SetProperty(ref m_Blade2NiceXinSongWaferRobotTAction, value);
  172. // }
  173. //}
  174. public NiceXinSongWaferRobotXAction Blade1NiceXinSongWaferRobotXAction
  175. {
  176. get { return m_Blade1NiceXinSongWaferRobotXAction; }
  177. set
  178. {
  179. SetProperty(ref m_Blade1NiceXinSongWaferRobotXAction, value);
  180. }
  181. }
  182. public NiceXinSongWaferRobotXAction Blade2NiceXinSongWaferRobotXAction
  183. {
  184. get { return m_Blade2NiceXinSongWaferRobotXAction; }
  185. set
  186. {
  187. SetProperty(ref m_Blade2NiceXinSongWaferRobotXAction, value);
  188. }
  189. }
  190. //int arm1oldWaferStatus = 100;
  191. //int arm2oldWaferStatus = 100;
  192. private async void TMRobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  193. {
  194. string RobotTarget;
  195. if (oldValue == null || newValue == null)
  196. {
  197. return;
  198. }
  199. #region Rotating
  200. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Rotating))
  201. {
  202. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  203. if (TMRobotMoveActionBladeTarget != null)
  204. {
  205. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  206. }
  207. else
  208. {
  209. return;
  210. }
  211. var values = RobotTarget.Split('.');
  212. var arm = values[0];
  213. var module = values[1];
  214. bool isParseOK;
  215. BladeNiceXinSongWaferRobotTAction = CommonFunction.ToEnum<NiceXinSongWaferRobotTAction>(module, out isParseOK);
  216. if (isParseOK == false)
  217. {
  218. return;
  219. }
  220. //if (arm == "ArmA")
  221. //{
  222. //}
  223. //else if (arm == "ArmB")
  224. //{
  225. // Blade2NiceXinSongWaferRobotTAction = (NiceXinSongWaferRobotTAction)Enum.Parse(typeof(NiceXinSongWaferRobotTAction), module, true);
  226. //}
  227. }
  228. #endregion
  229. #region pick 和 place LL
  230. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  231. {
  232. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  233. if (TMRobotMoveActionBladeTarget != null)
  234. {
  235. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  236. }
  237. else
  238. {
  239. return;
  240. }
  241. var values = RobotTarget.Split('.');
  242. var arm = values[0];
  243. var module = values[1];
  244. if (arm == "ArmA")
  245. {
  246. bool isParseOK;
  247. BladeNiceXinSongWaferRobotTAction = CommonFunction.ToEnum<NiceXinSongWaferRobotTAction>(module, out isParseOK);
  248. if (isParseOK == false)
  249. {
  250. return;
  251. }
  252. //var waferRobotTAction = (NiceXinSongWaferRobotTAction)Enum.Parse(typeof(NiceXinSongWaferRobotTAction), module, true);
  253. //BladeNiceXinSongWaferRobotTAction = waferRobotTAction;
  254. await Task.Delay(600);
  255. Blade1NiceXinSongWaferRobotXAction = NiceXinSongWaferRobotXAction.Extend1;
  256. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus == 0))
  257. {
  258. await Task.Delay(100);
  259. }
  260. //Robot1XAction = WaferRobotXAction.Retract;
  261. Blade1NiceXinSongWaferRobotXAction = NiceXinSongWaferRobotXAction.Retract1;
  262. }
  263. else if (arm == "ArmB")
  264. {
  265. bool isParseOK;
  266. BladeNiceXinSongWaferRobotTAction = CommonFunction.ToEnum<NiceXinSongWaferRobotTAction>(module, out isParseOK);
  267. if (isParseOK == false)
  268. {
  269. return;
  270. }
  271. //var waferRobotTAction = (NiceXinSongWaferRobotTAction)Enum.Parse(typeof(NiceXinSongWaferRobotTAction), module, true);
  272. //BladeNiceXinSongWaferRobotTAction = waferRobotTAction;
  273. //var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  274. //var waferRobotTAction = (NiceXinSongWaferRobotTAction)Enum.Parse(typeof(NiceXinSongWaferRobotTAction), module, true);
  275. //Blade2NiceXinSongWaferRobotTAction = waferRobotTAction;
  276. //if (waferRobotTAction != Blade2NiceXinSongWaferRobotTAction)
  277. //{
  278. //}
  279. await Task.Delay(600);
  280. Blade2NiceXinSongWaferRobotXAction = NiceXinSongWaferRobotXAction.Extend2;
  281. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus == 0))
  282. {
  283. await Task.Delay(100);
  284. }
  285. Blade2NiceXinSongWaferRobotXAction = NiceXinSongWaferRobotXAction.Retract2;
  286. }
  287. }
  288. #endregion
  289. #region pick 和 place pm
  290. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Extending)
  291. {
  292. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  293. if (TMRobotMoveActionBladeTarget != null)
  294. {
  295. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  296. }
  297. else
  298. {
  299. return;
  300. }
  301. var values = RobotTarget.Split('.');
  302. var arm = values[0];
  303. var module = values[1];
  304. bool isParseOK;
  305. BladeNiceXinSongWaferRobotTAction = CommonFunction.ToEnum<NiceXinSongWaferRobotTAction>(module, out isParseOK);
  306. if (isParseOK == false)
  307. {
  308. return;
  309. }
  310. //var waferRobotTAction = (NiceXinSongWaferRobotTAction)Enum.Parse(typeof(NiceXinSongWaferRobotTAction), module, true);
  311. //BladeNiceXinSongWaferRobotTAction = waferRobotTAction;
  312. if (arm == "ArmA")
  313. {
  314. await Task.Delay(600);
  315. Blade1NiceXinSongWaferRobotXAction = NiceXinSongWaferRobotXAction.Extend1;
  316. }
  317. else if (arm == "ArmB")
  318. {
  319. await Task.Delay(600);
  320. Blade2NiceXinSongWaferRobotXAction = NiceXinSongWaferRobotXAction.Extend2;
  321. }
  322. }
  323. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Retracting)
  324. {
  325. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  326. if (TMRobotMoveActionBladeTarget != null)
  327. {
  328. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  329. }
  330. else
  331. {
  332. return;
  333. }
  334. var values = RobotTarget.Split('.');
  335. var arm = values[0];
  336. if (arm == "ArmA")
  337. {
  338. //Robot1XAction = WaferRobotXAction.Retract;
  339. Blade1NiceXinSongWaferRobotXAction = NiceXinSongWaferRobotXAction.Retract1;
  340. }
  341. else if (arm == "ArmB")
  342. {
  343. //Robot2XAction = WaferRobotXAction.Retract;
  344. Blade2NiceXinSongWaferRobotXAction = NiceXinSongWaferRobotXAction.Retract2;
  345. }
  346. }
  347. #endregion
  348. #region Home
  349. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  350. {
  351. Blade1NiceXinSongWaferRobotXAction = NiceXinSongWaferRobotXAction.Retract1;
  352. Blade2NiceXinSongWaferRobotXAction = NiceXinSongWaferRobotXAction.Retract2;
  353. await Task.Delay(2000);
  354. BladeNiceXinSongWaferRobotTAction = NiceXinSongWaferRobotTAction.T_Origin;
  355. }
  356. #endregion
  357. }
  358. //private async void RobotActiont(string oldValue,string newValue)
  359. //{
  360. // if (oldValue == "None" && newValue == "Placing" && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus==1)
  361. // {
  362. // var TMRobotMoveActionBladeTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.BladeTarget");
  363. // if (TMRobotMoveActionBladeTarget != null)
  364. // {
  365. // RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  366. // }
  367. // else
  368. // {
  369. // return;
  370. // }
  371. // var values = RobotTarget.Split('.');
  372. // var arm = values[0];
  373. // var module = values[1];
  374. // Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  375. // await Task.Delay(1500);
  376. // Robot1XAction = WaferRobotXAction.Extend;
  377. // if (arm == "ArmA")
  378. // {
  379. // Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  380. // await Task.Delay(1500);
  381. // Robot1XAction = WaferRobotXAction.Extend;
  382. // }
  383. // else if (arm == "ArmB")
  384. // {
  385. // Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  386. // await Task.Delay(1500);
  387. // Robot2XAction = WaferRobotXAction.Extend;
  388. // }
  389. // }
  390. // if (oldValue == "None" && newValue == "Placing" && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1].WaferStatus == 1)
  391. // {
  392. // var TMRobotMoveActionBladeTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.BladeTarget");
  393. // if (TMRobotMoveActionBladeTarget != null)
  394. // {
  395. // RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  396. // }
  397. // else
  398. // {
  399. // return;
  400. // }
  401. // var values = RobotTarget.Split('.');
  402. // var arm = values[0];
  403. // var module = values[1];
  404. // if (arm == "ArmA")
  405. // {
  406. // Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  407. // await Task.Delay(1500);
  408. // Robot1XAction = WaferRobotXAction.Extend;
  409. // }
  410. // else if (arm == "ArmB")
  411. // {
  412. // Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  413. // await Task.Delay(1500);
  414. // Robot2XAction = WaferRobotXAction.Extend;
  415. // }
  416. // //Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  417. // //await Task.Delay(1500);
  418. // //Robot2XAction = WaferRobotXAction.Extend;
  419. // }
  420. // if (arm1oldWaferStatus != ModuleManager.ModuleInfos["TM"].WaferManager.Wafers[0].WaferStatus)
  421. // {
  422. // Robot1XAction = WaferRobotXAction.Retract;
  423. // }
  424. // if (arm2oldWaferStatus != ModuleManager.ModuleInfos["TM"].WaferManager.Wafers[1].WaferStatus)
  425. // {
  426. // Robot2XAction = WaferRobotXAction.Retract;
  427. // }
  428. // if (oldValue == "None" && newValue == "Picking" && ModuleManager.ModuleInfos["TM"].WaferManager.Wafers[1].WaferStatus == 0)
  429. // {
  430. // var TMRobotMoveActionBladeTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.BladeTarget");
  431. // if (TMRobotMoveActionBladeTarget != null)
  432. // {
  433. // RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  434. // }
  435. // else
  436. // {
  437. // return;
  438. // }
  439. // var values = RobotTarget.Split('.');
  440. // var arm = values[0];
  441. // var module = values[1];
  442. // if (arm == "ArmA")
  443. // {
  444. // Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  445. // await Task.Delay(1500);
  446. // Robot1XAction = WaferRobotXAction.Extend;
  447. // }
  448. // else if (arm == "ArmB")
  449. // {
  450. // Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  451. // await Task.Delay(1500);
  452. // Robot2XAction = WaferRobotXAction.Extend;
  453. // }
  454. // }
  455. // #region pick 和 place pm
  456. // if (oldValue == "None" && newValue == "Extending")
  457. // {
  458. // var TMRobotMoveActionBladeTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.BladeTarget");
  459. // if (TMRobotMoveActionBladeTarget != null)
  460. // {
  461. // RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  462. // }
  463. // else
  464. // {
  465. // return;
  466. // }
  467. // var values = RobotTarget.Split('.');
  468. // var arm = values[0];
  469. // var module = values[1];
  470. // if (arm == "ArmA")
  471. // {
  472. // Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  473. // await Task.Delay(1500);
  474. // Robot1XAction = WaferRobotXAction.Extend;
  475. // }
  476. // else if (arm == "ArmB")
  477. // {
  478. // Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  479. // await Task.Delay(1500);
  480. // Robot2XAction = WaferRobotXAction.Extend;
  481. // }
  482. // }
  483. // if (oldValue == "None" && newValue == "Retracting")
  484. // {
  485. // var TMRobotMoveActionBladeTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.BladeTarget");
  486. // if (TMRobotMoveActionBladeTarget != null)
  487. // {
  488. // RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  489. // }
  490. // else
  491. // {
  492. // return;
  493. // }
  494. // var values = RobotTarget.Split('.');
  495. // var arm = values[0];
  496. // if (arm == "ArmA")
  497. // {
  498. // Robot1XAction = WaferRobotXAction.Retract;
  499. // }
  500. // else if (arm == "ArmB")
  501. // {
  502. // Robot2XAction = WaferRobotXAction.Retract;
  503. // }
  504. // }
  505. // #endregion
  506. // arm1oldWaferStatus = ModuleManager.ModuleInfos["TM"].WaferManager.Wafers[0].WaferStatus;
  507. // arm2oldWaferStatus = ModuleManager.ModuleInfos["TM"].WaferManager.Wafers[1].WaferStatus;
  508. //}
  509. public WaferInfo LLAWafer
  510. {
  511. get { return m_LLAWafer; }
  512. set { SetProperty(ref m_LLAWafer, value); }
  513. }
  514. public WaferInfo LLBWafer
  515. {
  516. get { return m_LLBWafer; }
  517. set { SetProperty(ref m_LLBWafer, value); }
  518. }
  519. public WaferInfo PMAWafer
  520. {
  521. get { return m_PMAWafer; }
  522. set { SetProperty(ref m_PMAWafer, value); }
  523. }
  524. public WaferInfo PMBWafer
  525. {
  526. get { return m_PMBWafer; }
  527. set { SetProperty(ref m_PMBWafer, value); }
  528. }
  529. public WaferInfo PMCWafer
  530. {
  531. get { return m_PMCWafer; }
  532. set { SetProperty(ref m_PMCWafer, value); }
  533. }
  534. public WaferInfo PMDWafer
  535. {
  536. get { return m_PMDWafer; }
  537. set { SetProperty(ref m_PMDWafer, value); }
  538. }
  539. public WaferInfo BladeAWafer
  540. {
  541. get { return m_BladeAWafer; }
  542. set { SetProperty(ref m_BladeAWafer, value); }
  543. }
  544. public WaferInfo BladeBWafer
  545. {
  546. get { return m_BladeBWafer; }
  547. set { SetProperty(ref m_BladeBWafer, value); }
  548. }
  549. public ModuleInfo LLAModuleInfo
  550. {
  551. get { return m_LLAModuleInfo; }
  552. set { SetProperty(ref m_LLAModuleInfo, value); }
  553. }
  554. public ModuleInfo LLBModuleInfo
  555. {
  556. get { return m_LLBModuleInfo; }
  557. set { SetProperty(ref m_LLBModuleInfo, value); }
  558. }
  559. public ModuleInfo TMModuleInfo
  560. {
  561. get { return m_TMModuleInfo; }
  562. set { SetProperty(ref m_TMModuleInfo, value); }
  563. }
  564. public bool TMIsOFFline
  565. {
  566. get { return m_TMIsOFFline; }
  567. set { SetProperty(ref m_TMIsOFFline, value); }
  568. }
  569. public bool LLIsOFFline
  570. {
  571. get { return m_LLIsOFFline; }
  572. set { SetProperty(ref m_LLIsOFFline, value); }
  573. }
  574. public bool PMADoorIsOpen
  575. {
  576. get { return m_PMADoorIsOpen; }
  577. set { SetProperty(ref m_PMADoorIsOpen, value); }
  578. }
  579. public bool LLADoorIsOpen
  580. {
  581. get { return m_LLADoorIsOpen; }
  582. set { SetProperty(ref m_LLADoorIsOpen, value); }
  583. }
  584. //public WaferRobotTAction WaferRobotTAction
  585. //{
  586. // get { return m_WaferRobotTAction; }
  587. // set { SetProperty(ref m_WaferRobotTAction, value); }
  588. //}
  589. //public WaferRobotTAction Robot1TAction
  590. //{
  591. // get { return m_Robot1TAction; }
  592. // set { SetProperty(ref m_Robot1TAction, value); }
  593. //}
  594. //public WaferRobotXAction Robot1XAction
  595. //{
  596. // get { return m_Robot1XAction; }
  597. // set { SetProperty(ref m_Robot1XAction, value); }
  598. //}
  599. //public WaferRobotTAction Robot2TAction
  600. //{
  601. // get { return m_Robot2TAction; }
  602. // set { SetProperty(ref m_Robot2TAction, value); }
  603. //}
  604. //public WaferRobotXAction Robot2XAction
  605. //{
  606. // get { return m_Robot2XAction; }
  607. // set { SetProperty(ref m_Robot2XAction, value); }
  608. //}
  609. public TMModule PickSelectedModule
  610. {
  611. get { return m_PickSelectedModule; }
  612. set { SetProperty(ref m_PickSelectedModule, value); }
  613. }
  614. public TMModule PlaceSelectedModule
  615. {
  616. get { return m_PlaceSelectedModule; }
  617. set { SetProperty(ref m_PlaceSelectedModule, value); }
  618. }
  619. public TMModule ExtendSelectedModule
  620. {
  621. get { return m_ExtendSelectedModule; }
  622. set { SetProperty(ref m_ExtendSelectedModule, value); }
  623. }
  624. public TMModule RetractSelectedModule
  625. {
  626. get { return m_RetractSelectedModule; }
  627. set { SetProperty(ref m_RetractSelectedModule, value); }
  628. }
  629. public TMBlade PickSelectedBlade
  630. {
  631. get { return m_PickSelectedBlade; }
  632. set { SetProperty(ref m_PickSelectedBlade, value); }
  633. }
  634. public TMBlade PlaceSelectedBlade
  635. {
  636. get { return m_PlaceSelectedBlade; }
  637. set { SetProperty(ref m_PlaceSelectedBlade, value); }
  638. }
  639. public TMBlade ExtendSelectedBlade
  640. {
  641. get { return m_ExtendSelectedBlade; }
  642. set { SetProperty(ref m_ExtendSelectedBlade, value); }
  643. }
  644. public TMBlade RetractSelectedBlade
  645. {
  646. get { return m_RetractSelectedBlade; }
  647. set { SetProperty(ref m_RetractSelectedBlade, value); }
  648. }
  649. public TMBlade GoToSelectedBlade
  650. {
  651. get { return m_GoToSelectedBlade; }
  652. set { SetProperty(ref m_GoToSelectedBlade, value); }
  653. }
  654. public ObservableCollection<int> PickSoltItemsSource
  655. {
  656. get { return m_PickSoltItemsSource; }
  657. set { SetProperty(ref m_PickSoltItemsSource, value); }
  658. }
  659. public ObservableCollection<int> PlaceSoltItemsSource
  660. {
  661. get { return m_PlaceSoltItemsSource; }
  662. set { SetProperty(ref m_PlaceSoltItemsSource, value); }
  663. }
  664. public ObservableCollection<int> ExtendSoltItemsSource
  665. {
  666. get { return m_ExtendSoltItemsSource; }
  667. set { SetProperty(ref m_ExtendSoltItemsSource, value); }
  668. }
  669. public ObservableCollection<int> RetractSoltItemsSource
  670. {
  671. get { return m_RetractSoltItemsSource; }
  672. set { SetProperty(ref m_RetractSoltItemsSource, value); }
  673. }
  674. public int PickSoltSelectedIndex
  675. {
  676. get { return m_PickSoltSelectedIndex; }
  677. set { SetProperty(ref m_PickSoltSelectedIndex, value); }
  678. }
  679. public int PlaceSoltSelectedIndex
  680. {
  681. get { return m_PlaceSoltSelectedIndex; }
  682. set { SetProperty(ref m_PlaceSoltSelectedIndex, value); }
  683. }
  684. public int ExtendSoltSelectedIndex
  685. {
  686. get { return m_ExtendSoltSelectedIndex; }
  687. set { SetProperty(ref m_ExtendSoltSelectedIndex, value); }
  688. }
  689. public int RetractSoltSelectedIndex
  690. {
  691. get { return m_RetractSoltSelectedIndex; }
  692. set { SetProperty(ref m_RetractSoltSelectedIndex, value); }
  693. }
  694. public Dictionary<string, object> RtDataValues
  695. {
  696. get { return m_RtDataValues; }
  697. set { SetProperty(ref m_RtDataValues, value); }
  698. }
  699. public bool PMAIsInstalled
  700. {
  701. get { return m_PMAIsInstalled; }
  702. set { SetProperty(ref m_PMAIsInstalled, value); }
  703. }
  704. public bool PMBIsInstalled
  705. {
  706. get { return m_PMBIsInstalled; }
  707. set { SetProperty(ref m_PMBIsInstalled, value); }
  708. }
  709. public bool PMCIsInstalled
  710. {
  711. get { return m_PMCIsInstalled; }
  712. set { SetProperty(ref m_PMCIsInstalled, value); }
  713. }
  714. public bool PMDIsInstalled
  715. {
  716. get { return m_PMDIsInstalled; }
  717. set { SetProperty(ref m_PMDIsInstalled, value); }
  718. }
  719. public bool LLAIsInstalled
  720. {
  721. get { return m_LLAIsInstalled; }
  722. set { SetProperty(ref m_LLAIsInstalled, value); }
  723. }
  724. public bool LLBIsInstalled
  725. {
  726. get { return m_LLBIsInstalled; }
  727. set { SetProperty(ref m_LLBIsInstalled, value); }
  728. }
  729. public bool TMIsInstalled
  730. {
  731. get { return m_TMIsInstalled; }
  732. set { SetProperty(ref m_TMIsInstalled, value); }
  733. }
  734. public List<TMModule> TMModules
  735. {
  736. get { return m_TMModules; }
  737. set { SetProperty(ref m_TMModules, value); }
  738. }
  739. public bool CycleEnable
  740. {
  741. get { return m_CycleEnable; }
  742. set { SetProperty(ref m_CycleEnable, value); }
  743. }
  744. public string OriginalCycleSelectedItem
  745. {
  746. get { return m_OriginalCycleSelectedItem; }
  747. set { SetProperty(ref m_OriginalCycleSelectedItem, value); }
  748. }
  749. public string ToCycleSelectedItem
  750. {
  751. get { return m_ToCycleSelectedItem; }
  752. set { SetProperty(ref m_ToCycleSelectedItem, value); }
  753. }
  754. public bool PMAIsCycle
  755. {
  756. get { return m_PMAIsCycle; }
  757. set { SetProperty(ref m_PMAIsCycle, value); }
  758. }
  759. public bool PMBIsCycle
  760. {
  761. get { return m_PMBIsCycle; }
  762. set { SetProperty(ref m_PMBIsCycle, value); }
  763. }
  764. public bool PMCIsCycle
  765. {
  766. get { return m_PMCIsCycle; }
  767. set { SetProperty(ref m_PMCIsCycle, value); }
  768. }
  769. public bool PMDIsCycle
  770. {
  771. get { return m_PMDIsCycle; }
  772. set { SetProperty(ref m_PMDIsCycle, value); }
  773. }
  774. public int CycleCount
  775. {
  776. get { return m_CycleCount; }
  777. set { SetProperty(ref m_CycleCount, value); }
  778. }
  779. #endregion
  780. #region 命令
  781. private DelegateCommand _RobotHomeCommand;
  782. public DelegateCommand RobotHomeCommand =>
  783. _RobotHomeCommand ?? (_RobotHomeCommand = new DelegateCommand(OnRobotHome));
  784. private DelegateCommand _GotoCommand;
  785. public DelegateCommand GotoCommand =>
  786. _GotoCommand ?? (_GotoCommand = new DelegateCommand(OnGoto));
  787. private DelegateCommand _ExtendCommand;
  788. public DelegateCommand ExtendCommand =>
  789. _ExtendCommand ?? (_ExtendCommand = new DelegateCommand(OnExtend));
  790. private DelegateCommand _RetractCommand;
  791. public DelegateCommand RetractCommand =>
  792. _RetractCommand ?? (_RetractCommand = new DelegateCommand(OnRetract));
  793. private DelegateCommand<object> _ModuleChangeCommand;
  794. public DelegateCommand<object> ModuleChangeCommand =>
  795. _ModuleChangeCommand ?? (_ModuleChangeCommand = new DelegateCommand<object>(OnModuleChange));
  796. private DelegateCommand _PickCommand;
  797. public DelegateCommand PickCommand =>
  798. _PickCommand ?? (_PickCommand = new DelegateCommand(OnPick));
  799. private DelegateCommand _PlaceCommand;
  800. public DelegateCommand PlaceCommand =>
  801. _PlaceCommand ?? (_PlaceCommand = new DelegateCommand(OnPlace));
  802. private DelegateCommand _HomeCommand;
  803. public DelegateCommand HomeCommand =>
  804. _HomeCommand ?? (_HomeCommand = new DelegateCommand(OnHome));
  805. private DelegateCommand _VentCommand;
  806. public DelegateCommand VentCommand =>
  807. _VentCommand ?? (_VentCommand = new DelegateCommand(OnVent));
  808. private DelegateCommand _PumpCommand;
  809. public DelegateCommand PumpCommand =>
  810. _PumpCommand ?? (_PumpCommand = new DelegateCommand(OnPump));
  811. private DelegateCommand _PurgeCommand;
  812. public DelegateCommand PurgeCommand =>
  813. _PurgeCommand ?? (_PurgeCommand = new DelegateCommand(OnPurge));
  814. private DelegateCommand<object> _ModuleCheckedCommand;
  815. public DelegateCommand<object> ModuleCheckedCommand =>
  816. _ModuleCheckedCommand ?? (_ModuleCheckedCommand = new DelegateCommand<object>(OnModuleChecked));
  817. private DelegateCommand _AbortCommand;
  818. public DelegateCommand AbortCommand =>
  819. _AbortCommand ?? (_AbortCommand = new DelegateCommand(OnAbort));
  820. private DelegateCommand _StartCycleCommand;
  821. public DelegateCommand StartCycleCommand =>
  822. _StartCycleCommand ?? (_StartCycleCommand = new DelegateCommand(OnStartCycle));
  823. private DelegateCommand _StopCycleCommand;
  824. public DelegateCommand StopCycleCommand =>
  825. _StopCycleCommand ?? (_StopCycleCommand = new DelegateCommand(OnStopCycle));
  826. private DelegateCommand _SystemHomeCommand;
  827. public DelegateCommand SystemHomeCommand =>
  828. _SystemHomeCommand ?? (_SystemHomeCommand = new DelegateCommand(OnSystemHome));
  829. private DelegateCommand<object> _ChamberDoorOpenCommand;
  830. public DelegateCommand<object> ChamberDoorOpenCommand =>
  831. _ChamberDoorOpenCommand ?? (_ChamberDoorOpenCommand = new DelegateCommand<object>(OnChamberDoorOpen));
  832. private DelegateCommand<object> _ChamberDoorCloseCommand;
  833. public DelegateCommand<object> ChamberDoorCloseCommand =>
  834. _ChamberDoorCloseCommand ?? (_ChamberDoorCloseCommand = new DelegateCommand<object>(OnChamberDoorClose));
  835. private DelegateCommand _LoadCommand;
  836. public DelegateCommand LoadCommand =>
  837. _LoadCommand ?? (_LoadCommand = new DelegateCommand(OnLoad));
  838. #endregion
  839. #region 构造函数
  840. public TMViewModel()
  841. {
  842. string allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString();
  843. PMAIsInstalled = allModules.Contains("PMA");
  844. PMBIsInstalled = allModules.Contains("PMB");
  845. PMCIsInstalled = allModules.Contains("PMC");
  846. PMDIsInstalled = allModules.Contains("PMD");
  847. LLAIsInstalled = allModules.Contains("LLA");
  848. LLBIsInstalled = allModules.Contains("LLB");
  849. TMIsInstalled= allModules.Contains("TM");
  850. if (PMAIsInstalled == true)
  851. {
  852. TMModules.Add(TMModule.PMA);
  853. }
  854. if (PMBIsInstalled == true)
  855. {
  856. TMModules.Add(TMModule.PMB);
  857. }
  858. if (PMCIsInstalled == true)
  859. {
  860. TMModules.Add(TMModule.PMC);
  861. }
  862. if (PMDIsInstalled == true)
  863. {
  864. TMModules.Add(TMModule.PMD);
  865. }
  866. if (LLAIsInstalled == true)
  867. {
  868. OriginalCycle.Add("LLA");
  869. ToCycle.Add("LLA");
  870. TMModules.Add(TMModule.LLA);
  871. }
  872. if (LLBIsInstalled == true)
  873. {
  874. OriginalCycle.Add("LLB");
  875. ToCycle.Add("LLB");
  876. TMModules.Add(TMModule.LLB);
  877. }
  878. addDataKeys();
  879. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  880. timer = new DispatcherTimer();
  881. timer.Interval = TimeSpan.FromSeconds(0.1);
  882. timer.Tick += Timer_Tick;
  883. timer.Start();
  884. PickSoltItemsSource.Add(1);
  885. PlaceSoltItemsSource.Add(1);
  886. ExtendSoltItemsSource.Add(1);
  887. RetractSoltItemsSource.Add(1);
  888. }
  889. private void Timer_Tick(object sender, EventArgs e)
  890. {
  891. if (LLAIsInstalled == true)
  892. {
  893. LLAWafer = ModuleManager.ModuleInfos["LLA"].WaferManager.Wafers.FirstOrDefault(x=>x.WaferStatus!=0);
  894. LLAModuleInfo = ModuleManager.ModuleInfos["LLA"];
  895. }
  896. if (LLBIsInstalled == true)
  897. {
  898. LLBWafer = ModuleManager.ModuleInfos["LLB"].WaferManager.Wafers.FirstOrDefault(x => x.WaferStatus != 0);
  899. LLBModuleInfo = ModuleManager.ModuleInfos["LLB"];
  900. }
  901. if (PMAIsInstalled == true)
  902. {
  903. PMAWafer = ModuleManager.ModuleInfos["PMA"].WaferManager.Wafers[0];
  904. }
  905. if (PMBIsInstalled == true)
  906. {
  907. PMBWafer = ModuleManager.ModuleInfos["PMB"].WaferManager.Wafers[0];
  908. }
  909. if (PMCIsInstalled == true)
  910. {
  911. PMCWafer = ModuleManager.ModuleInfos["PMC"].WaferManager.Wafers[0];
  912. }
  913. if (PMDIsInstalled == true)
  914. {
  915. PMDWafer = ModuleManager.ModuleInfos["PMD"].WaferManager.Wafers[0];
  916. }
  917. if (TMIsInstalled == true)
  918. {
  919. BladeAWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0];
  920. BladeBWafer = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[1];
  921. TMModuleInfo = ModuleManager.ModuleInfos["TMRobot"];
  922. }
  923. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  924. var TMRobotMoveActionArmTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.ArmTarget");
  925. if (TMRobotMoveActionArmTarget != null)
  926. {
  927. RobotArm = ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].WaferStatus.ToString();
  928. }
  929. var TMRobotMoveActionBladeTarget = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.BladeTarget");
  930. if (TMRobotMoveActionBladeTarget != null)
  931. {
  932. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  933. }
  934. var TMRobotMoveActionRobotAction = QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction.RobotAction");
  935. if (TMRobotMoveActionRobotAction != null)
  936. {
  937. RobotAction2 = TMRobotMoveActionRobotAction.ToString();
  938. }
  939. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction");
  940. }
  941. #endregion
  942. #region 命令方法
  943. private void OnRobotHome()
  944. {
  945. InvokeClient.Instance.Service.DoOperation($"TM.RobotHome", "TMRobot");
  946. }
  947. private void OnGoto()
  948. {
  949. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), BladeNiceXinSongWaferRobotTAction.ToString(), true);
  950. var selectedHand = (Hand)Enum.Parse(typeof(Hand), GoToSelectedBlade.ToString(), true);
  951. InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.Goto}", moduleName, selectedHand, selectedHand);
  952. }
  953. private void OnExtend()
  954. {
  955. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), ExtendSelectedModule.ToString(), true);
  956. var selectedHand = (Hand)Enum.Parse(typeof(Hand), ExtendSelectedBlade.ToString(), true);
  957. InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.Extend}", moduleName, selectedHand, selectedHand);
  958. }
  959. private void OnRetract()
  960. {
  961. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), RetractSelectedModule.ToString(), true);
  962. var selectedHand = (Hand)Enum.Parse(typeof(Hand), RetractSelectedBlade.ToString(), true);
  963. InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.Retract}", moduleName, selectedHand, selectedHand);
  964. }
  965. private void OnModuleChange(object obj)
  966. {
  967. var value = obj.ToString();
  968. switch (value)
  969. {
  970. case "Pick":
  971. PickSoltItemsSource.Clear();
  972. if ((int)PickSelectedModule == 4)
  973. {
  974. for (int i = 1; i <= LLAModuleInfo.WaferManager.Wafers.Count; i++)
  975. {
  976. PickSoltItemsSource.Add(i);
  977. }
  978. }
  979. else if ((int)PickSelectedModule == 5)
  980. {
  981. for (int i = 1; i <= LLBModuleInfo.WaferManager.Wafers.Count; i++)
  982. {
  983. PickSoltItemsSource.Add(i);
  984. }
  985. }
  986. else
  987. {
  988. PickSoltItemsSource.Add(1);
  989. }
  990. PickSoltSelectedIndex = 0;
  991. break;
  992. case "Place":
  993. PlaceSoltItemsSource.Clear();
  994. if ((int)PlaceSelectedModule == 4)
  995. {
  996. for (int i = 1; i <= LLAModuleInfo.WaferManager.Wafers.Count; i++)
  997. {
  998. PlaceSoltItemsSource.Add(i);
  999. }
  1000. }
  1001. else if ((int)PlaceSelectedModule == 5)
  1002. {
  1003. for (int i = 1; i <= LLBModuleInfo.WaferManager.Wafers.Count; i++)
  1004. {
  1005. PlaceSoltItemsSource.Add(i);
  1006. }
  1007. }
  1008. else
  1009. {
  1010. PlaceSoltItemsSource.Add(1);
  1011. }
  1012. PlaceSoltSelectedIndex = 0;
  1013. break;
  1014. case "Extend":
  1015. ExtendSoltItemsSource.Clear();
  1016. if ((int)ExtendSelectedModule == 4)
  1017. {
  1018. for (int i = 1; i <= LLAModuleInfo.WaferManager.Wafers.Count; i++)
  1019. {
  1020. ExtendSoltItemsSource.Add(i);
  1021. }
  1022. }
  1023. else if ((int)ExtendSelectedModule == 5)
  1024. {
  1025. for (int i = 1; i <= LLBModuleInfo.WaferManager.Wafers.Count; i++)
  1026. {
  1027. ExtendSoltItemsSource.Add(i);
  1028. }
  1029. }
  1030. else
  1031. {
  1032. ExtendSoltItemsSource.Add(1);
  1033. }
  1034. ExtendSoltSelectedIndex = 0;
  1035. break;
  1036. case "Retract":
  1037. RetractSoltItemsSource.Clear();
  1038. if ((int)RetractSelectedModule == 4)
  1039. {
  1040. for (int i = 1; i <= LLAModuleInfo.WaferManager.Wafers.Count; i++)
  1041. {
  1042. RetractSoltItemsSource.Add(i);
  1043. }
  1044. //RetractSoltItemsSource = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8 };
  1045. }
  1046. else if ((int)RetractSelectedModule == 5)
  1047. {
  1048. for (int i = 1; i <= LLBModuleInfo.WaferManager.Wafers.Count; i++)
  1049. {
  1050. RetractSoltItemsSource.Add(i);
  1051. }
  1052. }
  1053. else
  1054. {
  1055. RetractSoltItemsSource.Add(1);
  1056. }
  1057. RetractSoltSelectedIndex = 0;
  1058. break;
  1059. }
  1060. }
  1061. private void OnPick()
  1062. {
  1063. Queue<MoveItem> moveItems = new Queue<MoveItem>();
  1064. var moduleName= (ModuleName)Enum.Parse(typeof(ModuleName), PickSelectedModule.ToString(), true);
  1065. var selectedHand= (Hand)Enum.Parse(typeof(Hand), PickSelectedBlade.ToString(), true);
  1066. MoveItem moveItem = new MoveItem(moduleName, PickSoltItemsSource[PickSoltSelectedIndex] - 1, 0, 0, selectedHand);
  1067. moveItems.Enqueue(moveItem);
  1068. if ((int)PickSelectedModule > 3)
  1069. {
  1070. InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.LLPick}", moveItems);
  1071. }
  1072. else
  1073. {
  1074. InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.PMPick}", moveItems);
  1075. }
  1076. }
  1077. private void OnPlace()
  1078. {
  1079. Queue<MoveItem> moveItems = new Queue<MoveItem>();
  1080. var moduleName = (ModuleName)Enum.Parse(typeof(ModuleName), PlaceSelectedModule.ToString(), true);
  1081. var selectedHand = (Hand)Enum.Parse(typeof(Hand), PlaceSelectedBlade.ToString(), true);
  1082. MoveItem moveItem = new MoveItem(0,0,moduleName, PlaceSoltItemsSource[PlaceSoltSelectedIndex]-1, selectedHand);
  1083. moveItems.Enqueue(moveItem);
  1084. if ((int)PlaceSelectedModule > 3)
  1085. {
  1086. InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.LLPlace}", moveItems);
  1087. }
  1088. else
  1089. {
  1090. InvokeClient.Instance.Service.DoOperation($"TM.{RtOperation.PMPlace}", moveItems);
  1091. }
  1092. }
  1093. private void OnHome()
  1094. {
  1095. InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.Home");
  1096. }
  1097. private void OnVent()
  1098. {
  1099. InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.Vent}");
  1100. }
  1101. private void OnPump()
  1102. {
  1103. InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.Pump}");
  1104. }
  1105. private void OnPurge()
  1106. {
  1107. InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.Purge}");
  1108. }
  1109. private void OnModuleChecked(object obj)
  1110. {
  1111. m_ModuleCheckedName=obj.ToString();
  1112. }
  1113. private void OnAbort()
  1114. {
  1115. InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.Abort}");
  1116. }
  1117. private void OnStartCycle()
  1118. {
  1119. if (CycleEnable == false)
  1120. {
  1121. return;
  1122. }
  1123. List<string> strings = new List<string>();
  1124. if (OriginalCycleSelectedItem != "")
  1125. {
  1126. strings.Add(OriginalCycleSelectedItem);
  1127. }
  1128. else
  1129. {
  1130. return;
  1131. }
  1132. if (PMAIsCycle==true)
  1133. {
  1134. strings.Add("PMA");
  1135. }
  1136. if (PMBIsCycle == true)
  1137. {
  1138. strings.Add("PMB");
  1139. }
  1140. if (PMCIsCycle == true)
  1141. {
  1142. strings.Add("PMC");
  1143. }
  1144. if (PMDIsCycle == true)
  1145. {
  1146. strings.Add("PMD");
  1147. }
  1148. if (ToCycleSelectedItem != "")
  1149. {
  1150. strings.Add(ToCycleSelectedItem);
  1151. }
  1152. else
  1153. {
  1154. return;
  1155. }
  1156. InvokeClient.Instance.Service.DoOperation("TMCycle.Start", strings.ToArray(),CycleCount);
  1157. }
  1158. private void OnStopCycle()
  1159. {
  1160. InvokeClient.Instance.Service.DoOperation("TMCycle.Abort");
  1161. }
  1162. private void OnSystemHome()
  1163. {
  1164. InvokeClient.Instance.Service.DoOperation("System.Home");
  1165. }
  1166. private void OnChamberDoorOpen(object obj)
  1167. {
  1168. InvokeClient.Instance.Service.DoOperation($"{obj?.ToString()}.SlitDoor.Open");
  1169. }
  1170. private void OnChamberDoorClose(object obj)
  1171. {
  1172. InvokeClient.Instance.Service.DoOperation($"{obj?.ToString()}.SlitDoor.Close");
  1173. }
  1174. private void OnLoad()
  1175. {
  1176. if (m_firstFlag)
  1177. {
  1178. object obj = QueryDataClient.Instance.Service.GetData("System.PressureUnitType");
  1179. PressureType = (PressureType)Convert.ToInt32(obj);
  1180. m_firstFlag = false;
  1181. }
  1182. }
  1183. #endregion
  1184. #region 私有方法
  1185. private void addDataKeys()
  1186. {
  1187. m_RtDataKeys.Add("PMA.IsSlitDoorClosed");
  1188. m_RtDataKeys.Add("PMB.IsSlitDoorClosed");
  1189. m_RtDataKeys.Add("PMC.IsSlitDoorClosed");
  1190. m_RtDataKeys.Add("PMD.IsSlitDoorClosed");
  1191. m_RtDataKeys.Add("TM.LLATSlitDoor.IsClosed");
  1192. m_RtDataKeys.Add("TM.LLBTSlitDoor.IsClosed");
  1193. m_RtDataKeys.Add("TM.LLAESlitDoor.IsClosed");
  1194. m_RtDataKeys.Add("TM.LLBESlitDoor.IsClosed");
  1195. m_RtDataKeys.Add("TMCycle.CycleIndex");
  1196. m_RtDataKeys.Add("PMA.CalculationPressure");
  1197. m_RtDataKeys.Add("PMB.CalculationPressure");
  1198. m_RtDataKeys.Add("PMC.CalculationPressure");
  1199. m_RtDataKeys.Add("PMD.CalculationPressure");
  1200. m_RtDataKeys.Add("TM.PMASlitDoor.IsClosed");
  1201. m_RtDataKeys.Add("TM.PMBSlitDoor.IsClosed");
  1202. m_RtDataKeys.Add("TM.PMCSlitDoor.IsClosed");
  1203. m_RtDataKeys.Add("TM.PMDSlitDoor.IsClosed");
  1204. m_RtDataKeys.Add("TM.TMProcessGauge.Value");
  1205. m_RtDataKeys.Add("TM.IsOnline");
  1206. }
  1207. public void EnterExitView(bool isEnter)
  1208. {
  1209. if (isEnter)
  1210. {
  1211. Timer_Tick(null, null);
  1212. timer.Start();
  1213. }
  1214. else
  1215. {
  1216. timer.Stop();
  1217. }
  1218. }
  1219. #endregion
  1220. }
  1221. }