IoViewModelRSW.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. using System.Collections.Generic;
  2. using System.Collections.ObjectModel;
  3. using System.Windows;
  4. using System.Windows.Input;
  5. using Aitex.Core.UI.MVVM;
  6. using Aitex.Core.Util;
  7. using Aitex.Sorter.UI.ViewModel;
  8. using MECF.Framework.Common.IOCore;
  9. namespace EfemUI.ViewModels
  10. {
  11. public class IoViewModelRSW : UIViewModelBase
  12. {
  13. private List<NotifiableIoItem> _di1;
  14. private List<NotifiableIoItem> _do2;
  15. private List<NotifiableIoItem> _di3;
  16. private List<NotifiableIoItem> _do4;
  17. private List<NotifiableIoItem> _plcDi;
  18. private List<NotifiableIoItem> _plcDo;
  19. private List<NotifiableIoItem> _ai5;
  20. private List<NotifiableIoItem> _ai6;
  21. private List<NotifiableIoItem> _ai7;
  22. private List<NotifiableIoItem> _motionAi;
  23. private List<NotifiableIoItem> _motionAo;
  24. public IoViewModelRSW() : base("IoViewModelRSW")
  25. {
  26. Card1DiList = new ObservableCollection<NotifiableIoItem>();
  27. Card2DoList = new ObservableCollection<NotifiableIoItem>();
  28. Card3DiList = new ObservableCollection<NotifiableIoItem>();
  29. Card4DoList = new ObservableCollection<NotifiableIoItem>();
  30. PlcDiList = new ObservableCollection<NotifiableIoItem>();
  31. PlcDoList = new ObservableCollection<NotifiableIoItem>();
  32. Card5AiList = new ObservableCollection<NotifiableIoItem>();
  33. Card6AiList = new ObservableCollection<NotifiableIoItem>();
  34. Card7AiList = new ObservableCollection<NotifiableIoItem>();
  35. MotionAiList = new ObservableCollection<NotifiableIoItem>();
  36. MotionAoList = new ObservableCollection<NotifiableIoItem>();
  37. SetDoCommand = new DelegateCommand<string>(PerformSetDo);
  38. }
  39. public ObservableCollection<NotifiableIoItem> Card1DiList { get; set; }
  40. public ObservableCollection<NotifiableIoItem> Card2DoList { get; set; }
  41. public ObservableCollection<NotifiableIoItem> Card3DiList { get; set; }
  42. public ObservableCollection<NotifiableIoItem> Card4DoList { get; set; }
  43. public ObservableCollection<NotifiableIoItem> Card5AiList { get; set; }
  44. public ObservableCollection<NotifiableIoItem> Card6AiList { get; set; }
  45. public ObservableCollection<NotifiableIoItem> Card7AiList { get; set; }
  46. public ObservableCollection<NotifiableIoItem> MotionAiList { get; set; }
  47. public ObservableCollection<NotifiableIoItem> MotionAoList { get; set; }
  48. public ObservableCollection<NotifiableIoItem> PlcDiList { get; set; }
  49. public ObservableCollection<NotifiableIoItem> PlcDoList { get; set; }
  50. [Subscription("System.dio000.DIList")]
  51. public List<NotifiableIoItem> DiListData1
  52. {
  53. get => _di1;
  54. set
  55. {
  56. _di1 = value;
  57. Application.Current.Dispatcher.Invoke(() =>
  58. {
  59. Card1DiList.Clear();
  60. _di1.ForEach(x =>
  61. {
  62. if (x.Provider.ToLower() == "system.dio000")
  63. Card1DiList.Add(x);
  64. });
  65. });
  66. }
  67. }
  68. [Subscription("System.dio001.DOList")]
  69. public List<NotifiableIoItem> DoListData2
  70. {
  71. get => _do2;
  72. set
  73. {
  74. _do2 = value;
  75. Application.Current.Dispatcher.Invoke(() =>
  76. {
  77. Card2DoList.Clear();
  78. _do2.ForEach(x =>
  79. {
  80. if (x.Provider.ToLower() == "system.dio001")
  81. Card2DoList.Add(x);
  82. });
  83. });
  84. }
  85. }
  86. [Subscription("System.dio002.DIList")]
  87. public List<NotifiableIoItem> DiListData3
  88. {
  89. get => _di3;
  90. set
  91. {
  92. _di3 = value;
  93. Application.Current.Dispatcher.Invoke(() =>
  94. {
  95. Card3DiList.Clear();
  96. _di3.ForEach(x =>
  97. {
  98. if (x.Provider.ToLower() == "system.dio002")
  99. Card3DiList.Add(x);
  100. });
  101. });
  102. }
  103. }
  104. [Subscription("System.dio003.DOList")]
  105. public List<NotifiableIoItem> DoListData4
  106. {
  107. get => _do4;
  108. set
  109. {
  110. _do4 = value;
  111. Application.Current.Dispatcher.Invoke(() =>
  112. {
  113. Card4DoList.Clear();
  114. _do4.ForEach(x =>
  115. {
  116. if (x.Provider.ToLower() == "system.dio003")
  117. Card4DoList.Add(x);
  118. });
  119. });
  120. }
  121. }
  122. [Subscription("System.dio004.AIList")]
  123. public List<NotifiableIoItem> AiListData5
  124. {
  125. get => _ai5;
  126. set
  127. {
  128. _ai5 = value;
  129. Application.Current.Dispatcher.Invoke(() =>
  130. {
  131. Card5AiList.Clear();
  132. _ai5.ForEach(x =>
  133. {
  134. if (x.Provider.ToLower() == "system.dio004")
  135. Card5AiList.Add(x);
  136. });
  137. });
  138. }
  139. }
  140. [Subscription("System.dio005.AIList")]
  141. public List<NotifiableIoItem> AiListData6
  142. {
  143. get => _ai6;
  144. set
  145. {
  146. _ai6 = value;
  147. Application.Current.Dispatcher.Invoke(() =>
  148. {
  149. Card6AiList.Clear();
  150. _ai6.ForEach(x =>
  151. {
  152. if (x.Provider.ToLower() == "system.dio005")
  153. Card6AiList.Add(x);
  154. });
  155. });
  156. }
  157. }
  158. [Subscription("System.dio006.AIList")]
  159. public List<NotifiableIoItem> AiListData7
  160. {
  161. get => _ai7;
  162. set
  163. {
  164. _ai7 = value;
  165. Application.Current.Dispatcher.Invoke(() =>
  166. {
  167. Card7AiList.Clear();
  168. _ai7.ForEach(x =>
  169. {
  170. if (x.Provider.ToLower() == "system.dio006")
  171. Card7AiList.Add(x);
  172. });
  173. });
  174. }
  175. }
  176. [Subscription("System.MotionAxis.AIList")]
  177. public List<NotifiableIoItem> AiListData
  178. {
  179. get => _motionAi;
  180. set
  181. {
  182. _motionAi = value;
  183. Application.Current.Dispatcher.Invoke(() =>
  184. {
  185. MotionAiList.Clear();
  186. _motionAi.ForEach(x =>
  187. {
  188. if (x.Provider.ToLower() == "system.motionaxis")
  189. MotionAiList.Add(x);
  190. });
  191. });
  192. }
  193. }
  194. [Subscription("System.MotionAxis.AOList")]
  195. public List<NotifiableIoItem> AoListData
  196. {
  197. get => _motionAo;
  198. set
  199. {
  200. _motionAo = value;
  201. Application.Current.Dispatcher.Invoke(() =>
  202. {
  203. MotionAoList.Clear();
  204. _motionAo.ForEach(x =>
  205. {
  206. if (x.Provider.ToLower() == "system.motionaxis")
  207. MotionAoList.Add(x);
  208. });
  209. });
  210. }
  211. }
  212. [Subscription("System.MainPlc.DIList")]
  213. public List<NotifiableIoItem> DiListData9
  214. {
  215. get => _plcDi;
  216. set
  217. {
  218. _plcDi = value;
  219. Application.Current.Dispatcher.Invoke(() =>
  220. {
  221. PlcDiList.Clear();
  222. _plcDi.ForEach(x =>
  223. {
  224. if (x.Provider.ToLower() == "system.mainplc")
  225. PlcDiList.Add(x);
  226. });
  227. });
  228. }
  229. }
  230. [Subscription("System.MainPlc.DOList")]
  231. public List<NotifiableIoItem> DoListData10
  232. {
  233. get => _plcDo;
  234. set
  235. {
  236. _plcDo = value;
  237. Application.Current.Dispatcher.Invoke(() =>
  238. {
  239. PlcDoList.Clear();
  240. _plcDo.ForEach(x =>
  241. {
  242. if (x.Provider.ToLower() == "system.mainplc")
  243. PlcDoList.Add(x);
  244. });
  245. });
  246. }
  247. }
  248. public ICommand SetDoCommand { get; set; }
  249. private void PerformSetDo(string ioName)
  250. {
  251. }
  252. private void SetDo()
  253. {
  254. }
  255. protected override void InvokeBeforeUpdateProperty(Dictionary<string, object> data)
  256. {
  257. //data[UIKey(UnitName.System.ToString(), ParamName.WaferInfoRobotAligner01)] = new WaferInfo("dummy", WaferStatus.Normal);
  258. }
  259. }
  260. }