终端一体化运控平台
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

App.xaml.cs 9.4 KiB

2 anni fa
2 anni fa
2 anni fa
2 anni fa
2 anni fa
2 anni fa
2 anni fa
2 anni fa
2 anni fa
2 anni fa
2 anni fa
2 anni fa
2 anni fa
2 anni fa
2 anni fa
2 anni fa
2 anni fa
2 anni fa
2 anni fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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.Model;
  15. using BPASmartClient.DosingSystem.View;
  16. using BPASmartClient.Helper;
  17. using BPASmartClient.Nfc;
  18. namespace BPASmartClient.DosingSystem
  19. {
  20. /// <summary>
  21. /// Interaction logic for App.xaml
  22. /// </summary>
  23. public partial class App : Application
  24. {
  25. public static Window MainWindow;
  26. protected override void OnStartup(StartupEventArgs e)
  27. {
  28. base.OnStartup(e);
  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. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  107. {
  108. MainMenuIcon = "&#xe622;",
  109. MainMenuName = "手动控制",
  110. Alias = "Parameter Set",
  111. subMenumodels = ManualControl,
  112. });
  113. #endregion
  114. #region 消息日志
  115. ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
  116. InfoLog.Add(new SubMenumodel()
  117. {
  118. SubMenuName = "操作日志",
  119. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  120. AssemblyName = "BPASmartClient.CustomResource",
  121. ToggleWindowPath = "Pages.View.UserLogView"
  122. });
  123. InfoLog.Add(new SubMenumodel()
  124. {
  125. SubMenuName = "运行日志",
  126. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  127. AssemblyName = "BPASmartClient.CustomResource",
  128. ToggleWindowPath = "Pages.View.RunLogView"
  129. });
  130. InfoLog.Add(new SubMenumodel()
  131. {
  132. SubMenuName = "报警记录",
  133. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  134. AssemblyName = "BPASmartClient.CustomResource",
  135. ToggleWindowPath = "Pages.View.AlarmView"
  136. });
  137. InfoLog.Add(new SubMenumodel()
  138. {
  139. SubMenuName = "调试日志",
  140. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
  141. AssemblyName = "BPASmartClient.CustomResource",
  142. ToggleWindowPath = "Pages.View.DebugLogView"
  143. });
  144. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  145. {
  146. MainMenuIcon = "&#xe668;",
  147. MainMenuName = "消息日志",
  148. Alias = "Message Log",
  149. subMenumodels = InfoLog,
  150. });
  151. #endregion
  152. #region 硬件设备监控
  153. ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
  154. DeviceMonitor.Add(new SubMenumodel()
  155. {
  156. SubMenuName = "原料设备列表",
  157. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  158. AssemblyName = "BPASmartClient.DosingSystem",
  159. ToggleWindowPath = "View.DeviceListView"
  160. });
  161. DeviceMonitor.Add(new SubMenumodel()
  162. {
  163. SubMenuName = "设备状态",
  164. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  165. AssemblyName = "BPASmartClient.DosingSystem",
  166. ToggleWindowPath = "View.HardwareStatusView"
  167. });
  168. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  169. {
  170. MainMenuIcon = "&#xe603;",
  171. MainMenuName = "设备监控",
  172. Alias = "Device Monitor",
  173. subMenumodels = DeviceMonitor,
  174. });
  175. #endregion
  176. #region 用户管理
  177. ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
  178. UserManager.Add(new SubMenumodel()
  179. {
  180. SubMenuName = "用户登录",
  181. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  182. AssemblyName = "BPASmartClient.CustomResource",
  183. ToggleWindowPath = "Pages.View.SubPagLoginView"
  184. });
  185. UserManager.Add(new SubMenumodel()
  186. {
  187. SubMenuName = "密码修改",
  188. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  189. AssemblyName = "BPASmartClient.CustomResource",
  190. ToggleWindowPath = "Pages.View.PasswordChangeView"
  191. });
  192. UserManager.Add(new SubMenumodel()
  193. {
  194. SubMenuName = "用户管理",
  195. SubMenuPermission = new Permission[] { Permission.管理员 },
  196. AssemblyName = "BPASmartClient.CustomResource",
  197. ToggleWindowPath = "Pages.View.UserManagerView"
  198. });
  199. UserManager.Add(new SubMenumodel()
  200. {
  201. SubMenuName = "NFC登录管理",
  202. SubMenuPermission = new Permission[] { Permission.管理员 },
  203. AssemblyName = "BPASmartClient.CustomResource",
  204. ToggleWindowPath = "Pages.View.NfcSetView"
  205. });
  206. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  207. {
  208. MainMenuIcon = "&#xe66d;",
  209. MainMenuName = "用户管理",
  210. Alias = "User Management",
  211. subMenumodels = UserManager,
  212. });
  213. #endregion
  214. }
  215. private void DataInit()
  216. {
  217. Config.GetInstance.Init();
  218. Json<LocaPar>.Read();
  219. Json<DevicePar>.Read();
  220. Json<LocaMaterial>.Read();
  221. }
  222. }
  223. }