终端一体化运控平台
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

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