终端一体化运控平台
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

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