OperationOverNewViewModel.cs 44 KB

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