终端一体化运控平台
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

229 Zeilen
9.2 KiB

  1. using BPASmartClient.AGV.Feedback;
  2. using BPASmartClient.CustomResource.Pages.Enums;
  3. using BPASmartClient.CustomResource.Pages.Model;
  4. using BPASmartClient.CustomResource.Pages.View;
  5. using BPASmartClient.Helper;
  6. using BPASmartClient.HubHelper;
  7. using FryPot_DosingSystem.Control;
  8. using FryPot_DosingSystem.Model;
  9. using Newtonsoft.Json;
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Collections.ObjectModel;
  13. using System.Configuration;
  14. using System.Data;
  15. using System.Linq;
  16. using System.Threading.Tasks;
  17. using System.Windows;
  18. using AlarmInfo = BPASmartClient.CustomResource.Pages.Model.AlarmInfo;
  19. namespace FryPot_DosingSystem
  20. {
  21. /// <summary>
  22. /// Interaction logic for App.xaml
  23. /// </summary>
  24. public partial class App : Application
  25. {
  26. protected override void OnStartup(StartupEventArgs e)
  27. {
  28. base.OnStartup(e);
  29. MenuInite();
  30. LoginDataInite();
  31. MainView mv = new MainView();
  32. LoginView lv = new LoginView();
  33. var res = lv.ShowDialog();
  34. if (res != null && res == true)
  35. {
  36. mv.Show();
  37. DeviceOperate deviceOperate = DeviceOperate.GetInstance;//开启实时PLC数据读取
  38. DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序
  39. HubHelper.GetInstance.Connect("192.168.1.14", 8089);
  40. AlarmHelper<AlarmInfo>.Init();
  41. }
  42. else
  43. mv.Close();
  44. //HubHelper.GetInstance.Report = new Action<object>((o) =>
  45. //{
  46. // var res = JsonConvert.DeserializeObject<AGVToUpSystem>(o.ToString());
  47. //});
  48. //HubHelper.GetInstance.Upstreamrequest = new Action<object>((o) =>
  49. //{
  50. // var res = JsonConvert.DeserializeObject<Upstreamrequest>(o.ToString());
  51. //});
  52. //本地服务连接
  53. }
  54. protected override void OnExit(ExitEventArgs e)
  55. {
  56. base.OnExit(e);
  57. Json<RecipeManage>.Save();
  58. MessageLog.GetInstance.LogSave();
  59. }
  60. private void MenuInite()
  61. {
  62. #region 配方管理菜单
  63. ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
  64. RecipeManage.Add(new SubMenumodel()
  65. {
  66. SubMenuName = "配方管理",
  67. SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
  68. AssemblyName = "FryPot_DosingSystem",
  69. ToggleWindowPath = "View.RecipeManageView"
  70. });
  71. RecipeManage.Add(new SubMenumodel()
  72. {
  73. SubMenuName = "配方下发",
  74. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  75. AssemblyName = "FryPot_DosingSystem",
  76. ToggleWindowPath = "View.RecipeSendDownView"
  77. });
  78. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  79. {
  80. MainMenuIcon = "&#xe683;",
  81. MainMenuName = "配方管理",
  82. Alias = "Recipe Management",
  83. MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  84. subMenumodels = RecipeManage,
  85. });
  86. #endregion
  87. #region 消息日志
  88. ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
  89. InfoLog.Add(new SubMenumodel()
  90. {
  91. SubMenuName = "操作日志",
  92. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  93. AssemblyName = "BPASmartClient.CustomResource",
  94. ToggleWindowPath = "Pages.View.UserLogView"
  95. });
  96. InfoLog.Add(new SubMenumodel()
  97. {
  98. SubMenuName = "运行日志",
  99. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  100. AssemblyName = "BPASmartClient.CustomResource",
  101. ToggleWindowPath = "Pages.View.RunLogView"
  102. });
  103. InfoLog.Add(new SubMenumodel()
  104. {
  105. SubMenuName = "报警记录",
  106. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  107. AssemblyName = "BPASmartClient.CustomResource",
  108. ToggleWindowPath = "Pages.View.AlarmView"
  109. });
  110. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  111. {
  112. MainMenuIcon = "&#xe668;",
  113. MainMenuName = "消息日志",
  114. Alias = "Message Log",
  115. MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  116. subMenumodels = InfoLog,
  117. });
  118. #endregion
  119. #region 硬件设备监控
  120. ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
  121. DeviceMonitor.Add(new SubMenumodel()
  122. {
  123. SubMenuName = "PLC通讯设置",
  124. SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
  125. AssemblyName = "FryPot_DosingSystem",
  126. ToggleWindowPath = "View.DeviceListVIew"
  127. });
  128. DeviceMonitor.Add(new SubMenumodel()
  129. {
  130. SubMenuName = "滚筒线运行状态",
  131. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员, Permission.观察员 },
  132. AssemblyName = "FryPot_DosingSystem",
  133. ToggleWindowPath = "View.HardWareStatusView"
  134. });
  135. DeviceMonitor.Add(new SubMenumodel()
  136. {
  137. SubMenuName = "AGV视图",
  138. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  139. AssemblyName = "FryPot_DosingSystem",
  140. ToggleWindowPath = "View.AgvView"
  141. });
  142. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  143. {
  144. MainMenuIcon = "&#xe603;",
  145. MainMenuName = "设备监控",
  146. Alias = "Device Monitor",
  147. MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员, Permission.观察员 },
  148. subMenumodels = DeviceMonitor,
  149. });
  150. #endregion
  151. #region 用户管理
  152. ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
  153. UserManager.Add(new SubMenumodel()
  154. {
  155. SubMenuName = "用户登录",
  156. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  157. AssemblyName = "BPASmartClient.CustomResource",
  158. ToggleWindowPath = "Pages.View.SubPagLoginView"
  159. });
  160. UserManager.Add(new SubMenumodel()
  161. {
  162. SubMenuName = "密码修改",
  163. SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
  164. AssemblyName = "BPASmartClient.CustomResource",
  165. ToggleWindowPath = "Pages.View.PasswordChangeView"
  166. });
  167. UserManager.Add(new SubMenumodel()
  168. {
  169. SubMenuName = "账号管理",
  170. SubMenuPermission = new Permission[] { Permission.管理员 },
  171. AssemblyName = "FryPot_DosingSystem",
  172. ToggleWindowPath = "View.UserManageView"
  173. });
  174. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  175. {
  176. MainMenuIcon = "&#xe66d;",
  177. MainMenuName = "用户管理",
  178. Alias = "User Management",
  179. MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  180. subMenumodels = UserManager,
  181. });
  182. #endregion
  183. ObservableCollection<SubMenumodel> DebugManage = new ObservableCollection<SubMenumodel>();
  184. DebugManage.Add(new SubMenumodel()
  185. {
  186. SubMenuName = "单一流程调试",
  187. SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
  188. AssemblyName = "FryPot_DosingSystem",
  189. ToggleWindowPath = "View.DebugView"
  190. });
  191. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  192. {
  193. MainMenuIcon = "&#xe683;",
  194. MainMenuName = "调试界面",
  195. Alias = "Debug Management",
  196. MainMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
  197. subMenumodels = DebugManage,
  198. });
  199. }
  200. private void LoginDataInite()
  201. {
  202. Config.GetInstance.Init();//用户数据初始化
  203. Json<RecipeManage>.Read();
  204. }
  205. }
  206. }