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

App.xaml.cs 8.9 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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.RecipeSetView"
  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. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  168. {
  169. MainMenuIcon = "&#xe66d;",
  170. MainMenuName = "用户管理",
  171. Alias = "User Management",
  172. MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  173. subMenumodels = UserManager,
  174. });
  175. #endregion
  176. ObservableCollection<SubMenumodel> DebugManage = new ObservableCollection<SubMenumodel>();
  177. DebugManage.Add(new SubMenumodel()
  178. {
  179. SubMenuName = "单一流程调试",
  180. SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
  181. AssemblyName = "FryPot_DosingSystem",
  182. ToggleWindowPath = "View.DebugView"
  183. });
  184. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  185. {
  186. MainMenuIcon = "&#xe683;",
  187. MainMenuName = "调试界面",
  188. Alias = "Debug Management",
  189. MainMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
  190. subMenumodels = DebugManage,
  191. });
  192. }
  193. private void LoginDataInite()
  194. {
  195. Config.GetInstance.Init();//用户数据初始化
  196. Json<RecipeManage>.Read();
  197. }
  198. }
  199. }