PlatingCellHomePageViewModel.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. using Aitex.Core.Common;
  2. using Aitex.Core.UI.MVVM;
  3. using MECF.Framework.Common.CommonData.Metal;
  4. using MECF.Framework.Common.CommonData.PlatingCell;
  5. using MECF.Framework.Common.CommonData.PowerSupplier;
  6. using MECF.Framework.Common.DataCenter;
  7. using MECF.Framework.Common.OperationCenter;
  8. using MECF.Framework.Common.Persistent.Reservoirs;
  9. using MECF.Framework.Common.RecipeCenter;
  10. using MECF.Framework.Common.ToolLayout;
  11. using MECF.Framework.Common.Utilities;
  12. using Prism.Mvvm;
  13. using System;
  14. using System.Collections.Generic;
  15. using System.Linq;
  16. using System.Text;
  17. using System.Threading.Tasks;
  18. using System.Windows.Input;
  19. using System.Windows.Threading;
  20. namespace PunkHPX8_MainPages.ViewModels
  21. {
  22. public class PlatingCellHomePageViewModel : BindableBase
  23. {
  24. #region 常量
  25. private const string PERSISTENT_VALUE = "PersistentValue";
  26. #endregion
  27. #region 内部变量
  28. #region Common
  29. /// <summary>
  30. /// 模块名称
  31. /// </summary>
  32. private string _module;
  33. /// <summary>
  34. /// 当前选择Recipe节点
  35. /// </summary>
  36. private RecipeNode _selectedRecipeNode;
  37. /// <summary>
  38. /// PlatingCellData
  39. /// </summary>
  40. private PlatingCellData _platingCellCommonData;
  41. /// <summary>
  42. /// Persistent
  43. /// </summary>
  44. private PlatingCellPersistentValue _platingCellPersistent;
  45. /// <summary>
  46. /// platingCellItem
  47. /// </summary>
  48. private PlatingCellItem _metalItem;
  49. /// <summary>
  50. /// WaferSize
  51. /// </summary>
  52. private WaferSize _selectedWaferSize = 0;
  53. /// <summary>
  54. /// Wafer Size List
  55. /// </summary>
  56. private List<int> _waferSizeList = new List<int>();
  57. /// <summary>
  58. /// 页面功能启用
  59. /// </summary>
  60. private bool _isEnabled;
  61. /// <summary>
  62. /// AutoMode页面功能启用
  63. /// </summary>
  64. private bool _isAutoEnabled;
  65. #endregion
  66. /// <summary>
  67. /// SeqRecipe
  68. /// </summary>
  69. private string _seqRecipe;
  70. #region 系统数据
  71. /// <summary>
  72. /// 定时器
  73. /// </summary>
  74. DispatcherTimer _timer;
  75. /// <summary>
  76. /// 查询后台数据集合
  77. /// </summary>
  78. private List<string> _rtDataKeys = new List<string>();
  79. /// <summary>
  80. /// rt查询key数值字典
  81. /// </summary>
  82. private Dictionary<string, object> _rtDataValueDic = new Dictionary<string, object>();
  83. #endregion
  84. #region platingCell
  85. /// <summary>
  86. /// RecipeContent
  87. /// </summary>
  88. private string _recipeContent;
  89. /// <summary>
  90. /// TimeRemaining
  91. /// </summary>
  92. private double _timeRemaining;
  93. /// <summary>
  94. /// OfTotalTime
  95. /// </summary>
  96. private double _totalTime;
  97. /// <summary>
  98. /// OperatingMode
  99. /// </summary>
  100. private string _operatingMode;
  101. /// <summary>
  102. /// State
  103. /// </summary>
  104. private string _state;
  105. /// <summary>
  106. /// RecipeMode
  107. /// </summary>
  108. private string _recipeMode;
  109. #endregion
  110. #region dep recipe
  111. /// <summary>
  112. /// RecipeModuleName
  113. /// </summary>
  114. private string _recipeModuleName;
  115. /// <summary>
  116. /// RecipeType
  117. /// </summary>
  118. private string _recipeType;
  119. /// <summary>
  120. /// AchievedRunRecipeCycle
  121. /// </summary>
  122. private int _achievedRunRecipeCycle;
  123. /// <summary>
  124. /// 当前Recipe
  125. /// </summary>
  126. private string _currentRecipe;
  127. #endregion
  128. #region UI Related
  129. /// <summary>
  130. /// IsErrorState
  131. /// </summary>
  132. private bool _isErrorState;
  133. #endregion
  134. #region PowerSupplier
  135. /// <summary>
  136. /// PowerSuplier数据
  137. /// </summary>
  138. private PowerSupplierData _powerSupplierData;
  139. #endregion
  140. #region 属性
  141. #region Common
  142. /// <summary>
  143. /// PlatingCellData
  144. /// </summary>
  145. public PlatingCellData PlatingCellCommonData
  146. {
  147. get { return _platingCellCommonData; }
  148. set { SetProperty(ref _platingCellCommonData, value); }
  149. }
  150. /// <summary>
  151. /// Persistent
  152. /// </summary>
  153. public PlatingCellPersistentValue PlatingCellPersistent
  154. {
  155. get { return _platingCellPersistent; }
  156. set { SetProperty(ref _platingCellPersistent, value); }
  157. }
  158. /// <summary>
  159. /// 模块名称
  160. /// </summary>
  161. public string Module
  162. {
  163. get { return _module; }
  164. set { SetProperty(ref _module, value); }
  165. }
  166. /// <summary>
  167. /// 当前选择Recipe节点
  168. /// </summary>
  169. public RecipeNode SelectedRecipeNode
  170. {
  171. get { return _selectedRecipeNode; }
  172. set { SetProperty(ref _selectedRecipeNode, value); }
  173. }
  174. /// <summary>
  175. /// WaferSize
  176. /// </summary>
  177. public WaferSize SelectedWaferSize
  178. {
  179. get { return _selectedWaferSize; }
  180. set { SetProperty(ref _selectedWaferSize, value); }
  181. }
  182. /// <summary>
  183. /// WaferSizeList
  184. /// </summary>
  185. public List<int> WaferSizeList
  186. {
  187. get { return _waferSizeList; }
  188. set { SetProperty(ref _waferSizeList, value); }
  189. }
  190. /// <summary>
  191. /// 页面功能启用
  192. /// </summary>
  193. public bool IsEnabled
  194. {
  195. get { return _isEnabled; }
  196. set { SetProperty(ref _isEnabled, value); }
  197. }
  198. /// <summary>
  199. /// AutoMode页面功能启用
  200. /// </summary>
  201. public bool IsAutoEnabled
  202. {
  203. get { return _isAutoEnabled; }
  204. set { SetProperty(ref _isAutoEnabled, value); }
  205. }
  206. #endregion
  207. /// SeqRecipe
  208. /// </summary>
  209. public string SeqRecipe
  210. {
  211. get { return _seqRecipe; }
  212. set { SetProperty(ref _seqRecipe, value); }
  213. }
  214. #region PlatingCell
  215. /// <summary>
  216. /// RecipeContent
  217. /// </summary>
  218. public string RecipeContent
  219. {
  220. get { return _recipeContent; }
  221. set { SetProperty(ref _recipeContent, value); }
  222. }
  223. /// <summary>
  224. /// TimeRemaining
  225. /// </summary>
  226. public double TimeRemaining
  227. {
  228. get { return _timeRemaining; }
  229. set { SetProperty(ref _timeRemaining, value); }
  230. }
  231. /// <summary>
  232. /// TotalTime
  233. /// </summary>
  234. public double TotalTime
  235. {
  236. get { return _totalTime; }
  237. set { SetProperty(ref _totalTime, value); }
  238. }
  239. /// <summary>
  240. /// OperatingMode
  241. /// </summary>
  242. public string OperatingMode
  243. {
  244. get { return _operatingMode; }
  245. set { SetProperty(ref _operatingMode, value); }
  246. }
  247. /// <summary>
  248. /// State
  249. /// </summary>
  250. public string State
  251. {
  252. get { return _state; }
  253. set { SetProperty(ref _state, value); }
  254. }
  255. /// <summary>
  256. /// RecipeMode
  257. /// </summary>
  258. public string RecipeMode
  259. {
  260. get { return _recipeMode; }
  261. set { SetProperty(ref _recipeMode, value); }
  262. }
  263. #endregion
  264. #region Metal recipe
  265. /// <summary>
  266. /// RecipeModuleName
  267. /// </summary>
  268. public string RecipeModuleName
  269. {
  270. get { return _recipeModuleName; }
  271. set { SetProperty(ref _recipeModuleName, value); }
  272. }
  273. /// <summary>
  274. /// RecipeType
  275. /// </summary>
  276. public string RecipeType
  277. {
  278. get { return _recipeType; }
  279. set { SetProperty(ref _recipeType, value); }
  280. }
  281. /// <summary>
  282. /// Run Recipe已经完成的次数
  283. /// </summary>
  284. public int AchievedRunRecipeCycle
  285. {
  286. get { return _achievedRunRecipeCycle; }
  287. set { SetProperty(ref _achievedRunRecipeCycle, value); }
  288. }
  289. /// <summary>
  290. /// 当前Recipe
  291. /// </summary>
  292. public string CurrentRecipe
  293. {
  294. get { return _currentRecipe; }
  295. set { SetProperty(ref _currentRecipe, value); }
  296. }
  297. #endregion
  298. #region UI Related
  299. /// <summary>
  300. /// IsErrorState
  301. /// </summary>
  302. public bool IsErrorState
  303. {
  304. get { return _isErrorState; }
  305. set { SetProperty(ref _isErrorState, value); }
  306. }
  307. #endregion
  308. /// <summary>
  309. /// SidA PowerSuplier数据
  310. /// </summary>
  311. public PowerSupplierData PowerSupplierData
  312. {
  313. get { return _powerSupplierData; }
  314. set { SetProperty(ref _powerSupplierData, value); }
  315. }
  316. #endregion
  317. #endregion
  318. #region Command指令
  319. public ICommand InitializeCommand { get; set; }
  320. #endregion
  321. /// <summary>
  322. /// 构造函数
  323. /// </summary>
  324. public PlatingCellHomePageViewModel()
  325. {
  326. InitializeCommand = new DelegateCommand<object>(InitializeAction);
  327. WaferSizeList.Add((int)WaferSize.WS8);
  328. WaferSizeList.Add((int)WaferSize.WS12);
  329. }
  330. /// <summary>
  331. /// 加载数据
  332. /// </summary>
  333. public void LoadData(string systemName)
  334. {
  335. Module = systemName;
  336. RecipeModuleName = "DEP Recipe";
  337. RecipeType = "dep";
  338. _rtDataKeys.Clear();
  339. _rtDataKeys.Add($"{Module}.FsmState");
  340. if (_timer == null)
  341. {
  342. _timer = new DispatcherTimer();
  343. _timer.Interval = TimeSpan.FromMilliseconds(200);
  344. _timer.Tick += Timer_Tick;
  345. }
  346. _timer.Start();
  347. }
  348. /// <summary>
  349. /// 定时器执行
  350. /// </summary>
  351. /// <param name="sender"></param>
  352. /// <param name="e"></param>
  353. private void Timer_Tick(object sender, EventArgs e)
  354. {
  355. if (_rtDataKeys.Count != 0)
  356. {
  357. _rtDataValueDic = QueryDataClient.Instance.Service.PollData(_rtDataKeys);
  358. if (_rtDataValueDic != null)
  359. {
  360. }
  361. }
  362. }
  363. /// <summary>
  364. /// 隐藏
  365. /// </summary>
  366. public void Hide()
  367. {
  368. if (_timer != null)
  369. {
  370. _timer.Stop();
  371. }
  372. }
  373. /// <summary>
  374. /// Initialize Action
  375. /// </summary>
  376. /// <param name="param"></param>
  377. private void InitializeAction(object param)
  378. {
  379. InvokeClient.Instance.Service.DoOperation($"{Module}.InitializeAll");
  380. }
  381. }
  382. }