NewWaferAssociationUnit.xaml.cs 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. using MECF.Framework.Common.DataCenter;
  2. using OpenSEMI.Ctrlib.Controls;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Diagnostics;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Input;
  11. using Venus_Core;
  12. using Venus_MainPages.Unity;
  13. namespace Venus_MainPages.Views
  14. {
  15. /// <summary>
  16. /// WaferAssociationUnit.xaml 的交互逻辑
  17. /// </summary>
  18. public partial class NewWaferAssociationUnit : UserControl
  19. {
  20. public NewWaferAssociationUnit()
  21. {
  22. InitializeComponent();
  23. }
  24. public WaferAssociationInfo WAInfo
  25. {
  26. get { return (WaferAssociationInfo)GetValue(WAInfoProperty); }
  27. set { SetValue(WAInfoProperty, value); }
  28. }
  29. public static readonly DependencyProperty WAInfoProperty = DependencyProperty.Register("WAInfo", typeof(WaferAssociationInfo), typeof(NewWaferAssociationUnit));
  30. public string SequenceName
  31. {
  32. get { return (string)GetValue(SequenceNameProperty); }
  33. set { SetValue(SequenceNameProperty, value); }
  34. }
  35. public static readonly DependencyProperty SequenceNameProperty = DependencyProperty.Register("SequenceName", typeof(string), typeof(NewWaferAssociationUnit));
  36. public int SelectedIndex
  37. {
  38. get { return (int)GetValue(SelectedIndexProperty); }
  39. set { SetValue(SelectedIndexProperty, value); }
  40. }
  41. public static readonly DependencyProperty SelectedIndexProperty = DependencyProperty.Register("SelectedIndex", typeof(int), typeof(NewWaferAssociationUnit),new PropertyMetadata(1));
  42. public string CycleInfo
  43. {
  44. get { return (string)GetValue(CycleInfoProperty); }
  45. set { SetValue(CycleInfoProperty, value); }
  46. }
  47. public static readonly DependencyProperty CycleInfoProperty = DependencyProperty.Register("CycleInfo", typeof(string), typeof(NewWaferAssociationUnit));
  48. public bool ButtonIsEnable
  49. {
  50. get { return (bool)GetValue(ButtonIsEnableProperty); }
  51. set { SetValue(ButtonIsEnableProperty, value); }
  52. }
  53. public static readonly DependencyProperty ButtonIsEnableProperty = DependencyProperty.Register("ButtonIsEnable", typeof(bool), typeof(NewWaferAssociationUnit), new PropertyMetadata(true));
  54. private void cb_DropDownOpened(object sender, EventArgs e)
  55. {
  56. cb.ItemsSource = GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "Sequence")).ToList();
  57. }
  58. private void cb_SelectionChanged(object sender, SelectionChangedEventArgs e)
  59. {
  60. WAInfo.SequenceName = cb.SelectedValue.ToString();
  61. }
  62. private void preComboBox_DropDownOpened(object sender, EventArgs e)
  63. {
  64. List<string> cleanRecipes=new List<string>();
  65. string installModules = (string)QueryDataClient.Instance.Service.GetConfig("System.InstalledModules");
  66. if (installModules.Contains("PMA"))
  67. {
  68. cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMA","Clean")).ToList());
  69. }
  70. if (installModules.Contains("PMB"))
  71. {
  72. cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMB", "Clean")).ToList());
  73. }
  74. if (installModules.Contains("PMC"))
  75. {
  76. cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMC", "Clean")).ToList());
  77. }
  78. if (installModules.Contains("PMD"))
  79. {
  80. cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMD", "Clean")).ToList());
  81. }
  82. cleanRecipes.Add("");
  83. preComboBox.ItemsSource = cleanRecipes.Distinct();
  84. }
  85. private void preComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
  86. {
  87. WAInfo.PreCleanRecipeName= preComboBox.SelectedValue.ToString();
  88. }
  89. private void postComboBox_DropDownOpened(object sender, EventArgs e)
  90. {
  91. List<string> cleanRecipes = new List<string>();
  92. string installModules = (string)QueryDataClient.Instance.Service.GetConfig("System.InstalledModules");
  93. if (installModules.Contains("PMA"))
  94. {
  95. cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMA", "Clean")).ToList());
  96. }
  97. if (installModules.Contains("PMB"))
  98. {
  99. cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMB", "Clean")).ToList());
  100. }
  101. if (installModules.Contains("PMC"))
  102. {
  103. cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMC", "Clean")).ToList());
  104. }
  105. if (installModules.Contains("PMD"))
  106. {
  107. cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMD", "Clean")).ToList());
  108. }
  109. cleanRecipes.Add("");
  110. postComboBox.ItemsSource = cleanRecipes.Distinct();
  111. }
  112. private void postComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
  113. {
  114. WAInfo.PostCleanRecipeName = postComboBox.SelectedValue.ToString();
  115. }
  116. private IEnumerable<string> GetFilesNames(string path)
  117. {
  118. if (Directory.Exists(path))
  119. {
  120. return Directory.GetFiles(path, "*.seq")
  121. .Select(System.IO.Path.GetFileNameWithoutExtension);
  122. }
  123. else
  124. {
  125. return new List<string>();
  126. }
  127. }
  128. private void SelectAllButton_Click(object sender, RoutedEventArgs e)
  129. {
  130. SelectedIndex = 0;
  131. }
  132. private void UnSelectAllButton_Click(object sender, RoutedEventArgs e)
  133. {
  134. SelectedIndex = 1;
  135. }
  136. private void IsEnableCycleCheckBox_Unchecked(object sender, RoutedEventArgs e)
  137. {
  138. CycleNumTextbox.IsEnabled = false;
  139. CycleNumTextbox.Text = "1";
  140. }
  141. private void IsEnableCycleCheckBox_Checked(object sender, RoutedEventArgs e)
  142. {
  143. CycleNumTextbox.IsEnabled = true;
  144. }
  145. private void Slot_SlotMouseButtonDown(object sender, MouseButtonEventArgs e)
  146. {
  147. VenusGlobalEvents.OnSlotRightClickChanged(sender as Slot);
  148. }
  149. private void Slot_WaferTransferStarted(object sender, DragDropEventArgs e)
  150. {
  151. try
  152. {
  153. VenusGlobalEvents.OnSlotWaferTransfer(e);
  154. }
  155. catch (Exception ex)
  156. {
  157. Trace.WriteLine(ex);
  158. }
  159. }
  160. }
  161. }