终端一体化运控平台
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

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