终端一体化运控平台
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

209 lines
7.8 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. MainView mv = new MainView();
  33. //mv.Show();
  34. LoginView lv = new LoginView();
  35. var res = lv.ShowDialog();
  36. if (res != null && res == true)
  37. {
  38. MessageLog.GetInstance.ShowUserLog("用户登录");
  39. mv.Show();
  40. }
  41. else
  42. mv.Close();
  43. MainWindow = mv;
  44. }
  45. protected override void OnExit(ExitEventArgs e)
  46. {
  47. base.OnExit(e);
  48. Json<LocaPar>.Save();
  49. MessageLog.GetInstance.LogSave();
  50. ThreadManage.GetInstance().Dispose();
  51. }
  52. private void MenuInit()
  53. {
  54. NfcServer.GetInstance.Init();
  55. #region 配方管理菜单
  56. ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
  57. RecipeManage.Add(new SubMenumodel()
  58. {
  59. SubMenuName = "配方管理",
  60. SubMenuPermission = new Permission[] { Permission.管理员 },
  61. AssemblyName = "BPASmartClient.DosingSystem",
  62. ToggleWindowPath = "View.RecipeSettingsView"
  63. });
  64. RecipeManage.Add(new SubMenumodel()
  65. {
  66. SubMenuName = "配方下发",
  67. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员 },
  68. AssemblyName = "BPASmartClient.DosingSystem",
  69. ToggleWindowPath = "View.RecipeControlView"
  70. });
  71. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  72. {
  73. MainMenuIcon = "&#xe683;",
  74. MainMenuName = "配方管理",
  75. Alias = "Recipe Management",
  76. subMenumodels = RecipeManage,
  77. });
  78. #endregion
  79. #region 消息日志
  80. ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
  81. InfoLog.Add(new SubMenumodel()
  82. {
  83. SubMenuName = "操作日志",
  84. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  85. AssemblyName = "BPASmartClient.CustomResource",
  86. ToggleWindowPath = "Pages.View.UserLogView"
  87. });
  88. InfoLog.Add(new SubMenumodel()
  89. {
  90. SubMenuName = "运行日志",
  91. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  92. AssemblyName = "BPASmartClient.CustomResource",
  93. ToggleWindowPath = "Pages.View.RunLogView"
  94. });
  95. InfoLog.Add(new SubMenumodel()
  96. {
  97. SubMenuName = "报警记录",
  98. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  99. AssemblyName = "BPASmartClient.CustomResource",
  100. ToggleWindowPath = "Pages.View.AlarmView"
  101. });
  102. InfoLog.Add(new SubMenumodel()
  103. {
  104. SubMenuName = "调试日志",
  105. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
  106. AssemblyName = "BPASmartClient.CustomResource",
  107. ToggleWindowPath = "Pages.View.DebugLogView"
  108. });
  109. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  110. {
  111. MainMenuIcon = "&#xe668;",
  112. MainMenuName = "消息日志",
  113. Alias = "Message Log",
  114. subMenumodels = InfoLog,
  115. });
  116. #endregion
  117. #region 硬件设备监控
  118. ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
  119. DeviceMonitor.Add(new SubMenumodel()
  120. {
  121. SubMenuName = "原料设备列表",
  122. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  123. AssemblyName = "BPASmartClient.DosingSystem",
  124. ToggleWindowPath = "View.DeviceListView"
  125. });
  126. DeviceMonitor.Add(new SubMenumodel()
  127. {
  128. SubMenuName = "设备状态",
  129. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  130. AssemblyName = "BPASmartClient.DosingSystem",
  131. ToggleWindowPath = "View.HardwareStatusView"
  132. });
  133. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  134. {
  135. MainMenuIcon = "&#xe603;",
  136. MainMenuName = "设备监控",
  137. Alias = "Device Monitor",
  138. subMenumodels = DeviceMonitor,
  139. });
  140. #endregion
  141. #region 用户管理
  142. ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
  143. UserManager.Add(new SubMenumodel()
  144. {
  145. SubMenuName = "用户登录",
  146. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  147. AssemblyName = "BPASmartClient.CustomResource",
  148. ToggleWindowPath = "Pages.View.SubPagLoginView"
  149. });
  150. UserManager.Add(new SubMenumodel()
  151. {
  152. SubMenuName = "密码修改",
  153. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  154. AssemblyName = "BPASmartClient.CustomResource",
  155. ToggleWindowPath = "Pages.View.PasswordChangeView"
  156. });
  157. UserManager.Add(new SubMenumodel()
  158. {
  159. SubMenuName = "用户管理",
  160. SubMenuPermission = new Permission[] { Permission.管理员 },
  161. AssemblyName = "BPASmartClient.CustomResource",
  162. ToggleWindowPath = "Pages.View.UserManagerView"
  163. });
  164. UserManager.Add(new SubMenumodel()
  165. {
  166. SubMenuName = "NFC登录设置",
  167. SubMenuPermission = new Permission[] { Permission.管理员 },
  168. AssemblyName = "BPASmartClient.CustomResource",
  169. ToggleWindowPath = "Pages.View.NfcSetView"
  170. });
  171. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  172. {
  173. MainMenuIcon = "&#xe66d;",
  174. MainMenuName = "用户管理",
  175. Alias = "User Management",
  176. subMenumodels = UserManager,
  177. });
  178. #endregion
  179. }
  180. private void DataInit()
  181. {
  182. Config.GetInstance.Init();
  183. Json<LocaPar>.Read();
  184. Json<LocaMaterial>.Read();
  185. }
  186. }
  187. }