终端一体化运控平台
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

263 satır
10 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Configuration;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Threading;
  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.DosingSystem.View;
  15. using BPASmartClient.Helper;
  16. using BPASmartClient.Nfc;
  17. namespace BPASmartClient.DosingSystem
  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. BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut();
  29. MenuInit();
  30. DataInit();
  31. DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化
  32. MainView mv = new MainView();
  33. //mv.Show();
  34. LoginView lv = new LoginView();
  35. var res = lv.ShowDialog();
  36. if (res != null && res == true)
  37. {
  38. MessageLog.GetInstance.ShowUserLog("用户登录");
  39. mv.Show();
  40. }
  41. else
  42. mv.Close();
  43. MainWindow = mv;
  44. }
  45. protected override void OnExit(ExitEventArgs e)
  46. {
  47. base.OnExit(e);
  48. Json<LocaPar>.Save();
  49. Json<DevicePar>.Save();
  50. MessageLog.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.DosingSystem",
  63. ToggleWindowPath = "View.RecipeSettingsView"
  64. });
  65. RecipeManage.Add(new SubMenumodel()
  66. {
  67. SubMenuName = "配方下发",
  68. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员 },
  69. AssemblyName = "BPASmartClient.DosingSystem",
  70. ToggleWindowPath = "View.RecipeControlView"
  71. });
  72. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  73. {
  74. MainMenuIcon = "&#xe683;",
  75. MainMenuName = "配方管理",
  76. Alias = "Recipe Management",
  77. subMenumodels = RecipeManage,
  78. });
  79. #endregion
  80. #region 参数设置
  81. ObservableCollection<SubMenumodel> ParSet = new ObservableCollection<SubMenumodel>();
  82. ParSet.Add(new SubMenumodel()
  83. {
  84. SubMenuName = "原料参数设置",
  85. SubMenuPermission = new Permission[] { Permission.管理员 },
  86. AssemblyName = "BPASmartClient.DosingSystem",
  87. ToggleWindowPath = "View.DeviceMaterialParView"
  88. });
  89. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  90. {
  91. MainMenuIcon = "&#xe62d;",
  92. MainMenuName = "参数设置",
  93. Alias = "Parameter Set",
  94. subMenumodels = ParSet,
  95. });
  96. #endregion
  97. #region 手动控制
  98. ObservableCollection<SubMenumodel> ManualControl = new ObservableCollection<SubMenumodel>();
  99. ManualControl.Add(new SubMenumodel()
  100. {
  101. SubMenuName = "手动控制",
  102. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  103. AssemblyName = "BPASmartClient.DosingSystem",
  104. ToggleWindowPath = "View.ManualControlView"
  105. });
  106. ManualControl.Add(new SubMenumodel()
  107. {
  108. SubMenuName = "料仓控制",
  109. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  110. AssemblyName = "BPASmartClient.DosingSystem",
  111. ToggleWindowPath = "View.StockControlView"
  112. });
  113. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  114. {
  115. MainMenuIcon = "&#xe622;",
  116. MainMenuName = "手动控制",
  117. Alias = "Parameter Set",
  118. subMenumodels = ManualControl,
  119. });
  120. #endregion
  121. #region 消息日志
  122. ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
  123. InfoLog.Add(new SubMenumodel()
  124. {
  125. SubMenuName = "操作日志",
  126. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  127. AssemblyName = "BPASmartClient.CustomResource",
  128. ToggleWindowPath = "Pages.View.UserLogView"
  129. });
  130. InfoLog.Add(new SubMenumodel()
  131. {
  132. SubMenuName = "运行日志",
  133. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  134. AssemblyName = "BPASmartClient.CustomResource",
  135. ToggleWindowPath = "Pages.View.RunLogView"
  136. });
  137. InfoLog.Add(new SubMenumodel()
  138. {
  139. SubMenuName = "报警记录",
  140. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  141. AssemblyName = "BPASmartClient.CustomResource",
  142. ToggleWindowPath = "Pages.View.AlarmView"
  143. });
  144. InfoLog.Add(new SubMenumodel()
  145. {
  146. SubMenuName = "调试日志",
  147. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
  148. AssemblyName = "BPASmartClient.CustomResource",
  149. ToggleWindowPath = "Pages.View.DebugLogView"
  150. });
  151. InfoLog.Add(new SubMenumodel()
  152. {
  153. SubMenuName = "报表数据",
  154. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
  155. AssemblyName = "BPASmartClient.CustomResource",
  156. ToggleWindowPath = "Pages.View.ReportView"
  157. });
  158. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  159. {
  160. MainMenuIcon = "&#xe668;",
  161. MainMenuName = "消息日志",
  162. Alias = "Message Log",
  163. subMenumodels = InfoLog,
  164. });
  165. #endregion
  166. #region 硬件设备监控
  167. ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
  168. DeviceMonitor.Add(new SubMenumodel()
  169. {
  170. SubMenuName = "原料设备列表",
  171. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  172. AssemblyName = "BPASmartClient.DosingSystem",
  173. ToggleWindowPath = "View.DeviceListView"
  174. });
  175. DeviceMonitor.Add(new SubMenumodel()
  176. {
  177. SubMenuName = "设备状态",
  178. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  179. AssemblyName = "BPASmartClient.DosingSystem",
  180. ToggleWindowPath = "View.HardwareStatusView"
  181. });
  182. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  183. {
  184. MainMenuIcon = "&#xe603;",
  185. MainMenuName = "设备监控",
  186. Alias = "Device Monitor",
  187. subMenumodels = DeviceMonitor,
  188. });
  189. #endregion
  190. #region 用户管理
  191. ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
  192. UserManager.Add(new SubMenumodel()
  193. {
  194. SubMenuName = "用户登录",
  195. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  196. AssemblyName = "BPASmartClient.CustomResource",
  197. ToggleWindowPath = "Pages.View.SubPagLoginView"
  198. });
  199. UserManager.Add(new SubMenumodel()
  200. {
  201. SubMenuName = "密码修改",
  202. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  203. AssemblyName = "BPASmartClient.CustomResource",
  204. ToggleWindowPath = "Pages.View.PasswordChangeView"
  205. });
  206. UserManager.Add(new SubMenumodel()
  207. {
  208. SubMenuName = "用户管理",
  209. SubMenuPermission = new Permission[] { Permission.管理员 },
  210. AssemblyName = "BPASmartClient.CustomResource",
  211. ToggleWindowPath = "Pages.View.UserManagerView"
  212. });
  213. UserManager.Add(new SubMenumodel()
  214. {
  215. SubMenuName = "NFC登录管理",
  216. SubMenuPermission = new Permission[] { Permission.管理员 },
  217. AssemblyName = "BPASmartClient.CustomResource",
  218. ToggleWindowPath = "Pages.View.NfcSetView"
  219. });
  220. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  221. {
  222. MainMenuIcon = "&#xe66d;",
  223. MainMenuName = "用户管理",
  224. Alias = "User Management",
  225. subMenumodels = UserManager,
  226. });
  227. #endregion
  228. }
  229. private void DataInit()
  230. {
  231. //Config.GetInstance.Init();
  232. Json<LocaPar>.Read();
  233. Json<DevicePar>.Read();
  234. Json<LocaMaterial>.Read();
  235. }
  236. }
  237. }