OperationOverNewViewModel.cs 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164
  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. BladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
  514. }
  515. if (EFEMIsInstalled == true)
  516. {
  517. if (ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers.Count != 0)
  518. {
  519. EFEMBladeAWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[0];
  520. EFEMBladeBWafer = ModuleManager.ModuleInfos["EfemRobot"].WaferManager.Wafers[1];
  521. }
  522. if (ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers.Count != 0)
  523. {
  524. Aligner1Wafer = ModuleManager.ModuleInfos["Aligner1"].WaferManager.Wafers[0];
  525. }
  526. }
  527. if (ModuleManager.ModuleInfos["VPW1"].WaferManager.Wafers.Count != 0)
  528. {
  529. VPW1Wafer = ModuleManager.ModuleInfos["VPW1"].WaferManager.Wafers[0];
  530. }
  531. if (ModuleManager.ModuleInfos["VPW2"].WaferManager.Wafers.Count != 0)
  532. {
  533. VPW2Wafer = ModuleManager.ModuleInfos["VPW2"].WaferManager.Wafers[0];
  534. }
  535. if (ModuleManager.ModuleInfos["PlatingCell1"].WaferManager.Wafers.Count!=0)
  536. {
  537. PlatingCell1Wafer = ModuleManager.ModuleInfos["PlatingCell1"].WaferManager.Wafers[0];
  538. }
  539. if (ModuleManager.ModuleInfos["PlatingCell2"].WaferManager.Wafers.Count != 0)
  540. {
  541. PlatingCell2Wafer = ModuleManager.ModuleInfos["PlatingCell2"].WaferManager.Wafers[0];
  542. }
  543. if (ModuleManager.ModuleInfos["PlatingCell3"].WaferManager.Wafers.Count != 0)
  544. {
  545. PlatingCell3Wafer = ModuleManager.ModuleInfos["PlatingCell3"].WaferManager.Wafers[0];
  546. }
  547. if (ModuleManager.ModuleInfos["PlatingCell4"].WaferManager.Wafers.Count != 0)
  548. {
  549. PlatingCell4Wafer = ModuleManager.ModuleInfos["PlatingCell4"].WaferManager.Wafers[0];
  550. }
  551. if (SRD1ModuleInfo != null&& SRD1ModuleInfo.WaferManager.Wafers.Count!=0)
  552. {
  553. SRD1Wafer = SRD1ModuleInfo.WaferManager.Wafers[0];
  554. }
  555. if (SRD2ModuleInfo != null&& SRD2ModuleInfo.WaferManager.Wafers.Count!=0)
  556. {
  557. SRD2Wafer = SRD2ModuleInfo.WaferManager.Wafers[0];
  558. }
  559. RobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("TM.RobotMoveAction");
  560. EfemRobotMoveInfo = (RobotMoveInfo)QueryDataClient.Instance.Service.GetData("EFEM.RobotMoveAction");
  561. LP1WaferCount = LP1ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  562. LP2WaferCount = LP2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  563. //Dummy1WaferCount = 15;
  564. Dummy1WaferCount = Dummy1ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  565. Dummy2WaferCount = Dummy2ModuleInfo.WaferManager.Wafers.Where(x => x.WaferStatus != 0).Count();
  566. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  567. IsLP1Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort1Unable");
  568. IsLP2Unable = (bool)QueryDataClient.Instance.Service.GetConfig("EFEM.IsLoadPort2Unable");
  569. if (RtDataValues != null)
  570. {
  571. if (CommonFunction.GetValue<int>(RtDataValues, "EquipmentStatus") == 4)
  572. {
  573. RouteState = "Resume";
  574. }
  575. else
  576. {
  577. RouteState = "Pause";
  578. }
  579. ControlJobInfo lp1Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP1.CurrentControlJob");
  580. IsLP1HasNoJob = lp1Cj == null ? true : false;
  581. ControlJobInfo lp2Cj = CommonFunction.GetValue<ControlJobInfo>(RtDataValues, "LP2.CurrentControlJob");
  582. IsLP2HasNoJob = lp2Cj == null ? true : false;
  583. }
  584. }
  585. int count = 0;
  586. private async void RobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  587. {
  588. string RobotTarget;
  589. if (oldValue == null || newValue == null)
  590. {
  591. return;
  592. }
  593. #region Rotating
  594. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Rotating))
  595. {
  596. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  597. if (TMRobotMoveActionBladeTarget != null)
  598. {
  599. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  600. }
  601. else
  602. {
  603. return;
  604. }
  605. var values = RobotTarget.Split('.');
  606. var arm = values[0];
  607. var module = values[1];
  608. if (arm == "ArmA")
  609. {
  610. Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  611. }
  612. else if (arm == "ArmB")
  613. {
  614. Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  615. }
  616. }
  617. #endregion
  618. #region pick 和 place LL
  619. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  620. {
  621. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  622. if (TMRobotMoveActionBladeTarget != null)
  623. {
  624. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  625. }
  626. else
  627. {
  628. return;
  629. }
  630. var values = RobotTarget.Split('.');
  631. var arm = values[0];
  632. var module = values[1];
  633. if (arm == "ArmA")
  634. {
  635. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  636. if (waferRobotTAction != Robot1TAction)
  637. {
  638. Robot1TAction = waferRobotTAction;
  639. }
  640. else
  641. {
  642. //await Task.Delay(100);
  643. }
  644. await Task.Delay(600);
  645. //Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  646. //await Task.Delay(600);
  647. Robot1XAction = WaferRobotXAction.Extend;
  648. 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))
  649. {
  650. await Task.Delay(100);
  651. }
  652. Robot1XAction = WaferRobotXAction.Retract;
  653. }
  654. else if (arm == "ArmB")
  655. {
  656. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  657. if (waferRobotTAction != Robot2TAction)
  658. {
  659. Robot2TAction = waferRobotTAction;
  660. }
  661. else
  662. {
  663. //await Task.Delay(100);
  664. }
  665. await Task.Delay(600);
  666. //Robot2TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  667. //await Task.Delay(600);
  668. Robot2XAction = WaferRobotXAction.Extend;
  669. 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))
  670. {
  671. await Task.Delay(100);
  672. }
  673. Robot2XAction = WaferRobotXAction.Retract;
  674. }
  675. }
  676. #endregion
  677. #region pick 和 place pm
  678. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Extending)
  679. {
  680. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  681. if (TMRobotMoveActionBladeTarget != null)
  682. {
  683. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  684. }
  685. else
  686. {
  687. return;
  688. }
  689. var values = RobotTarget.Split('.');
  690. var arm = values[0];
  691. var module = values[1];
  692. if (arm == "ArmA")
  693. {
  694. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  695. if (waferRobotTAction != Robot1TAction)
  696. {
  697. Robot1TAction = waferRobotTAction;
  698. }
  699. else
  700. {
  701. // await Task.Delay(100);
  702. }
  703. await Task.Delay(600);
  704. Robot1XAction = WaferRobotXAction.Extend;
  705. }
  706. else if (arm == "ArmB")
  707. {
  708. var waferRobotTAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  709. if (waferRobotTAction != Robot2TAction)
  710. {
  711. Robot2TAction = waferRobotTAction;
  712. }
  713. else
  714. {
  715. // await Task.Delay(100);
  716. }
  717. await Task.Delay(600);
  718. Robot2XAction = WaferRobotXAction.Extend;
  719. }
  720. }
  721. else if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && newValue.Action == RobotAction.Retracting)
  722. {
  723. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  724. if (TMRobotMoveActionBladeTarget != null)
  725. {
  726. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  727. }
  728. else
  729. {
  730. return;
  731. }
  732. var values = RobotTarget.Split('.');
  733. var arm = values[0];
  734. if (arm == "ArmA")
  735. {
  736. Robot1XAction = WaferRobotXAction.Retract;
  737. }
  738. else if (arm == "ArmB")
  739. {
  740. Robot2XAction = WaferRobotXAction.Retract;
  741. }
  742. }
  743. #endregion
  744. #region Home
  745. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  746. {
  747. if (Robot1XAction == WaferRobotXAction.Extend)
  748. {
  749. Robot1XAction = WaferRobotXAction.Retract;
  750. }
  751. if (Robot2XAction == WaferRobotXAction.Extend)
  752. {
  753. Robot2XAction = WaferRobotXAction.Retract;
  754. }
  755. await Task.Delay(2000);
  756. if (Robot1TAction != WaferRobotTAction.T_Origin)
  757. {
  758. Robot1TAction = WaferRobotTAction.T_Origin;
  759. }
  760. if (Robot2TAction != WaferRobotTAction.T_Origin)
  761. {
  762. Robot2TAction = WaferRobotTAction.T_Origin;
  763. }
  764. }
  765. #endregion
  766. }
  767. private async void EFEMRobotMoveInfoChanged(RobotMoveInfo oldValue, RobotMoveInfo newValue)
  768. {
  769. string RobotTarget;
  770. if (oldValue == null || newValue == null)
  771. {
  772. return;
  773. }
  774. if ((oldValue.Action == RobotAction.None || oldValue.ArmTarget != newValue.ArmTarget) && (newValue.Action == RobotAction.Placing || newValue.Action == RobotAction.Picking))
  775. {
  776. var TMRobotMoveActionBladeTarget = newValue.BladeTarget;
  777. if (TMRobotMoveActionBladeTarget != null)
  778. {
  779. RobotTarget = TMRobotMoveActionBladeTarget.ToString();
  780. }
  781. else
  782. {
  783. return;
  784. }
  785. var values = RobotTarget.Split('.');
  786. var arm = values[0];
  787. var module = values[1];
  788. if (arm == "ArmA")
  789. {
  790. var robot1Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  791. //Robot整体平移动画
  792. await ChangePosition(robot1Robot1TAction, newValue.Action);
  793. if (Robot1TAction != robot1Robot1TAction)
  794. {
  795. Robot1TAction = robot1Robot1TAction;
  796. await Task.Delay(600);
  797. }
  798. //await Task.Delay(1500);
  799. Robot1XAction = WaferRobotXAction.Extend;
  800. 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))
  801. {
  802. await Task.Delay(100);
  803. }
  804. Robot1XAction = WaferRobotXAction.Retract;
  805. if (newValue.Action == RobotAction.Placing)
  806. {
  807. await ChangePosition(WaferRobotTAction.T_Origin, newValue.Action);
  808. }
  809. }
  810. else //使用上手臂
  811. {
  812. var robot1Robot1TAction = (WaferRobotTAction)Enum.Parse(typeof(WaferRobotTAction), module, true);
  813. //Robot整体平移动画
  814. await ChangePosition(robot1Robot1TAction, newValue.Action);
  815. if (Robot1TAction != robot1Robot1TAction)
  816. {
  817. Robot1TAction = robot1Robot1TAction;
  818. await Task.Delay(600);
  819. }
  820. //await Task.Delay(1500);
  821. Robot1XAction = WaferRobotXAction.Extend2;
  822. 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))
  823. {
  824. await Task.Delay(100);
  825. }
  826. Robot1XAction = WaferRobotXAction.Retract2;
  827. if (newValue.Action == RobotAction.Placing)
  828. {
  829. await ChangePosition(WaferRobotTAction.T_Origin, newValue.Action);
  830. }
  831. }
  832. }
  833. #region Home
  834. else if (oldValue.Action == RobotAction.None && newValue.Action == RobotAction.Homing)
  835. {
  836. if (Robot1XAction == WaferRobotXAction.Extend || Robot2XAction == WaferRobotXAction.Extend2)
  837. {
  838. Robot1XAction = WaferRobotXAction.Retract2;
  839. }
  840. if (Robot2XAction == WaferRobotXAction.Extend || Robot2XAction == WaferRobotXAction.Extend2)
  841. {
  842. Robot2XAction = WaferRobotXAction.Retract2;
  843. }
  844. await Task.Delay(2000);
  845. if (Robot1TAction != WaferRobotTAction.T_Origin)
  846. {
  847. Robot1TAction = WaferRobotTAction.T_Origin;
  848. }
  849. if (Robot2TAction != WaferRobotTAction.T_Origin)
  850. {
  851. Robot2TAction = WaferRobotTAction.T_Origin;
  852. }
  853. if (CurrentRobotPosition != EFEM.RobotPosition.Origin)
  854. {
  855. CurrentRobotPosition = EFEM.RobotPosition.Origin;
  856. }
  857. await ChangePosition(WaferRobotTAction.T_Origin, newValue.Action);
  858. }
  859. #endregion
  860. }
  861. private void addDataKeys()
  862. {
  863. m_RtDataKeys.Add("LP1.IsLoaded");
  864. m_RtDataKeys.Add("LP2.IsLoaded");
  865. m_RtDataKeys.Add("LP1.CassettePlaced");
  866. m_RtDataKeys.Add("LP2.CassettePlaced");
  867. m_RtDataKeys.Add("LP1.CurrentControlJob");
  868. m_RtDataKeys.Add("LP2.CurrentControlJob");
  869. m_RtDataKeys.Add("LP1.WaferSize");
  870. m_RtDataKeys.Add("LP2.WaferSize");
  871. m_RtDataKeys.Add("Dummy1.CassettePlaced");
  872. m_RtDataKeys.Add("Dummy2.CassettePlaced");
  873. m_RtDataKeys.Add("Dummy1.WaferSize");
  874. m_RtDataKeys.Add("Dummy2.WaferSize");
  875. m_RtDataKeys.Add("System.IsAutoMode");
  876. m_RtDataKeys.Add("System.IsBusy");
  877. m_RtDataKeys.Add("Scheduler.CycledCount");
  878. m_RtDataKeys.Add("Scheduler.CycledWafer");
  879. m_RtDataKeys.Add("Scheduler.CycleSetPoint");
  880. m_RtDataKeys.Add("Scheduler.Throughput");
  881. m_RtDataKeys.Add("EquipmentStatus");
  882. m_RtDataKeys.Add("Scheduler.PjNameList");
  883. m_RtDataKeys.Add("Scheduler.CjNameList");
  884. }
  885. private bool HasWaferOnSlot(List<WaferInfo> wafers, int index)
  886. {
  887. if (wafers[index].WaferStatus == 0)
  888. return false;
  889. return true;
  890. }
  891. private async Task ChangePosition(WaferRobotTAction waferRobotTAction, RobotAction robotAction)
  892. {
  893. //CurrentRobotPosition = RobotPosition.Origin;
  894. //await Task.Delay(1000);
  895. if (robotAction == RobotAction.Placing)
  896. {
  897. if (waferRobotTAction == WaferRobotTAction.LP1)
  898. {
  899. CurrentRobotPosition = EFEM.RobotPosition.Left_Place;
  900. }
  901. else if (waferRobotTAction == WaferRobotTAction.LP2)
  902. {
  903. CurrentRobotPosition = EFEM.RobotPosition.Middle_Place;
  904. }
  905. else if (waferRobotTAction == WaferRobotTAction.Aligner1)
  906. {
  907. CurrentRobotPosition = EFEM.RobotPosition.Aligner_Place;
  908. }
  909. else if (waferRobotTAction == WaferRobotTAction.SRD1 || waferRobotTAction == WaferRobotTAction.SRD2)
  910. {
  911. CurrentRobotPosition = EFEM.RobotPosition.SRD_Place;
  912. }
  913. else if (waferRobotTAction == WaferRobotTAction.Dummy1 || waferRobotTAction == WaferRobotTAction.Dummy2)
  914. {
  915. CurrentRobotPosition = EFEM.RobotPosition.Dummy_Place;
  916. }
  917. else if (waferRobotTAction == WaferRobotTAction.VPW1)
  918. {
  919. CurrentRobotPosition = EFEM.RobotPosition.VPW1_Place;
  920. }
  921. else if (waferRobotTAction == WaferRobotTAction.VPW2)
  922. {
  923. CurrentRobotPosition = EFEM.RobotPosition.VPW2_Place;
  924. }
  925. else if (waferRobotTAction == WaferRobotTAction.PlatingCell1)
  926. {
  927. CurrentRobotPosition = EFEM.RobotPosition.PlatingCell1_Place;
  928. }
  929. else if (waferRobotTAction == WaferRobotTAction.PlatingCell2)
  930. {
  931. CurrentRobotPosition = EFEM.RobotPosition.PlatingCell2_Place;
  932. }
  933. else if (waferRobotTAction == WaferRobotTAction.PlatingCell3)
  934. {
  935. CurrentRobotPosition = EFEM.RobotPosition.PlatingCell3_Place;
  936. }
  937. else if (waferRobotTAction == WaferRobotTAction.PlatingCell4)
  938. {
  939. CurrentRobotPosition = EFEM.RobotPosition.PlatingCell4_Place;
  940. }
  941. else
  942. {
  943. CurrentRobotPosition = EFEM.RobotPosition.Origin;
  944. }
  945. }
  946. else
  947. {
  948. if (waferRobotTAction == WaferRobotTAction.LP1)
  949. {
  950. CurrentRobotPosition = EFEM.RobotPosition.Left;
  951. }
  952. else if (waferRobotTAction == WaferRobotTAction.LP2)
  953. {
  954. CurrentRobotPosition = EFEM.RobotPosition.Middle;
  955. }
  956. else if (waferRobotTAction == WaferRobotTAction.Aligner1)
  957. {
  958. CurrentRobotPosition = EFEM.RobotPosition.Aligner;
  959. }
  960. else if (waferRobotTAction == WaferRobotTAction.SRD1 || waferRobotTAction == WaferRobotTAction.SRD2)
  961. {
  962. CurrentRobotPosition = EFEM.RobotPosition.SRD;
  963. }
  964. else if (waferRobotTAction == WaferRobotTAction.Dummy1 || waferRobotTAction == WaferRobotTAction.Dummy2)
  965. {
  966. CurrentRobotPosition = EFEM.RobotPosition.Dummy;
  967. }
  968. else if (waferRobotTAction == WaferRobotTAction.VPW1)
  969. {
  970. CurrentRobotPosition = EFEM.RobotPosition.VPW1;
  971. }
  972. else if (waferRobotTAction == WaferRobotTAction.VPW2)
  973. {
  974. CurrentRobotPosition = EFEM.RobotPosition.VPW2;
  975. }
  976. else if (waferRobotTAction == WaferRobotTAction.PlatingCell1)
  977. {
  978. CurrentRobotPosition = EFEM.RobotPosition.PlatingCell1;
  979. }
  980. else if (waferRobotTAction == WaferRobotTAction.PlatingCell2)
  981. {
  982. CurrentRobotPosition = EFEM.RobotPosition.PlatingCell2;
  983. }
  984. else if (waferRobotTAction == WaferRobotTAction.PlatingCell3)
  985. {
  986. CurrentRobotPosition = EFEM.RobotPosition.PlatingCell3;
  987. }
  988. else if (waferRobotTAction == WaferRobotTAction.PlatingCell4)
  989. {
  990. CurrentRobotPosition = EFEM.RobotPosition.PlatingCell4;
  991. }
  992. else
  993. {
  994. CurrentRobotPosition = EFEM.RobotPosition.Origin;
  995. }
  996. }
  997. await Task.Delay(600);
  998. }
  999. /// <summary>
  1000. /// 计算最大值最小值
  1001. /// </summary>
  1002. /// <param name="Puf1RotationAxis"></param>
  1003. /// <returns></returns>
  1004. private (double right, double left) CalculatePufMaxMin(BeckhoffStationAxis pufAxis)
  1005. {
  1006. if (pufAxis == null || pufAxis.Stations.Count == 0) return (-1,-1);
  1007. double max = double.Parse(pufAxis.Stations[0].Position);
  1008. double min = double.Parse(pufAxis.Stations[0].Position);
  1009. double home = 0;
  1010. double pickup = 0;
  1011. foreach (Station item in pufAxis.Stations)
  1012. {
  1013. if (item.Name.ToLower().Contains("home")) home = double.Parse(item.Position);
  1014. if (item.Name.ToLower().Contains("pickup")) pickup = double.Parse(item.Position);
  1015. double position = double.Parse(item.Position);
  1016. if (position > max)
  1017. {
  1018. max = position;
  1019. }
  1020. if (position < min)
  1021. {
  1022. min = position;
  1023. }
  1024. }
  1025. return pickup < home ? (min, max):(max, min);
  1026. }
  1027. /// <summary>
  1028. /// 计算PufFlip差值
  1029. /// </summary>
  1030. /// <param name="pufAxis"></param>
  1031. /// <returns></returns>
  1032. private double CalculatePufFlipDiff(BeckhoffStationAxis pufAxis)
  1033. {
  1034. double sideAangle = 0;
  1035. double sideBangle = 0; ;
  1036. return sideAangle > sideBangle ? 180 : 0;
  1037. }
  1038. /// <summary>
  1039. /// 判定是否在station位置
  1040. /// </summary>
  1041. private bool JudgeAtStation(double targetPosition, double currentPosition, double tolerance)
  1042. {
  1043. if (Math.Abs(currentPosition - targetPosition) <= tolerance)
  1044. {
  1045. return true;
  1046. }
  1047. else
  1048. {
  1049. return false;
  1050. }
  1051. }
  1052. #endregion
  1053. }
  1054. }