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

275 line
11 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. MessageNotify.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. Json<LocalRecipeDataColl>.Save();
  49. MessageNotify.GetInstance.LogSave();
  50. ThreadManage.GetInstance().Dispose();
  51. }
  52. private void MenuInit()
  53. {
  54. //NfcServer.GetInstance.Init();
  55. #region 配方管理菜单
  56. ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
  57. RecipeManage.Add(new SubMenumodel()
  58. {
  59. SubMenuName = "味魔方配方管理",
  60. SubMenuPermission = new Permission[] { Permission.管理员 },
  61. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  62. ToggleWindowPath = "View.RecipeSettingsView"
  63. });
  64. RecipeManage.Add(new SubMenumodel()
  65. {
  66. SubMenuName = "味魔方配方下发",
  67. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员 },
  68. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  69. ToggleWindowPath = "View.RecipeControlView"
  70. });
  71. RecipeManage.Add(new SubMenumodel()
  72. {
  73. SubMenuName = "本地配方管理",
  74. SubMenuPermission = new Permission[] { Permission.管理员 },
  75. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  76. ToggleWindowPath = "View.RecipeReceiveView"
  77. });
  78. RecipeManage.Add(new SubMenumodel()
  79. {
  80. SubMenuName = "西门子配方管理",
  81. SubMenuPermission = new Permission[] { Permission.管理员 },
  82. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  83. ToggleWindowPath = "View.SiemensRecipeReceiveView"
  84. });
  85. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  86. {
  87. MainMenuIcon = "&#xe683;",
  88. MainMenuName = "配方管理",
  89. Alias = "Recipe Management",
  90. subMenumodels = RecipeManage,
  91. });
  92. #endregion
  93. #region 参数设置
  94. ObservableCollection<SubMenumodel> ParSet = new ObservableCollection<SubMenumodel>();
  95. ParSet.Add(new SubMenumodel()
  96. {
  97. SubMenuName = "柔性味魔方参数设置",
  98. SubMenuPermission = new Permission[] { Permission.管理员 },
  99. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  100. ToggleWindowPath = "View.DeviceMaterialParView"
  101. });
  102. ParSet.Add(new SubMenumodel()
  103. {
  104. SubMenuName = "粉仓参数设置",
  105. SubMenuPermission = new Permission[] { Permission.管理员 },
  106. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  107. ToggleWindowPath = "View.WindSendParView"
  108. });
  109. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  110. {
  111. MainMenuIcon = "&#xe62d;",
  112. MainMenuName = "参数设置",
  113. Alias = "Parameter Set",
  114. subMenumodels = ParSet,
  115. });
  116. #endregion
  117. #region 手动控制
  118. ObservableCollection<SubMenumodel> ManualControl = new ObservableCollection<SubMenumodel>();
  119. ManualControl.Add(new SubMenumodel()
  120. {
  121. SubMenuName = "手动控制硬件",
  122. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  123. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  124. ToggleWindowPath = "View.ManualControlView"
  125. });
  126. ManualControl.Add(new SubMenumodel()
  127. {
  128. SubMenuName = "手动控制信号",
  129. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  130. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  131. ToggleWindowPath = "View.ManualCommView"
  132. });
  133. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  134. {
  135. MainMenuIcon = "&#xe622;",
  136. MainMenuName = "手动控制",
  137. Alias = "Parameter Set",
  138. subMenumodels = ManualControl,
  139. });
  140. #endregion
  141. #region 消息日志
  142. ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
  143. InfoLog.Add(new SubMenumodel()
  144. {
  145. SubMenuName = "操作日志",
  146. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  147. AssemblyName = "BPASmartClient.CustomResource",
  148. ToggleWindowPath = "Pages.View.UserLogView"
  149. });
  150. InfoLog.Add(new SubMenumodel()
  151. {
  152. SubMenuName = "运行日志",
  153. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  154. AssemblyName = "BPASmartClient.CustomResource",
  155. ToggleWindowPath = "Pages.View.RunLogView"
  156. });
  157. InfoLog.Add(new SubMenumodel()
  158. {
  159. SubMenuName = "报警记录",
  160. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  161. AssemblyName = "BPASmartClient.CustomResource",
  162. ToggleWindowPath = "Pages.View.AlarmView"
  163. });
  164. InfoLog.Add(new SubMenumodel()
  165. {
  166. SubMenuName = "调试日志",
  167. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
  168. AssemblyName = "BPASmartClient.CustomResource",
  169. ToggleWindowPath = "Pages.View.DebugLogView"
  170. });
  171. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  172. {
  173. MainMenuIcon = "&#xe668;",
  174. MainMenuName = "消息日志",
  175. Alias = "Message Log",
  176. subMenumodels = InfoLog,
  177. });
  178. #endregion
  179. #region 硬件设备监控
  180. ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
  181. DeviceMonitor.Add(new SubMenumodel()
  182. {
  183. SubMenuName = "原料设备列表",
  184. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  185. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  186. ToggleWindowPath = "View.DeviceListView"
  187. });
  188. DeviceMonitor.Add(new SubMenumodel()
  189. {
  190. SubMenuName = "设备状态",
  191. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  192. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  193. ToggleWindowPath = "View.HardwareStatusView"
  194. });
  195. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  196. {
  197. MainMenuIcon = "&#xe603;",
  198. MainMenuName = "设备监控",
  199. Alias = "Device Monitor",
  200. subMenumodels = DeviceMonitor,
  201. });
  202. #endregion
  203. #region 用户管理
  204. ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
  205. UserManager.Add(new SubMenumodel()
  206. {
  207. SubMenuName = "用户登录",
  208. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  209. AssemblyName = "BPASmartClient.CustomResource",
  210. ToggleWindowPath = "Pages.View.SubPagLoginView"
  211. });
  212. UserManager.Add(new SubMenumodel()
  213. {
  214. SubMenuName = "密码修改",
  215. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  216. AssemblyName = "BPASmartClient.CustomResource",
  217. ToggleWindowPath = "Pages.View.PasswordChangeView"
  218. });
  219. UserManager.Add(new SubMenumodel()
  220. {
  221. SubMenuName = "用户管理",
  222. SubMenuPermission = new Permission[] { Permission.管理员 },
  223. AssemblyName = "BPASmartClient.CustomResource",
  224. ToggleWindowPath = "Pages.View.UserManagerView"
  225. });
  226. /* UserManager.Add(new SubMenumodel()
  227. {
  228. SubMenuName = "NFC登录设置",
  229. SubMenuPermission = new Permission[] { Permission.管理员 },
  230. AssemblyName = "BPASmartClient.CustomResource",
  231. ToggleWindowPath = "Pages.View.NfcSetView"
  232. });*/
  233. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  234. {
  235. MainMenuIcon = "&#xe66d;",
  236. MainMenuName = "用户管理",
  237. Alias = "User Management",
  238. subMenumodels = UserManager,
  239. });
  240. #endregion
  241. }
  242. private void DataInit()
  243. {
  244. //Config.GetInstance.Init();
  245. Json<LocaPar>.Read();
  246. Json<DevicePar>.Read();
  247. Json<WindSendDevicePar>.Read();
  248. Json<LocalRecipeDataColl>.Read();
  249. }
  250. }
  251. }