OperationOverViewModel.cs 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743
  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 System.Windows;
  14. using System.Windows.Threading;
  15. using CyberX8_Core;
  16. using CyberX8_MainPages.Unity;
  17. using CyberX8_MainPages.Views;
  18. using CyberX8_Themes.CustomControls;
  19. using CyberX8_Themes.Unity;
  20. using CyberX8_Themes.UserControls;
  21. using Aitex.Core.RT.Log;
  22. using MECF.Framework.Common.Reservior;
  23. using MECF.Framework.Common.ProcessCell;
  24. using MECF.Framework.Common.Utilities;
  25. using Aitex.Sorter.Common;
  26. using MECF.Framework.Common.Schedulers;
  27. using MECF.Framework.Common.Beckhoff.Station;
  28. using MECF.Framework.Common.Layout;
  29. using Aitex.Core.RT.Routine;
  30. using Aitex.Core.RT.Device;
  31. using System.Reflection;
  32. using MECF.Framework.Common.Beckhoff.IOAxis;
  33. using MECF.Framework.Common.TwinCat;
  34. using LiveCharts.Wpf;
  35. using MECF.Framework.Common.CommonData.PUF;
  36. using MECF.Framework.Common.Beckhoff.AxisProvider;
  37. using QiHe.CodeLib;
  38. using MECF.Framework.Common.Jobs;
  39. namespace CyberX8_MainPages.ViewModels
  40. {
  41. public class OperationOverViewModel : BindableBase
  42. {
  43. #region 常量
  44. private const string CURRENT_STATION = "CurrentStation";
  45. private const string MOTOR_POSITION = "MotorPosition";
  46. private const string MOTION_DATA = "MotionData";
  47. private const double LOADER_ROTATION_DIFFER = 90;
  48. private const double PUF_FLIP_DIFFER = 180;
  49. #endregion
  50. #region 私有字段
  51. private bool _isLp1Unable;
  52. private bool _isLp2Unable;
  53. private bool _isLp3Unable;
  54. private ModuleInfo _LP1ModuleInfo;
  55. private ModuleInfo _LP2ModuleInfo;
  56. private ModuleInfo _LP3ModuleInfo;
  57. private ModuleInfo _EFEMModuleInfo;
  58. private ModuleInfo _srd1ModuleInfo;
  59. private ModuleInfo _srd2ModuleInfo;
  60. private ModuleInfo _puf1ModuleInfo;
  61. private ModuleInfo _puf2ModuleInfo;
  62. private ModuleInfo _dummy1ModuleInfo;
  63. private ModuleInfo _dummy2ModuleInfo;
  64. private ModuleInfo _loaderModuleInfo;
  65. private WaferRobotTAction m_Robot1TAction;
  66. private WaferRobotXAction m_Robot1XAction;
  67. private WaferRobotTAction m_Robot2TAction;
  68. private WaferRobotXAction m_Robot2XAction;
  69. private WaferRobotTAction m_Robot3TAction;
  70. private WaferRobotXAction m_Robot3XAction;
  71. private WaferRobotTAction m_Robot4TAction;
  72. private WaferRobotXAction m_Robot4XAction;
  73. private RobotMoveInfo m_robotMoveInfo;
  74. private WaferInfo m_srd1Wafer;
  75. private WaferInfo m_srd2Wafer;
  76. private WaferInfo m_puf1WaferA;
  77. private WaferInfo m_puf1WaferB;
  78. private WaferInfo m_puf2WaferA;
  79. private WaferInfo m_puf2WaferB;
  80. private WaferInfo m_loaderWaferA;
  81. private WaferInfo m_loaderWaferB;
  82. private List<string> m_RtDataKeys = new List<string>();
  83. private Dictionary<string, object> m_RtDataValues;
  84. private bool m_EFEMIsInstalled;
  85. private bool m_loaderInstalled;
  86. private bool m_puf1IsInRobotStation;
  87. private bool m_puf2IsInRobotStation;
  88. //private bool m_IsPUFChange;
  89. private WaferInfo m_EFEMBladeAWafer;
  90. private WaferInfo m_EFEMBladeBWafer;
  91. private WaferInfo m_Aligner1Wafer;
  92. private int m_LP1WaferCount;
  93. private int m_LP2WaferCount;
  94. private int m_LP3WaferCount;
  95. private int m_dummy1WaferCount;
  96. private int m_dummy2WaferCount;
  97. private int m_CycledWafer;
  98. private int m_CycleCountDisplay;
  99. private EFEM.RobotPosition m_CurrentRobotPosition;
  100. private PufControl.LoaderXLocation m_loaderAXLoaction = PufControl.LoaderXLocation.Parker;
  101. private PufControl.LoaderXLocation m_loaderBXLoaction = PufControl.LoaderXLocation.Parker;
  102. /// <summary>
  103. /// Loader的sideA开启状态
  104. /// </summary>
  105. private bool m_loaderWaferVisibleA = false;
  106. /// <summary>
  107. /// Loader的sideB开启状态
  108. /// </summary>
  109. private bool m_loaderWaferVisibleB = false;
  110. private WaferInfo m_BladeAWafer;
  111. private WaferInfo m_BladeBWafer;
  112. private string m_ATMModeIsOn;
  113. private string m_RouteState;
  114. /// <summary>
  115. /// puf1 Rotation ui 水平比例
  116. /// </summary>
  117. private double _puf1RotationRatio;
  118. /// <summary>
  119. /// puf2 Rotation ui 水平比例
  120. /// </summary>
  121. private double _puf2RotationRatio;
  122. ///// <summary>
  123. ///// puf1 Flip最大角度
  124. ///// </summary>
  125. //private double _puf1FlipMax;
  126. ///// <summary>
  127. ///// puf1 Flip最小角度
  128. ///// </summary>
  129. //private double _puf1FlipMin;
  130. ///// <summary>
  131. ///// puf2 Flip最大角度
  132. ///// </summary>
  133. //private double _puf2FlipMax;
  134. ///// <summary>
  135. ///// puf2 Flip最小角度
  136. ///// </summary>
  137. //private double _puf2FlipMin;
  138. /// <summary>
  139. /// Wafer尺寸
  140. /// </summary>
  141. private int _waferSize = 0;
  142. /// <summary>
  143. /// 定时器
  144. /// </summary>
  145. private DispatcherTimer _timer;
  146. /// <summary>
  147. /// 定时器1
  148. /// </summary>
  149. private DispatcherTimer _timer1;
  150. /// <summary>
  151. /// puf Rotation UI水平距离
  152. /// </summary>
  153. private int _pufLayoutRotationDistance;
  154. /// <summary>
  155. /// Efem robot UI位置
  156. /// </summary>
  157. private int _robotLayoutPosition;
  158. /// <summary>
  159. /// Puf1 Rotation实际位置数据
  160. /// </summary>
  161. private double _puf1RotationMotorPosition;
  162. /// <summary>
  163. /// Puf2 Rotation实际位置数据
  164. /// </summary>
  165. private double _puf2RotationMotorPosition;
  166. /// <summary>
  167. /// Puf1 Flip实际位置数据
  168. /// </summary>
  169. private double _puf1FlipMotorPosition;
  170. /// <summary>
  171. /// Puf2 Flip实际位置数据
  172. /// </summary>
  173. private double _puf2FlipMotorPosition;
  174. /// <summary>
  175. /// Puf1 Flip UI位置
  176. /// </summary>
  177. private double _puf1FlipPosition;
  178. /// <summary>
  179. /// Puf2 Flip UI位置
  180. /// </summary>
  181. private double _puf2FlipPosition;
  182. /// <summary>
  183. /// Puf1 Rotation最左侧的位置
  184. /// </summary>
  185. private double _puf1RotationMotorPositionMax;
  186. /// <summary>
  187. /// Puf2 Rotation最左侧的位置
  188. /// </summary>
  189. private double _puf2RotationMotorPositionMin;
  190. /// <summary>
  191. /// Puf1 Rotation UI对应位置
  192. /// </summary>
  193. private double _puf1RotationPosition;
  194. /// <summary>
  195. /// Puf2 Rotation UI对应位置
  196. /// </summary>
  197. private double _puf2RotationPosition;
  198. /// <summary>
  199. /// Loader1 Rotation UI对应位置
  200. /// </summary>
  201. private double _loader1RotationPosition;
  202. /// <summary>
  203. /// Puf1 Rotation Axis
  204. /// </summary>
  205. private BeckhoffStationAxis _puf1RotationAxis;
  206. /// <summary>
  207. /// Puf2 Rotation Axis
  208. /// </summary>
  209. private BeckhoffStationAxis _puf2RotationAxis;
  210. /// <summary>
  211. /// Puf1 Flip Axis
  212. /// </summary>
  213. private BeckhoffStationAxis _puf1FlipAxis;
  214. /// <summary>
  215. /// Puf2 Flip Axis
  216. /// </summary>
  217. private BeckhoffStationAxis _puf2FlipAxis;
  218. /// <summary>
  219. /// Loader1 Rotation Axis
  220. /// </summary>
  221. private BeckhoffStationAxis _loader1RotationAxis;
  222. /// <summary>
  223. /// Loader1 TlitA Axis
  224. /// </summary>
  225. private BeckhoffStationAxis _loader1TiltAAxis;
  226. /// <summary>
  227. /// Loader1 TlitB Axis
  228. /// </summary>
  229. private BeckhoffStationAxis _loader1TiltBAxis;
  230. /// <summary>
  231. /// Loader1 Rotation实际位置数据
  232. /// </summary>
  233. private double _loader1RotationMotorPosition;
  234. /// <summary>
  235. /// Loader1 TiltA实际位置数据
  236. /// </summary>
  237. private double _loader1TiltAMotorPosition;
  238. /// <summary>
  239. /// Loader1 TiltB实际位置数据
  240. /// </summary>
  241. private double _loader1TiltBMotorPosition;
  242. /// <summary>
  243. /// Loader Rotation位置
  244. /// </summary>
  245. private LoaderControl.LoaderRotation m_currentLoaderRotation = LoaderControl.LoaderRotation.Load;
  246. /// <summary>
  247. /// Puf1 Flip当前station
  248. /// </summary>
  249. private string _puf1FlipCurrentStation;
  250. /// <summary>
  251. /// Puf2 Flip当前station
  252. /// </summary>
  253. private string _puf2FlipCurrentStation;
  254. /// <summary>
  255. /// Loader1 TiltA当前station
  256. /// </summary>
  257. private string _loaderTiltACurrentStation;
  258. /// <summary>
  259. /// Loader1 TiltB当前station
  260. /// </summary>
  261. private string _loaderTiltBCurrentStation;
  262. /// <summary>
  263. /// 是否存在Job
  264. /// </summary>
  265. private bool _isLp1HasNoJob;
  266. private bool _isLp2HasNoJob;
  267. private bool _isLp3HasNoJob;
  268. #endregion
  269. #region 属性
  270. public bool IsLP1Unable
  271. {
  272. get { return _isLp1Unable; }
  273. set { SetProperty(ref _isLp1Unable, value); }
  274. }
  275. public bool IsLP2Unable
  276. {
  277. get { return _isLp2Unable; }
  278. set { SetProperty(ref _isLp2Unable, value); }
  279. }
  280. public bool IsLP3Unable
  281. {
  282. get { return _isLp3Unable; }
  283. set { SetProperty(ref _isLp3Unable, value); }
  284. }
  285. public ModuleInfo LP1ModuleInfo
  286. {
  287. get { return _LP1ModuleInfo; }
  288. set { SetProperty(ref _LP1ModuleInfo, value); }
  289. }
  290. public ModuleInfo EFEMModuleInfo
  291. {
  292. get { return _EFEMModuleInfo; }
  293. set { SetProperty(ref _EFEMModuleInfo, value); }
  294. }
  295. public ModuleInfo LP2ModuleInfo
  296. {
  297. get { return _LP2ModuleInfo; }
  298. set { SetProperty(ref _LP2ModuleInfo, value); }
  299. }
  300. public ModuleInfo LP3ModuleInfo
  301. {
  302. get { return _LP3ModuleInfo; }
  303. set { SetProperty(ref _LP3ModuleInfo, value); }
  304. }
  305. public ModuleInfo SRD1ModuleInfo
  306. {
  307. get { return _srd1ModuleInfo; }
  308. set { SetProperty(ref _srd1ModuleInfo, value); }
  309. }
  310. public ModuleInfo SRD2ModuleInfo
  311. {
  312. get { return _srd2ModuleInfo; }
  313. set { SetProperty(ref _srd2ModuleInfo, value); }
  314. }
  315. public ModuleInfo PUF1ModuleInfo
  316. {
  317. get { return _puf1ModuleInfo; }
  318. set { SetProperty(ref _puf1ModuleInfo, value); }
  319. }
  320. public ModuleInfo PUF2ModuleInfo
  321. {
  322. get { return _puf2ModuleInfo; }
  323. set { SetProperty(ref _puf2ModuleInfo, value); }
  324. }
  325. public ModuleInfo Dummy1ModuleInfo
  326. {
  327. get { return _dummy1ModuleInfo; }
  328. set { SetProperty(ref _dummy1ModuleInfo, value); }
  329. }
  330. public ModuleInfo Dummy2ModuleInfo
  331. {
  332. get { return _dummy2ModuleInfo; }
  333. set { SetProperty(ref _dummy2ModuleInfo, value); }
  334. }
  335. public ModuleInfo LoaderModuleInfo
  336. {
  337. get { return _loaderModuleInfo; }
  338. set { SetProperty(ref _loaderModuleInfo, value); }
  339. }
  340. public WaferRobotTAction Robot1TAction
  341. {
  342. get { return m_Robot1TAction; }
  343. set { SetProperty(ref m_Robot1TAction, value); }
  344. }
  345. public WaferRobotXAction Robot1XAction
  346. {
  347. get { return m_Robot1XAction; }
  348. set { SetProperty(ref m_Robot1XAction, value); }
  349. }
  350. public WaferRobotTAction Robot2TAction
  351. {
  352. get { return m_Robot2TAction; }
  353. set { SetProperty(ref m_Robot2TAction, value); }
  354. }
  355. public WaferRobotXAction Robot2XAction
  356. {
  357. get { return m_Robot2XAction; }
  358. set { SetProperty(ref m_Robot2XAction, value); }
  359. }
  360. public WaferRobotTAction Robot3TAction
  361. {
  362. get { return m_Robot3TAction; }
  363. set { SetProperty(ref m_Robot3TAction, value); }
  364. }
  365. public WaferRobotXAction Robot3XAction
  366. {
  367. get { return m_Robot3XAction; }
  368. set { SetProperty(ref m_Robot3XAction, value); }
  369. }
  370. public WaferRobotTAction Robot4TAction
  371. {
  372. get { return m_Robot4TAction; }
  373. set { SetProperty(ref m_Robot4TAction, value); }
  374. }
  375. public WaferRobotXAction Robot4XAction
  376. {
  377. get { return m_Robot4XAction; }
  378. set { SetProperty(ref m_Robot4XAction, value); }
  379. }
  380. public RobotMoveInfo RobotMoveInfo
  381. {
  382. get { return m_robotMoveInfo; }
  383. set
  384. {
  385. RobotMoveInfoChanged(m_robotMoveInfo, value);
  386. //m_robotMoveInfo = value;
  387. SetProperty(ref m_robotMoveInfo, value);
  388. }
  389. }
  390. public Dictionary<string, object> RtDataValues
  391. {
  392. get { return m_RtDataValues; }
  393. set { SetProperty(ref m_RtDataValues, value); }
  394. }
  395. public bool EFEMIsInstalled
  396. {
  397. get { return m_EFEMIsInstalled; }
  398. set { SetProperty(ref m_EFEMIsInstalled, value); }
  399. }
  400. public WaferInfo EFEMBladeAWafer
  401. {
  402. get { return m_EFEMBladeAWafer; }
  403. set { SetProperty(ref m_EFEMBladeAWafer, value); }
  404. }
  405. public WaferInfo EFEMBladeBWafer
  406. {
  407. get { return m_EFEMBladeBWafer; }
  408. set { SetProperty(ref m_EFEMBladeBWafer, value); }
  409. }
  410. public bool LoaderIsInstalled
  411. {
  412. get { return m_loaderInstalled; }
  413. set { SetProperty(ref m_loaderInstalled, value); }
  414. }
  415. public WaferInfo Aligner1Wafer
  416. {
  417. get { return m_Aligner1Wafer; }
  418. set { SetProperty(ref m_Aligner1Wafer, value); }
  419. }
  420. public WaferInfo SRD1Wafer
  421. {
  422. get { return m_srd1Wafer; }
  423. set { SetProperty(ref m_srd1Wafer, value); }
  424. }
  425. public WaferInfo SRD2Wafer
  426. {
  427. get { return m_srd2Wafer; }
  428. set { SetProperty(ref m_srd2Wafer, value); }
  429. }
  430. public WaferInfo PUF1WaferA
  431. {
  432. get { return m_puf1WaferA; }
  433. set { SetProperty(ref m_puf1WaferA, value); }
  434. }
  435. public WaferInfo PUF1WaferB
  436. {
  437. get { return m_puf1WaferB; }
  438. set { SetProperty(ref m_puf1WaferB, value); }
  439. }
  440. public WaferInfo PUF2WaferA
  441. {
  442. get { return m_puf2WaferA; }
  443. set { SetProperty(ref m_puf2WaferA, value); }
  444. }
  445. public WaferInfo PUF2WaferB
  446. {
  447. get { return m_puf2WaferB; }
  448. set { SetProperty(ref m_puf2WaferB, value); }
  449. }
  450. public WaferInfo LoaderWaferA
  451. {
  452. get { return m_loaderWaferA; }
  453. set { SetProperty(ref m_loaderWaferA, value); }
  454. }
  455. public WaferInfo LoaderWaferB
  456. {
  457. get { return m_loaderWaferB; }
  458. set { SetProperty(ref m_loaderWaferB, value); }
  459. }
  460. public int LP1WaferCount
  461. {
  462. get { return m_LP1WaferCount; }
  463. set { SetProperty(ref m_LP1WaferCount, value); }
  464. }
  465. public int LP2WaferCount
  466. {
  467. get { return m_LP2WaferCount; }
  468. set { SetProperty(ref m_LP2WaferCount, value); }
  469. }
  470. public int LP3WaferCount
  471. {
  472. get { return m_LP3WaferCount; }
  473. set { SetProperty(ref m_LP3WaferCount, value); }
  474. }
  475. public int Dummy1WaferCount
  476. {
  477. get { return m_dummy1WaferCount; }
  478. set { SetProperty(ref m_dummy1WaferCount, value); }
  479. }
  480. public int Dummy2WaferCount
  481. {
  482. get { return m_dummy2WaferCount; }
  483. set { SetProperty(ref m_dummy2WaferCount, value); }
  484. }
  485. public int CycledWafer
  486. {
  487. get { return m_CycledWafer; }
  488. set { SetProperty(ref m_CycledWafer, value); }
  489. }
  490. public int CycleCountDisplay
  491. {
  492. get { return m_CycleCountDisplay; }
  493. set { SetProperty(ref m_CycleCountDisplay, value); }
  494. }
  495. public RobotMoveInfo m_EfemRobotMoveInfo;
  496. public RobotMoveInfo EfemRobotMoveInfo
  497. {
  498. get { return m_EfemRobotMoveInfo; }
  499. set
  500. {
  501. EFEMRobotMoveInfoChanged(m_EfemRobotMoveInfo, value);
  502. //m_EfemRobotMoveInfo = value;
  503. SetProperty(ref m_EfemRobotMoveInfo, value);
  504. }
  505. }
  506. public EFEM.RobotPosition CurrentRobotPosition
  507. {
  508. get { return m_CurrentRobotPosition; }
  509. set { SetProperty(ref m_CurrentRobotPosition, value); }
  510. }
  511. public PufControl.LoaderXLocation LoaderAXLocation
  512. {
  513. get { return m_loaderAXLoaction; }
  514. set { SetProperty(ref m_loaderAXLoaction, value); }
  515. }
  516. public PufControl.LoaderXLocation LoaderBXLocation
  517. {
  518. get { return m_loaderBXLoaction; }
  519. set { SetProperty(ref m_loaderBXLoaction, value); }
  520. }
  521. public WaferInfo BladeAWafer
  522. {
  523. get { return m_BladeAWafer; }
  524. set { SetProperty(ref m_BladeAWafer, value); }
  525. }
  526. public WaferInfo BladeBWafer
  527. {
  528. get { return m_BladeBWafer; }
  529. set { SetProperty(ref m_BladeBWafer, value); }
  530. }
  531. public string ATMModeIsOn
  532. {
  533. get { return m_ATMModeIsOn; }
  534. set { SetProperty(ref m_ATMModeIsOn, value); }
  535. }
  536. public string RouteState
  537. {
  538. get { return m_RouteState; }
  539. set { SetProperty(ref m_RouteState, value); }
  540. }
  541. /// <summary>
  542. /// Loader的sideA开启状态
  543. /// </summary>
  544. public bool LoaderWaferVisibleA
  545. {
  546. get { return m_loaderWaferVisibleA; }
  547. set { SetProperty(ref m_loaderWaferVisibleA, value); }
  548. }
  549. /// <summary>
  550. /// Loader的sideB开启状态
  551. /// </summary>
  552. public bool LoaderWaferVisibleB
  553. {
  554. get { return m_loaderWaferVisibleB; }
  555. set { SetProperty(ref m_loaderWaferVisibleB, value); }
  556. }
  557. public bool Puf1IsInRobotStation
  558. {
  559. get { return m_puf1IsInRobotStation; }
  560. set { SetProperty(ref m_puf1IsInRobotStation, value); }
  561. }
  562. public bool Puf2IsInRobotStation
  563. {
  564. get { return m_puf2IsInRobotStation; }
  565. set { SetProperty(ref m_puf2IsInRobotStation, value); }
  566. }
  567. /// <summary>
  568. /// Puf1 Rotation实际位置数据
  569. /// </summary>
  570. public double Puf1RotationMotorPosition
  571. {
  572. get { return _puf1RotationMotorPosition; }
  573. set { SetProperty(ref _puf1RotationMotorPosition, value); }
  574. }
  575. /// <summary>
  576. /// Puf2 Rotation实际位置数据
  577. /// </summary>
  578. public double Puf2RotationMotorPosition
  579. {
  580. get { return _puf2RotationMotorPosition; }
  581. set { SetProperty(ref _puf2RotationMotorPosition, value); }
  582. }
  583. /// <summary>
  584. /// Puf1 Flip实际位置数据
  585. /// </summary>
  586. public double Puf1FlipMotorPosition
  587. {
  588. get { return _puf1FlipMotorPosition; }
  589. set { SetProperty(ref _puf1FlipMotorPosition, value); }
  590. }
  591. /// <summary>
  592. /// Puf2 Flip实际位置数据
  593. /// </summary>
  594. public double Puf2FlipMotorPosition
  595. {
  596. get { return _puf2FlipMotorPosition; }
  597. set { SetProperty(ref _puf2FlipMotorPosition, value); }
  598. }
  599. /// <summary>
  600. /// Puf1 Flip UI位置
  601. /// </summary>
  602. public double Puf1FlipPosition
  603. {
  604. get { return _puf1FlipPosition; }
  605. set { SetProperty(ref _puf1FlipPosition, value); }
  606. }
  607. /// <summary>
  608. /// Puf2 Flip UI位置
  609. /// </summary>
  610. public double Puf2FlipPosition
  611. {
  612. get { return _puf2FlipPosition; }
  613. set { SetProperty(ref _puf2FlipPosition, value); }
  614. }
  615. /// <summary>
  616. /// Puf1 Rotation UI对应位置
  617. /// </summary>
  618. public double Puf1RotationPosition
  619. {
  620. get { return _puf1RotationPosition; }
  621. set { SetProperty(ref _puf1RotationPosition, value); }
  622. }
  623. /// <summary>
  624. /// Puf2 Rotation UI对应位置
  625. /// </summary>
  626. public double Puf2RotationPosition
  627. {
  628. get { return _puf2RotationPosition; }
  629. set { SetProperty(ref _puf2RotationPosition, value); }
  630. }
  631. /// <summary>
  632. /// Loader1 Rotation UI对应位置
  633. /// </summary>
  634. public double Loader1RotationPosition
  635. {
  636. get { return _loader1RotationPosition; }
  637. set { SetProperty(ref _loader1RotationPosition, value); }
  638. }
  639. /// <summary>
  640. /// Puf1 Rotation Axis
  641. /// </summary>
  642. public BeckhoffStationAxis Puf1RotationAxis
  643. {
  644. get { return _puf1RotationAxis; }
  645. set { SetProperty(ref _puf1RotationAxis, value); }
  646. }
  647. /// <summary>
  648. /// Puf1 Rotation Axis
  649. /// </summary>
  650. public BeckhoffStationAxis Puf2RotationAxis
  651. {
  652. get { return _puf2RotationAxis; }
  653. set { SetProperty(ref _puf2RotationAxis, value); }
  654. }
  655. /// <summary>
  656. /// Puf1 Flip Axis
  657. /// </summary>
  658. public BeckhoffStationAxis Puf1FlipAxis
  659. {
  660. get { return _puf1FlipAxis; }
  661. set { SetProperty(ref _puf1FlipAxis, value); }
  662. }
  663. /// <summary>
  664. /// Puf2 Flip Axis
  665. /// </summary>
  666. public BeckhoffStationAxis Puf2FlipAxis
  667. {
  668. get { return _puf2FlipAxis; }
  669. set { SetProperty(ref _puf2FlipAxis, value); }
  670. }
  671. /// <summary>
  672. /// Loader1 Rotation Axis
  673. /// </summary>
  674. public BeckhoffStationAxis Loader1RotationAxis
  675. {
  676. get { return _loader1RotationAxis; }
  677. set { SetProperty(ref _loader1RotationAxis, value); }
  678. }
  679. /// <summary>
  680. /// Loader1 TiltA Axis
  681. /// </summary>
  682. public BeckhoffStationAxis Loader1TiltAAxis
  683. {
  684. get { return _loader1TiltAAxis; }
  685. set { SetProperty(ref _loader1TiltAAxis, value); }
  686. }
  687. /// <summary>
  688. /// Loader1 TiltB Axis
  689. /// </summary>
  690. public BeckhoffStationAxis Loader1TiltBAxis
  691. {
  692. get { return _loader1TiltBAxis; }
  693. set { SetProperty(ref _loader1TiltBAxis, value); }
  694. }
  695. /// <summary>
  696. /// Loader1 Rotation实际位置数据
  697. /// </summary>
  698. public double Loader1RotationMotorPosition
  699. {
  700. get { return _loader1RotationMotorPosition; }
  701. set { SetProperty(ref _loader1RotationMotorPosition, value); }
  702. }
  703. /// <summary>
  704. /// Loader1 TiltA实际位置数据
  705. /// </summary>
  706. public double Loader1TiltAMotorPosition
  707. {
  708. get { return _loader1TiltAMotorPosition; }
  709. set { SetProperty(ref _loader1TiltAMotorPosition, value); }
  710. }
  711. /// <summary>
  712. /// Loader1 TiltB实际位置数据
  713. /// </summary>
  714. public double Loader1TiltBMotorPosition
  715. {
  716. get { return _loader1TiltBMotorPosition; }
  717. set { SetProperty(ref _loader1TiltBMotorPosition, value); }
  718. }
  719. /// <summary>
  720. /// Loader Rotation位置
  721. /// </summary>
  722. public LoaderControl.LoaderRotation CurrentLoaderRotation
  723. {
  724. get { return m_currentLoaderRotation; }
  725. set { SetProperty(ref m_currentLoaderRotation, value); }
  726. }
  727. public string LoaderTiltACurrentStation
  728. {
  729. get { return _loaderTiltACurrentStation; }
  730. set { SetProperty(ref _loaderTiltACurrentStation, value); }
  731. }
  732. /// <summary>
  733. /// Loader TiltB当前station
  734. /// </summary>
  735. public string LoaderTiltBCurrentStation
  736. {
  737. get { return _loaderTiltBCurrentStation; }
  738. set { SetProperty(ref _loaderTiltBCurrentStation, value); }
  739. }
  740. public bool IsLP1HasNoJob
  741. {
  742. get { return _isLp1HasNoJob; }
  743. set { SetProperty(ref _isLp1HasNoJob, value); }
  744. }
  745. public bool IsLP2HasNoJob
  746. {
  747. get { return _isLp2HasNoJob; }
  748. set { SetProperty(ref _isLp2HasNoJob, value); }
  749. }
  750. public bool IsLP3HasNoJob
  751. {
  752. get { return _isLp3HasNoJob; }
  753. set { SetProperty(ref _isLp3HasNoJob, value); }
  754. }
  755. #endregion
  756. #region 命令
  757. private DelegateCommand<object> _LoadWaferCommand;
  758. public DelegateCommand<object> LoadWaferCommand =>
  759. _LoadWaferCommand ?? (_LoadWaferCommand = new DelegateCommand<object>(OnLoadWafer));
  760. private DelegateCommand<object> _UnLoadWaferCommand;
  761. public DelegateCommand<object> UnLoadWaferCommand =>
  762. _UnLoadWaferCommand ?? (_UnLoadWaferCommand = new DelegateCommand<object>(OnUnLoadWafer));
  763. private DelegateCommand<object> _StartCommand;
  764. public DelegateCommand<object> StartCommand =>
  765. _StartCommand ?? (_StartCommand = new DelegateCommand<object>(OnStart));
  766. private DelegateCommand<object> _StopCommand;
  767. public DelegateCommand<object> StopCommand =>
  768. _StopCommand ?? (_StopCommand = new DelegateCommand<object>(OnStop));
  769. private DelegateCommand<object> _AbortCommand;
  770. public DelegateCommand<object> AbortCommand =>
  771. _AbortCommand ?? (_AbortCommand = new DelegateCommand<object>(OnAbort));
  772. private DelegateCommand _HomeAllCommand;
  773. public DelegateCommand HomeAllCommand =>
  774. _HomeAllCommand ?? (_HomeAllCommand = new DelegateCommand(OnHomeAll));
  775. private DelegateCommand _ResumeAllJobCommand;
  776. public DelegateCommand ResumeAllJobCommand =>
  777. _ResumeAllJobCommand ?? (_ResumeAllJobCommand = new DelegateCommand(OnResumeAllJob));
  778. private DelegateCommand _AbortAllCommand;
  779. public DelegateCommand AbortAllCommand =>
  780. _AbortAllCommand ?? (_AbortAllCommand = new DelegateCommand(OnAbortAll));
  781. private DelegateCommand _ReturnAllWaferCommand;
  782. public DelegateCommand ReturnAllWaferCommand =>
  783. _ReturnAllWaferCommand ?? (_ReturnAllWaferCommand = new DelegateCommand(OnReturnAllWafer));
  784. private DelegateCommand<object> _SetSequenceCommand;
  785. public DelegateCommand<object> SetSequenceCommand =>
  786. _SetSequenceCommand ?? (_SetSequenceCommand = new DelegateCommand<object>(OnSetSequence));
  787. private DelegateCommand _EnableAutoCommand;
  788. public DelegateCommand EnableAutoCommand =>
  789. _EnableAutoCommand ?? (_EnableAutoCommand = new DelegateCommand(OnEnableAuto));
  790. private DelegateCommand _EnableManualCommand;
  791. public DelegateCommand EnableManualCommand =>
  792. _EnableManualCommand ?? (_EnableManualCommand = new DelegateCommand(OnEnableManual));
  793. private DelegateCommand<object> _GotoSrdViewCommond;
  794. public DelegateCommand<object> GotoSrdViewCommond =>
  795. _GotoSrdViewCommond ?? (_GotoSrdViewCommond = new DelegateCommand<object>(GotoSrdViewAction));
  796. public bool SwitchFlag;
  797. #endregion
  798. #region 构造函数
  799. public OperationOverViewModel()
  800. {
  801. addDataKeys();
  802. ATMModeIsOn = Convert.ToBoolean(QueryDataClient.Instance.Service.GetConfig("System.IsATMMode")) == true ? "ATM Mode On" : "ATM Mode Off";
  803. }
  804. #endregion
  805. #region 命令方法
  806. /// <summary>
  807. /// 加载数据
  808. /// </summary>
  809. public void LoadData(string systemName)
  810. {
  811. Dictionary<string, object> allModulesDictionary = QueryDataClient.Instance.Service.PollData(new List<string>() { "System.InstalledModules" });
  812. if (allModulesDictionary != null)
  813. {
  814. List<string> allModules = CommonFunction.GetValue<List<string>>(allModulesDictionary, "System.InstalledModules");
  815. EFEMIsInstalled = allModules.Contains("EFEM");
  816. LoaderIsInstalled = allModules.Contains(ModuleName.Loader1.ToString());
  817. }
  818. if (_timer == null)
  819. {
  820. _timer = new DispatcherTimer();
  821. _timer.Interval = TimeSpan.FromMilliseconds(100);
  822. _timer.Tick += Timer_Tick;
  823. }
  824. _timer.Start();
  825. if (_timer1 == null)
  826. {
  827. _timer1 = new DispatcherTimer();
  828. _timer1.Interval = TimeSpan.FromMilliseconds(50);
  829. _timer1.Tick += Timer1_Tick;
  830. }
  831. _timer1.Start();
  832. _pufLayoutRotationDistance = (int)QueryDataClient.Instance.Service.GetConfig("DualPUF.PufLayoutRotationDistance");
  833. _robotLayoutPosition = (int)QueryDataClient.Instance.Service.GetConfig("DualPUF.RobotLayoutPosition");
  834. _waferSize = (int)QueryDataClient.Instance.Service.GetConfig("System.WaferSize");
  835. if (!m_RtDataKeys.Contains($"Station.PUF1.Roation.{_waferSize}"))
  836. {
  837. addDataKeys(_waferSize);
  838. }
  839. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  840. if (RtDataValues != null)
  841. {
  842. //目标位置数据获取
  843. Puf1RotationAxis = CommonFunction.GetValue<BeckhoffStationAxis>(RtDataValues, $"Station.PUF1.Rotation.{_waferSize}");
  844. Puf2RotationAxis = CommonFunction.GetValue<BeckhoffStationAxis>(RtDataValues, $"Station.PUF2.Rotation.{_waferSize}");
  845. //Puf1FlipAxis = CommonFunction.GetValue<BeckhoffStationAxis>(RtDataValues, $"Station.PUF1.Flip.{_waferSize}");
  846. //Puf2FlipAxis = CommonFunction.GetValue<BeckhoffStationAxis>(RtDataValues, $"Station.PUF2.Flip.{_waferSize}");
  847. //Loader1RotationAxis = CommonFunction.GetValue<BeckhoffStationAxis>(RtDataValues, $"Station.Loader1.Rotation.{_waferSize}");
  848. //Loader1TiltAAxis = CommonFunction.GetValue<BeckhoffStationAxis>(RtDataValues, $"Station.Loader1.TiltA.{_waferSize}");
  849. //Loader1TiltBAxis = CommonFunction.GetValue<BeckhoffStationAxis>(RtDataValues, $"Station.Loader1.TiltB.{_waferSize}");
  850. //Puf1Rotation比例尺计算
  851. var resultRotation = CalculateMaxMin(Puf1RotationAxis);
  852. double distance = resultRotation.max - resultRotation.min;
  853. _puf1RotationRatio = distance / _pufLayoutRotationDistance;
  854. _puf1RotationMotorPositionMax = resultRotation.max;
  855. //Puf2Rotation比例尺计算
  856. resultRotation = CalculateMaxMin(Puf2RotationAxis);
  857. distance = resultRotation.max - resultRotation.min;
  858. _puf2RotationRatio = distance / _pufLayoutRotationDistance;
  859. _puf2RotationMotorPositionMin = resultRotation.min;
  860. }
  861. }
  862. /// <summary>
  863. /// 隐藏
  864. /// </summary>
  865. public void Hide()
  866. {
  867. if (_timer != null)
  868. {
  869. _timer.Stop();
  870. }
  871. if (_timer1 != null)
  872. {
  873. _timer1.Stop();
  874. }
  875. }
  876. private void OnLoadWafer(object obj)
  877. {
  878. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Load", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
  879. }
  880. private void OnUnLoadWafer(object obj)
  881. {
  882. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Unload", ModuleManager.ModuleInfos[obj.ToString()].ModuleID);
  883. }
  884. private void OnStart(object obj)
  885. {
  886. var info = obj as WaferAssociationInfo;
  887. InvokeClient.Instance.Service.DoOperation("System.StartJob", info.LotId);
  888. }
  889. private void OnStop(object obj)
  890. {
  891. var info = obj as WaferAssociationInfo;
  892. InvokeClient.Instance.Service.DoOperation("System.PauseJob", info.JobID);
  893. }
  894. private void OnAbort(object obj)
  895. {
  896. var info = obj as WaferAssociationInfo;
  897. InvokeClient.Instance.Service.DoOperation("System.ResumeJob", info.JobID);
  898. }
  899. private void OnHomeAll()
  900. {
  901. InvokeClient.Instance.Service.DoOperation("System.HomeAll");
  902. }
  903. private void OnResumeAllJob()
  904. {
  905. if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
  906. {
  907. InvokeClient.Instance.Service.DoOperation("System.ResumeAllJob");
  908. }
  909. else
  910. {
  911. InvokeClient.Instance.Service.DoOperation("System.PauseAllJob");
  912. }
  913. }
  914. private void OnAbortAll()
  915. {
  916. InvokeClient.Instance.Service.DoOperation("System.Abort");
  917. }
  918. private void OnReturnAllWafer()
  919. {
  920. //Dialog
  921. WaferDialogView dialog = new WaferDialogView()
  922. {
  923. Owner = Application.Current.MainWindow,
  924. };
  925. dialog.Height = 300;
  926. dialog.Width = 400;
  927. double angel = 0;
  928. double coolingtime = 0;
  929. string message = "Please Confirm Return Wafer";
  930. WaferDialogViewModel vm = new WaferDialogViewModel();
  931. vm.ConfirmText = message;
  932. dialog.DataContext = vm;
  933. if (dialog.ShowDialog() == true)
  934. {
  935. if ((bool)dialog.AlignFlag == true && !string.IsNullOrEmpty(dialog.Angle))
  936. {
  937. angel = Convert.ToDouble(dialog.Angle);
  938. }
  939. if ((bool)dialog.CoolingFlag == true && !string.IsNullOrEmpty(dialog.CoolingTime))
  940. {
  941. coolingtime = Convert.ToDouble(dialog.CoolingTime);
  942. }
  943. InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer", dialog.CoolingFlag, coolingtime, dialog.AlignFlag, angel);
  944. }
  945. }
  946. private void OnSetSequence(object obj)
  947. {
  948. var info = obj as WaferInfo;
  949. bool flag = info.SequenceName != "" ? false : true;
  950. }
  951. private void OnEnableAuto()
  952. {
  953. InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
  954. }
  955. private void OnEnableManual()
  956. {
  957. InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
  958. }
  959. private void GotoSrdViewAction(object obj)
  960. {
  961. CyberX8_Core.GlobalEvents.OnSwitchFixedTabItem("HardWare", "SRD", $"{obj.ToString()}");
  962. }
  963. #endregion
  964. #region 私有方法
  965. /// <summary>
  966. /// 定时器
  967. /// </summary>
  968. /// <param name="sender"></param>
  969. /// <param name="e"></param>
  970. private void Timer_Tick(object sender, EventArgs e)
  971. {
  972. LP1ModuleInfo = ModuleManager.ModuleInfos["LP1"];
  973. LP2ModuleInfo = ModuleManager.ModuleInfos["LP2"];
  974. LP3ModuleInfo = ModuleManager.ModuleInfos["LP3"];
  975. EFEMModuleInfo = ModuleManager.ModuleInfos["EfemRobot"];
  976. SRD1ModuleInfo = ModuleManager.ModuleInfos["SRD1"];
  977. SRD2ModuleInfo = ModuleManager.ModuleInfos["SRD2"];
  978. PUF1ModuleInfo = ModuleManager.ModuleInfos["PUF1"];
  979. PUF2ModuleInfo = ModuleManager.ModuleInfos["PUF2"];
  980. Dummy1ModuleInfo = ModuleManager.ModuleInfos["Dummy1"];
  981. Dummy2ModuleInfo = ModuleManager.ModuleInfos["Dummy2"];
  982. LoaderModuleInfo = ModuleManager.ModuleInfos["Loader1"];
  983. if (ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers.Count != 0)
  984. {
  985. BladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  986. }
  987. if (EFEMIsInstalled == true)
  988. {
  989. if (ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers.Count != 0)
  990. {
  991. EFEMBladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  992. }
  993. if (ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers.Count != 0)
  994. {
  995. Aligner1Wafer = ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0];
  996. }
  997. }
  998. if (SRD1ModuleInfo != null&& SRD1ModuleInfo.WaferManager.Wafers.Count!=0)
  999. {
  1000. SRD1Wafer = SRD1ModuleInfo.WaferManager.Wafers[0];
  1001. }
  1002. if (SRD2ModuleInfo != null&& SRD2ModuleInfo.WaferManager.Wafers.Count!=0)
  1003. {
  1004. SRD2Wafer = SRD2ModuleInfo.WaferManager.Wafers[0];
  1005. }
  1006. if(PUF1ModuleInfo!=null)
  1007. {
  1008. if (PUF1ModuleInfo.WaferManager.Wafers.Count != 0)
  1009. {
  1010. PUF1WaferA = PUF1ModuleInfo.WaferManager.Wafers[0];
  1011. }
  1012. if (PUF1ModuleInfo.WaferManager.Wafers.Count != 0)
  1013. {
  1014. PUF1WaferB = PUF1ModuleInfo.WaferManager.Wafers[1];
  1015. }
  1016. }
  1017. if (PUF2ModuleInfo != null)
  1018. {
  1019. if (PUF2ModuleInfo.WaferManager.Wafers.Count != 0)
  1020. {
  1021. PUF2WaferA = PUF2ModuleInfo.WaferManager.Wafers[0];
  1022. }
  1023. if (PUF2ModuleInfo.WaferManager.Wafers.Count != 0)
  1024. {
  1025. PUF2WaferB = PUF2ModuleInfo.WaferManager.Wafers[1];
  1026. }
  1027. }
  1028. if(LoaderIsInstalled&&LoaderModuleInfo!=null)
  1029. {
  1030. if (LoaderModuleInfo.WaferManager.Wafers.Count != 0)
  1031. {
  1032. LoaderWaferA = LoaderModuleInfo.WaferManager.Wafers[0];
  1033. }
  1034. if (LoaderModuleInfo.WaferManager.Wafers.Count != 0)
  1035. {
  1036. LoaderWaferB = LoaderModuleInfo.WaferManager.Wafers[1];
  1037. }
  1038. }
  1039. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction");
  1040. EfemRobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("EFEM.RobotMoveAction");
  1041. LP1WaferCount = LP1ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  1042. LP2WaferCount = LP2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  1043. LP3WaferCount = LP3ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  1044. //Dummy1WaferCount = 15;
  1045. Dummy1WaferCount = Dummy1ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  1046. Dummy2WaferCount = Dummy2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  1047. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  1048. IsLP1Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort1Unable");
  1049. IsLP2Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort2Unable");
  1050. IsLP3Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort3Unable");
  1051. if (RtDataValues != null)
  1052. {
  1053. Puf1IsInRobotStation = CommonFunction.GetValue<bool>(RtDataValues, "PUF1.IsInRobotStation");
  1054. Puf2IsInRobotStation = CommonFunction.GetValue<bool>(RtDataValues, "PUF2.IsInRobotStation");
  1055. if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
  1056. {
  1057. RouteState = "Resume";
  1058. }
  1059. else
  1060. {
  1061. RouteState = "Pause";
  1062. }
  1063. ControlJobInfo lp1Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP1.CurrentControlJob");
  1064. IsLP1HasNoJob = lp1Cj == null ? true : false;
  1065. ControlJobInfo lp2Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP2.CurrentControlJob");
  1066. IsLP2HasNoJob = lp2Cj == null ? true : false;
  1067. ControlJobInfo lp3Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP3.CurrentControlJob");
  1068. IsLP3HasNoJob = lp3Cj == null ? true : false;
  1069. }
  1070. }
  1071. int count = 0;
  1072. /// <summary>
  1073. /// 定时器1
  1074. /// </summary>
  1075. /// <param name="sender"></param>
  1076. /// <param name="e"></param>
  1077. private void Timer1_Tick(object sender, EventArgs e)
  1078. {
  1079. if (m_RtDataKeys.Count != 0)
  1080. {
  1081. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  1082. if (RtDataValues != null)
  1083. {
  1084. Puf1RotationMotorPosition = CommonFunction.GetValue<double>(RtDataValues, $"PUF1.Rotation.{MOTOR_POSITION}");
  1085. Puf2RotationMotorPosition = CommonFunction.GetValue<double>(RtDataValues, $"PUF2.Rotation.{MOTOR_POSITION}");
  1086. Loader1TiltAMotorPosition = CommonFunction.GetValue<double>(RtDataValues, $"Loader1.TiltA.{MOTOR_POSITION}");
  1087. Loader1TiltBMotorPosition = CommonFunction.GetValue<double>(RtDataValues, $"Loader1.TiltB.{MOTOR_POSITION}");
  1088. Loader1RotationMotorPosition = CommonFunction.GetValue<double>(RtDataValues, $"Loader1.Rotation.{MOTOR_POSITION}");
  1089. Puf1FlipMotorPosition = CommonFunction.GetValue<double>(RtDataValues, $"PUF1.Flip.{MOTOR_POSITION}");
  1090. Puf2FlipMotorPosition = CommonFunction.GetValue<double>(RtDataValues, $"PUF2.Flip.{MOTOR_POSITION}");
  1091. //计算Puf1和Puf2 Rotation UI位置
  1092. Puf1RotationPosition = _robotLayoutPosition + (_puf1RotationMotorPositionMax - Puf1RotationMotorPosition) / _puf1RotationRatio;
  1093. Puf2RotationPosition = _robotLayoutPosition + (Puf2RotationMotorPosition - _puf2RotationMotorPositionMin) / _puf2RotationRatio;
  1094. //计Loader Rotation UI位置
  1095. Loader1RotationPosition = -Loader1RotationMotorPosition - LOADER_ROTATION_DIFFER;
  1096. //计算Puf1和Puf2 Flip UI位置
  1097. Puf1FlipPosition = Puf1FlipMotorPosition - PUF_FLIP_DIFFER;
  1098. Puf2FlipPosition = Puf2FlipMotorPosition - PUF_FLIP_DIFFER;
  1099. //判断Loader1的TiltA水平状态
  1100. LoaderTiltACurrentStation = CommonFunction.GetCurrentStationLastContent(CommonFunction.GetValue<string>(RtDataValues, $"Loader1.TiltA.{CURRENT_STATION}"), "Loader1.TiltA");
  1101. if (LoaderTiltACurrentStation == "HORI")
  1102. {
  1103. LoaderWaferVisibleA = true;
  1104. }
  1105. else if(LoaderTiltACurrentStation == "VERT")
  1106. {
  1107. LoaderWaferVisibleA = false;
  1108. }
  1109. //判断Loader1的TiltB水平状态
  1110. LoaderTiltBCurrentStation = CommonFunction.GetCurrentStationLastContent(CommonFunction.GetValue<string>(RtDataValues, $"Loader1.TiltB.{CURRENT_STATION}"), "Loader1.TiltB");
  1111. if (LoaderTiltBCurrentStation == "HORI")
  1112. {
  1113. LoaderWaferVisibleB = true;
  1114. }
  1115. else if (LoaderTiltBCurrentStation == "VERT")
  1116. {
  1117. LoaderWaferVisibleB = false;
  1118. }
  1119. }
  1120. }
  1121. }
  1122. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  1123. {
  1124. string RobotTarget;
  1125. if (oldValue == null || newValue == null)
  1126. {
  1127. return;
  1128. }
  1129. #region Rotating
  1130. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Rotating))
  1131. {
  1132. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  1133. if (TMRobotMoveActionBladeTarget != null)
  1134. {
  1135. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  1136. }
  1137. else
  1138. {
  1139. return;
  1140. }
  1141. var values = RobotTarget.Split('.');
  1142. var arm = values[0];
  1143. var module = values[1];
  1144. if (arm == "ArmA")
  1145. {
  1146. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1147. }
  1148. else if (arm == "ArmB")
  1149. {
  1150. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1151. }
  1152. }
  1153. #endregion
  1154. #region pick 和 place LL
  1155. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  1156. {
  1157. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  1158. if (TMRobotMoveActionBladeTarget != null)
  1159. {
  1160. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  1161. }
  1162. else
  1163. {
  1164. return;
  1165. }
  1166. var values = RobotTarget.Split('.');
  1167. var arm = values[0];
  1168. var module = values[1];
  1169. if (arm == "ArmA")
  1170. {
  1171. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1172. if (waferRobotTAction != Robot1TAction)
  1173. {
  1174. Robot1TAction = waferRobotTAction;
  1175. }
  1176. else
  1177. {
  1178. //await Task.Delay(100);
  1179. }
  1180. await Task.Delay(600);
  1181. //Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1182. //await Task.Delay(600);
  1183. Robot1XAction = WaferRobotXAction.Extend;
  1184. 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))
  1185. {
  1186. await Task.Delay(100);
  1187. }
  1188. Robot1XAction = WaferRobotXAction.Retract;
  1189. }
  1190. else if (arm == "ArmB")
  1191. {
  1192. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1193. if (waferRobotTAction != Robot2TAction)
  1194. {
  1195. Robot2TAction = waferRobotTAction;
  1196. }
  1197. else
  1198. {
  1199. //await Task.Delay(100);
  1200. }
  1201. await Task.Delay(600);
  1202. //Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1203. //await Task.Delay(600);
  1204. Robot2XAction = WaferRobotXAction.Extend;
  1205. 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))
  1206. {
  1207. await Task.Delay(100);
  1208. }
  1209. Robot2XAction = WaferRobotXAction.Retract;
  1210. }
  1211. }
  1212. #endregion
  1213. #region pick 和 place pm
  1214. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Extending)
  1215. {
  1216. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  1217. if (TMRobotMoveActionBladeTarget != null)
  1218. {
  1219. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  1220. }
  1221. else
  1222. {
  1223. return;
  1224. }
  1225. var values = RobotTarget.Split('.');
  1226. var arm = values[0];
  1227. var module = values[1];
  1228. if (arm == "ArmA")
  1229. {
  1230. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1231. if (waferRobotTAction != Robot1TAction)
  1232. {
  1233. Robot1TAction = waferRobotTAction;
  1234. }
  1235. else
  1236. {
  1237. // await Task.Delay(100);
  1238. }
  1239. await Task.Delay(600);
  1240. Robot1XAction = WaferRobotXAction.Extend;
  1241. }
  1242. else if (arm == "ArmB")
  1243. {
  1244. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1245. if (waferRobotTAction != Robot2TAction)
  1246. {
  1247. Robot2TAction = waferRobotTAction;
  1248. }
  1249. else
  1250. {
  1251. // await Task.Delay(100);
  1252. }
  1253. await Task.Delay(600);
  1254. Robot2XAction = WaferRobotXAction.Extend;
  1255. }
  1256. }
  1257. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Retracting)
  1258. {
  1259. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  1260. if (TMRobotMoveActionBladeTarget != null)
  1261. {
  1262. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  1263. }
  1264. else
  1265. {
  1266. return;
  1267. }
  1268. var values = RobotTarget.Split('.');
  1269. var arm = values[0];
  1270. if (arm == "ArmA")
  1271. {
  1272. Robot1XAction = WaferRobotXAction.Retract;
  1273. }
  1274. else if (arm == "ArmB")
  1275. {
  1276. Robot2XAction = WaferRobotXAction.Retract;
  1277. }
  1278. }
  1279. #endregion
  1280. #region Home
  1281. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  1282. {
  1283. if (Robot1XAction == WaferRobotXAction.Extend)
  1284. {
  1285. Robot1XAction = WaferRobotXAction.Retract;
  1286. }
  1287. if (Robot2XAction == WaferRobotXAction.Extend)
  1288. {
  1289. Robot2XAction = WaferRobotXAction.Retract;
  1290. }
  1291. await Task.Delay(2000);
  1292. if (Robot1TAction != WaferRobotTAction.T_Origin)
  1293. {
  1294. Robot1TAction = WaferRobotTAction.T_Origin;
  1295. }
  1296. if (Robot2TAction != WaferRobotTAction.T_Origin)
  1297. {
  1298. Robot2TAction = WaferRobotTAction.T_Origin;
  1299. }
  1300. }
  1301. #endregion
  1302. }
  1303. private async void EFEMRobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  1304. {
  1305. string RobotTarget;
  1306. if (oldValue == null || newValue == null)
  1307. {
  1308. return;
  1309. }
  1310. #region pick 和 place LL
  1311. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  1312. {
  1313. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  1314. if (TMRobotMoveActionBladeTarget != null)
  1315. {
  1316. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  1317. }
  1318. else
  1319. {
  1320. return;
  1321. }
  1322. var values = RobotTarget.Split('.');
  1323. var arm = values[0];
  1324. var module = values[1];
  1325. if (arm == "ArmA")
  1326. {
  1327. var robot3Robot3TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1328. //await Task.Delay(1000);
  1329. await ChangePosition(robot3Robot3TAction, newValue.Action);
  1330. if (Robot3TAction != robot3Robot3TAction)
  1331. {
  1332. Robot3TAction = robot3Robot3TAction;
  1333. await Task.Delay(600);
  1334. }
  1335. Robot3XAction = WaferRobotXAction.Extend;
  1336. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0].WaferStatus == 0))
  1337. {
  1338. await Task.Delay(100);
  1339. }
  1340. Robot3XAction = WaferRobotXAction.Retract;
  1341. if(newValue.Action == RobotAction.Placing)
  1342. {
  1343. await ChangePosition(WaferRobotTAction.T_Origin, newValue.Action);
  1344. }
  1345. }
  1346. }
  1347. #endregion
  1348. #region pick 和 place pm
  1349. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Extending)
  1350. {
  1351. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  1352. if (TMRobotMoveActionBladeTarget != null)
  1353. {
  1354. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  1355. }
  1356. else
  1357. {
  1358. return;
  1359. }
  1360. var values = RobotTarget.Split('.');
  1361. var arm = values[0];
  1362. var module = values[1];
  1363. if (arm == "ArmA")
  1364. {
  1365. Robot3TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1366. await Task.Delay(1500);
  1367. //ChangePosition(Robot3TAction);
  1368. //await Task.Delay(2000);
  1369. Robot3XAction = WaferRobotXAction.Extend;
  1370. }
  1371. else if (arm == "ArmB")
  1372. {
  1373. Robot4TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  1374. await Task.Delay(1500);
  1375. //ChangePosition(Robot4TAction);
  1376. //await Task.Delay(2000);
  1377. Robot4XAction = WaferRobotXAction.Extend;
  1378. }
  1379. }
  1380. if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Retracting)
  1381. {
  1382. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  1383. if (TMRobotMoveActionBladeTarget != null)
  1384. {
  1385. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  1386. }
  1387. else
  1388. {
  1389. return;
  1390. }
  1391. var values = RobotTarget.Split('.');
  1392. var arm = values[0];
  1393. if (arm == "ArmA")
  1394. {
  1395. Robot3XAction = WaferRobotXAction.Retract;
  1396. await Task.Delay(3000);
  1397. //ChangePosition(Robot3TAction);
  1398. //await Task.Delay(2000);
  1399. }
  1400. else if (arm == "ArmB")
  1401. {
  1402. Robot4XAction = WaferRobotXAction.Retract;
  1403. await Task.Delay(3000);
  1404. //ChangePosition(Robot3TAction);
  1405. //await Task.Delay(2000);
  1406. }
  1407. }
  1408. #endregion
  1409. #region Home
  1410. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  1411. {
  1412. if (Robot3XAction == WaferRobotXAction.Extend)
  1413. {
  1414. Robot3XAction = WaferRobotXAction.Retract;
  1415. }
  1416. if (Robot4XAction == WaferRobotXAction.Extend)
  1417. {
  1418. Robot4XAction = WaferRobotXAction.Retract;
  1419. }
  1420. if (Robot3TAction != WaferRobotTAction.T_Origin)
  1421. {
  1422. Robot3TAction = WaferRobotTAction.T_Origin;
  1423. }
  1424. if (Robot4TAction != WaferRobotTAction.T_Origin)
  1425. {
  1426. Robot4TAction = WaferRobotTAction.T_Origin;
  1427. }
  1428. await Task.Delay(1000);
  1429. await ChangePosition(WaferRobotTAction.T_Origin, newValue.Action);
  1430. }
  1431. #endregion
  1432. }
  1433. private void addDataKeys()
  1434. {
  1435. m_RtDataKeys.Add("LP1.IsLoaded");
  1436. m_RtDataKeys.Add("LP2.IsLoaded");
  1437. m_RtDataKeys.Add("LP3.IsLoaded");
  1438. m_RtDataKeys.Add("LP1.CassettePlaced");
  1439. m_RtDataKeys.Add("LP2.CassettePlaced");
  1440. m_RtDataKeys.Add("LP3.CassettePlaced");
  1441. m_RtDataKeys.Add("LP1.CurrentControlJob");
  1442. m_RtDataKeys.Add("LP2.CurrentControlJob");
  1443. m_RtDataKeys.Add("LP3.CurrentControlJob");
  1444. m_RtDataKeys.Add("System.IsAutoMode");
  1445. m_RtDataKeys.Add("System.IsBusy");
  1446. m_RtDataKeys.Add("Scheduler.CycledCount");
  1447. m_RtDataKeys.Add("Scheduler.CycledWafer");
  1448. m_RtDataKeys.Add("Scheduler.CycleSetPoint");
  1449. m_RtDataKeys.Add("Scheduler.Throughput");
  1450. m_RtDataKeys.Add("EquipmentStatus");
  1451. m_RtDataKeys.Add("Scheduler.PjNameList");
  1452. m_RtDataKeys.Add("PUF1.IsInRobotStation");
  1453. m_RtDataKeys.Add("PUF2.IsInRobotStation");
  1454. m_RtDataKeys.Add("Scheduler.CjNameList");
  1455. }
  1456. private void addDataKeys(int waferSize)
  1457. {
  1458. m_RtDataKeys.Add($"Station.PUF1.Rotation.{waferSize}");
  1459. m_RtDataKeys.Add($"Station.PUF2.Rotation.{waferSize}");
  1460. m_RtDataKeys.Add($"Station.PUF1.Flip.{waferSize}");
  1461. m_RtDataKeys.Add($"Station.PUF2.Flip.{waferSize}");
  1462. m_RtDataKeys.Add($"Station.PUF1.Vertical.{waferSize}");
  1463. m_RtDataKeys.Add($"Station.PUF2.Vertical.{waferSize}");
  1464. m_RtDataKeys.Add($"Station.Loader1.Rotation.{waferSize}");
  1465. m_RtDataKeys.Add($"Station.Loader1.TiltA.{waferSize}");
  1466. m_RtDataKeys.Add($"Station.Loader1.TiltB.{waferSize}");
  1467. m_RtDataKeys.Add($"PUF1.Rotation.{MOTOR_POSITION}");
  1468. m_RtDataKeys.Add($"PUF2.Rotation.{MOTOR_POSITION}");
  1469. m_RtDataKeys.Add($"PUF1.Flip.{MOTOR_POSITION}");
  1470. m_RtDataKeys.Add($"PUF2.Flip.{MOTOR_POSITION}");
  1471. m_RtDataKeys.Add($"Loader1.Rotation.{MOTOR_POSITION}");
  1472. m_RtDataKeys.Add($"Loader1.TiltA.{MOTOR_POSITION}");
  1473. m_RtDataKeys.Add($"Loader1.TiltB.{MOTOR_POSITION}");
  1474. m_RtDataKeys.Add($"PUF1.Flip.{CURRENT_STATION}");
  1475. m_RtDataKeys.Add($"PUF2.Flip.{CURRENT_STATION}");
  1476. m_RtDataKeys.Add($"Loader1.TiltA.{CURRENT_STATION}");
  1477. m_RtDataKeys.Add($"Loader1.TiltB.{CURRENT_STATION}");
  1478. m_RtDataKeys.Add($"PUF1.Rotation.{MOTION_DATA}");
  1479. m_RtDataKeys.Add($"PUF2.Rotation.{MOTION_DATA}");
  1480. }
  1481. private bool HasWaferOnSlot(List<WaferInfo> wafers, int index)
  1482. {
  1483. if (wafers[index].WaferStatus == 0)
  1484. return false;
  1485. return true;
  1486. }
  1487. private async Task ChangePosition(WaferRobotTAction waferRobotTAction, RobotAction robotAction)
  1488. {
  1489. await Task.Delay(500);
  1490. int delay = 500;
  1491. if (robotAction == RobotAction.Placing)
  1492. {
  1493. if (waferRobotTAction == WaferRobotTAction.LP1 || waferRobotTAction == WaferRobotTAction.PUF1)
  1494. {
  1495. CurrentRobotPosition = EFEM.RobotPosition.Left_Place;
  1496. await Task.Delay(delay);
  1497. }
  1498. else if (waferRobotTAction == WaferRobotTAction.LP3)
  1499. {
  1500. CurrentRobotPosition = EFEM.RobotPosition.Right_Place;
  1501. await Task.Delay(delay);
  1502. }
  1503. else if (waferRobotTAction == WaferRobotTAction.LP2 || waferRobotTAction == WaferRobotTAction.PUF2)
  1504. {
  1505. CurrentRobotPosition = EFEM.RobotPosition.Middle_Place;
  1506. await Task.Delay(delay);
  1507. }
  1508. else if (waferRobotTAction == WaferRobotTAction.Aligner1)
  1509. {
  1510. CurrentRobotPosition = EFEM.RobotPosition.Aligner_Place;
  1511. await Task.Delay(delay);
  1512. }
  1513. else if (waferRobotTAction == WaferRobotTAction.SRD1 || waferRobotTAction == WaferRobotTAction.SRD2)
  1514. {
  1515. CurrentRobotPosition = EFEM.RobotPosition.SRD_Place;
  1516. }
  1517. else if (waferRobotTAction == WaferRobotTAction.Dummy1 || waferRobotTAction == WaferRobotTAction.Dummy2)
  1518. {
  1519. CurrentRobotPosition = EFEM.RobotPosition.Dummy_Place;
  1520. }
  1521. else
  1522. {
  1523. CurrentRobotPosition = EFEM.RobotPosition.Origin;
  1524. await Task.Delay(delay);
  1525. }
  1526. }
  1527. else
  1528. {
  1529. if (waferRobotTAction == WaferRobotTAction.LP1 || waferRobotTAction == WaferRobotTAction.PUF1)
  1530. {
  1531. CurrentRobotPosition = EFEM.RobotPosition.Left;
  1532. await Task.Delay(delay);
  1533. }
  1534. else if (waferRobotTAction == WaferRobotTAction.LP3)
  1535. {
  1536. CurrentRobotPosition = EFEM.RobotPosition.Right;
  1537. await Task.Delay(delay);
  1538. }
  1539. else if (waferRobotTAction == WaferRobotTAction.LP2 || waferRobotTAction == WaferRobotTAction.PUF2)
  1540. {
  1541. CurrentRobotPosition = EFEM.RobotPosition.Middle;
  1542. await Task.Delay(delay);
  1543. }
  1544. else if (waferRobotTAction == WaferRobotTAction.Aligner1)
  1545. {
  1546. CurrentRobotPosition = EFEM.RobotPosition.Aligner;
  1547. await Task.Delay(delay);
  1548. }
  1549. else if (waferRobotTAction == WaferRobotTAction.SRD1 || waferRobotTAction == WaferRobotTAction.SRD2)
  1550. {
  1551. CurrentRobotPosition = EFEM.RobotPosition.SRD;
  1552. }
  1553. else if (waferRobotTAction == WaferRobotTAction.Dummy1 || waferRobotTAction == WaferRobotTAction.Dummy2)
  1554. {
  1555. CurrentRobotPosition = EFEM.RobotPosition.Dummy;
  1556. }
  1557. else
  1558. {
  1559. CurrentRobotPosition = EFEM.RobotPosition.Origin;
  1560. await Task.Delay(delay);
  1561. }
  1562. }
  1563. }
  1564. /// <summary>
  1565. /// 计算最大值最小值
  1566. /// </summary>
  1567. /// <param name="Puf1RotationAxis"></param>
  1568. /// <returns></returns>
  1569. private (double max, double min) CalculateMaxMin(BeckhoffStationAxis pufAxis)
  1570. {
  1571. double max = 0;
  1572. double min = 0;
  1573. foreach (Station item in pufAxis.Stations)
  1574. {
  1575. double position = double.Parse(item.Position);
  1576. if (position > max)
  1577. {
  1578. max = position;
  1579. }
  1580. if (position < min)
  1581. {
  1582. min = position;
  1583. }
  1584. }
  1585. foreach (Station item in pufAxis.Stations)
  1586. {
  1587. double position = double.Parse(item.Position);
  1588. if (position > max)
  1589. {
  1590. max = position;
  1591. }
  1592. if (position < min)
  1593. {
  1594. min = position;
  1595. }
  1596. }
  1597. return (max, min);
  1598. }
  1599. /// <summary>
  1600. /// 判定是否在station位置
  1601. /// </summary>
  1602. private bool JudgeAtStation(double targetPosition, double currentPosition, double tolerance)
  1603. {
  1604. if (Math.Abs(currentPosition - targetPosition) <= tolerance)
  1605. {
  1606. return true;
  1607. }
  1608. else
  1609. {
  1610. return false;
  1611. }
  1612. }
  1613. #endregion
  1614. }
  1615. }