E84Info.xaml.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. using System.ComponentModel;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. using System.Windows.Input;
  5. using Aitex.Core.UI.MVVM;
  6. using Aitex.Core.Util;
  7. using Aitex.Core.Utilities;
  8. using MECF.Framework.Common.DataCenter;
  9. using MECF.Framework.Common.OperationCenter;
  10. using MECF.Framework.UI.Client.ClientBase;
  11. using MECF.Framework.UI.Core.View.Common;
  12. using OpenSEMI.ClientBase;
  13. namespace MECF.Framework.UI.Client.CenterViews.Controls
  14. {
  15. public partial class E84Info : UserControl
  16. {
  17. public static readonly DependencyProperty LoadPortNameProperty = DependencyProperty.Register(
  18. "LoadPortName", typeof(string), typeof(E84Info), new
  19. PropertyMetadata(""));
  20. public static readonly DependencyProperty E84DataProperty = DependencyProperty.Register(
  21. "E84Data", typeof(E84InfoData), typeof(E84Info), new PropertyMetadata(null));
  22. private readonly E84InfoViewModel _e84InfoViewModel;
  23. public E84Info()
  24. {
  25. InitializeComponent();
  26. root.DataContext = this;
  27. _e84InfoViewModel = new E84InfoViewModel();
  28. ConfigBorder.DataContext = _e84InfoViewModel;
  29. ConfigBorder1.DataContext = _e84InfoViewModel;
  30. Inputs.DataContext = this;
  31. Outputs.DataContext = this;
  32. //BindingErrorTraceListener.SetTrace();
  33. E84Command = new DelegateCommand<string>(DoLoadPortCmd);
  34. IsVisibleChanged += E84Info_IsVisibleChanged;
  35. }
  36. public ICommand E84Command { get; set; }
  37. public string LoadPortName
  38. {
  39. get => (string) GetValue(LoadPortNameProperty);
  40. set => SetValue(LoadPortNameProperty, value);
  41. }
  42. public E84InfoData E84Data
  43. {
  44. get => (E84InfoData) GetValue(E84DataProperty);
  45. set => SetValue(E84DataProperty, value);
  46. }
  47. private void DoLoadPortCmd(string cmd)
  48. {
  49. var deviceName = LoadPortName;
  50. var param = new object[] {deviceName};
  51. if(cmd == "SetAMHS" && E84Data.PodPresent)
  52. {
  53. DialogBox.ShowWarning($"{LoadPortName} change to auto failed, for FOUP present");
  54. return;
  55. }
  56. InvokeClient.Instance.Service.DoOperation($"{param[0]}.{cmd}");
  57. }
  58. private void E84Info_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
  59. {
  60. (DataContext as E84InfoViewModel)?.EnableTimer(IsVisible);
  61. }
  62. }
  63. internal class E84InfoViewModel : UiViewModelBase
  64. {
  65. public E84InfoViewModel()
  66. {
  67. SetConfigCommand = new DelegateCommand<object>(SetConfig);
  68. ConfigFeedback = new E84SCs();
  69. ConfigSetPoint = new E84SCs();
  70. ConfigFeedback.UpdateKeys(typeof(E84SCs).GetProperties());
  71. ConfigSetPoint.UpdateKeys(typeof(E84SCs).GetProperties());
  72. UpdateConfig();
  73. }
  74. [IgnorePropertyChange] public ICommand SetConfigCommand { get; }
  75. [IgnorePropertyChange] public E84SCs ConfigFeedback { get; set; }
  76. [IgnorePropertyChange] public E84SCs ConfigSetPoint { get; set; }
  77. public bool AutomaticMode { get; set; }
  78. public bool KeepClampedAfterRun { get; set; }
  79. public bool KeepDockAfterRun { get; set; }
  80. public bool CloseDoorAfterMap { get; set; }
  81. [Subscription("E84State")] public string E84Status { get; set; }
  82. private void SetConfig(object param)
  83. {
  84. var sc = (object[]) param;
  85. InvokeClient.Instance.Service.DoOperation("System.SetConfig", sc[0].ToString(), sc[1].ToString());
  86. UpdateConfig();
  87. }
  88. public void UpdateConfig()
  89. {
  90. ConfigFeedback.Update(QueryDataClient.Instance.Service.PollConfig(ConfigFeedback.GetKeys()));
  91. ConfigSetPoint.Update(QueryDataClient.Instance.Service.PollConfig(ConfigSetPoint.GetKeys()));
  92. Refresh();
  93. }
  94. protected override void Poll()
  95. {
  96. Refresh();
  97. base.Poll();
  98. }
  99. }
  100. public class E84SCs : PageSCValue
  101. {
  102. public int Fa_E84_TP1 { get; set; }
  103. public int Fa_E84_TP2 { get; set; }
  104. public int Fa_E84_TP3 { get; set; }
  105. public int Fa_E84_TP4 { get; set; }
  106. public int Fa_E84_TP5 { get; set; }
  107. public int Fa_E84_TP6 { get; set; }
  108. public bool LoadPort_CarrierIDReaderInUse { get; set; }
  109. public int LoadPort_DataReadSize { get; set; }
  110. public int LoadPort_StartPage { get; set; }
  111. public int LoadPort_DefaultPage { get; set; }
  112. }
  113. public class E84InfoData : INotifyPropertyChanged
  114. {
  115. private bool _busy;
  116. private string _carrierId;
  117. private bool _continuousTransfer;
  118. private bool _cs0;
  119. private bool _cs1;
  120. private string _e84State;
  121. private bool _emergencyOk;
  122. private bool _errorOnPlacementTimeout;
  123. private bool _handoffAvailable;
  124. private string _loadPortState;
  125. private string _AccessMode;
  126. //Factory Outputs
  127. private bool _loadRequest;
  128. private bool _podDocked;
  129. private bool _podLatched;
  130. private bool _podOpen;
  131. private bool _podPlaced;
  132. private bool _podReserved;
  133. private string _portState;
  134. private bool _potPresent;
  135. private bool _readyToTransfer;
  136. private string _slotMap;
  137. private bool _transferComplete;
  138. private bool _transferRequest;
  139. private bool _unloadRequest;
  140. //Factory Inputs
  141. private bool _valid;
  142. private bool _virtualMode;
  143. private string _carrierIDStatus;
  144. public string CarrierIDStatus
  145. {
  146. get => _carrierIDStatus;
  147. set
  148. {
  149. _carrierIDStatus = value;
  150. OnPropertyChanged("CarrierIDStatus");
  151. }
  152. }
  153. private string _slotmapStatus;
  154. public string SlotMapStatus
  155. {
  156. get => _slotmapStatus;
  157. set
  158. {
  159. _slotmapStatus = value;
  160. OnPropertyChanged("SlotMapStatus");
  161. }
  162. }
  163. private string _accessStatus;
  164. public string AccessStatus
  165. {
  166. get => _accessStatus;
  167. set
  168. {
  169. _accessStatus = value;
  170. OnPropertyChanged("AccessStatus");
  171. }
  172. }
  173. public bool PodPresent
  174. {
  175. get => _potPresent;
  176. set
  177. {
  178. _potPresent = value;
  179. OnPropertyChanged("PodPresent");
  180. }
  181. }
  182. public bool PodPlaced
  183. {
  184. get => _podPlaced;
  185. set
  186. {
  187. _podPlaced = value;
  188. OnPropertyChanged("PodPlaced");
  189. }
  190. }
  191. public bool PodLatched
  192. {
  193. get => _podLatched;
  194. set
  195. {
  196. _podLatched = value;
  197. OnPropertyChanged("PodLatched");
  198. }
  199. }
  200. public bool PodDocked
  201. {
  202. get => _podDocked;
  203. set
  204. {
  205. _podDocked = value;
  206. OnPropertyChanged("PodDocked");
  207. }
  208. }
  209. public bool PodOpen
  210. {
  211. get => _podOpen;
  212. set
  213. {
  214. _podOpen = value;
  215. OnPropertyChanged("PodOpen");
  216. }
  217. }
  218. public string LoadPortState
  219. {
  220. get => $"_{_loadPortState}";
  221. set
  222. {
  223. _loadPortState = value;
  224. OnPropertyChanged("LoadPortState");
  225. }
  226. }
  227. public string AccessMode
  228. {
  229. get => $"{_AccessMode}";
  230. set
  231. {
  232. _AccessMode = value;
  233. OnPropertyChanged("AccessMode");
  234. }
  235. }
  236. public bool VirtualMode
  237. {
  238. get => _virtualMode;
  239. set
  240. {
  241. _virtualMode = value;
  242. OnPropertyChanged("VirtualMode");
  243. }
  244. }
  245. public bool PodReserved
  246. {
  247. get => _podReserved;
  248. set
  249. {
  250. _podReserved = value;
  251. OnPropertyChanged("PodReserved");
  252. }
  253. }
  254. public string PortState
  255. {
  256. get =>$"{_portState}";
  257. set
  258. {
  259. _portState = value;
  260. OnPropertyChanged("PortState");
  261. }
  262. }
  263. public string CarrierID
  264. {
  265. get => _carrierId;
  266. set
  267. {
  268. _carrierId = value;
  269. OnPropertyChanged("CarrierID");
  270. }
  271. }
  272. public string SlotMap
  273. {
  274. get => _slotMap;
  275. set
  276. {
  277. _slotMap = value;
  278. OnPropertyChanged("SlotMap");
  279. }
  280. }
  281. public bool Valid
  282. {
  283. get => _valid;
  284. set
  285. {
  286. _valid = value;
  287. OnPropertyChanged("Valid");
  288. }
  289. }
  290. public bool TransferRequest
  291. {
  292. get => _transferRequest;
  293. set
  294. {
  295. _transferRequest = value;
  296. OnPropertyChanged("TransferRequest");
  297. }
  298. }
  299. public bool Busy
  300. {
  301. get => _busy;
  302. set
  303. {
  304. _busy = value;
  305. OnPropertyChanged("Busy");
  306. }
  307. }
  308. public bool TransferComplete
  309. {
  310. get => _transferComplete;
  311. set
  312. {
  313. _transferComplete = value;
  314. OnPropertyChanged("TransferComplete");
  315. }
  316. }
  317. public bool CS0
  318. {
  319. get => _cs0;
  320. set
  321. {
  322. _cs0 = value;
  323. OnPropertyChanged("CS0");
  324. }
  325. }
  326. public bool CS1
  327. {
  328. get => _cs1;
  329. set
  330. {
  331. _cs1 = value;
  332. OnPropertyChanged("CS1");
  333. }
  334. }
  335. public bool ContinuousTransfer
  336. {
  337. get => _continuousTransfer;
  338. set
  339. {
  340. _continuousTransfer = value;
  341. OnPropertyChanged("ContinuousTransfer");
  342. }
  343. }
  344. public bool LoadRequest
  345. {
  346. get => _loadRequest;
  347. set
  348. {
  349. _loadRequest = value;
  350. OnPropertyChanged("LoadRequest");
  351. }
  352. }
  353. public bool UnloadRequest
  354. {
  355. get => _unloadRequest;
  356. set
  357. {
  358. _unloadRequest = value;
  359. OnPropertyChanged("UnloadRequest");
  360. }
  361. }
  362. public bool ReadyToTransfer
  363. {
  364. get => _readyToTransfer;
  365. set
  366. {
  367. _readyToTransfer = value;
  368. OnPropertyChanged("ReadyToTransfer");
  369. }
  370. }
  371. public bool HandoffAvailable
  372. {
  373. get => _handoffAvailable;
  374. set
  375. {
  376. _handoffAvailable = value;
  377. OnPropertyChanged("HandoffAvailable");
  378. }
  379. }
  380. public bool EmergencyOk
  381. {
  382. get => _emergencyOk;
  383. set
  384. {
  385. _emergencyOk = value;
  386. OnPropertyChanged("EmergencyOk");
  387. }
  388. }
  389. public bool ErrorOnPlacementTimeout
  390. {
  391. get => _errorOnPlacementTimeout;
  392. set
  393. {
  394. _errorOnPlacementTimeout = value;
  395. OnPropertyChanged("ErrorOnPlacementTimeout");
  396. }
  397. }
  398. public string E84State
  399. {
  400. get => _e84State;
  401. set
  402. {
  403. _e84State = value;
  404. OnPropertyChanged("E84State");
  405. }
  406. }
  407. #region INotifyPropertyChanged Members
  408. public event PropertyChangedEventHandler PropertyChanged;
  409. protected virtual void OnPropertyChanged(string propertyName)
  410. {
  411. PropertyChangedEventHandler handler = this.PropertyChanged;
  412. if (handler != null)
  413. handler(this, new PropertyChangedEventArgs(propertyName));
  414. }
  415. #endregion
  416. }
  417. }