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

204 satır
7.8 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. 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> InfoLog = new ObservableCollection<SubMenumodel>();
  86. InfoLog.Add(new SubMenumodel()
  87. {
  88. SubMenuName = "操作日志",
  89. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  90. AssemblyName = "BPASmartClient.CustomResource",
  91. ToggleWindowPath = "Pages.View.UserLogView"
  92. });
  93. InfoLog.Add(new SubMenumodel()
  94. {
  95. SubMenuName = "运行日志",
  96. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  97. AssemblyName = "BPASmartClient.CustomResource",
  98. ToggleWindowPath = "Pages.View.RunLogView"
  99. });
  100. InfoLog.Add(new SubMenumodel()
  101. {
  102. SubMenuName = "报警记录",
  103. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  104. AssemblyName = "BPASmartClient.CustomResource",
  105. ToggleWindowPath = "Pages.View.AlarmView"
  106. });
  107. InfoLog.Add(new SubMenumodel()
  108. {
  109. SubMenuName = "调试日志",
  110. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
  111. AssemblyName = "BPASmartClient.CustomResource",
  112. ToggleWindowPath = "Pages.View.DebugLogView"
  113. });
  114. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  115. {
  116. MainMenuIcon = "&#xe668;",
  117. MainMenuName = "消息日志",
  118. Alias = "Message Log",
  119. subMenumodels = InfoLog,
  120. });
  121. #endregion
  122. #region 硬件设备监控
  123. ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
  124. DeviceMonitor.Add(new SubMenumodel()
  125. {
  126. SubMenuName = "原料设备列表",
  127. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  128. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  129. ToggleWindowPath = "View.DeviceListView"
  130. });
  131. DeviceMonitor.Add(new SubMenumodel()
  132. {
  133. SubMenuName = "设备状态",
  134. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  135. AssemblyName = "BPASmartClient.JXJFoodSmallStation",
  136. ToggleWindowPath = "View.HardwareStatusView"
  137. });
  138. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  139. {
  140. MainMenuIcon = "&#xe603;",
  141. MainMenuName = "设备监控",
  142. Alias = "Device Monitor",
  143. subMenumodels = DeviceMonitor,
  144. });
  145. #endregion
  146. #region 用户管理
  147. ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
  148. UserManager.Add(new SubMenumodel()
  149. {
  150. SubMenuName = "用户登录",
  151. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  152. AssemblyName = "BPASmartClient.CustomResource",
  153. ToggleWindowPath = "Pages.View.SubPagLoginView"
  154. });
  155. UserManager.Add(new SubMenumodel()
  156. {
  157. SubMenuName = "密码修改",
  158. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  159. AssemblyName = "BPASmartClient.CustomResource",
  160. ToggleWindowPath = "Pages.View.PasswordChangeView"
  161. });
  162. /* UserManager.Add(new SubMenumodel()
  163. {
  164. SubMenuName = "NFC登录设置",
  165. SubMenuPermission = new Permission[] { Permission.管理员 },
  166. AssemblyName = "BPASmartClient.CustomResource",
  167. ToggleWindowPath = "Pages.View.NfcSetView"
  168. });*/
  169. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  170. {
  171. MainMenuIcon = "&#xe66d;",
  172. MainMenuName = "用户管理",
  173. Alias = "User Management",
  174. subMenumodels = UserManager,
  175. });
  176. #endregion
  177. }
  178. private void DataInit()
  179. {
  180. Config.GetInstance.Init();
  181. Json<LocaPar>.Read();
  182. }
  183. }
  184. }