VenusDeOperationOverViewModel.cs 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168
  1. using MECF.Framework.Common.CommonData;
  2. using MECF.Framework.Common.DataCenter;
  3. using MECF.Framework.Common.Equipment;
  4. using MECF.Framework.Common.OperationCenter;
  5. using OpenSEMI.ClientBase;
  6. using Prism.Commands;
  7. using Prism.Mvvm;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using Venus_Core;
  14. using Venus_Themes.CustomControls;
  15. using System.Windows.Threading;
  16. using Venus_MainPages.Unity;
  17. using Microsoft.VisualBasic;
  18. using ExcelLibrary.BinaryFileFormat;
  19. using MECF.Framework.Common.Schedulers;
  20. using Venus_MainPages.Views;
  21. using System.Windows;
  22. using static Venus_Themes.CustomControls.SERobot;
  23. using System.Security.RightsManagement;
  24. namespace Venus_MainPages.ViewModels
  25. {
  26. public class VenusDeOperationOverViewModel : BindableBase
  27. {
  28. #region 私有字段
  29. private ModuleInfo m_VCEAModuleInfo;
  30. private ModuleInfo m_VCEBModuleInfo;
  31. private ModuleInfo m_PMAModuleInfo;
  32. private ModuleInfo m_PMBModuleInfo;
  33. private ModuleInfo m_PMCModuleInfo;
  34. private ModuleInfo m_PMDModuleInfo;
  35. private ModuleInfo m_VPAModuleInfo;
  36. private ModuleInfo m_TMModuleInfo;
  37. public WaferInfo m_PMAWafer;
  38. public WaferInfo m_PMBWafer;
  39. public WaferInfo m_PMCWafer;
  40. public WaferInfo m_PMDWafer;
  41. public WaferInfo m_RobotUpperWafer;
  42. public WaferInfo m_RobotLowerWafer;
  43. public WaferInfo m_PAWafer;
  44. private SERobotTAction m_Robot1TAction;
  45. private SERobotXAction m_Robot1XAction;
  46. private SERobotTAction m_Robot2TAction;
  47. private SERobotXAction m_Robot2XAction;
  48. public RobotMoveInfo m_robotMoveInfo;
  49. private int m_VCEAWaferCount;
  50. private int m_VCEBWaferCount;
  51. private bool m_PMAIsInstalled;
  52. private bool m_PMBIsInstalled;
  53. private bool m_PMCIsInstalled;
  54. private bool m_PMDIsInstalled;
  55. private bool m_VCEAIsInstalled;
  56. private bool m_VCEBIsInstalled;
  57. private bool m_VCEADoorIsOpen;
  58. private bool m_VCEBDoorIsOpen;
  59. private bool m_PMADoorIsOpen;
  60. private bool m_PMBDoorIsOpen;
  61. private bool m_PMCDoorIsOpen;
  62. private bool m_PMDDoorIsOpen;
  63. private bool m_VCEAOutDoorIsOpen;
  64. private bool m_VCEBOutDoorIsOpen;
  65. private Dictionary<string, object> m_RtDataValues = new Dictionary<string, object>();
  66. private List<string> m_RtDataKeys = new List<string>();
  67. private double m_PMAPercent;
  68. private double m_PMBPercent;
  69. private double m_PMCPercent;
  70. private double m_PMDPercent;
  71. private double m_VCEAPercent;
  72. private double m_VCEBPercent;
  73. private int m_PickNum;
  74. private RecipeResult m_PMARecipeResult;
  75. private RecipeResult m_PMBRecipeResult;
  76. private RecipeResult m_PMCRecipeResult;
  77. private RecipeResult m_PMDRecipeResult;
  78. private WaferAssociationInfo m_VCEAwaferAssociation;
  79. private WaferAssociationInfo m_VCEBwaferAssociation;
  80. private bool loadflag;
  81. private bool m_TMIsVAC;
  82. private bool m_VCEAIsVAC;
  83. private bool m_VCEBIsVAC;
  84. #endregion
  85. #region 属性
  86. public bool TMIsVAC
  87. {
  88. get { return m_TMIsVAC; }
  89. set { SetProperty(ref m_TMIsVAC, value); }
  90. }
  91. public bool VCEAIsVAC
  92. {
  93. get { return m_VCEAIsVAC; }
  94. set { SetProperty(ref m_VCEAIsVAC, value); }
  95. }
  96. public bool VCEBIsVAC
  97. {
  98. get { return m_VCEBIsVAC; }
  99. set { SetProperty(ref m_VCEBIsVAC, value); }
  100. }
  101. public SERobotTAction Robot1TAction
  102. {
  103. get { return m_Robot1TAction; }
  104. set { SetProperty(ref m_Robot1TAction, value); }
  105. }
  106. private DelegateCommand<object> _AbortJobCommand;
  107. public DelegateCommand<object> AbortJobCommand =>
  108. _AbortJobCommand ?? (_AbortJobCommand = new DelegateCommand<object>(OnAbortJob));
  109. public SERobotXAction Robot1XAction
  110. {
  111. get { return m_Robot1XAction; }
  112. set { SetProperty(ref m_Robot1XAction, value); }
  113. }
  114. public SERobotTAction Robot2TAction
  115. {
  116. get { return m_Robot2TAction; }
  117. set { SetProperty(ref m_Robot2TAction, value); }
  118. }
  119. public SERobotXAction Robot2XAction
  120. {
  121. get { return m_Robot2XAction; }
  122. set { SetProperty(ref m_Robot2XAction, value); }
  123. }
  124. public RobotMoveInfo RobotMoveInfo
  125. {
  126. get { return m_robotMoveInfo; }
  127. set
  128. {
  129. //RobotMoveInfoChanged(m_robotMoveInfo, value);
  130. m_robotMoveInfo = value;
  131. }
  132. }
  133. public RecipeResult PMARecipeResult
  134. {
  135. get { return m_PMARecipeResult; }
  136. set { SetProperty(ref m_PMARecipeResult, value); }
  137. }
  138. public RecipeResult PMBRecipeResult
  139. {
  140. get { return m_PMBRecipeResult; }
  141. set { SetProperty(ref m_PMBRecipeResult, value); }
  142. }
  143. public RecipeResult PMCRecipeResult
  144. {
  145. get { return m_PMCRecipeResult; }
  146. set { SetProperty(ref m_PMCRecipeResult, value); }
  147. }
  148. public RecipeResult PMDRecipeResult
  149. {
  150. get { return m_PMDRecipeResult; }
  151. set { SetProperty(ref m_PMDRecipeResult, value); }
  152. }
  153. public double PMAPercent
  154. {
  155. get { return m_PMAPercent; }
  156. set { SetProperty(ref m_PMAPercent, value); }
  157. }
  158. public double PMBPercent
  159. {
  160. get { return m_PMBPercent; }
  161. set { SetProperty(ref m_PMBPercent, value); }
  162. }
  163. public double PMCPercent
  164. {
  165. get { return m_PMCPercent; }
  166. set { SetProperty(ref m_PMCPercent, value); }
  167. }
  168. public double PMDPercent
  169. {
  170. get { return m_PMDPercent; }
  171. set { SetProperty(ref m_PMDPercent, value); }
  172. }
  173. public double VCEAPercent
  174. {
  175. get { return m_VCEAPercent; }
  176. set { SetProperty(ref m_VCEAPercent, value); }
  177. }
  178. public double VCEBPercent
  179. {
  180. get { return m_VCEBPercent; }
  181. set { SetProperty(ref m_VCEBPercent, value); }
  182. }
  183. public int PickNum
  184. {
  185. get { return m_PickNum; }
  186. set { SetProperty(ref m_PickNum, value); }
  187. }
  188. public WaferInfo PMAWafer
  189. {
  190. get { return m_PMAWafer; }
  191. set { SetProperty(ref m_PMAWafer, value); }
  192. }
  193. public WaferInfo PMBWafer
  194. {
  195. get { return m_PMBWafer; }
  196. set { SetProperty(ref m_PMBWafer, value); }
  197. }
  198. public WaferInfo PMCWafer
  199. {
  200. get { return m_PMCWafer; }
  201. set { SetProperty(ref m_PMCWafer, value); }
  202. }
  203. public WaferInfo PMDWafer
  204. {
  205. get { return m_PMDWafer; }
  206. set { SetProperty(ref m_PMDWafer, value); }
  207. }
  208. public WaferInfo RobotUpperWafer
  209. {
  210. get { return m_RobotUpperWafer; }
  211. set { SetProperty(ref m_RobotUpperWafer, value); }
  212. }
  213. public WaferInfo RobotLowerWafer
  214. {
  215. get { return m_RobotLowerWafer; }
  216. set { SetProperty(ref m_RobotLowerWafer, value); }
  217. }
  218. public WaferInfo PAWafer
  219. {
  220. get { return m_PAWafer; }
  221. set { SetProperty(ref m_PAWafer, value); }
  222. }
  223. public ModuleInfo VCEAModuleInfo
  224. {
  225. get { return m_VCEAModuleInfo; }
  226. set
  227. {
  228. SetProperty(ref m_VCEAModuleInfo, value);
  229. }
  230. }
  231. public ModuleInfo VCEBModuleInfo
  232. {
  233. get { return m_VCEBModuleInfo; }
  234. set
  235. {
  236. SetProperty(ref m_VCEBModuleInfo, value);
  237. }
  238. }
  239. public ModuleInfo PMAModuleInfo
  240. {
  241. get { return m_PMAModuleInfo; }
  242. set
  243. {
  244. SetProperty(ref m_PMAModuleInfo, value);
  245. }
  246. }
  247. public ModuleInfo PMBModuleInfo
  248. {
  249. get { return m_PMBModuleInfo; }
  250. set
  251. {
  252. SetProperty(ref m_PMBModuleInfo, value);
  253. }
  254. }
  255. public ModuleInfo PMCModuleInfo
  256. {
  257. get { return m_PMCModuleInfo; }
  258. set
  259. {
  260. SetProperty(ref m_PMCModuleInfo, value);
  261. }
  262. }
  263. public ModuleInfo PMDModuleInfo
  264. {
  265. get { return m_PMDModuleInfo; }
  266. set
  267. {
  268. SetProperty(ref m_PMDModuleInfo, value);
  269. }
  270. }
  271. public ModuleInfo VPAModuleInfo
  272. {
  273. get { return m_VPAModuleInfo; }
  274. set
  275. {
  276. SetProperty(ref m_VPAModuleInfo, value);
  277. }
  278. }
  279. public ModuleInfo TMModuleInfo
  280. {
  281. get { return m_TMModuleInfo; }
  282. set
  283. {
  284. SetProperty(ref m_TMModuleInfo, value);
  285. }
  286. }
  287. public bool PMAIsInstalled
  288. {
  289. get { return m_PMAIsInstalled; }
  290. set
  291. {
  292. SetProperty(ref m_PMAIsInstalled, value);
  293. }
  294. }
  295. public bool PMBIsInstalled
  296. {
  297. get { return m_PMBIsInstalled; }
  298. set
  299. {
  300. SetProperty(ref m_PMBIsInstalled, value);
  301. }
  302. }
  303. public bool PMCIsInstalled
  304. {
  305. get { return m_PMCIsInstalled; }
  306. set
  307. {
  308. SetProperty(ref m_PMCIsInstalled, value);
  309. }
  310. }
  311. public bool PMDIsInstalled
  312. {
  313. get { return m_PMDIsInstalled; }
  314. set
  315. {
  316. SetProperty(ref m_PMDIsInstalled, value);
  317. }
  318. }
  319. public bool VCEAIsInstalled
  320. {
  321. get { return m_VCEAIsInstalled; }
  322. set
  323. {
  324. SetProperty(ref m_VCEAIsInstalled, value);
  325. }
  326. }
  327. public bool VCEBIsInstalled
  328. {
  329. get { return m_VCEBIsInstalled; }
  330. set
  331. {
  332. SetProperty(ref m_VCEBIsInstalled, value);
  333. }
  334. }
  335. public bool VCEADoorIsOpen { get => m_VCEADoorIsOpen; set => SetProperty(ref m_VCEADoorIsOpen, value); }
  336. public bool VCEBDoorIsOpen { get => m_VCEBDoorIsOpen; set => SetProperty(ref m_VCEBDoorIsOpen, value); }
  337. public bool PMADoorIsOpen { get => m_PMADoorIsOpen; set => SetProperty(ref m_PMADoorIsOpen, value); }
  338. public bool PMBDoorIsOpen { get => m_PMBDoorIsOpen; set => SetProperty(ref m_PMBDoorIsOpen, value); }
  339. public bool PMCDoorIsOpen { get => m_PMCDoorIsOpen; set => SetProperty(ref m_PMCDoorIsOpen, value); }
  340. public bool PMDDoorIsOpen { get => m_PMDDoorIsOpen; set => SetProperty(ref m_PMDDoorIsOpen, value); }
  341. public bool VCEAOutDoorIsOpen { get => m_VCEAOutDoorIsOpen; set => SetProperty(ref m_VCEAOutDoorIsOpen, value); }
  342. public bool VCEBOutDoorIsOpen { get => m_VCEBOutDoorIsOpen; set => SetProperty(ref m_VCEBOutDoorIsOpen, value); }
  343. public int VCEAWaferCount
  344. {
  345. get { return m_VCEAWaferCount; }
  346. set
  347. {
  348. SetProperty(ref m_VCEAWaferCount, value);
  349. }
  350. }
  351. public int VCEBWaferCount
  352. {
  353. get { return m_VCEBWaferCount; }
  354. set
  355. {
  356. SetProperty(ref m_VCEBWaferCount, value);
  357. }
  358. }
  359. public Dictionary<string, object> RtDataValues
  360. {
  361. get { return m_RtDataValues; }
  362. set { SetProperty(ref m_RtDataValues, value); }
  363. }
  364. public WaferAssociationInfo VCEAwaferAssociation
  365. {
  366. get { return m_VCEAwaferAssociation; }
  367. set { SetProperty(ref m_VCEAwaferAssociation, value); }
  368. }
  369. public WaferAssociationInfo VCEBwaferAssociation
  370. {
  371. get { return m_VCEBwaferAssociation; }
  372. set { SetProperty(ref m_VCEBwaferAssociation, value); }
  373. }
  374. #endregion
  375. #region 命令
  376. private DelegateCommand _HomeAll;
  377. public DelegateCommand HomeAll => _HomeAll ?? (_HomeAll = new DelegateCommand(onHomeAll));
  378. private DelegateCommand _SetAutoMode;
  379. public DelegateCommand SetAutoMode => _SetAutoMode ?? (_SetAutoMode = new DelegateCommand(onSetAutoMode));
  380. private DelegateCommand _SetManualMode;
  381. public DelegateCommand SetManualMode => _SetManualMode ?? (_SetManualMode = new DelegateCommand(onSetManualMode));
  382. private DelegateCommand _StartSETMCycle;
  383. public DelegateCommand StartSETMCycle => _StartSETMCycle ?? (_StartSETMCycle = new DelegateCommand(onStartSETMCycle));
  384. private DelegateCommand<object> _StartCommand;
  385. public DelegateCommand<object> StartCommand =>
  386. _StartCommand ?? (_StartCommand = new DelegateCommand<object>(OnStart));
  387. private DelegateCommand<object> _StopCommand;
  388. public DelegateCommand<object> StopCommand =>
  389. _StopCommand ?? (_StopCommand = new DelegateCommand<object>(OnStop));
  390. private DelegateCommand<object> _AbortCommand;
  391. public DelegateCommand<object> AbortCommand =>
  392. _AbortCommand ?? (_AbortCommand = new DelegateCommand<object>(OnAbort));
  393. private DelegateCommand _StopCycle;
  394. public DelegateCommand StopCycle => _StopCycle ?? (_StopCycle = new DelegateCommand(onStopCycle));
  395. private DelegateCommand<object> _VCEHome;
  396. public DelegateCommand<object> VCEHome => _VCEHome ?? (_VCEHome = new DelegateCommand<object>(vceHome));
  397. private DelegateCommand<object> _VCEReadMap;
  398. public DelegateCommand<object> VCEReadMap => _VCEReadMap ?? (_VCEReadMap = new DelegateCommand<object>(vceReadMap));
  399. private DelegateCommand<object> _VCELoadPrepare;
  400. public DelegateCommand<object> VCELoadPrepare =>
  401. _VCELoadPrepare ?? (_VCELoadPrepare = new DelegateCommand<object>(vceLoadPrepare));
  402. private DelegateCommand<object> __VCELoad;
  403. public DelegateCommand<object> VCELoad =>
  404. __VCELoad ?? (__VCELoad = new DelegateCommand<object>(vceLoad));
  405. private DelegateCommand<object> __VCELoadWithSMIF;
  406. public DelegateCommand<object> VCELoadWithSMIF =>
  407. __VCELoadWithSMIF ?? (__VCELoadWithSMIF = new DelegateCommand<object>(vceLoadWithSMIF));
  408. private DelegateCommand<object> __VCEUnLoadWithSMIF;
  409. public DelegateCommand<object> VCEUnLoadWithSMIF =>
  410. __VCEUnLoadWithSMIF ?? (__VCEUnLoadWithSMIF = new DelegateCommand<object>(vceUnLoadWithSMIF));
  411. private DelegateCommand<object> _VCEUnLoad;
  412. public DelegateCommand<object> VCEUnLoad =>
  413. _VCEUnLoad ?? (_VCEUnLoad = new DelegateCommand<object>(vceUnLoad));
  414. private DelegateCommand _SMIFLoad;
  415. public DelegateCommand SMIFLoad =>
  416. _SMIFLoad ?? (_SMIFLoad = new DelegateCommand(smifLoad));
  417. private DelegateCommand _SMIFULoad;
  418. public DelegateCommand SMIFULoad =>
  419. _SMIFULoad ?? (_SMIFULoad = new DelegateCommand(smifUnLoad));
  420. private DelegateCommand _tmhome;
  421. public DelegateCommand TmHome =>
  422. _tmhome ?? (_tmhome = new DelegateCommand(tmhome));
  423. private DelegateCommand _tmPick;
  424. public DelegateCommand TmPick =>
  425. _tmPick ?? (_tmPick = new DelegateCommand(tmpick));
  426. private DelegateCommand _tmPlace;
  427. public DelegateCommand TMPlace =>
  428. _tmPlace ?? (_tmPlace = new DelegateCommand(tmplace));
  429. //private DelegateCommand _tmSave;
  430. private DelegateCommand _LoadCommand;
  431. public DelegateCommand LoadCommand =>
  432. _LoadCommand ?? (_LoadCommand = new DelegateCommand(OnLoad));
  433. private DelegateCommand _PauseAllJobCommand;
  434. public DelegateCommand PauseAllJobCommand =>
  435. _PauseAllJobCommand ?? (_PauseAllJobCommand = new DelegateCommand(OnPauseAllJob));
  436. private DelegateCommand _AbortAllCommand;
  437. public DelegateCommand AbortAllCommand =>
  438. _AbortAllCommand ?? (_AbortAllCommand = new DelegateCommand(OnAbortAll));
  439. private DelegateCommand<object> _SetSequenceCommand;
  440. public DelegateCommand<object> SetSequenceCommand =>
  441. _SetSequenceCommand ?? (_SetSequenceCommand = new DelegateCommand<object>(OnSetSequence));
  442. private DelegateCommand<object> _CreateJobCommand;
  443. public DelegateCommand<object> CreateJobCommand =>
  444. _CreateJobCommand ?? (_CreateJobCommand = new DelegateCommand<object>(OnCreateJob));
  445. private DelegateCommand<object> _SelectAllCommand;
  446. public DelegateCommand<object> SelectAllCommand =>
  447. _SelectAllCommand ?? (_SelectAllCommand = new DelegateCommand<object>(OnSelectAll));
  448. private DelegateCommand<object> _UnSelectAllCommand;
  449. public DelegateCommand<object> UnSelectAllCommand =>
  450. _UnSelectAllCommand ?? (_UnSelectAllCommand = new DelegateCommand<object>(OnDeSelectAll));
  451. private DelegateCommand<object> _ReturnAllWafer;
  452. public DelegateCommand<object> ReturnAllWafer =>
  453. _ReturnAllWafer ?? (_ReturnAllWafer = new DelegateCommand<object>(OnReturnAllWafer));
  454. #endregion
  455. #region 构造函数
  456. public VenusDeOperationOverViewModel()
  457. {
  458. //页面不刷错的方法 页面中的PM做成List的形式 通过itemsource显示 同时提供各个位置的pm点位 旋转角度
  459. VCEAWaferCount = 25;
  460. VCEBWaferCount = 25;
  461. string[] allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(',');
  462. PMAIsInstalled = allModules.Contains("PMA");
  463. PMBIsInstalled = allModules.Contains("PMB");
  464. PMCIsInstalled = allModules.Contains("PMC");
  465. PMDIsInstalled = allModules.Contains("PMD");
  466. VCEAIsInstalled = allModules.Contains("VCEA");
  467. VCEBIsInstalled = allModules.Contains("VCEB");
  468. addDataKeys();
  469. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  470. VCEADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCESlitDoorClosed");
  471. VCEBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCESlitDoorClosed");
  472. PMADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMASlitDoorClosed");
  473. PMBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMBSlitDoorClosed");
  474. PMCDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMCSlitDoorClosed");
  475. PMDDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMDSlitDoorClosed");
  476. VCEAOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCEA.VCEOutDoorClosed");
  477. VCEBOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCEB.VCEOutDoorClosed");
  478. loadflag = false;
  479. DispatcherTimer timer = new DispatcherTimer();
  480. timer.Interval = TimeSpan.FromSeconds(0.1);
  481. timer.Tick += Timer_Tick;
  482. timer.Start();
  483. }
  484. #endregion
  485. #region 命令实现
  486. private void OnLoad()
  487. {
  488. if (!loadflag)
  489. {
  490. if (VCEAIsInstalled && VCEAwaferAssociation == null)
  491. {
  492. VCEAwaferAssociation = new WaferAssociationInfo
  493. {
  494. ModuleData = ModuleManager.ModuleInfos["LP1"]
  495. };
  496. }
  497. if (VCEBIsInstalled && VCEBwaferAssociation == null)
  498. {
  499. VCEBwaferAssociation = new WaferAssociationInfo
  500. {
  501. ModuleData = ModuleManager.ModuleInfos["LP2"]
  502. };
  503. }
  504. loadflag = true;
  505. }
  506. }
  507. private void OnResumeAllJob()
  508. {
  509. var t = CommonFunction.GetValue<List<string>>(RtDataValues, "Scheduler.PjNameList");
  510. if (t == null && t.Count == 0)
  511. {
  512. return;
  513. }
  514. if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
  515. {
  516. t.ForEach(x =>
  517. {
  518. InvokeClient.Instance.Service.DoOperation("System.ResumeJob", x);
  519. });
  520. }
  521. else
  522. {
  523. t.ForEach(x =>
  524. {
  525. InvokeClient.Instance.Service.DoOperation("System.PauseJob", x);
  526. });
  527. }
  528. }
  529. private void OnAbortJob(object obj)
  530. {
  531. InvokeClient.Instance.Service.DoOperation("System.AbortJob", obj.ToString());
  532. }
  533. private void OnSelectAll(object obj)
  534. {
  535. var info = obj as WaferAssociationInfo;
  536. info.SlotFrom = 1;
  537. info.SlotTo = 25;
  538. AssociateSequence(info, true);
  539. }
  540. private void OnDeSelectAll(object obj)
  541. {
  542. var info = obj as WaferAssociationInfo;
  543. info.SlotFrom = 1;
  544. info.SlotTo = 25;
  545. AssociateSequence(info, false);
  546. }
  547. private void OnReturnAllWafer(object obj)
  548. {
  549. WaferDialogView dialog = new WaferDialogView()
  550. {
  551. Owner = Application.Current.MainWindow,
  552. };
  553. dialog.Height = 300;
  554. dialog.Width = 400;
  555. double angel = 0;
  556. double coolingtime = 0;
  557. string message = "Please Confirm Return Wafer";
  558. WaferDialogViewModel vm = new WaferDialogViewModel();
  559. vm.ConfirmText = message;
  560. dialog.DataContext = vm;
  561. if (dialog.ShowDialog() == true)
  562. {
  563. if ((bool)dialog.AlignFlag == true && !string.IsNullOrEmpty(dialog.Angle))
  564. {
  565. angel = Convert.ToDouble(dialog.Angle);
  566. }
  567. if ((bool)dialog.CoolingFlag == true && !string.IsNullOrEmpty(dialog.CoolingTime))
  568. {
  569. coolingtime = Convert.ToDouble(dialog.CoolingTime);
  570. }
  571. InvokeClient.Instance.Service.DoOperation("System.ReturnAllSEWafer", dialog.CoolingFlag, coolingtime, dialog.AlignFlag, angel);
  572. }
  573. }
  574. private void OnCreateJob(object obj)
  575. {
  576. var info = obj as WaferAssociationInfo;
  577. List<string> slotSequence = new List<string>();
  578. info.ModuleData.WaferManager.Wafers.ForEach(key => { slotSequence.Insert(0, key.SequenceName); });
  579. string jobId = info.LotId.Trim();
  580. if (string.IsNullOrEmpty(jobId))
  581. jobId = "CJ_Local_" + info.ModuleData.ModuleID;
  582. info.LotId = jobId;
  583. info.JobID = jobId;
  584. info.JobStatus = "WaitingForStart";
  585. info.LotIdSaved = true;
  586. Dictionary<string, object> param = new Dictionary<string, object>()
  587. {
  588. {"JobId", jobId},
  589. {"Module", info.ModuleData.ModuleID},
  590. {"SlotSequence", slotSequence.ToArray()},
  591. {"AutoStart", true},
  592. };
  593. InvokeClient.Instance.Service.DoOperation("System.CreateSEJob", param);
  594. }
  595. private void OnSetSequence(object obj)
  596. {
  597. var info = obj as WaferInfo;
  598. bool flag = info.SequenceName != "" ? false : true;
  599. if (info.ModuleID == "VCEA")
  600. {
  601. AssociateSequence(VCEAwaferAssociation, flag, info.SlotID);
  602. }
  603. if (info.ModuleID == "VCEB")
  604. {
  605. AssociateSequence(VCEBwaferAssociation, flag, info.SlotID);
  606. }
  607. }
  608. private void OnPauseAllJob()
  609. {
  610. }
  611. private void OnAbortAll()
  612. {
  613. InvokeClient.Instance.Service.DoOperation("System.Abort");
  614. }
  615. private void AssociateSequence(WaferAssociationInfo info, bool flag, int slot = -1)
  616. {
  617. List<WaferInfo> wafers = info.ModuleData.WaferManager.Wafers;
  618. if (slot >= 0) //by wafer
  619. {
  620. int index = wafers.Count - slot - 1;
  621. if (index < wafers.Count)
  622. {
  623. //has wafer
  624. if (flag && !(wafers[index].WaferStatus == 0))
  625. wafers[index].SequenceName = info.SequenceName;
  626. else
  627. wafers[index].SequenceName = string.Empty;
  628. }
  629. }
  630. else //by from-to
  631. {
  632. for (int i = info.SlotFrom - 1; i < info.SlotTo; i++)
  633. {
  634. int index = wafers.Count - i - 1;
  635. if (index < wafers.Count)
  636. {
  637. if (flag && !(wafers[index].WaferStatus == 0))
  638. wafers[index].SequenceName = info.SequenceName;
  639. else
  640. wafers[index].SequenceName = string.Empty;
  641. }
  642. }
  643. }
  644. }
  645. private void addDataKeys()
  646. {
  647. m_RtDataKeys.Add($"DETM.VCEASlitDoorClosed");
  648. m_RtDataKeys.Add($"DETM.VCEBSlitDoorClosed");
  649. m_RtDataKeys.Add($"DETM.PMASlitDoorClosed");
  650. m_RtDataKeys.Add($"DETM.PMBSlitDoorClosed");
  651. m_RtDataKeys.Add($"DETM.PMCSlitDoorClosed");
  652. m_RtDataKeys.Add($"DETM.PMDSlitDoorClosed");
  653. m_RtDataKeys.Add($"DETM.TMPressure.Value");
  654. m_RtDataKeys.Add($"DETM.VCEAPressure.Value");
  655. m_RtDataKeys.Add($"DETM.VCEBPressure.Value");
  656. m_RtDataKeys.Add($"VCEA.VCEOutDoorClosed");
  657. m_RtDataKeys.Add($"VCEA.CassetteArrive");
  658. m_RtDataKeys.Add($"VCEB.VCEOutDoorClosed");
  659. m_RtDataKeys.Add($"VCEB.CassetteArrive");
  660. m_RtDataKeys.Add($"SEScheduler.CycledWafer");
  661. m_RtDataKeys.Add($"SEScheduler.CycleSetPoint");
  662. m_RtDataKeys.Add($"SEScheduler.CycleCount");
  663. m_RtDataKeys.Add($"SEScheduler.ThroughPut");
  664. m_RtDataKeys.Add($"PMA.ChamberPressure");
  665. m_RtDataKeys.Add($"PMA.VentingFlag");
  666. m_RtDataKeys.Add($"PMA.CurrentRecipeResult");
  667. m_RtDataKeys.Add($"PMB.ChamberPressure");
  668. m_RtDataKeys.Add($"PMB.VentingFlag");
  669. m_RtDataKeys.Add($"PMB.CurrentRecipeResult");
  670. m_RtDataKeys.Add($"PMC.ChamberPressure");
  671. m_RtDataKeys.Add($"PMC.VentingFlag");
  672. m_RtDataKeys.Add($"PMC.CurrentRecipeResult");
  673. m_RtDataKeys.Add($"PMD.ChamberPressure");
  674. m_RtDataKeys.Add($"PMD.VentingFlag");
  675. m_RtDataKeys.Add($"PMD.CurrentRecipeResult");
  676. m_RtDataKeys.Add($"DETM.TMIsATM");
  677. m_RtDataKeys.Add($"DETM.VCEAIsATM");
  678. m_RtDataKeys.Add($"DETM.VCEBIsATM");
  679. m_RtDataKeys.Add("System.IsAutoMode");
  680. m_RtDataKeys.Add("System.IsBusy");
  681. m_RtDataKeys.Add("Scheduler.CycledCount");
  682. m_RtDataKeys.Add("Scheduler.CycledWafer");
  683. m_RtDataKeys.Add("Scheduler.CycleSetPoint");
  684. m_RtDataKeys.Add("Scheduler.Throughput");
  685. //m_RtDataKeys.Add("EquipmentStatus");
  686. m_RtDataKeys.Add("Scheduler.PjNameList");
  687. //if (PMAIsInstalled)
  688. //{
  689. // m_RtDataKeys.Add($"PMA.ChamberPressure");
  690. // m_RtDataKeys.Add($"PMA.VentingFlag");
  691. // m_RtDataKeys.Add($"PMA.CurrentRecipeResult");
  692. //}
  693. //if (PMBIsInstalled)
  694. //{
  695. // m_RtDataKeys.Add($"PMB.ChamberPressure");
  696. // m_RtDataKeys.Add($"PMB.VentingFlag");
  697. // m_RtDataKeys.Add($"PMB.CurrentRecipeResult");
  698. //}
  699. //if (PMCIsInstalled)
  700. //{
  701. // m_RtDataKeys.Add($"PMC.ChamberPressure");
  702. // m_RtDataKeys.Add($"PMC.VentingFlag");
  703. // m_RtDataKeys.Add($"PMC.CurrentRecipeResult");
  704. //}
  705. }
  706. private void onHomeAll()
  707. {
  708. InvokeClient.Instance.Service.DoOperation("System.HomeAll");
  709. }
  710. private void onSetAutoMode()
  711. {
  712. InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
  713. }
  714. private void onSetManualMode()
  715. {
  716. InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
  717. }
  718. private void onStopCycle()
  719. {
  720. InvokeClient.Instance.Service.DoOperation("System.StopSECycle");
  721. }
  722. private void onStartSETMCycle()
  723. {
  724. List<string> stations = new List<string>();
  725. stations.Add("VCEA");
  726. stations.Add("VPA");
  727. if (PMAIsInstalled)
  728. {
  729. stations.Add("PMA");
  730. }
  731. if (PMBIsInstalled)
  732. {
  733. stations.Add("PMB");
  734. }
  735. if (PMCIsInstalled)
  736. {
  737. stations.Add("PMC");
  738. }
  739. if (PMCIsInstalled)
  740. {
  741. stations.Add("PMD");
  742. }
  743. stations.Add("VCEA");
  744. InvokeClient.Instance.Service.DoOperation("System.SETMCycle", stations.ToArray(), 1);
  745. }
  746. private void OnStart(object obj)
  747. {
  748. var info = obj as WaferAssociationInfo;
  749. InvokeClient.Instance.Service.DoOperation("System.StartSEJob", info.LotId);
  750. }
  751. private void OnStop(object obj)
  752. {
  753. var info = obj as WaferAssociationInfo;
  754. InvokeClient.Instance.Service.DoOperation("System.AbortJob", info.JobID);
  755. }
  756. private void OnAbort(object obj)
  757. {
  758. var info = obj as WaferAssociationInfo;
  759. InvokeClient.Instance.Service.DoOperation("System.StopJob", info.JobID);
  760. }
  761. private void vceHome(object obj)
  762. {
  763. InvokeClient.Instance.Service.DoOperation($"{obj}.HOME");
  764. }
  765. private void vceReadMap(object obj)
  766. {
  767. InvokeClient.Instance.Service.DoOperation($"{obj}.ReadMap");
  768. }
  769. private void vceLoadPrepare(object obj)
  770. {
  771. InvokeClient.Instance.Service.DoOperation($"{obj}.LoadPrepare");
  772. }
  773. private void vceLoad(object obj)
  774. {
  775. InvokeClient.Instance.Service.DoOperation($"{obj}.SafeLoad");
  776. }
  777. private void vceLoadWithSMIF(object obj)
  778. {
  779. InvokeClient.Instance.Service.DoOperation($"{obj}.LoadWithSMIF");
  780. }
  781. private void vceUnLoadWithSMIF(object obj)
  782. {
  783. InvokeClient.Instance.Service.DoOperation($"{obj}.UnLoadWithSMIF");
  784. }
  785. private void vceUnLoad(object obj)
  786. {
  787. InvokeClient.Instance.Service.DoOperation($"{obj}.SafeUnload");
  788. }
  789. private void smifLoad() { }
  790. private void smifUnLoad() { }
  791. private void tmhome()
  792. {
  793. InvokeClient.Instance.Service.DoOperation("DETM.Home");
  794. }
  795. private void tmpick()
  796. {
  797. ModuleName target = ModuleName.VCE1;
  798. int slot = PickNum;
  799. MoveItem moveItem = new MoveItem(target, slot - 1, ModuleName.TMRobot, 0, 0);
  800. Queue<MoveItem> que = new Queue<MoveItem>();
  801. que.Enqueue(moveItem);
  802. InvokeClient.Instance.Service.DoOperation("DETM.Pick", que);
  803. }
  804. private void tmplace()
  805. {
  806. ModuleName target = ModuleName.VCE1;
  807. int slot = PickNum;
  808. MoveItem moveItem = new MoveItem(ModuleName.TMRobot, 0, target, slot - 1, 0);
  809. Queue<MoveItem> que = new Queue<MoveItem>();
  810. que.Enqueue(moveItem);
  811. InvokeClient.Instance.Service.DoOperation("DETM.Place", que);
  812. }
  813. #endregion
  814. #region 私有方法
  815. private void Timer_Tick(object sender, EventArgs e)
  816. {
  817. try
  818. {
  819. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  820. VCEADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEASlitDoorClosed");
  821. VCEBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.VCEBSlitDoorClosed");
  822. PMADoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMASlitDoorClosed");
  823. PMBDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMBSlitDoorClosed");
  824. PMCDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMCSlitDoorClosed");
  825. PMDDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "DETM.PMDSlitDoorClosed");
  826. VCEAOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCEA.VCEOutDoorClosed");
  827. VCEBOutDoorIsOpen = !CommonFunction.GetValue<bool>(RtDataValues, "VCEB.VCEOutDoorClosed");
  828. VCEAPercent = CommonFunction.GetValue<double>(RtDataValues, "DETM.VCEAPressure.Value") * 260 / 750000;
  829. VCEBPercent = CommonFunction.GetValue<double>(RtDataValues, "DETM.VCEBPressure.Value") * 260 / 750000;
  830. TMIsVAC = (CommonFunction.GetValue<int>(RtDataValues, "DETM.TMPressure.Value") < Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"DETM.VACTargetPressure")));
  831. VCEAIsVAC = (CommonFunction.GetValue<int>(RtDataValues, "DETM.VCEAPressure.Value") < Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"VCEA.VACTargetPressure")));
  832. VCEBIsVAC = (CommonFunction.GetValue<int>(RtDataValues, "DETM.VCEBPressure.Value") < Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"VCEB.VACTargetPressure")));
  833. if (PMAIsInstalled == true)
  834. {
  835. PMAModuleInfo = ModuleManager.ModuleInfos["PMA"];
  836. PMAWafer = PMAModuleInfo.WaferManager.Wafers[0];
  837. PMAPercent = CommonFunction.GetValue<double>(RtDataValues, "PMA.ChamberPressure") * 260 / 750000;
  838. PMARecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, "PMA.CurrentRecipeResult");
  839. }
  840. if (PMBIsInstalled == true)
  841. {
  842. PMBModuleInfo = ModuleManager.ModuleInfos["PMB"];
  843. PMBWafer = PMBModuleInfo.WaferManager.Wafers[0];
  844. PMBPercent = CommonFunction.GetValue<double>(RtDataValues, "PMB.ChamberPressure") * 260 / 750000;
  845. PMBRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, "PMB.CurrentRecipeResult");
  846. }
  847. if (PMCIsInstalled == true)
  848. {
  849. PMCModuleInfo = ModuleManager.ModuleInfos["PMC"];
  850. PMCWafer = PMCModuleInfo.WaferManager.Wafers[0];
  851. PMCPercent = CommonFunction.GetValue<double>(RtDataValues, "PMC.ChamberPressure") * 260 / 750000;
  852. PMCRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, "PMC.CurrentRecipeResult");
  853. }
  854. if (PMDIsInstalled == true)
  855. {
  856. PMDModuleInfo = ModuleManager.ModuleInfos["PMD"];
  857. PMDWafer = PMCModuleInfo.WaferManager.Wafers[0];
  858. PMDPercent = CommonFunction.GetValue<double>(RtDataValues, "PMD.ChamberPressure") * 260 / 750000;
  859. PMDRecipeResult = CommonFunction.GetValue<RecipeResult>(RtDataValues, "PMD.CurrentRecipeResult");
  860. }
  861. if (VCEAIsInstalled == true)
  862. {
  863. VCEAModuleInfo = ModuleManager.ModuleInfos["LP1"];
  864. }
  865. if (VCEBIsInstalled == true)
  866. {
  867. VCEBModuleInfo = ModuleManager.ModuleInfos["LP2"];
  868. }
  869. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("DETM.RobotMoveAction");
  870. TMModuleInfo = ModuleManager.ModuleInfos["TMRobot"];
  871. RobotUpperWafer = TMModuleInfo.WaferManager.Wafers[0];
  872. RobotLowerWafer = TMModuleInfo.WaferManager.Wafers[1];
  873. PAWafer = ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0];
  874. }
  875. catch
  876. {
  877. }
  878. }
  879. #endregion
  880. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  881. {
  882. string RobotTarget;
  883. if (oldValue == null || newValue == null)
  884. {
  885. return;
  886. }
  887. #region Rotating
  888. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Rotating))
  889. {
  890. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  891. if (TMRobotMoveActionBladeTarget != null)
  892. {
  893. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  894. }
  895. else
  896. {
  897. return;
  898. }
  899. var values = RobotTarget.Split('.');
  900. var arm = values[0];
  901. var module = values[1];
  902. if (arm == "ArmA")
  903. {
  904. Robot1TAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  905. }
  906. else if (arm == "ArmB")
  907. {
  908. Robot2TAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  909. }
  910. }
  911. #endregion
  912. #region VPA、VCE1 Pick、Place
  913. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  914. {
  915. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  916. if (TMRobotMoveActionBladeTarget != null)
  917. {
  918. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  919. }
  920. else
  921. {
  922. return;
  923. }
  924. var values = RobotTarget.Split('.');
  925. var arm = values[0];
  926. var module = values[1];
  927. if (arm == "ArmA")
  928. {
  929. var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  930. if (SERobotTAction != Robot1TAction)
  931. {
  932. Robot1TAction = SERobotTAction;
  933. }
  934. else
  935. {
  936. //await Task.Delay(100);
  937. }
  938. await Task.Delay(600);
  939. if (module == "VCE1")
  940. {
  941. Robot1XAction = SERobotXAction.ToVCE;
  942. }
  943. else
  944. {
  945. Robot1XAction = SERobotXAction.Extend;
  946. }
  947. 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))
  948. {
  949. await Task.Delay(100);
  950. }
  951. Robot1XAction = SERobotXAction.Retract;
  952. }
  953. else if (arm == "ArmB")
  954. {
  955. var waferRobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  956. if (waferRobotTAction != Robot2TAction)
  957. {
  958. Robot2TAction = waferRobotTAction;
  959. }
  960. else
  961. {
  962. //await Task.Delay(100);
  963. }
  964. await Task.Delay(600);
  965. if (module == "VCE1")
  966. {
  967. Robot2XAction = SERobotXAction.ToVCE2;
  968. }
  969. else
  970. {
  971. Robot2XAction = SERobotXAction.Extend2;
  972. }
  973. 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))
  974. {
  975. await Task.Delay(100);
  976. }
  977. Robot2XAction = SERobotXAction.Retract2;
  978. }
  979. }
  980. #endregion
  981. #region PM pick、PM place
  982. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Extending)
  983. {
  984. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  985. if (TMRobotMoveActionBladeTarget != null)
  986. {
  987. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  988. }
  989. else
  990. {
  991. return;
  992. }
  993. var values = RobotTarget.Split('.');
  994. var arm = values[0];
  995. var module = values[1];
  996. if (arm == "ArmA")
  997. {
  998. var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  999. if (SERobotTAction != Robot1TAction)
  1000. {
  1001. Robot1TAction = SERobotTAction;
  1002. }
  1003. else
  1004. {
  1005. // await Task.Delay(100);
  1006. }
  1007. await Task.Delay(600);
  1008. Robot1XAction = SERobotXAction.Extend;
  1009. }
  1010. else if (arm == "ArmB")
  1011. {
  1012. var SERobotTAction = (SERobotTAction)Enum.Parse(typeof(SERobotTAction), module, true);
  1013. if (SERobotTAction != Robot2TAction)
  1014. {
  1015. Robot2TAction = SERobotTAction;
  1016. }
  1017. else
  1018. {
  1019. // await Task.Delay(100);
  1020. }
  1021. await Task.Delay(600);
  1022. Robot2XAction = SERobotXAction.Extend2;
  1023. }
  1024. }
  1025. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Retracting)
  1026. {
  1027. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  1028. if (TMRobotMoveActionBladeTarget != null)
  1029. {
  1030. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  1031. }
  1032. else
  1033. {
  1034. return;
  1035. }
  1036. var values = RobotTarget.Split('.');
  1037. var arm = values[0];
  1038. if (arm == "ArmA")
  1039. {
  1040. Robot1XAction = SERobotXAction.Retract;
  1041. }
  1042. else if (arm == "ArmB")
  1043. {
  1044. Robot2XAction = SERobotXAction.Retract2;
  1045. }
  1046. }
  1047. #endregion
  1048. #region Home
  1049. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  1050. {
  1051. if (Robot1XAction == SERobotXAction.Extend)
  1052. {
  1053. Robot1XAction = SERobotXAction.Retract;
  1054. }
  1055. if (Robot2XAction == SERobotXAction.Extend2)
  1056. {
  1057. Robot2XAction = SERobotXAction.Retract2;
  1058. }
  1059. await Task.Delay(2000);
  1060. if (Robot1TAction != SERobotTAction.T_Origin)
  1061. {
  1062. Robot1TAction = SERobotTAction.T_Origin;
  1063. }
  1064. if (Robot2TAction != SERobotTAction.T_Origin)
  1065. {
  1066. Robot2TAction = SERobotTAction.T_Origin;
  1067. }
  1068. }
  1069. #endregion
  1070. }
  1071. }
  1072. }