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

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