OperationOverNewViewModel.cs 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162
  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 PunkHPX8_Core;
  16. using PunkHPX8_MainPages.Unity;
  17. using PunkHPX8_MainPages.Views;
  18. using PunkHPX8_Themes.CustomControls;
  19. using PunkHPX8_Themes.Unity;
  20. using PunkHPX8_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.Beckhoff.AxisProvider;
  36. using QiHe.CodeLib;
  37. using MECF.Framework.Common.Jobs;
  38. using ExcelLibrary.BinaryFileFormat;
  39. namespace PunkHPX8_MainPages.ViewModels
  40. {
  41. public class OperationOverNewViewModel : 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. #endregion
  49. #region 私有字段
  50. private bool _isLp1Unable;
  51. private bool _isLp2Unable;
  52. private ModuleInfo _LP1ModuleInfo;
  53. private ModuleInfo _LP2ModuleInfo;
  54. private ModuleInfo _EFEMModuleInfo;
  55. private ModuleInfo _alignerModuleInfo;
  56. private ModuleInfo _srd1ModuleInfo;
  57. private ModuleInfo _srd2ModuleInfo;
  58. private ModuleInfo _dummy1ModuleInfo;
  59. private ModuleInfo _dummy2ModuleInfo;
  60. private WaferRobotTAction m_Robot1TAction;
  61. private WaferRobotXAction m_Robot1XAction;
  62. private WaferRobotTAction m_Robot2TAction;
  63. private WaferRobotXAction m_Robot2XAction;
  64. private WaferRobotFAction m_Robot2FAction;
  65. private RobotMoveInfo m_robotMoveInfo;
  66. private WaferInfo m_srd1Wafer;
  67. private WaferInfo m_srd2Wafer;
  68. private List<string> m_RtDataKeys = new List<string>();
  69. private Dictionary<string, object> m_RtDataValues;
  70. private bool m_EFEMIsInstalled;
  71. private WaferInfo m_EFEMBladeAWafer;
  72. private WaferInfo m_EFEMBladeBWafer;
  73. private WaferInfo m_Aligner1Wafer;
  74. private WaferInfo m_vpw1Wafer;
  75. private WaferInfo m_vpw2Wafer;
  76. private WaferInfo m_platingCell1Wafer;
  77. private WaferInfo m_platingCell2Wafer;
  78. private WaferInfo m_platingCell3Wafer;
  79. private WaferInfo m_platingCell4Wafer;
  80. private int m_LP1WaferCount;
  81. private int m_LP2WaferCount;
  82. private int m_dummy1WaferCount;
  83. private int m_dummy2WaferCount;
  84. private int m_CycledWafer;
  85. private int m_CycleCountDisplay;
  86. private EFEM.RobotPosition m_CurrentRobotPosition;
  87. private WaferInfo m_BladeAWafer;
  88. private WaferInfo m_BladeBWafer;
  89. private string m_RouteState;
  90. /// <summary>
  91. /// 定时器
  92. /// </summary>
  93. private DispatcherTimer _timer;
  94. /// <summary>
  95. /// 是否存在Job
  96. /// </summary>
  97. private bool _isLp1HasNoJob;
  98. private bool _isLp2HasNoJob;
  99. #endregion
  100. #region 属性
  101. public bool IsLP1Unable
  102. {
  103. get { return _isLp1Unable; }
  104. set { SetProperty(ref _isLp1Unable, value); }
  105. }
  106. public bool IsLP2Unable
  107. {
  108. get { return _isLp2Unable; }
  109. set { SetProperty(ref _isLp2Unable, value); }
  110. }
  111. public ModuleInfo LP1ModuleInfo
  112. {
  113. get { return _LP1ModuleInfo; }
  114. set { SetProperty(ref _LP1ModuleInfo, value); }
  115. }
  116. public ModuleInfo EFEMModuleInfo
  117. {
  118. get { return _EFEMModuleInfo; }
  119. set { SetProperty(ref _EFEMModuleInfo, value); }
  120. }
  121. public ModuleInfo AlignerModuleInfo
  122. {
  123. get { return _alignerModuleInfo; }
  124. set { SetProperty(ref _alignerModuleInfo, value); }
  125. }
  126. public ModuleInfo LP2ModuleInfo
  127. {
  128. get { return _LP2ModuleInfo; }
  129. set { SetProperty(ref _LP2ModuleInfo, value); }
  130. }
  131. public ModuleInfo SRD1ModuleInfo
  132. {
  133. get { return _srd1ModuleInfo; }
  134. set { SetProperty(ref _srd1ModuleInfo, value); }
  135. }
  136. public ModuleInfo SRD2ModuleInfo
  137. {
  138. get { return _srd2ModuleInfo; }
  139. set { SetProperty(ref _srd2ModuleInfo, value); }
  140. }
  141. public ModuleInfo Dummy1ModuleInfo
  142. {
  143. get { return _dummy1ModuleInfo; }
  144. set { SetProperty(ref _dummy1ModuleInfo, value); }
  145. }
  146. public ModuleInfo Dummy2ModuleInfo
  147. {
  148. get { return _dummy2ModuleInfo; }
  149. set { SetProperty(ref _dummy2ModuleInfo, value); }
  150. }
  151. public WaferRobotTAction Robot1TAction
  152. {
  153. get { return m_Robot1TAction; }
  154. set { SetProperty(ref m_Robot1TAction, value); }
  155. }
  156. public WaferRobotXAction Robot1XAction
  157. {
  158. get { return m_Robot1XAction; }
  159. set { SetProperty(ref m_Robot1XAction, value); }
  160. }
  161. public WaferRobotTAction Robot2TAction
  162. {
  163. get { return m_Robot2TAction; }
  164. set { SetProperty(ref m_Robot2TAction, value); }
  165. }
  166. public WaferRobotXAction Robot2XAction
  167. {
  168. get { return m_Robot2XAction; }
  169. set { SetProperty(ref m_Robot2XAction, value); }
  170. }
  171. public WaferRobotFAction Robot2FAction
  172. {
  173. get { return m_Robot2FAction; }
  174. set { SetProperty(ref m_Robot2FAction, value); }
  175. }
  176. public RobotMoveInfo RobotMoveInfo
  177. {
  178. get { return m_robotMoveInfo; }
  179. set
  180. {
  181. RobotMoveInfoChanged(m_robotMoveInfo, value);
  182. //m_robotMoveInfo = value;
  183. SetProperty(ref m_robotMoveInfo, value);
  184. }
  185. }
  186. public Dictionary<string, object> RtDataValues
  187. {
  188. get { return m_RtDataValues; }
  189. set { SetProperty(ref m_RtDataValues, value); }
  190. }
  191. public bool EFEMIsInstalled
  192. {
  193. get { return m_EFEMIsInstalled; }
  194. set { SetProperty(ref m_EFEMIsInstalled, value); }
  195. }
  196. public WaferInfo EFEMBladeAWafer
  197. {
  198. get { return m_EFEMBladeAWafer; }
  199. set { SetProperty(ref m_EFEMBladeAWafer, value); }
  200. }
  201. public WaferInfo EFEMBladeBWafer
  202. {
  203. get { return m_EFEMBladeBWafer; }
  204. set { SetProperty(ref m_EFEMBladeBWafer, value); }
  205. }
  206. public WaferInfo Aligner1Wafer
  207. {
  208. get { return m_Aligner1Wafer; }
  209. set { SetProperty(ref m_Aligner1Wafer, value); }
  210. }
  211. public WaferInfo VPW1Wafer
  212. {
  213. get { return m_vpw1Wafer; }
  214. set { SetProperty(ref m_vpw1Wafer, value); }
  215. }
  216. public WaferInfo VPW2Wafer
  217. {
  218. get { return m_vpw2Wafer; }
  219. set { SetProperty(ref m_vpw2Wafer, value); }
  220. }
  221. public WaferInfo PlatingCell1Wafer
  222. {
  223. get { return m_platingCell1Wafer; }
  224. set { SetProperty(ref m_platingCell1Wafer, value); }
  225. }
  226. public WaferInfo PlatingCell2Wafer
  227. {
  228. get { return m_platingCell2Wafer; }
  229. set { SetProperty(ref m_platingCell2Wafer, value); }
  230. }
  231. public WaferInfo PlatingCell3Wafer
  232. {
  233. get { return m_platingCell3Wafer; }
  234. set { SetProperty(ref m_platingCell3Wafer, value); }
  235. }
  236. public WaferInfo PlatingCell4Wafer
  237. {
  238. get { return m_platingCell4Wafer; }
  239. set { SetProperty(ref m_platingCell4Wafer, value); }
  240. }
  241. public WaferInfo SRD1Wafer
  242. {
  243. get { return m_srd1Wafer; }
  244. set { SetProperty(ref m_srd1Wafer, value); }
  245. }
  246. public WaferInfo SRD2Wafer
  247. {
  248. get { return m_srd2Wafer; }
  249. set { SetProperty(ref m_srd2Wafer, value); }
  250. }
  251. public int LP1WaferCount
  252. {
  253. get { return m_LP1WaferCount; }
  254. set { SetProperty(ref m_LP1WaferCount, value); }
  255. }
  256. public int LP2WaferCount
  257. {
  258. get { return m_LP2WaferCount; }
  259. set { SetProperty(ref m_LP2WaferCount, value); }
  260. }
  261. public int Dummy1WaferCount
  262. {
  263. get { return m_dummy1WaferCount; }
  264. set { SetProperty(ref m_dummy1WaferCount, value); }
  265. }
  266. public int Dummy2WaferCount
  267. {
  268. get { return m_dummy2WaferCount; }
  269. set { SetProperty(ref m_dummy2WaferCount, value); }
  270. }
  271. public int CycledWafer
  272. {
  273. get { return m_CycledWafer; }
  274. set { SetProperty(ref m_CycledWafer, value); }
  275. }
  276. public int CycleCountDisplay
  277. {
  278. get { return m_CycleCountDisplay; }
  279. set { SetProperty(ref m_CycleCountDisplay, value); }
  280. }
  281. public RobotMoveInfo m_EfemRobotMoveInfo;
  282. public RobotMoveInfo EfemRobotMoveInfo
  283. {
  284. get { return m_EfemRobotMoveInfo; }
  285. set
  286. {
  287. EFEMRobotMoveInfoChanged(m_EfemRobotMoveInfo, value);
  288. //m_EfemRobotMoveInfo = value;
  289. SetProperty(ref m_EfemRobotMoveInfo, value);
  290. }
  291. }
  292. public EFEM.RobotPosition CurrentRobotPosition
  293. {
  294. get { return m_CurrentRobotPosition; }
  295. set { SetProperty(ref m_CurrentRobotPosition, value); }
  296. }
  297. public WaferInfo BladeAWafer
  298. {
  299. get { return m_BladeAWafer; }
  300. set { SetProperty(ref m_BladeAWafer, value); }
  301. }
  302. public WaferInfo BladeBWafer
  303. {
  304. get { return m_BladeBWafer; }
  305. set { SetProperty(ref m_BladeBWafer, value); }
  306. }
  307. public string RouteState
  308. {
  309. get { return m_RouteState; }
  310. set { SetProperty(ref m_RouteState, value); }
  311. }
  312. public bool IsLP1HasNoJob
  313. {
  314. get { return _isLp1HasNoJob; }
  315. set { SetProperty(ref _isLp1HasNoJob, value); }
  316. }
  317. public bool IsLP2HasNoJob
  318. {
  319. get { return _isLp2HasNoJob; }
  320. set { SetProperty(ref _isLp2HasNoJob, value); }
  321. }
  322. #endregion
  323. #region 命令
  324. private DelegateCommand<object> _MapCommand;
  325. public DelegateCommand<object> MapCommand =>
  326. _MapCommand ?? (_MapCommand = new DelegateCommand<object>(OnMap));
  327. private DelegateCommand<object> _StartCommand;
  328. public DelegateCommand<object> StartCommand =>
  329. _StartCommand ?? (_StartCommand = new DelegateCommand<object>(OnStart));
  330. private DelegateCommand<object> _StopCommand;
  331. public DelegateCommand<object> StopCommand =>
  332. _StopCommand ?? (_StopCommand = new DelegateCommand<object>(OnStop));
  333. private DelegateCommand<object> _AbortCommand;
  334. public DelegateCommand<object> AbortCommand =>
  335. _AbortCommand ?? (_AbortCommand = new DelegateCommand<object>(OnAbort));
  336. private DelegateCommand _HomeAllCommand;
  337. public DelegateCommand HomeAllCommand =>
  338. _HomeAllCommand ?? (_HomeAllCommand = new DelegateCommand(OnHomeAll));
  339. private DelegateCommand _ResumeAllJobCommand;
  340. public DelegateCommand ResumeAllJobCommand =>
  341. _ResumeAllJobCommand ?? (_ResumeAllJobCommand = new DelegateCommand(OnResumeAllJob));
  342. private DelegateCommand _AbortAllCommand;
  343. public DelegateCommand AbortAllCommand =>
  344. _AbortAllCommand ?? (_AbortAllCommand = new DelegateCommand(OnAbortAll));
  345. private DelegateCommand _ReturnAllWaferCommand;
  346. public DelegateCommand ReturnAllWaferCommand =>
  347. _ReturnAllWaferCommand ?? (_ReturnAllWaferCommand = new DelegateCommand(OnReturnAllWafer));
  348. private DelegateCommand<object> _SetSequenceCommand;
  349. public DelegateCommand<object> SetSequenceCommand =>
  350. _SetSequenceCommand ?? (_SetSequenceCommand = new DelegateCommand<object>(OnSetSequence));
  351. private DelegateCommand _EnableAutoCommand;
  352. public DelegateCommand EnableAutoCommand =>
  353. _EnableAutoCommand ?? (_EnableAutoCommand = new DelegateCommand(OnEnableAuto));
  354. private DelegateCommand _EnableManualCommand;
  355. public DelegateCommand EnableManualCommand =>
  356. _EnableManualCommand ?? (_EnableManualCommand = new DelegateCommand(OnEnableManual));
  357. private DelegateCommand<object> _GotoSrdViewCommond;
  358. public DelegateCommand<object> GotoSrdViewCommond =>
  359. _GotoSrdViewCommond ?? (_GotoSrdViewCommond = new DelegateCommand<object>(GotoSrdViewAction));
  360. public bool SwitchFlag;
  361. #endregion
  362. #region 构造函数
  363. public OperationOverNewViewModel()
  364. {
  365. addDataKeys();
  366. }
  367. #endregion
  368. #region 命令方法
  369. /// <summary>
  370. /// 加载数据
  371. /// </summary>
  372. public void LoadData(string systemName)
  373. {
  374. Dictionary<string, object> allModulesDictionary = QueryDataClient.Instance.Service.PollData(new List<string>() { "System.InstalledModules" });
  375. if (allModulesDictionary != null)
  376. {
  377. List<string> allModules = CommonFunction.GetValue<List<string>>(allModulesDictionary, "System.InstalledModules");
  378. EFEMIsInstalled = allModules.Contains("EFEM");
  379. }
  380. if (_timer == null)
  381. {
  382. _timer = new DispatcherTimer();
  383. _timer.Interval = TimeSpan.FromMilliseconds(100);
  384. _timer.Tick += Timer_Tick;
  385. }
  386. _timer.Start();
  387. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  388. }
  389. /// <summary>
  390. /// 隐藏
  391. /// </summary>
  392. public void Hide()
  393. {
  394. if (_timer != null)
  395. {
  396. _timer.Stop();
  397. }
  398. }
  399. private void OnMap(object obj)
  400. {
  401. InvokeClient.Instance.Service.DoOperation($"{obj.ToString()}.Map");
  402. }
  403. private void OnStart(object obj)
  404. {
  405. var info = obj as WaferAssociationInfo;
  406. InvokeClient.Instance.Service.DoOperation("System.StartJob", info.LotId);
  407. }
  408. private void OnStop(object obj)
  409. {
  410. var info = obj as WaferAssociationInfo;
  411. InvokeClient.Instance.Service.DoOperation("System.PauseJob", info.JobID);
  412. }
  413. private void OnAbort(object obj)
  414. {
  415. var info = obj as WaferAssociationInfo;
  416. InvokeClient.Instance.Service.DoOperation("System.ResumeJob", info.JobID);
  417. }
  418. private void OnHomeAll()
  419. {
  420. InvokeClient.Instance.Service.DoOperation("System.HomeAll");
  421. }
  422. private void OnResumeAllJob()
  423. {
  424. if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
  425. {
  426. InvokeClient.Instance.Service.DoOperation("System.ResumeAllJob");
  427. }
  428. else
  429. {
  430. InvokeClient.Instance.Service.DoOperation("System.PauseAllJob");
  431. }
  432. }
  433. private void OnAbortAll()
  434. {
  435. InvokeClient.Instance.Service.DoOperation("System.Abort");
  436. }
  437. private void OnReturnAllWafer()
  438. {
  439. //Dialog
  440. WaferDialogView dialog = new WaferDialogView()
  441. {
  442. Owner = Application.Current.MainWindow,
  443. };
  444. dialog.Height = 300;
  445. dialog.Width = 400;
  446. double angel = 0;
  447. double coolingtime = 0;
  448. string message = "Please Confirm Return Wafer";
  449. WaferDialogViewModel vm = new WaferDialogViewModel();
  450. vm.ConfirmText = message;
  451. dialog.DataContext = vm;
  452. if (dialog.ShowDialog() == true)
  453. {
  454. if ((bool)dialog.AlignFlag == true && !string.IsNullOrEmpty(dialog.Angle))
  455. {
  456. angel = Convert.ToDouble(dialog.Angle);
  457. }
  458. if ((bool)dialog.CoolingFlag == true && !string.IsNullOrEmpty(dialog.CoolingTime))
  459. {
  460. coolingtime = Convert.ToDouble(dialog.CoolingTime);
  461. }
  462. InvokeClient.Instance.Service.DoOperation("System.ReturnAllWafer", dialog.CoolingFlag, coolingtime, dialog.AlignFlag, angel);
  463. }
  464. }
  465. private void OnSetSequence(object obj)
  466. {
  467. var info = obj as WaferInfo;
  468. bool flag = info.SequenceName != "" ? false : true;
  469. }
  470. private void OnEnableAuto()
  471. {
  472. InvokeClient.Instance.Service.DoOperation("System.SetAutoMode");
  473. }
  474. private void OnEnableManual()
  475. {
  476. InvokeClient.Instance.Service.DoOperation("System.SetManualMode");
  477. }
  478. private void GotoSrdViewAction(object obj)
  479. {
  480. PunkHPX8_Core.GlobalEvents.OnSwitchFixedTabItem("HardWare", "SRD", $"{obj.ToString()}");
  481. }
  482. #endregion
  483. #region 私有方法
  484. /// <summary>
  485. /// 定时器
  486. /// </summary>
  487. /// <param name="sender"></param>
  488. /// <param name="e"></param>
  489. private void Timer_Tick(object sender, EventArgs e)
  490. {
  491. LP1ModuleInfo = ModuleManager.ModuleInfos["LP1"];
  492. LP2ModuleInfo = ModuleManager.ModuleInfos["LP2"];
  493. EFEMModuleInfo = ModuleManager.ModuleInfos["EfemRobot"];
  494. SRD1ModuleInfo = ModuleManager.ModuleInfos["SRD1"];
  495. SRD2ModuleInfo = ModuleManager.ModuleInfos["SRD2"];
  496. Dummy1ModuleInfo = ModuleManager.ModuleInfos["Dummy1"];
  497. Dummy2ModuleInfo = ModuleManager.ModuleInfos["Dummy2"];
  498. AlignerModuleInfo = ModuleManager.ModuleInfos["Aligner1"];
  499. if (ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers.Count != 0)
  500. {
  501. BladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  502. BladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
  503. }
  504. if (EFEMIsInstalled == true)
  505. {
  506. if (ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers.Count != 0)
  507. {
  508. EFEMBladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  509. EFEMBladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
  510. }
  511. if (ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers.Count != 0)
  512. {
  513. Aligner1Wafer = ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0];
  514. }
  515. }
  516. if (ModuleManager.ModuleInfos["VPW1"].WaferManager.Wafers.Count != 0)
  517. {
  518. VPW1Wafer = ModuleManager.ModuleInfos["VPW1"].WaferManager.Wafers[0];
  519. }
  520. if (ModuleManager.ModuleInfos["VPW2"].WaferManager.Wafers.Count != 0)
  521. {
  522. VPW2Wafer = ModuleManager.ModuleInfos["VPW2"].WaferManager.Wafers[0];
  523. }
  524. if (ModuleManager.ModuleInfos["PlatingCell1"].WaferManager.Wafers.Count!=0)
  525. {
  526. PlatingCell1Wafer = ModuleManager.ModuleInfos["PlatingCell1"].WaferManager.Wafers[0];
  527. }
  528. if (ModuleManager.ModuleInfos["PlatingCell2"].WaferManager.Wafers.Count != 0)
  529. {
  530. PlatingCell2Wafer = ModuleManager.ModuleInfos["PlatingCell2"].WaferManager.Wafers[0];
  531. }
  532. if (ModuleManager.ModuleInfos["PlatingCell3"].WaferManager.Wafers.Count != 0)
  533. {
  534. PlatingCell3Wafer = ModuleManager.ModuleInfos["PlatingCell3"].WaferManager.Wafers[0];
  535. }
  536. if (ModuleManager.ModuleInfos["PlatingCell4"].WaferManager.Wafers.Count != 0)
  537. {
  538. PlatingCell4Wafer = ModuleManager.ModuleInfos["PlatingCell4"].WaferManager.Wafers[0];
  539. }
  540. if (SRD1ModuleInfo != null&& SRD1ModuleInfo.WaferManager.Wafers.Count!=0)
  541. {
  542. SRD1Wafer = SRD1ModuleInfo.WaferManager.Wafers[0];
  543. }
  544. if (SRD2ModuleInfo != null&& SRD2ModuleInfo.WaferManager.Wafers.Count!=0)
  545. {
  546. SRD2Wafer = SRD2ModuleInfo.WaferManager.Wafers[0];
  547. }
  548. EfemRobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("EFEM.RobotMoveAction");
  549. LP1WaferCount = LP1ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  550. LP2WaferCount = LP2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  551. //Dummy1WaferCount = 15;
  552. Dummy1WaferCount = Dummy1ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  553. Dummy2WaferCount = Dummy2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  554. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  555. IsLP1Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort1Unable");
  556. IsLP2Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort2Unable");
  557. if (RtDataValues != null)
  558. {
  559. if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
  560. {
  561. RouteState = "Resume";
  562. }
  563. else
  564. {
  565. RouteState = "Pause";
  566. }
  567. ControlJobInfo lp1Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP1.CurrentControlJob");
  568. IsLP1HasNoJob = lp1Cj == null ? true : false;
  569. ControlJobInfo lp2Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP2.CurrentControlJob");
  570. IsLP2HasNoJob = lp2Cj == null ? true : false;
  571. }
  572. }
  573. int count = 0;
  574. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  575. {
  576. string RobotTarget;
  577. if (oldValue == null || newValue == null)
  578. {
  579. return;
  580. }
  581. #region Rotating
  582. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Rotating))
  583. {
  584. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  585. if (TMRobotMoveActionBladeTarget != null)
  586. {
  587. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  588. }
  589. else
  590. {
  591. return;
  592. }
  593. var values = RobotTarget.Split('.');
  594. var arm = values[0];
  595. var module = values[1];
  596. if (arm == "ArmA")
  597. {
  598. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  599. }
  600. else if (arm == "ArmB")
  601. {
  602. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  603. }
  604. }
  605. #endregion
  606. #region pick 和 place LL
  607. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  608. {
  609. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  610. if (TMRobotMoveActionBladeTarget != null)
  611. {
  612. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  613. }
  614. else
  615. {
  616. return;
  617. }
  618. var values = RobotTarget.Split('.');
  619. var arm = values[0];
  620. var module = values[1];
  621. if (arm == "ArmA")
  622. {
  623. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  624. if (waferRobotTAction != Robot1TAction)
  625. {
  626. Robot1TAction = waferRobotTAction;
  627. }
  628. else
  629. {
  630. //await Task.Delay(100);
  631. }
  632. await Task.Delay(600);
  633. //Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  634. //await Task.Delay(600);
  635. Robot1XAction = WaferRobotXAction.Extend;
  636. 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))
  637. {
  638. await Task.Delay(100);
  639. }
  640. Robot1XAction = WaferRobotXAction.Retract;
  641. }
  642. else if (arm == "ArmB")
  643. {
  644. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  645. if (waferRobotTAction != Robot2TAction)
  646. {
  647. Robot2TAction = waferRobotTAction;
  648. }
  649. else
  650. {
  651. //await Task.Delay(100);
  652. }
  653. await Task.Delay(600);
  654. //Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  655. //await Task.Delay(600);
  656. Robot2XAction = WaferRobotXAction.Extend;
  657. 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))
  658. {
  659. await Task.Delay(100);
  660. }
  661. Robot2XAction = WaferRobotXAction.Retract;
  662. }
  663. }
  664. #endregion
  665. #region pick 和 place pm
  666. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Extending)
  667. {
  668. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  669. if (TMRobotMoveActionBladeTarget != null)
  670. {
  671. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  672. }
  673. else
  674. {
  675. return;
  676. }
  677. var values = RobotTarget.Split('.');
  678. var arm = values[0];
  679. var module = values[1];
  680. if (arm == "ArmA")
  681. {
  682. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  683. if (waferRobotTAction != Robot1TAction)
  684. {
  685. Robot1TAction = waferRobotTAction;
  686. }
  687. else
  688. {
  689. // await Task.Delay(100);
  690. }
  691. await Task.Delay(600);
  692. Robot1XAction = WaferRobotXAction.Extend;
  693. }
  694. else if (arm == "ArmB")
  695. {
  696. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  697. if (waferRobotTAction != Robot2TAction)
  698. {
  699. Robot2TAction = waferRobotTAction;
  700. }
  701. else
  702. {
  703. // await Task.Delay(100);
  704. }
  705. await Task.Delay(600);
  706. Robot2XAction = WaferRobotXAction.Extend;
  707. }
  708. }
  709. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Retracting)
  710. {
  711. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  712. if (TMRobotMoveActionBladeTarget != null)
  713. {
  714. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  715. }
  716. else
  717. {
  718. return;
  719. }
  720. var values = RobotTarget.Split('.');
  721. var arm = values[0];
  722. if (arm == "ArmA")
  723. {
  724. Robot1XAction = WaferRobotXAction.Retract;
  725. }
  726. else if (arm == "ArmB")
  727. {
  728. Robot2XAction = WaferRobotXAction.Retract;
  729. }
  730. }
  731. #endregion
  732. #region Home
  733. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  734. {
  735. if (Robot1XAction == WaferRobotXAction.Extend)
  736. {
  737. Robot1XAction = WaferRobotXAction.Retract;
  738. }
  739. if (Robot2XAction == WaferRobotXAction.Extend)
  740. {
  741. Robot2XAction = WaferRobotXAction.Retract;
  742. }
  743. await Task.Delay(2000);
  744. if (Robot1TAction != WaferRobotTAction.T_Origin)
  745. {
  746. Robot1TAction = WaferRobotTAction.T_Origin;
  747. }
  748. if (Robot2TAction != WaferRobotTAction.T_Origin)
  749. {
  750. Robot2TAction = WaferRobotTAction.T_Origin;
  751. }
  752. }
  753. #endregion
  754. }
  755. private async void EFEMRobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  756. {
  757. string RobotTarget;
  758. if (oldValue == null || newValue == null)
  759. {
  760. return;
  761. }
  762. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  763. {
  764. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  765. if (TMRobotMoveActionBladeTarget != null)
  766. {
  767. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  768. }
  769. else
  770. {
  771. return;
  772. }
  773. var values = RobotTarget.Split('.');
  774. var arm = values[0];
  775. var module = values[1];
  776. if (arm == "ArmA")
  777. {
  778. var robot1Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  779. //Robot整体平移动画
  780. await ChangePosition(robot1Robot1TAction, newValue.Action);
  781. if (Robot1TAction != robot1Robot1TAction)
  782. {
  783. Robot1TAction = robot1Robot1TAction;
  784. await Task.Delay(600);
  785. }
  786. //await Task.Delay(1500);
  787. Robot1XAction = WaferRobotXAction.Extend;
  788. 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))
  789. {
  790. await Task.Delay(100);
  791. }
  792. Robot1XAction = WaferRobotXAction.Retract;
  793. if (newValue.Action == RobotAction.Placing)
  794. {
  795. await ChangePosition(WaferRobotTAction.T_Origin, newValue.Action);
  796. }
  797. }
  798. else //使用上手臂
  799. {
  800. //实现翻转动画
  801. if (newValue.BladeTarget.Split('.')[2] == "Down")
  802. {
  803. Robot2FAction = WaferRobotFAction.UpperToDown;
  804. }
  805. else if (newValue.BladeTarget.Split('.')[2] == "Upper")
  806. {
  807. Robot2FAction = WaferRobotFAction.DownToUpper;
  808. }
  809. var robot1Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  810. //Robot整体平移动画
  811. await ChangePosition(robot1Robot1TAction, newValue.Action);
  812. if (Robot1TAction != robot1Robot1TAction)
  813. {
  814. Robot1TAction = robot1Robot1TAction;
  815. await Task.Delay(600);
  816. }
  817. //await Task.Delay(1500);
  818. Robot1XAction = WaferRobotXAction.Extend2;
  819. while ((newValue.Action == RobotAction.Placing && ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1].WaferStatus != 0) || (newValue.Action == RobotAction.Picking && ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1].WaferStatus == 0))
  820. {
  821. await Task.Delay(100);
  822. }
  823. Robot1XAction = WaferRobotXAction.Retract2;
  824. if (newValue.Action == RobotAction.Placing)
  825. {
  826. await ChangePosition(WaferRobotTAction.T_Origin, newValue.Action);
  827. }
  828. }
  829. }
  830. #region Home
  831. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  832. {
  833. if (Robot1XAction == WaferRobotXAction.Extend || Robot2XAction == WaferRobotXAction.Extend2)
  834. {
  835. Robot1XAction = WaferRobotXAction.Retract2;
  836. }
  837. if (Robot2XAction == WaferRobotXAction.Extend || Robot2XAction == WaferRobotXAction.Extend2)
  838. {
  839. Robot2XAction = WaferRobotXAction.Retract2;
  840. }
  841. await Task.Delay(2000);
  842. if (Robot1TAction != WaferRobotTAction.T_Origin)
  843. {
  844. Robot1TAction = WaferRobotTAction.T_Origin;
  845. }
  846. if (Robot2TAction != WaferRobotTAction.T_Origin)
  847. {
  848. Robot2TAction = WaferRobotTAction.T_Origin;
  849. }
  850. if (CurrentRobotPosition != EFEM.RobotPosition.Origin)
  851. {
  852. CurrentRobotPosition = EFEM.RobotPosition.Origin;
  853. }
  854. await ChangePosition(WaferRobotTAction.T_Origin, newValue.Action);
  855. }
  856. #endregion
  857. }
  858. private void addDataKeys()
  859. {
  860. m_RtDataKeys.Add("LP1.IsLoaded");
  861. m_RtDataKeys.Add("LP2.IsLoaded");
  862. m_RtDataKeys.Add("LP1.CassettePlaced");
  863. m_RtDataKeys.Add("LP2.CassettePlaced");
  864. m_RtDataKeys.Add("LP1.CurrentControlJob");
  865. m_RtDataKeys.Add("LP2.CurrentControlJob");
  866. m_RtDataKeys.Add("LP1.WaferSize");
  867. m_RtDataKeys.Add("LP2.WaferSize");
  868. m_RtDataKeys.Add("Dummy1.CassettePlaced");
  869. m_RtDataKeys.Add("Dummy2.CassettePlaced");
  870. m_RtDataKeys.Add("Dummy1.WaferSize");
  871. m_RtDataKeys.Add("Dummy2.WaferSize");
  872. m_RtDataKeys.Add("System.IsAutoMode");
  873. m_RtDataKeys.Add("System.IsBusy");
  874. m_RtDataKeys.Add("Scheduler.CycledCount");
  875. m_RtDataKeys.Add("Scheduler.CycledWafer");
  876. m_RtDataKeys.Add("Scheduler.CycleSetPoint");
  877. m_RtDataKeys.Add("Scheduler.Throughput");
  878. m_RtDataKeys.Add("EquipmentStatus");
  879. m_RtDataKeys.Add("Scheduler.PjNameList");
  880. m_RtDataKeys.Add("Scheduler.CjNameList");
  881. }
  882. private bool HasWaferOnSlot(List<WaferInfo> wafers, int index)
  883. {
  884. if (wafers[index].WaferStatus == 0)
  885. return false;
  886. return true;
  887. }
  888. private async Task ChangePosition(WaferRobotTAction waferRobotTAction, RobotAction robotAction)
  889. {
  890. //CurrentRobotPosition = RobotPosition.Origin;
  891. //await Task.Delay(1000);
  892. if (robotAction == RobotAction.Placing)
  893. {
  894. if (waferRobotTAction == WaferRobotTAction.LP1)
  895. {
  896. CurrentRobotPosition = EFEM.RobotPosition.Left_Place;
  897. }
  898. else if (waferRobotTAction == WaferRobotTAction.LP2)
  899. {
  900. CurrentRobotPosition = EFEM.RobotPosition.Middle_Place;
  901. }
  902. else if (waferRobotTAction == WaferRobotTAction.Aligner1)
  903. {
  904. CurrentRobotPosition = EFEM.RobotPosition.Aligner_Place;
  905. }
  906. else if (waferRobotTAction == WaferRobotTAction.SRD1 || waferRobotTAction == WaferRobotTAction.SRD2)
  907. {
  908. CurrentRobotPosition = EFEM.RobotPosition.SRD_Place;
  909. }
  910. else if (waferRobotTAction == WaferRobotTAction.Dummy1 || waferRobotTAction == WaferRobotTAction.Dummy2)
  911. {
  912. CurrentRobotPosition = EFEM.RobotPosition.Dummy_Place;
  913. }
  914. else if (waferRobotTAction == WaferRobotTAction.VPW1)
  915. {
  916. CurrentRobotPosition = EFEM.RobotPosition.VPW1_Place;
  917. }
  918. else if (waferRobotTAction == WaferRobotTAction.VPW2)
  919. {
  920. CurrentRobotPosition = EFEM.RobotPosition.VPW2_Place;
  921. }
  922. else if (waferRobotTAction == WaferRobotTAction.PlatingCell1)
  923. {
  924. CurrentRobotPosition = EFEM.RobotPosition.PlatingCell1_Place;
  925. }
  926. else if (waferRobotTAction == WaferRobotTAction.PlatingCell2)
  927. {
  928. CurrentRobotPosition = EFEM.RobotPosition.PlatingCell2_Place;
  929. }
  930. else if (waferRobotTAction == WaferRobotTAction.PlatingCell3)
  931. {
  932. CurrentRobotPosition = EFEM.RobotPosition.PlatingCell3_Place;
  933. }
  934. else if (waferRobotTAction == WaferRobotTAction.PlatingCell4)
  935. {
  936. CurrentRobotPosition = EFEM.RobotPosition.PlatingCell4_Place;
  937. }
  938. else
  939. {
  940. CurrentRobotPosition = EFEM.RobotPosition.Origin;
  941. }
  942. }
  943. else
  944. {
  945. if (waferRobotTAction == WaferRobotTAction.LP1)
  946. {
  947. CurrentRobotPosition = EFEM.RobotPosition.Left;
  948. }
  949. else if (waferRobotTAction == WaferRobotTAction.LP2)
  950. {
  951. CurrentRobotPosition = EFEM.RobotPosition.Middle;
  952. }
  953. else if (waferRobotTAction == WaferRobotTAction.Aligner1)
  954. {
  955. CurrentRobotPosition = EFEM.RobotPosition.Aligner;
  956. }
  957. else if (waferRobotTAction == WaferRobotTAction.SRD1 || waferRobotTAction == WaferRobotTAction.SRD2)
  958. {
  959. CurrentRobotPosition = EFEM.RobotPosition.SRD;
  960. }
  961. else if (waferRobotTAction == WaferRobotTAction.Dummy1 || waferRobotTAction == WaferRobotTAction.Dummy2)
  962. {
  963. CurrentRobotPosition = EFEM.RobotPosition.Dummy;
  964. }
  965. else if (waferRobotTAction == WaferRobotTAction.VPW1)
  966. {
  967. CurrentRobotPosition = EFEM.RobotPosition.VPW1;
  968. }
  969. else if (waferRobotTAction == WaferRobotTAction.VPW2)
  970. {
  971. CurrentRobotPosition = EFEM.RobotPosition.VPW2;
  972. }
  973. else if (waferRobotTAction == WaferRobotTAction.PlatingCell1)
  974. {
  975. CurrentRobotPosition = EFEM.RobotPosition.PlatingCell1;
  976. }
  977. else if (waferRobotTAction == WaferRobotTAction.PlatingCell2)
  978. {
  979. CurrentRobotPosition = EFEM.RobotPosition.PlatingCell2;
  980. }
  981. else if (waferRobotTAction == WaferRobotTAction.PlatingCell3)
  982. {
  983. CurrentRobotPosition = EFEM.RobotPosition.PlatingCell3;
  984. }
  985. else if (waferRobotTAction == WaferRobotTAction.PlatingCell4)
  986. {
  987. CurrentRobotPosition = EFEM.RobotPosition.PlatingCell4;
  988. }
  989. else
  990. {
  991. CurrentRobotPosition = EFEM.RobotPosition.Origin;
  992. }
  993. }
  994. await Task.Delay(600);
  995. }
  996. /// <summary>
  997. /// 计算最大值最小值
  998. /// </summary>
  999. /// <param name="Puf1RotationAxis"></param>
  1000. /// <returns></returns>
  1001. private (double right, double left) CalculatePufMaxMin(BeckhoffStationAxis pufAxis)
  1002. {
  1003. if (pufAxis == null || pufAxis.Stations.Count == 0) return (-1,-1);
  1004. double max = double.Parse(pufAxis.Stations[0].Position);
  1005. double min = double.Parse(pufAxis.Stations[0].Position);
  1006. double home = 0;
  1007. double pickup = 0;
  1008. foreach (Station item in pufAxis.Stations)
  1009. {
  1010. if (item.Name.ToLower().Contains("home")) home = double.Parse(item.Position);
  1011. if (item.Name.ToLower().Contains("pickup")) pickup = double.Parse(item.Position);
  1012. double position = double.Parse(item.Position);
  1013. if (position > max)
  1014. {
  1015. max = position;
  1016. }
  1017. if (position < min)
  1018. {
  1019. min = position;
  1020. }
  1021. }
  1022. return pickup < home ? (min, max):(max, min);
  1023. }
  1024. /// <summary>
  1025. /// 计算PufFlip差值
  1026. /// </summary>
  1027. /// <param name="pufAxis"></param>
  1028. /// <returns></returns>
  1029. private double CalculatePufFlipDiff(BeckhoffStationAxis pufAxis)
  1030. {
  1031. double sideAangle = 0;
  1032. double sideBangle = 0; ;
  1033. return sideAangle > sideBangle ? 180 : 0;
  1034. }
  1035. /// <summary>
  1036. /// 判定是否在station位置
  1037. /// </summary>
  1038. private bool JudgeAtStation(double targetPosition, double currentPosition, double tolerance)
  1039. {
  1040. if (Math.Abs(currentPosition - targetPosition) <= tolerance)
  1041. {
  1042. return true;
  1043. }
  1044. else
  1045. {
  1046. return false;
  1047. }
  1048. }
  1049. #endregion
  1050. }
  1051. }