ProcessHistoryViewModel.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. using MECF.Framework.Common.DataCenter;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Windows.Media;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using Venus_Core;
  10. using Prism.Commands;
  11. using Prism.Mvvm;
  12. using Venus_MainPages.Unity;
  13. using Venus_MainPages.Views;
  14. using System.Collections.ObjectModel;
  15. using System.Windows.Threading;
  16. using System.Windows;
  17. using Aitex.Core.RT.Log;
  18. using Aitex.Core.UI.ControlDataContext;
  19. using WPF.Themes.UserControls;
  20. using System.IO;
  21. using System.Diagnostics;
  22. using Aitex.Core.RT.Routine;
  23. using System.Xml.Linq;
  24. using System.Windows.Forms;
  25. using ExcelLibrary.BinaryFileFormat;
  26. using Aitex.Core.UI.View.Common;
  27. using Aitex.Core.RT.DataCenter;
  28. using System.Xml;
  29. using System.Security.Cryptography.X509Certificates;
  30. using System.Reflection;
  31. using Newtonsoft.Json;
  32. using Venus_Themes.UserControls;
  33. using Aitex.Core.UI.Control;
  34. using System.Windows.Annotations;
  35. using System.Runtime.Serialization;
  36. namespace Venus_MainPages.ViewModels
  37. {
  38. public class ProcessHistoryViewModel : BindableBase
  39. {
  40. #region 私有字段
  41. private ProcessHistoryView view;
  42. List<string> keys = new List<string>();
  43. RealtimeProvider _provider = new RealtimeProvider();
  44. private ObservableCollection<ParameterNode> _ParameterNodes;
  45. DispatcherTimer timer = new DispatcherTimer();
  46. ObservableCollection<PdKeyData> _PdKeyDataObservation = new ObservableCollection<PdKeyData>();
  47. public List<string> RecipesAdd = new List<string>();
  48. public List<SolidColorBrush> solidColorBrushes = new List<SolidColorBrush>();
  49. DateTime currentTime;
  50. private RecipeItem selectedRecipeItem;
  51. #endregion
  52. #region 属性
  53. public List<HistoryDataItem> ProcessData { get; set; }
  54. public List<Recipeslist> CheboxRecipes { get; set; }
  55. public ProcessDataChartDataItem ProcessChartData { get; set; }
  56. public DateTime StartDateTime { get; set; }
  57. public DateTime EndDateTime { get; set; }
  58. public string SelectedValuePM { get; set; }
  59. public string RecipeName { get; set; }
  60. public ObservableCollection<PdKeyData> OldPdKeyDataCollection { get; set; }
  61. public ObservableCollection<RecipeItem> Recipes { get; set; }
  62. public class Recipeslist
  63. {
  64. public string BoxName { get; set; }
  65. }
  66. public class RecipeAdd
  67. {
  68. public string Recipesname { get; set; }
  69. }
  70. public ObservableCollection<ParameterNode> ParameterNodes
  71. {
  72. get { return _ParameterNodes; }
  73. set { SetProperty(ref _ParameterNodes, value); }
  74. }
  75. public ObservableCollection<PdKeyData> PdKeyDataCollection
  76. {
  77. get { return _PdKeyDataObservation; }
  78. set { SetProperty(ref _PdKeyDataObservation, value); }
  79. }
  80. #endregion
  81. #region 命令
  82. private DelegateCommand<object> _LoadCommandPD;
  83. public DelegateCommand<object> LoadCommandPD =>
  84. _LoadCommandPD ?? (_LoadCommandPD = new DelegateCommand<object>(OnLoadPd));
  85. private DelegateCommand _SearchRecipeCommand;
  86. public DelegateCommand SearchRecipeCommand =>
  87. _SearchRecipeCommand ?? (_SearchRecipeCommand = new DelegateCommand(SearchRecipes));
  88. private DelegateCommand<object> _PdParameterCheckCommand;
  89. public DelegateCommand<object> PdParameterCheckCommand =>
  90. _PdParameterCheckCommand ?? (_PdParameterCheckCommand = new DelegateCommand<object>(OnParameterCheck));
  91. private DelegateCommand<object> _DataGridSelectionChangedCommand;
  92. public DelegateCommand<object> DataGridSelectionChangedCommand =>
  93. _DataGridSelectionChangedCommand ?? (_DataGridSelectionChangedCommand = new DelegateCommand<object>(OnDataGridSelectionChanged));
  94. private DelegateCommand _SearchDataCommand;
  95. public DelegateCommand SearchDataCommand =>
  96. _SearchDataCommand ?? (_SearchDataCommand = new DelegateCommand(OnSearchData));
  97. private DelegateCommand _ClearDataCommand;
  98. public DelegateCommand ClearDataCommand =>
  99. _ClearDataCommand ?? (_ClearDataCommand = new DelegateCommand(OnClearData));
  100. #endregion
  101. #region 构造函数
  102. public ProcessHistoryViewModel()
  103. {
  104. ProcessChartData = new ProcessDataChartDataItem(60000);
  105. Recipes = new ObservableCollection<RecipeItem>();
  106. timer.Interval = TimeSpan.FromSeconds(0.5);
  107. OldPdKeyDataCollection = new ObservableCollection<PdKeyData>();
  108. CheboxRecipes = new List<Recipeslist>();
  109. solidColorBrushes.Add(new SolidColorBrush(Colors.Green));
  110. solidColorBrushes.Add(new SolidColorBrush(Colors.Red));
  111. solidColorBrushes.Add(new SolidColorBrush(Colors.Blue));
  112. solidColorBrushes.Add(new SolidColorBrush(Colors.Orange));
  113. solidColorBrushes.Add(new SolidColorBrush(Colors.Yellow));
  114. solidColorBrushes.Add(new SolidColorBrush(Colors.YellowGreen));
  115. solidColorBrushes.Add(new SolidColorBrush(Colors.AliceBlue));
  116. solidColorBrushes.Add(new SolidColorBrush(Colors.Chocolate));
  117. solidColorBrushes.Add(new SolidColorBrush(Colors.Cyan));
  118. solidColorBrushes.Add(new SolidColorBrush(Colors.DarkGreen));
  119. }
  120. #endregion
  121. #region 命令方法
  122. private void OnLoadPd(Object eventView)
  123. {
  124. this.view = (ProcessHistoryView)eventView;
  125. this.view.wfTimeFrom.Value = DateTime.Today;
  126. this.view.wfTimeTo.Value = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59, 999);
  127. this.LoadRecipeCheckBox();
  128. }
  129. private void LoadRecipeCheckBox()
  130. {
  131. List<string> chamber = new List<string>() { "PMA", "PMB", "PMC", "PMD" };
  132. CheboxRecipes.Clear();
  133. foreach (string item in chamber)
  134. {
  135. string path = Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", item);
  136. if (Directory.Exists(path))
  137. {
  138. string[] dir = Directory.GetFiles(path);
  139. for (int i = 0; i < dir.Length; i++)
  140. {
  141. CheboxRecipes.Add(new Recipeslist { BoxName = Path.GetFileName(dir[i]) });
  142. }
  143. }
  144. }
  145. }
  146. public void SearchRecipes()
  147. {
  148. SearchRecipe(this.view.wfTimeFrom.Value, this.view.wfTimeTo.Value);
  149. }
  150. public void searchlot(string id)
  151. {
  152. Recipes.Clear();
  153. try
  154. {
  155. string sql1 = string.Format($"SELECT * FROM \"lot_wafer_data\" where guid ='{id}'; ");
  156. DataTable dbData1 = QueryDataClient.Instance.Service.QueryData(sql1);
  157. string lot_data_guid = dbData1.Rows[0]["wafer_data_guid"].ToString();
  158. string sql = string.Format($"SELECT * FROM \"process_data\" where wafer_data_guid ='{lot_data_guid}'");
  159. if (!string.IsNullOrEmpty(SelectedValuePM))
  160. {
  161. string[] pms = SelectedValuePM.Split(',');
  162. if (pms.Length > 0)
  163. {
  164. sql += " and (FALSE ";
  165. foreach (var pm in pms)
  166. {
  167. sql += $" OR \"process_in\"='{pm}' ";
  168. }
  169. sql += " ) ";
  170. }
  171. }
  172. if (!string.IsNullOrEmpty(RecipeName))
  173. {
  174. sql += string.Format(" and lower(\"recipe_name\") like '%{0}%'", RecipeName.ToLower());
  175. }
  176. sql += " order by \"process_begin_time\" ASC;";
  177. DataTable dbData = QueryDataClient.Instance.Service.QueryData(sql);
  178. System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() =>
  179. {
  180. if (dbData == null || dbData.Rows.Count == 0) return;
  181. for (int i = 0; i < dbData.Rows.Count; i++)
  182. {
  183. RecipeItem item = new RecipeItem();
  184. item.Selected = false;
  185. item.Recipe = dbData.Rows[i]["recipe_name"].ToString();
  186. item.Guid = dbData.Rows[i]["guid"].ToString();
  187. item.RecipeRunGuid = dbData.Rows[i]["wafer_data_guid"].ToString();
  188. item.Chamber = dbData.Rows[i]["process_in"].ToString();
  189. item.Status = dbData.Rows[i]["process_status"].ToString();
  190. item.SlotID = dbData.Rows[i]["slot_id"].ToString();
  191. item.LotID = dbData.Rows[i]["lot_id"].ToString();
  192. if (!dbData.Rows[i]["process_begin_time"].Equals(DBNull.Value))
  193. item.StartTime = ((DateTime)dbData.Rows[i]["process_begin_time"]).ToString("yyyy-MM-dd HH:mm:ss");
  194. if (!dbData.Rows[i]["process_end_time"].Equals(DBNull.Value))
  195. item.EndTime = ((DateTime)dbData.Rows[i]["process_end_time"]).ToString("yyyy-MM-dd HH:mm:ss");
  196. Recipes.Add(item);
  197. }
  198. }));
  199. }
  200. catch (Exception e)
  201. {
  202. LOG.WriteExeption(e);
  203. }
  204. }
  205. public void SearchRecipe(DateTime start, DateTime end)
  206. {
  207. this.StartDateTime = start;
  208. this.EndDateTime = end;
  209. Recipes.Clear();
  210. try
  211. {
  212. string sql = $"SELECT * FROM \"process_data\" where \"process_begin_time\" >='{StartDateTime.ToString("yyyy/MM/dd HH:mm:ss.fff")}' and \"process_begin_time\" <='{EndDateTime.ToString("yyyy/MM/dd HH:mm:ss.fff")}' ";
  213. if (!string.IsNullOrEmpty(SelectedValuePM))
  214. {
  215. string[] pms = SelectedValuePM.Split(',');
  216. if (pms.Length > 0)
  217. {
  218. sql += " and (FALSE ";
  219. foreach (var pm in pms)
  220. {
  221. sql += $" OR \"process_in\"='{pm}' ";
  222. }
  223. sql += " ) ";
  224. }
  225. }
  226. if (!string.IsNullOrEmpty(RecipeName))
  227. {
  228. sql += string.Format(" and lower(\"recipe_name\") like '%{0}%'", RecipeName.ToLower());
  229. }
  230. sql += " order by \"process_begin_time\" ASC;";
  231. DataTable dbData = QueryDataClient.Instance.Service.QueryData(sql);
  232. System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() =>
  233. {
  234. if (dbData == null || dbData.Rows.Count == 0) return;
  235. for (int i = 0; i < dbData.Rows.Count; i++)
  236. {
  237. RecipeItem item = new RecipeItem();
  238. item.Selected = false;
  239. item.Recipe = dbData.Rows[i]["recipe_name"].ToString();
  240. item.Guid = dbData.Rows[i]["guid"].ToString();
  241. item.RecipeRunGuid = dbData.Rows[i]["wafer_data_guid"].ToString();
  242. item.Chamber = dbData.Rows[i]["process_in"].ToString();
  243. item.Status = dbData.Rows[i]["process_status"].ToString();
  244. item.SlotID = dbData.Rows[i]["slot_id"].ToString();
  245. item.LotID = dbData.Rows[i]["lot_id"].ToString();
  246. if (!dbData.Rows[i]["process_begin_time"].Equals(DBNull.Value))
  247. item.StartTime = ((DateTime)dbData.Rows[i]["process_begin_time"]).ToString("yyyy-MM-dd HH:mm:ss");
  248. if (!dbData.Rows[i]["process_end_time"].Equals(DBNull.Value))
  249. item.EndTime = ((DateTime)dbData.Rows[i]["process_end_time"]).ToString("yyyy-MM-dd HH:mm:ss");
  250. Recipes.Add(item);
  251. }
  252. }));
  253. }
  254. catch (Exception e)
  255. {
  256. LOG.WriteExeption(e);
  257. }
  258. }
  259. private void CalKeys(ParameterNode parameterNode)
  260. {
  261. if (parameterNode.ChildNodes.Count > 0)
  262. {
  263. foreach (var item in parameterNode.ChildNodes)
  264. {
  265. CalKeys(item);
  266. }
  267. }
  268. else
  269. {
  270. if (parameterNode.Selected == true)
  271. {
  272. keys.Add(parameterNode.Name);
  273. }
  274. }
  275. }
  276. private Dictionary<string, List<HistoryDataItem>> GetData(List<string> keys, DateTime from, DateTime to)
  277. {
  278. string sql = "select time AS InternalTimeStamp";
  279. foreach (var dataId in keys)
  280. {
  281. sql += "," + string.Format("\"{0}\"", dataId);
  282. }
  283. sql += string.Format(" from \"{0}\" where time > {1} and time <= {2} order by time asc",
  284. from.ToString("yyyyMMdd") + "." + "Data", from.Ticks, to.Ticks);
  285. DataTable dataTable = QueryDataClient.Instance.Service.QueryData(sql);
  286. Dictionary<string, List<HistoryDataItem>> historyData = new Dictionary<string, List<HistoryDataItem>>();
  287. if (dataTable == null || dataTable.Rows.Count == 0)
  288. return null;
  289. DateTime dt = new DateTime();
  290. Dictionary<int, string> colName = new Dictionary<int, string>();
  291. for (int colNo = 0; colNo < dataTable.Columns.Count; colNo++)
  292. {
  293. colName.Add(colNo, dataTable.Columns[colNo].ColumnName);
  294. historyData[dataTable.Columns[colNo].ColumnName] = new List<HistoryDataItem>();
  295. }
  296. for (int rowNo = 0; rowNo < dataTable.Rows.Count; rowNo++)
  297. {
  298. PointCollection points = new PointCollection();
  299. var row = dataTable.Rows[rowNo];
  300. for (int i = 0; i < dataTable.Columns.Count; i++)
  301. {
  302. HistoryDataItem data = new HistoryDataItem();
  303. if (i == 0)
  304. {
  305. long ticks = (long)row[i];
  306. dt = new DateTime(ticks);
  307. continue;
  308. }
  309. else
  310. {
  311. string dataId = colName[i];
  312. if (row[i] is DBNull || row[i] == null)
  313. {
  314. data.dateTime = dt;
  315. data.dbName = colName[i];
  316. data.value = 0;
  317. }
  318. else if (row[i] is bool)
  319. {
  320. data.dateTime = dt;
  321. data.dbName = colName[i];
  322. data.value = (bool)row[i] ? 1 : 0;
  323. }
  324. else
  325. {
  326. data.dateTime = dt;
  327. data.dbName = colName[i];
  328. data.value = float.Parse(row[i].ToString());
  329. }
  330. }
  331. historyData[data.dbName].Add(data);
  332. }
  333. }
  334. foreach (var item in historyData)
  335. {
  336. item.Value.Sort((x, y) => DateTime.Compare(x.dateTime, y.dateTime));
  337. }
  338. return historyData;
  339. }
  340. private bool RefreshTreeStatusToChild(ParameterNode node)
  341. {
  342. if (node.ChildNodes.Count > 0)
  343. {
  344. for (int i = 0; i < node.ChildNodes.Count; i++)
  345. {
  346. ParameterNode n = node.ChildNodes[i];
  347. n.Selected = node.Selected;
  348. if (!RefreshTreeStatusToChild(n))
  349. {
  350. //uncheck left node
  351. for (int j = i; j < node.ChildNodes.Count; j++)
  352. {
  353. node.ChildNodes[j].Selected = !node.Selected;
  354. }
  355. //node.Selected = !node.Selected;
  356. return false;
  357. }
  358. }
  359. }
  360. //else
  361. //{
  362. // if (node.Selected == true)
  363. // {
  364. // keys.Add(node.Name);
  365. // }
  366. // else
  367. // {
  368. // keys.Remove(node.Name);
  369. // }
  370. //}
  371. return true;
  372. }
  373. private void RefreshTreeStatusToParent(ParameterNode node)
  374. {
  375. if (node.ParentNode != null)
  376. {
  377. if (node.Selected)
  378. {
  379. bool flag = true;
  380. for (int i = 0; i < node.ParentNode.ChildNodes.Count; i++)
  381. {
  382. if (!node.ParentNode.ChildNodes[i].Selected)
  383. {
  384. flag = false; //as least one child is unselected
  385. break;
  386. }
  387. }
  388. if (flag)
  389. node.ParentNode.Selected = true;
  390. }
  391. else
  392. {
  393. node.ParentNode.Selected = false;
  394. }
  395. RefreshTreeStatusToParent(node.ParentNode);
  396. }
  397. }
  398. public static T DeepCopyJson<T>(T obj)
  399. {
  400. // 序列化
  401. string json = JsonConvert.SerializeObject(obj);
  402. // 反序列化
  403. return JsonConvert.DeserializeObject<T>(json);
  404. }
  405. private void OnParameterCheck(object obj)
  406. {
  407. ParameterNode node = obj as ParameterNode;
  408. if (!RefreshTreeStatusToChild(node))
  409. {
  410. node.Selected = !node.Selected;
  411. }
  412. else
  413. {
  414. RefreshTreeStatusToParent(node);
  415. }
  416. keys.Clear();
  417. for (int i = 0; i < ParameterNodes.Count; i++)
  418. {
  419. CalKeys(ParameterNodes[i]);
  420. }
  421. if (keys.Count > 10)
  422. {
  423. WPFMessageBox.ShowWarning("最多显示10个数据");
  424. return;
  425. }
  426. OldPdKeyDataCollection.Clear();
  427. OldPdKeyDataCollection = DeepCopyJson(PdKeyDataCollection);
  428. PdKeyDataCollection.Clear();
  429. for (int i = 0; i < keys.Count; i++)
  430. {
  431. if (i == 10)
  432. {
  433. break;
  434. }
  435. PdKeyDataCollection.Add(new PdKeyData() { Key = keys[i], Color = solidColorBrushes[i], UniqueId = i });
  436. }
  437. Compare(OldPdKeyDataCollection, PdKeyDataCollection);
  438. PdKeyDataCollection = DeepCopyJson(OldPdKeyDataCollection);
  439. }
  440. public void Compare(ObservableCollection<PdKeyData> olddata, ObservableCollection<PdKeyData> newdata)
  441. {
  442. if (newdata != null)
  443. {
  444. for (int i = 0; i < newdata.Count; i++)
  445. {
  446. var lists = olddata.ToList().Find(t => t.Key == newdata[i].Key);
  447. if (lists == null)
  448. {
  449. olddata.Add(new PdKeyData() { Key = newdata[i].Key, Color = solidColorBrushes[i], UniqueId = olddata.Count + 1 });
  450. }
  451. }
  452. for (int i = 0; i < olddata.Count; i++)
  453. {
  454. var lists = newdata.ToList().Find(t => t.Key == olddata[i].Key);
  455. if (lists == null)
  456. {
  457. olddata.Remove(olddata[i]);
  458. }
  459. }
  460. }
  461. }
  462. public void UpdateData(RecipeItem dataLog)
  463. {
  464. OnClearData();
  465. //CheckRecipe(dataLog.Guid);
  466. }
  467. public void CheckRecipe(string RecipeGuid)
  468. {
  469. string sql = $"SELECT * FROM \"recipe_step_data\" where \"process_data_guid\" = '{RecipeGuid}' order by step_number ASC;";
  470. var dbData = QueryDataClient.Instance.Service.QueryData(sql);
  471. List<StepData> steps = new List<StepData>();
  472. if (dbData != null && dbData.Rows.Count > 0)
  473. {
  474. for (int i = 0; i < dbData.Rows.Count; i++)
  475. {
  476. StepData item = new StepData();
  477. item.No = int.Parse(dbData.Rows[i]["step_number"].ToString());
  478. item.Name = dbData.Rows[i]["step_name"].ToString();
  479. if (!dbData.Rows[i]["step_begin_time"].Equals(DBNull.Value))
  480. item.StartTime = (DateTime)dbData.Rows[i]["step_begin_time"];
  481. if (!dbData.Rows[i]["step_end_time"].Equals(DBNull.Value))
  482. item.EndTime = (DateTime)dbData.Rows[i]["step_end_time"];
  483. item.ActualTime = item.EndTime.CompareTo(item.StartTime) <= 0 ? "" : item.EndTime.Subtract(item.StartTime).TotalSeconds.ToString();
  484. item.SettingTime = dbData.Rows[i]["step_time"].ToString();
  485. //annotation.Add(VerLine(Brushes.Blue, item.StartTime, Brushes.Blue, $"{item.No}:{item.Name}"));
  486. }
  487. }
  488. }
  489. public void OnDataGridSelectionChanged(object obj)
  490. {
  491. selectedRecipeItem = obj as RecipeItem;
  492. ParameterNodes = new ObservableCollection<ParameterNode>(_provider.GetParameters().Where(x => x.Name == selectedRecipeItem?.Chamber));
  493. }
  494. public void OnSearchData()
  495. {
  496. this.view.MyDrawGraphicsControl.ClearPlotPoints();
  497. var Keys = new List<string>();
  498. PdKeyDataCollection.ToList().ForEach(key =>
  499. {
  500. Keys.Add(key.Key);
  501. });
  502. if (keys.Count == 0)
  503. {
  504. return;
  505. }
  506. var result = GetData(Keys.Distinct().ToList(), Convert.ToDateTime(selectedRecipeItem?.StartTime), Convert.ToDateTime(selectedRecipeItem?.EndTime));
  507. if (result == null)
  508. {
  509. return;
  510. }
  511. List<PointCollection> cls = new List<PointCollection>();
  512. for (int i = 0; i < Keys.Count; i++)
  513. {
  514. PointCollection points = new PointCollection();
  515. int k = 1;
  516. result[Keys[i]].ForEach(point =>
  517. {
  518. points.Add(new Point() { X = point.dateTime.ToOADate(), Y = point.value });
  519. k += 1;
  520. });
  521. cls.Add(points);
  522. }
  523. for (int i = 0; i <PdKeyDataCollection.Count(); i++)
  524. {
  525. var _color = PdKeyDataCollection[i].Color.Color;
  526. view.MyDrawGraphicsControl.m_PenCollencteions[i] = new System.Drawing.Pen(System.Drawing.Color.FromArgb(_color.A, _color.R, _color.G, _color.B), 2);
  527. }
  528. this.view.MyDrawGraphicsControl.PointCollections = cls;
  529. this.view.MyDrawGraphicsControl.FitControl();
  530. }
  531. private void CloseAll(ObservableCollection<ParameterNode> parameterNodes)
  532. {
  533. if (parameterNodes != null)
  534. {
  535. foreach (var item in parameterNodes)
  536. {
  537. item.Selected = false;
  538. if (item.ChildNodes.Count > 0)
  539. {
  540. CloseAll(item.ChildNodes);
  541. }
  542. }
  543. }
  544. }
  545. private void OnClearData()
  546. {
  547. PdKeyDataCollection.Clear();
  548. this.view.MyDrawGraphicsControl.ClearPlotPoints();
  549. CloseAll(ParameterNodes);
  550. }
  551. }
  552. #endregion
  553. #region 数据类
  554. public class RecipeItem : BindableBase
  555. {
  556. public bool Selected { get; set; }
  557. public string Recipe { get; set; }
  558. public string Guid { get; set; }
  559. public string RecipeRunGuid { get; set; }
  560. public string Chamber { get; set; }
  561. public string Status { get; set; }
  562. public string StartTime { get; set; }
  563. public string EndTime { get; set; }
  564. public string LotID { get; set; }
  565. public string SlotID { get; set; }
  566. }
  567. public class StepData
  568. {
  569. [DataMember]
  570. public int No { get; set; }
  571. [DataMember]
  572. public string Name { get; set; }
  573. [DataMember]
  574. public DateTime StartTime { get; set; }
  575. [DataMember]
  576. public DateTime EndTime { get; set; }
  577. [DataMember]
  578. public string ActualTime { get; set; }
  579. [DataMember]
  580. public string SettingTime { get; set; }
  581. }
  582. public class PdKeyData : BindableBase, ICloneable
  583. {
  584. public string Key { get; set; }
  585. public SolidColorBrush _Color;
  586. public SolidColorBrush Color
  587. {
  588. get { return _Color; }
  589. set { SetProperty(ref _Color, value); }
  590. }
  591. public int UniqueId { get; set; }
  592. public object Clone()
  593. {
  594. return MemberwiseClone();
  595. }
  596. }
  597. #endregion
  598. }