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

265 lines
10 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. using BPASmartClient.JXJFoodSmallStation.Model.WindSend;
  17. namespace BPASmartClient.JXJFoodSmallStation
  18. {
  19. /// <summary>
  20. /// Interaction logic for App.xaml
  21. /// </summary>
  22. public partial class App : Application
  23. {
  24. public static Window MainWindow;
  25. protected override void OnStartup(StartupEventArgs e)
  26. {
  27. base.OnStartup(e);
  28. MenuInit();
  29. DataInit();
  30. DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化
  31. // ProcessControl.GetInstance.Init();
  32. MainView mv = new MainView();
  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. RecipeManage.Add(new SubMenumodel()
  78. {
  79. SubMenuName = "西门子配方管理",
  80. SubMenuPermission = new Permission[] { Permission.管理员 },
  81. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  82. ToggleWindowPath = "View.SiemensRecipeReceiveView"
  83. });
  84. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  85. {
  86. MainMenuIcon = "&#xe683;",
  87. MainMenuName = "配方管理",
  88. Alias = "Recipe Management",
  89. subMenumodels = RecipeManage,
  90. });
  91. #endregion
  92. #region 参数设置
  93. ObservableCollection<SubMenumodel> ParSet = new ObservableCollection<SubMenumodel>();
  94. ParSet.Add(new SubMenumodel()
  95. {
  96. SubMenuName = "柔性味魔方参数设置",
  97. SubMenuPermission = new Permission[] { Permission.管理员 },
  98. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  99. ToggleWindowPath = "View.DeviceMaterialParView"
  100. });
  101. ParSet.Add(new SubMenumodel()
  102. {
  103. SubMenuName = "粉仓参数设置",
  104. SubMenuPermission = new Permission[] { Permission.管理员 },
  105. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  106. ToggleWindowPath = "View.WindSendParView"
  107. });
  108. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  109. {
  110. MainMenuIcon = "&#xe62d;",
  111. MainMenuName = "参数设置",
  112. Alias = "Parameter Set",
  113. subMenumodels = ParSet,
  114. });
  115. #endregion
  116. #region 手动控制
  117. ObservableCollection<SubMenumodel> ManualControl = new ObservableCollection<SubMenumodel>();
  118. ManualControl.Add(new SubMenumodel()
  119. {
  120. SubMenuName = "手动控制",
  121. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  122. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  123. ToggleWindowPath = "View.ManualControlView"
  124. });
  125. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  126. {
  127. MainMenuIcon = "&#xe622;",
  128. MainMenuName = "手动控制",
  129. Alias = "Parameter Set",
  130. subMenumodels = ManualControl,
  131. });
  132. #endregion
  133. #region 消息日志
  134. ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
  135. InfoLog.Add(new SubMenumodel()
  136. {
  137. SubMenuName = "操作日志",
  138. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  139. AssemblyName = "BPASmartClient.CustomResource",
  140. ToggleWindowPath = "Pages.View.UserLogView"
  141. });
  142. InfoLog.Add(new SubMenumodel()
  143. {
  144. SubMenuName = "运行日志",
  145. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  146. AssemblyName = "BPASmartClient.CustomResource",
  147. ToggleWindowPath = "Pages.View.RunLogView"
  148. });
  149. InfoLog.Add(new SubMenumodel()
  150. {
  151. SubMenuName = "报警记录",
  152. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  153. AssemblyName = "BPASmartClient.CustomResource",
  154. ToggleWindowPath = "Pages.View.AlarmView"
  155. });
  156. InfoLog.Add(new SubMenumodel()
  157. {
  158. SubMenuName = "调试日志",
  159. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
  160. AssemblyName = "BPASmartClient.CustomResource",
  161. ToggleWindowPath = "Pages.View.DebugLogView"
  162. });
  163. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  164. {
  165. MainMenuIcon = "&#xe668;",
  166. MainMenuName = "消息日志",
  167. Alias = "Message Log",
  168. subMenumodels = InfoLog,
  169. });
  170. #endregion
  171. #region 硬件设备监控
  172. ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
  173. DeviceMonitor.Add(new SubMenumodel()
  174. {
  175. SubMenuName = "原料设备列表",
  176. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  177. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  178. ToggleWindowPath = "View.DeviceListView"
  179. });
  180. DeviceMonitor.Add(new SubMenumodel()
  181. {
  182. SubMenuName = "设备状态",
  183. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  184. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  185. ToggleWindowPath = "View.HardwareStatusView"
  186. });
  187. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  188. {
  189. MainMenuIcon = "&#xe603;",
  190. MainMenuName = "设备监控",
  191. Alias = "Device Monitor",
  192. subMenumodels = DeviceMonitor,
  193. });
  194. #endregion
  195. #region 用户管理
  196. ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
  197. UserManager.Add(new SubMenumodel()
  198. {
  199. SubMenuName = "用户登录",
  200. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  201. AssemblyName = "BPASmartClient.CustomResource",
  202. ToggleWindowPath = "Pages.View.SubPagLoginView"
  203. });
  204. UserManager.Add(new SubMenumodel()
  205. {
  206. SubMenuName = "密码修改",
  207. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  208. AssemblyName = "BPASmartClient.CustomResource",
  209. ToggleWindowPath = "Pages.View.PasswordChangeView"
  210. });
  211. UserManager.Add(new SubMenumodel()
  212. {
  213. SubMenuName = "用户管理",
  214. SubMenuPermission = new Permission[] { Permission.管理员 },
  215. AssemblyName = "BPASmartClient.CustomResource",
  216. ToggleWindowPath = "Pages.View.UserManagerView"
  217. });
  218. /* UserManager.Add(new SubMenumodel()
  219. {
  220. SubMenuName = "NFC登录设置",
  221. SubMenuPermission = new Permission[] { Permission.管理员 },
  222. AssemblyName = "BPASmartClient.CustomResource",
  223. ToggleWindowPath = "Pages.View.NfcSetView"
  224. });*/
  225. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  226. {
  227. MainMenuIcon = "&#xe66d;",
  228. MainMenuName = "用户管理",
  229. Alias = "User Management",
  230. subMenumodels = UserManager,
  231. });
  232. #endregion
  233. }
  234. private void DataInit()
  235. {
  236. //Config.GetInstance.Init();
  237. Json<LocaPar>.Read();
  238. Json<DevicePar>.Read();
  239. Json<WindSendDevicePar>.Read();
  240. }
  241. }
  242. }