OperationSubViewModel.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. using Aitex.Core.Common;
  2. using Aitex.Core.UI.MVVM;
  3. using Aitex.Core.Util;
  4. using Aitex.Core.Utilities;
  5. using Aitex.Sorter.Common;
  6. using Aitex.Sorter.UI.Controls;
  7. using Aitex.Sorter.UI.Controls.Common;
  8. using MECF.Framework.Common.Equipment;
  9. using MECF.Framework.Common.OperationCenter;
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Threading.Tasks;
  15. using System.Windows;
  16. using System.Windows.Controls;
  17. using System.Windows.Input;
  18. namespace Aitex.Sorter.UI.ViewModel
  19. {
  20. class OperationViewSubModel : OperationMultiLPViewModel
  21. {
  22. private static int loadPortCount = 4;
  23. public ICommand StartCycleCommand { get; set; }
  24. public ICommand MapCommand { get; set; }
  25. [IgnorePropertyChange]
  26. public string BatchIDSetPoint
  27. {
  28. get;
  29. set;
  30. }
  31. [IgnorePropertyChange]
  32. public ComboBoxItem CycleFrom { get; set; }
  33. [IgnorePropertyChange]
  34. public ComboBoxItem CycleTo { get; set; }
  35. [Subscription(ParamName.ModuleWaferList, DeviceName.TurnOverStation)]
  36. public WaferInfo[] TurnOverStationWafers
  37. {
  38. get;
  39. set;
  40. }
  41. public WaferInfo TurnOverStationWafer => TurnOverStationWafers?[0];
  42. [Subscription("System.TurnoverStation.IsPlacement")]
  43. public bool TurnoverStationWaferDetector
  44. {
  45. get => !_turnoverStationWaferDetector;
  46. set => _turnoverStationWaferDetector = value;
  47. }
  48. private bool _turnoverStationWaferDetector;
  49. [Subscription("LP1.InfoPadCarrierType")]
  50. public string LP1CarrierType
  51. {
  52. get => _lp1CarrierType;
  53. set => _lp1CarrierType = value;
  54. }
  55. private string _lp1CarrierType;
  56. [Subscription("LP2.InfoPadCarrierType")]
  57. public string LP2CarrierType
  58. {
  59. get => _lp2CarrierType;
  60. set => _lp2CarrierType = value;
  61. }
  62. private string _lp2CarrierType;
  63. [Subscription("LP3.InfoPadCarrierType")]
  64. public string LP3CarrierType
  65. {
  66. get => _lp3CarrierType;
  67. set => _lp3CarrierType = value;
  68. }
  69. private string _lp3CarrierType;
  70. [Subscription("LP4.InfoPadCarrierType")]
  71. public string LP4CarrierType
  72. {
  73. get => _lp4CarrierType;
  74. set => _lp4CarrierType = value;
  75. }
  76. private string _lp4CarrierType;
  77. public OperationViewSubModel() : base(loadPortCount)
  78. {
  79. WaferTransferOptionCommand = new DelegateCommand<WaferTransferOption>(BeforeTransfer);
  80. StartCycleCommand = new DelegateCommand<object>(StartCycle);
  81. MapCommand = new DelegateCommand<DependencyObject>(DoLoadPortCmd, x =>
  82. {
  83. if (x != null)
  84. {
  85. var target = CommandHelper.GetTarget(x);
  86. if (target != null)
  87. {
  88. var loadport = FoupList.Single(l => l.DeviceName == target.ToString());
  89. switch (loadport.Station)
  90. {
  91. case ModuleName.LP1:
  92. return loadport.Present && loadport.Placement && (_lp1CarrierType != null && !_lp1CarrierType.Contains("FOUP"));
  93. case ModuleName.LP2:
  94. return loadport.Present && loadport.Placement && (_lp2CarrierType != null && !_lp2CarrierType.Contains("FOUP"));// && LoadPort_LoadPort2CassetteType != "Type1";
  95. case ModuleName.LP3:
  96. return loadport.Present && loadport.Placement && (_lp3CarrierType != null && !_lp3CarrierType.Contains("FOUP"));
  97. case ModuleName.LP4:
  98. return loadport.Present && loadport.Placement && (_lp4CarrierType != null && !_lp4CarrierType.Contains("FOUP"));
  99. }
  100. return loadport.Present && loadport.Placement;
  101. }
  102. }
  103. return false;
  104. });
  105. }
  106. protected override void Poll()
  107. {
  108. base.Poll();
  109. }
  110. private void StartCycle(object obj)
  111. {
  112. if (CycleFrom == null || CycleTo == null)
  113. return;
  114. InvokeClient.Instance.Service.DoOperation("System.StartCycle", (string)CycleFrom.Content, (string)CycleTo.Content);
  115. }
  116. public ICommand WaferTransferOptionCommand
  117. {
  118. get; set;
  119. }
  120. protected virtual void BeforeTransfer(WaferTransferOption option)
  121. {
  122. option.Setting.ShowAlign = true;
  123. option.Setting.ShowLaserMarker = true;
  124. option.Setting.ShowT7Code = true;
  125. option.Setting.ShowTurnOver = true;
  126. }
  127. protected override void InitFoupList()
  128. {
  129. foreach (var item in FoupList)
  130. {
  131. item.FoupType = Controls.FoupType.LoadportMapButtonControl;
  132. }
  133. base.InitFoupList();
  134. }
  135. }
  136. }