终端一体化运控平台
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

App.xaml.cs 9.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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. namespace BPASmartClient.JXJFoodSmallStation
  17. {
  18. /// <summary>
  19. /// Interaction logic for App.xaml
  20. /// </summary>
  21. public partial class App : Application
  22. {
  23. public static Window MainWindow;
  24. protected override void OnStartup(StartupEventArgs e)
  25. {
  26. base.OnStartup(e);
  27. MenuInit();
  28. DataInit();
  29. DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化
  30. ProcessControl.GetInstance.Init();
  31. MainView mv = new MainView();
  32. LoginView lv = new LoginView();
  33. var res = lv.ShowDialog();
  34. if (res != null && res == true)
  35. {
  36. MessageLog.GetInstance.ShowUserLog("用户登录");
  37. mv.Show();
  38. }
  39. else
  40. mv.Close();
  41. MainWindow = mv;
  42. }
  43. protected override void OnExit(ExitEventArgs e)
  44. {
  45. base.OnExit(e);
  46. Json<LocaPar>.Save();
  47. MessageLog.GetInstance.LogSave();
  48. ThreadManage.GetInstance().Dispose();
  49. }
  50. private void MenuInit()
  51. {
  52. //NfcServer.GetInstance.Init();
  53. #region 配方管理菜单
  54. ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
  55. RecipeManage.Add(new SubMenumodel()
  56. {
  57. SubMenuName = "本地配方管理",
  58. SubMenuPermission = new Permission[] { Permission.管理员 },
  59. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  60. ToggleWindowPath = "View.RecipeSettingsView"
  61. });
  62. RecipeManage.Add(new SubMenumodel()
  63. {
  64. SubMenuName = "本地配方下发",
  65. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员 },
  66. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  67. ToggleWindowPath = "View.RecipeControlView"
  68. });
  69. RecipeManage.Add(new SubMenumodel()
  70. {
  71. SubMenuName = "服务配方管理",
  72. SubMenuPermission = new Permission[] { Permission.管理员 },
  73. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  74. ToggleWindowPath = "View.RecipeReceiveView"
  75. });
  76. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  77. {
  78. MainMenuIcon = "&#xe683;",
  79. MainMenuName = "配方管理",
  80. Alias = "Recipe Management",
  81. subMenumodels = RecipeManage,
  82. });
  83. #endregion
  84. #region 参数设置
  85. ObservableCollection<SubMenumodel> ParSet = new ObservableCollection<SubMenumodel>();
  86. ParSet.Add(new SubMenumodel()
  87. {
  88. SubMenuName = "原料参数设置",
  89. SubMenuPermission = new Permission[] { Permission.管理员 },
  90. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  91. ToggleWindowPath = "View.DeviceMaterialParView"
  92. });
  93. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  94. {
  95. MainMenuIcon = "&#xe62d;",
  96. MainMenuName = "参数设置",
  97. Alias = "Parameter Set",
  98. subMenumodels = ParSet,
  99. });
  100. #endregion
  101. #region 手动控制
  102. ObservableCollection<SubMenumodel> ManualControl = new ObservableCollection<SubMenumodel>();
  103. ManualControl.Add(new SubMenumodel()
  104. {
  105. SubMenuName = "手动控制",
  106. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  107. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  108. ToggleWindowPath = "View.ManualControlView"
  109. });
  110. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  111. {
  112. MainMenuIcon = "&#xe622;",
  113. MainMenuName = "手动控制",
  114. Alias = "Parameter Set",
  115. subMenumodels = ManualControl,
  116. });
  117. #endregion
  118. #region 消息日志
  119. ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
  120. InfoLog.Add(new SubMenumodel()
  121. {
  122. SubMenuName = "操作日志",
  123. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  124. AssemblyName = "BPASmartClient.CustomResource",
  125. ToggleWindowPath = "Pages.View.UserLogView"
  126. });
  127. InfoLog.Add(new SubMenumodel()
  128. {
  129. SubMenuName = "运行日志",
  130. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  131. AssemblyName = "BPASmartClient.CustomResource",
  132. ToggleWindowPath = "Pages.View.RunLogView"
  133. });
  134. InfoLog.Add(new SubMenumodel()
  135. {
  136. SubMenuName = "报警记录",
  137. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  138. AssemblyName = "BPASmartClient.CustomResource",
  139. ToggleWindowPath = "Pages.View.AlarmView"
  140. });
  141. InfoLog.Add(new SubMenumodel()
  142. {
  143. SubMenuName = "调试日志",
  144. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
  145. AssemblyName = "BPASmartClient.CustomResource",
  146. ToggleWindowPath = "Pages.View.DebugLogView"
  147. });
  148. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  149. {
  150. MainMenuIcon = "&#xe668;",
  151. MainMenuName = "消息日志",
  152. Alias = "Message Log",
  153. subMenumodels = InfoLog,
  154. });
  155. #endregion
  156. #region 硬件设备监控
  157. ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
  158. DeviceMonitor.Add(new SubMenumodel()
  159. {
  160. SubMenuName = "原料设备列表",
  161. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  162. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  163. ToggleWindowPath = "View.DeviceListView"
  164. });
  165. DeviceMonitor.Add(new SubMenumodel()
  166. {
  167. SubMenuName = "设备状态",
  168. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  169. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  170. ToggleWindowPath = "View.HardwareStatusView"
  171. });
  172. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  173. {
  174. MainMenuIcon = "&#xe603;",
  175. MainMenuName = "设备监控",
  176. Alias = "Device Monitor",
  177. subMenumodels = DeviceMonitor,
  178. });
  179. #endregion
  180. #region 用户管理
  181. ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
  182. UserManager.Add(new SubMenumodel()
  183. {
  184. SubMenuName = "用户登录",
  185. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  186. AssemblyName = "BPASmartClient.CustomResource",
  187. ToggleWindowPath = "Pages.View.SubPagLoginView"
  188. });
  189. UserManager.Add(new SubMenumodel()
  190. {
  191. SubMenuName = "密码修改",
  192. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  193. AssemblyName = "BPASmartClient.CustomResource",
  194. ToggleWindowPath = "Pages.View.PasswordChangeView"
  195. });
  196. UserManager.Add(new SubMenumodel()
  197. {
  198. SubMenuName = "用户管理",
  199. SubMenuPermission = new Permission[] { Permission.管理员 },
  200. AssemblyName = "BPASmartClient.CustomResource",
  201. ToggleWindowPath = "Pages.View.UserManagerView"
  202. });
  203. /* UserManager.Add(new SubMenumodel()
  204. {
  205. SubMenuName = "NFC登录设置",
  206. SubMenuPermission = new Permission[] { Permission.管理员 },
  207. AssemblyName = "BPASmartClient.CustomResource",
  208. ToggleWindowPath = "Pages.View.NfcSetView"
  209. });*/
  210. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  211. {
  212. MainMenuIcon = "&#xe66d;",
  213. MainMenuName = "用户管理",
  214. Alias = "User Management",
  215. subMenumodels = UserManager,
  216. });
  217. #endregion
  218. }
  219. private void DataInit()
  220. {
  221. Config.GetInstance.Init();
  222. Json<LocaPar>.Read();
  223. }
  224. }
  225. }