终端一体化运控平台
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.
 
 
 

253 lines
9.9 KiB

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