ShellView.xaml.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. using Prism.Regions;
  2. using System.Collections.Generic;
  3. using System.Windows;
  4. using Venus_Themes.CustomControls;
  5. using Venus_UI.Themes.Attach;
  6. using Venus_Unity;
  7. using System.Linq;
  8. using System.Threading;
  9. using System;
  10. using Venus_MainPages.Views;
  11. using System.Windows.Controls;
  12. using Aitex.Core.UI.View.Frame;
  13. using System.Windows.Media;
  14. using Venus_Core;
  15. using System.Reflection;
  16. using Venus_MainPages.Unity;
  17. using MECF.Framework.Common.DataCenter;
  18. using MECF.Framework.Common.OperationCenter;
  19. using Aitex.Core.RT.OperationCenter;
  20. using Venus_MainPages.ViewModels;
  21. using MECF.Framework.Common.CommonData;
  22. using System.Windows.Controls.Primitives;
  23. using System.Timers;
  24. using System.Windows.Threading;
  25. using Venus_Themes.Unity;
  26. using Venus_Themes.UserControls;
  27. using OpenSEMI.Ctrlib.Controls;
  28. namespace Venus_UI.Views
  29. {
  30. /// <summary>
  31. /// ShellView.xaml 的交互逻辑
  32. /// </summary>
  33. public partial class ShellView : Window
  34. {
  35. IRegionManager m_regionManager;
  36. IRegionNavigationService m_regionNavigationService;
  37. List<VenusMenu> VenusMenu;
  38. List<TabControl> centerTabViews=new List<TabControl> ();
  39. List<Button> buttonList=new List<Button> ();
  40. DispatcherTimer timer = new DispatcherTimer();
  41. public ShellView(IRegionManager regionManager, IRegionNavigationService regionNavigationService)
  42. {
  43. InitializeComponent();
  44. m_regionManager = regionManager;
  45. m_regionNavigationService = regionNavigationService;
  46. m_regionManager.RegisterViewWithRegion("TopRegion", typeof(Venus_MainPages.Views.TopView));
  47. VenusGlobalEvents.SlotRightClickChangedEvent += Instance_SlotRightClickChangedEvent;
  48. VenusGlobalEvents.SlotWaferTransferEvent += Instance_SlotStartTransferEvent;
  49. timer.Tick += timer_Tick;
  50. timer.Interval = TimeSpan.FromSeconds(0.5);
  51. timer.Start();
  52. UIEvents.PMDoorRaiseChangedEvent += UIEvents_PMDoorRaiseChangedEvent;
  53. UIEvents.LLTDoorRaiseChangedEvent += UIEvents_LLTDoorRaiseChangedEvent;
  54. UIEvents.LLEDoorRaiseChangedEvent += UIEvents_LLEDoorRaiseChangedEvent;
  55. UIEvents.ChamberCreateDeleteWaferEvent += UIEvents_ChamberCreateDeleteWaferEvent;
  56. }
  57. void timer_Tick(object sender, EventArgs e)
  58. {
  59. if (Anychange.needchange)
  60. {
  61. Anystationchange(Anychange.menuname, Anychange.args);
  62. Anychange.needchange=false;
  63. }
  64. }
  65. private void Instance_SlotRightClickChangedEvent(OpenSEMI.Ctrlib.Controls.Slot slot)
  66. {
  67. if (slot != null)
  68. {
  69. ContextMenu cm = ContextMenuManager.Instance.GetSlotMenus(slot);
  70. if (cm != null)
  71. {
  72. slot.ContextMenu = cm;
  73. }
  74. return;
  75. }
  76. }
  77. private void Instance_SlotStartTransferEvent(OpenSEMI.Ctrlib.Controls.DragDropEventArgs e)
  78. {
  79. InvokeClient.Instance.Service.DoOperation("System.MoveWafer",
  80. e.TranferFrom.ModuleID,e.TranferFrom.SlotID, e.TranferTo.ModuleID, e.TranferTo.SlotID,false,1,false,1,"");
  81. e.TranferFrom.ClearDragDropStatus();
  82. e.TranferTo.ClearDragDropStatus();
  83. }
  84. private void CustomWnd_Loaded(object sender, RoutedEventArgs e)
  85. {
  86. VenusMenu = SerializeHelper.Instance.ReadFromJsonFile<List<VenusMenu>>($"Config/UIMenu.json");
  87. int index = 0;
  88. for (int i = 0; i < VenusMenu.Count; i++)
  89. {
  90. if (VenusMenu[i].IsShow == false)
  91. {
  92. continue;
  93. }
  94. string[] allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(',');
  95. if (VenusMenu[i].Id == "PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD" || VenusMenu[i].Id == "TM")
  96. {
  97. if (!allModules.Contains(VenusMenu[i].Id))
  98. {
  99. continue;
  100. }
  101. }
  102. //if (VenusMenu[i].Id == "SETM" && SC.GetStringValue("System.ChamberSelect") !="4" && SC.GetStringValue("System.ChamberSelect") != "5")
  103. //{
  104. // //不是SE DE
  105. // continue;
  106. //}
  107. AduRadioButtonIcon aduRadioButtonIcon = new AduRadioButtonIcon();
  108. if (i == 0)
  109. {
  110. aduRadioButtonIcon.IsChecked = true;
  111. }
  112. IconElement.SetPathData(aduRadioButtonIcon,(Geometry)aduRadioButtonIcon.FindResource($"Icon_{VenusMenu[i].Id}"));
  113. aduRadioButtonIcon.Content = VenusMenu[i].Name;
  114. aduRadioButtonIcon.Click += AduRadioButtonIcon_Click;
  115. aduRadioButtonIcon.SelectBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#6AD7FF"));
  116. aduRadioButtonIcon.SelectColor = new SolidColorBrush((Colors.Black));
  117. aduRadioButtonIcon.DefaultBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#94BCD7"));
  118. //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush(Colors.DarkGray);
  119. aduRadioButtonIcon.Width = 180;
  120. aduRadioButtonIcon.Height= 40;
  121. //aduRadioButtonIcon.Foreground=Brushes.White;
  122. aduRadioButtonIcon.Tag = index;
  123. index += 1;
  124. Bottom_Frame.Children.Add(aduRadioButtonIcon);
  125. //if (VenusMenu[i].Id == "PMC")
  126. //{
  127. // AduRadioButtonIcon aduRadioButtonIcon2 = new AduRadioButtonIcon();
  128. // IconElement.SetPathData(aduRadioButtonIcon2, (Geometry)aduRadioButtonIcon.FindResource($"Icon_{VenusMenu[i].Id}"));
  129. // aduRadioButtonIcon2.Content = "PMD";
  130. // //aduRadioButtonIcon2.Click += AduRadioButtonIcon_Click;
  131. // aduRadioButtonIcon2.SelectBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#6AD7FF"));
  132. // aduRadioButtonIcon2.SelectColor = new SolidColorBrush((Colors.Black));
  133. // aduRadioButtonIcon2.DefaultBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#94BCD7"));
  134. // //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush(Colors.DarkGray);
  135. // aduRadioButtonIcon2.Width = 180;
  136. // aduRadioButtonIcon2.Height = 40;
  137. // Bottom_Frame.Children.Add(aduRadioButtonIcon2);
  138. //}
  139. TabControl tabControl = new TabControl();
  140. for (int j = 0; j < VenusMenu[i].MenuItem.Count; j++)
  141. {
  142. if (VenusMenu[i].MenuItem[j].IsShow == false)
  143. {
  144. continue;
  145. }
  146. string className;
  147. if ((VenusMenu[i].Id == "PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD")&& VenusMenu[i].MenuItem[j].Id== "Operation")
  148. {
  149. JetChamber jetChamber = (JetChamber)(Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"{VenusMenu[i].Id}.ChamberType")));
  150. className = $"Venus_MainPages.Views.Over{jetChamber.ToString()}View";
  151. }
  152. else
  153. {
  154. className = $"Venus_MainPages.Views.{VenusMenu[i].MenuItem[j].View}";
  155. }
  156. Type t = Type.GetType($"{className},Venus_MainPages");
  157. var obj = System.Activator.CreateInstance(t);
  158. if (VenusMenu[i].Id=="PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD" || VenusMenu[i].Id == "TM" || VenusMenu[i].Id == "SETM")
  159. {
  160. MethodInfo methodInfo = t.GetMethod("Init", new Type[] { typeof(string) });
  161. methodInfo?.Invoke(obj, new object[] { VenusMenu[i].Id });
  162. }
  163. tabControl.Items.Add(new TabItem() { Header = VenusMenu[i].MenuItem[j].Name, Content = obj });
  164. }
  165. centerTabViews.Add(tabControl);
  166. }
  167. Main_Frame.Content = centerTabViews[0];
  168. ModuleManager.Initialize();
  169. }
  170. public void Anystationchange(string menuviewItem, WaferHistoryWafer queryFilter)
  171. {
  172. UserControl address = new ProcessHistoryView();
  173. ProcessHistoryViewModel vm = new ProcessHistoryViewModel() {};
  174. vm.searchlot(queryFilter.WaferGuid);
  175. //vm.OnDataGridSelectionChanged(vm.Recipes[0]);
  176. address.DataContext = vm;
  177. centerTabViews.Last().Items[2]= new TabItem() { Header = menuviewItem, Content = address };
  178. centerTabViews.Last().SelectedIndex = 2;
  179. Main_Frame.Content = centerTabViews.Last();
  180. }
  181. private void AduRadioButtonIcon_Click(object sender, RoutedEventArgs e)
  182. {
  183. var currentButton = sender as AduRadioButtonIcon;
  184. Main_Frame.Content = centerTabViews[Convert.ToInt32(currentButton.Tag)];
  185. }
  186. private void CustomWnd_Closed(object sender, EventArgs e)
  187. {
  188. System.Diagnostics.Process.GetCurrentProcess().Kill();
  189. }
  190. private void UIEvents_ChamberCreateDeleteWaferEvent(WaferOperation obj)
  191. {
  192. if (obj.IsCreate == true)
  193. {
  194. InvokeClient.Instance.Service.DoOperation("CreateWafer", obj.ModuleName, 0);
  195. }
  196. else
  197. {
  198. InvokeClient.Instance.Service.DoOperation("DeleteWafer", obj.ModuleName, 0);
  199. }
  200. }
  201. private void UIEvents_PMDoorRaiseChangedEvent(DoorPara obj)
  202. {
  203. //InvokeClient.Instance.Service.DoOperation($"{obj?.ModuleName}.SlitDoor.{obj?.IsOpen}");
  204. InvokeClient.Instance.Service.DoOperation($"{obj?.ModuleName}.SetSlitDoor", obj.IsOpen == "Open" ? true : false);
  205. }
  206. private void UIEvents_LLTDoorRaiseChangedEvent(DoorPara obj)
  207. {
  208. InvokeClient.Instance.Service.DoOperation($"TM.SetMFSlitDoor", obj.ModuleName, obj.IsOpen == "Open" ? true : false);
  209. }
  210. private void UIEvents_LLEDoorRaiseChangedEvent(DoorPara obj)
  211. {
  212. InvokeClient.Instance.Service.DoOperation($"TM.SetEFEMSlitDoor", obj.ModuleName, obj.IsOpen == "Open" ? true : false);
  213. }
  214. }
  215. }