终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

203 lines
7.9 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. namespace FryPot_DosingSystem
  19. {
  20. /// <summary>
  21. /// Interaction logic for App.xaml
  22. /// </summary>
  23. public partial class App : Application
  24. {
  25. protected override void OnStartup(StartupEventArgs e)
  26. {
  27. base.OnStartup(e);
  28. MenuInite();
  29. LoginDataInite();
  30. MainView mv = new MainView();
  31. LoginView lv = new LoginView();
  32. var res = lv.ShowDialog();
  33. if (res != null && res == true)
  34. {
  35. mv.Show();
  36. DeviceOperate deviceOperate = DeviceOperate.GetInstance;//开启实时PLC数据读取
  37. DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序
  38. }
  39. else
  40. mv.Close();
  41. HubHelper.GetInstance.Report = new Action<object>((o) =>
  42. {
  43. var res = JsonConvert.DeserializeObject<AGVToUpSystem>(o.ToString());
  44. });
  45. HubHelper.GetInstance.Upstreamrequest = new Action<object>((o) =>
  46. {
  47. var res = JsonConvert.DeserializeObject<Upstreamrequest>(o.ToString());
  48. });
  49. HubHelper.GetInstance.Connect("192.168.1.99", 8089);
  50. }
  51. protected override void OnExit(ExitEventArgs e)
  52. {
  53. base.OnExit(e);
  54. Json<RecipeManage>.Save();
  55. MessageLog.GetInstance.LogSave();
  56. }
  57. private void MenuInite()
  58. {
  59. #region 配方管理菜单
  60. ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
  61. RecipeManage.Add(new SubMenumodel()
  62. {
  63. SubMenuName = "配方管理",
  64. SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
  65. AssemblyName = "FryPot_DosingSystem",
  66. ToggleWindowPath = "View.RecipeSetView"
  67. });
  68. RecipeManage.Add(new SubMenumodel()
  69. {
  70. SubMenuName = "配方下发",
  71. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  72. AssemblyName = "FryPot_DosingSystem",
  73. ToggleWindowPath = "View.RecipeSendDownView"
  74. });
  75. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  76. {
  77. MainMenuIcon = "&#xe683;",
  78. MainMenuName = "配方管理",
  79. Alias = "Recipe Management",
  80. MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  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. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  108. {
  109. MainMenuIcon = "&#xe668;",
  110. MainMenuName = "消息日志",
  111. Alias = "Message Log",
  112. MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  113. subMenumodels = InfoLog,
  114. });
  115. #endregion
  116. #region 硬件设备监控
  117. ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
  118. DeviceMonitor.Add(new SubMenumodel()
  119. {
  120. SubMenuName = "PLC通讯设置",
  121. SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
  122. AssemblyName = "FryPot_DosingSystem",
  123. ToggleWindowPath = "View.DeviceListVIew"
  124. });
  125. DeviceMonitor.Add(new SubMenumodel()
  126. {
  127. SubMenuName = "滚筒线运行状态",
  128. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员, Permission.观察员 },
  129. AssemblyName = "FryPot_DosingSystem",
  130. ToggleWindowPath = "View.HardWareStatusView"
  131. });
  132. DeviceMonitor.Add(new SubMenumodel()
  133. {
  134. SubMenuName = "AGV视图",
  135. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  136. AssemblyName = "FryPot_DosingSystem",
  137. ToggleWindowPath = "View.AgvView"
  138. });
  139. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  140. {
  141. MainMenuIcon = "&#xe603;",
  142. MainMenuName = "设备监控",
  143. Alias = "Device Monitor",
  144. MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员, Permission.观察员 },
  145. subMenumodels = DeviceMonitor,
  146. });
  147. #endregion
  148. #region 用户管理
  149. ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
  150. UserManager.Add(new SubMenumodel()
  151. {
  152. SubMenuName = "用户登录",
  153. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  154. AssemblyName = "BPASmartClient.CustomResource",
  155. ToggleWindowPath = "Pages.View.LoginView"
  156. });
  157. UserManager.Add(new SubMenumodel()
  158. {
  159. SubMenuName = "密码修改",
  160. SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
  161. AssemblyName = "BPASmartClient.CustomResource",
  162. ToggleWindowPath = "Pages.View.PasswordChangeView"
  163. });
  164. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  165. {
  166. MainMenuIcon = "&#xe66d;",
  167. MainMenuName = "用户管理",
  168. Alias = "User Management",
  169. MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  170. subMenumodels = UserManager,
  171. });
  172. #endregion
  173. }
  174. private void LoginDataInite()
  175. {
  176. Config.GetInstance.Init();//用户数据初始化
  177. Json<RecipeManage>.Read();
  178. }
  179. }
  180. }