终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

210 lines
7.9 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Configuration;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Threading;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using BPASmartClient.CustomResource.Pages.Enums;
  11. using BPASmartClient.CustomResource.Pages.Model;
  12. using BPASmartClient.CustomResource.Pages.View;
  13. using BPASmartClient.CustomResource.Pages.ViewModel;
  14. using BPASmartClient.DosingSystem.Model;
  15. using BPASmartClient.DosingSystem.View;
  16. using BPASmartClient.Helper;
  17. using BPASmartClient.Nfc;
  18. namespace BPASmartClient.DosingSystem
  19. {
  20. /// <summary>
  21. /// Interaction logic for App.xaml
  22. /// </summary>
  23. public partial class App : Application
  24. {
  25. public static Window MainWindow;
  26. protected override void OnStartup(StartupEventArgs e)
  27. {
  28. base.OnStartup(e);
  29. MenuInit();
  30. DataInit();
  31. DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化
  32. NewMaterialDeviceParView newMaterialDeviceParView = new NewMaterialDeviceParView();
  33. newMaterialDeviceParView.ShowDialog();
  34. MainView mv = new MainView();
  35. //mv.Show();
  36. LoginView lv = new LoginView();
  37. var res = lv.ShowDialog();
  38. if (res != null && res == true)
  39. {
  40. MessageLog.GetInstance.ShowUserLog("用户登录");
  41. mv.Show();
  42. }
  43. else
  44. mv.Close();
  45. MainWindow = mv;
  46. }
  47. protected override void OnExit(ExitEventArgs e)
  48. {
  49. base.OnExit(e);
  50. Json<LocaPar>.Save();
  51. MessageLog.GetInstance.LogSave();
  52. ThreadManage.GetInstance().Dispose();
  53. }
  54. private void MenuInit()
  55. {
  56. NfcServer.GetInstance.Init();
  57. #region 配方管理菜单
  58. ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
  59. RecipeManage.Add(new SubMenumodel()
  60. {
  61. SubMenuName = "配方管理",
  62. SubMenuPermission = new Permission[] { Permission.管理员 },
  63. AssemblyName = "BPASmartClient.DosingSystem",
  64. ToggleWindowPath = "View.RecipeSettingsView"
  65. });
  66. RecipeManage.Add(new SubMenumodel()
  67. {
  68. SubMenuName = "配方下发",
  69. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员 },
  70. AssemblyName = "BPASmartClient.DosingSystem",
  71. ToggleWindowPath = "View.RecipeControlView"
  72. });
  73. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  74. {
  75. MainMenuIcon = "&#xe683;",
  76. MainMenuName = "配方管理",
  77. Alias = "Recipe Management",
  78. subMenumodels = RecipeManage,
  79. });
  80. #endregion
  81. #region 消息日志
  82. ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
  83. InfoLog.Add(new SubMenumodel()
  84. {
  85. SubMenuName = "操作日志",
  86. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  87. AssemblyName = "BPASmartClient.CustomResource",
  88. ToggleWindowPath = "Pages.View.UserLogView"
  89. });
  90. InfoLog.Add(new SubMenumodel()
  91. {
  92. SubMenuName = "运行日志",
  93. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  94. AssemblyName = "BPASmartClient.CustomResource",
  95. ToggleWindowPath = "Pages.View.RunLogView"
  96. });
  97. InfoLog.Add(new SubMenumodel()
  98. {
  99. SubMenuName = "报警记录",
  100. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  101. AssemblyName = "BPASmartClient.CustomResource",
  102. ToggleWindowPath = "Pages.View.AlarmView"
  103. });
  104. InfoLog.Add(new SubMenumodel()
  105. {
  106. SubMenuName = "调试日志",
  107. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
  108. AssemblyName = "BPASmartClient.CustomResource",
  109. ToggleWindowPath = "Pages.View.DebugLogView"
  110. });
  111. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  112. {
  113. MainMenuIcon = "&#xe668;",
  114. MainMenuName = "消息日志",
  115. Alias = "Message Log",
  116. subMenumodels = InfoLog,
  117. });
  118. #endregion
  119. #region 硬件设备监控
  120. ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
  121. DeviceMonitor.Add(new SubMenumodel()
  122. {
  123. SubMenuName = "原料设备列表",
  124. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  125. AssemblyName = "BPASmartClient.DosingSystem",
  126. ToggleWindowPath = "View.DeviceListView"
  127. });
  128. DeviceMonitor.Add(new SubMenumodel()
  129. {
  130. SubMenuName = "设备状态",
  131. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  132. AssemblyName = "BPASmartClient.DosingSystem",
  133. ToggleWindowPath = "View.HardwareStatusView"
  134. });
  135. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  136. {
  137. MainMenuIcon = "&#xe603;",
  138. MainMenuName = "设备监控",
  139. Alias = "Device Monitor",
  140. subMenumodels = DeviceMonitor,
  141. });
  142. #endregion
  143. #region 用户管理
  144. ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
  145. UserManager.Add(new SubMenumodel()
  146. {
  147. SubMenuName = "用户登录",
  148. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  149. AssemblyName = "BPASmartClient.CustomResource",
  150. ToggleWindowPath = "Pages.View.SubPagLoginView"
  151. });
  152. UserManager.Add(new SubMenumodel()
  153. {
  154. SubMenuName = "密码修改",
  155. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  156. AssemblyName = "BPASmartClient.CustomResource",
  157. ToggleWindowPath = "Pages.View.PasswordChangeView"
  158. });
  159. UserManager.Add(new SubMenumodel()
  160. {
  161. SubMenuName = "用户管理",
  162. SubMenuPermission = new Permission[] { Permission.管理员 },
  163. AssemblyName = "BPASmartClient.CustomResource",
  164. ToggleWindowPath = "Pages.View.UserManagerView"
  165. });
  166. UserManager.Add(new SubMenumodel()
  167. {
  168. SubMenuName = "NFC登录设置",
  169. SubMenuPermission = new Permission[] { Permission.管理员 },
  170. AssemblyName = "BPASmartClient.CustomResource",
  171. ToggleWindowPath = "Pages.View.NfcSetView"
  172. });
  173. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  174. {
  175. MainMenuIcon = "&#xe66d;",
  176. MainMenuName = "用户管理",
  177. Alias = "User Management",
  178. subMenumodels = UserManager,
  179. });
  180. #endregion
  181. }
  182. private void DataInit()
  183. {
  184. Config.GetInstance.Init();
  185. Json<LocaPar>.Read();
  186. Json<LocaMaterial>.Read();
  187. }
  188. }
  189. }