CarrierListViewModel.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. using Aitex.Core.Common;
  2. using Aitex.Core.RT.DataCenter;
  3. using Aitex.Core.UI.MVVM;
  4. using Aitex.Core.Util;
  5. using Aitex.Core.Utilities;
  6. using Aitex.Sorter.Common;
  7. using Aitex.Sorter.UI.Controls;
  8. using Aitex.Sorter.UI.ViewModel;
  9. using Aitex.Sorter.UI.Views;
  10. using MECF.Framework.Common.CommonData.SorterDefines;
  11. using MECF.Framework.Common.DataCenter;
  12. using MECF.Framework.Common.Equipment;
  13. using MECF.Framework.Common.OperationCenter;
  14. using System;
  15. using System.Collections.Generic;
  16. using System.Collections.ObjectModel;
  17. using System.Linq;
  18. using System.Text;
  19. using System.Threading;
  20. using System.Threading.Tasks;
  21. using System.Windows;
  22. using System.Windows.Controls;
  23. using System.Windows.Input;
  24. namespace EfemUI.ViewModels
  25. {
  26. public class CarrierListViewModel : UIViewModelBase
  27. {
  28. //[Subscription("CarrierConfigurationList")]
  29. public CarrierConfigurationItem[] CarrierConfigurationList { get; set; }
  30. private ObservableCollection<string> carrierList;
  31. public ObservableCollection<string> CarrierList
  32. {
  33. get
  34. {
  35. return carrierList;
  36. }
  37. set
  38. {
  39. carrierList = value;
  40. InvokePropertyChanged("CarrierList");
  41. }
  42. }
  43. private CarrierConfigurationItem _currentCarrier;
  44. public CarrierConfigurationItem CurrentCarrier
  45. {
  46. get
  47. {
  48. return _currentCarrier;
  49. }
  50. set
  51. {
  52. _currentCarrier = value;
  53. InvokePropertyChanged("CurrentCarrier");
  54. }
  55. }
  56. private int _selectedIndex;
  57. public int SelectedIndex
  58. {
  59. get => _selectedIndex;
  60. set
  61. {
  62. _selectedIndex = value;
  63. InvokePropertyChanged("SelectedIndex");
  64. if(_selectedIndex!=-1)
  65. CurrentCarrier = CarrierConfigurationList[_selectedIndex];
  66. }
  67. }
  68. public ICommand CarrierCommand { get; set; }
  69. public CarrierListViewModel() : base("CarrierList")
  70. {
  71. CarrierCommand = new DelegateCommand<string>(DoCarrierCommand);
  72. }
  73. private void DoCarrierCommand(string cmd)
  74. {
  75. switch (cmd)
  76. {
  77. case "Save":
  78. InvokeClient.Instance.Service.DoOperation($"SetCarrierConfigurationItem",
  79. new object[] {
  80. CurrentCarrier.Index,
  81. CurrentCarrier.CarrierName,
  82. CurrentCarrier.CarrierWaferSize,
  83. CurrentCarrier.CarrierSlotsNumber,
  84. CurrentCarrier.IsInfoPadAOn,
  85. CurrentCarrier.IsInfoPadBOn,
  86. CurrentCarrier.IsInfoPadCOn,
  87. CurrentCarrier.IsInfoPadDOn,
  88. CurrentCarrier.LP1StationName,
  89. CurrentCarrier.LP2StationName,
  90. CurrentCarrier.LP3StationName,
  91. CurrentCarrier.LP4StationName,
  92. CurrentCarrier.LP5StationName,
  93. CurrentCarrier.LP6StationName,
  94. CurrentCarrier.LP7StationName,
  95. CurrentCarrier.LP8StationName,
  96. CurrentCarrier.GetOffset,
  97. CurrentCarrier.PutOffset,
  98. CurrentCarrier.CIDReaderIndex,
  99. CurrentCarrier.CarrierFosbMode,
  100. CurrentCarrier.NeedCheckIronDoorCarrier,
  101. CurrentCarrier.KeepClampedAfterUnloadCarrier,
  102. CurrentCarrier.DisableEvenSlot,
  103. CurrentCarrier.DisableOddSlot,
  104. CurrentCarrier.ThicknessLowLimit,
  105. CurrentCarrier.ThicknessHighLimit,
  106. CurrentCarrier.SlotPositionBaseLine,
  107. CurrentCarrier.SlotPitch,
  108. CurrentCarrier.WaferCenterDeviationLimit,
  109. CurrentCarrier.EnableDualTransfer,
  110. CurrentCarrier.ForbidAccessAboveWafer,
  111. CurrentCarrier.MappedByRobot,
  112. CurrentCarrier.EnableCarrier,
  113. });
  114. break;
  115. }
  116. Refresh();
  117. }
  118. internal void Refresh()
  119. {
  120. CarrierConfigurationList = (CarrierConfigurationItem[])QueryDataClient.Instance.Service.GetData("CarrierConfigurationList");
  121. ObservableCollection<string> itemlist = new ObservableCollection<string>();
  122. if (CarrierConfigurationList != null)
  123. {
  124. foreach (var config in CarrierConfigurationList)
  125. {
  126. itemlist.Add($"Index{config.Index}:{config.CarrierName}{(config.EnableCarrier ? "✔" : "")}");
  127. }
  128. CarrierList = itemlist;
  129. }
  130. }
  131. }
  132. }