终端一体化运控平台
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

205 строки
7.8 KiB

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