TMViewModel.cs 51 KB

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