终端一体化运控平台
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

264 lignes
11 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. NfcServer.GetInstance.Init();
  64. #region 配方管理菜单
  65. ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
  66. RecipeManage.Add(new SubMenumodel()
  67. {
  68. SubMenuName = "配方管理",
  69. SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
  70. AssemblyName = "FryPot_DosingSystem",
  71. ToggleWindowPath = "View.RecipeManageView"
  72. });
  73. RecipeManage.Add(new SubMenumodel()
  74. {
  75. SubMenuName = "配方下发",
  76. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  77. AssemblyName = "FryPot_DosingSystem",
  78. ToggleWindowPath = "View.RecipeSendDownView"
  79. });
  80. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  81. {
  82. MainMenuIcon = "&#xe683;",
  83. MainMenuName = "配方管理",
  84. Alias = "Recipe Management",
  85. MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  86. subMenumodels = RecipeManage,
  87. });
  88. #endregion
  89. #region 消息日志
  90. ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
  91. InfoLog.Add(new SubMenumodel()
  92. {
  93. SubMenuName = "操作日志",
  94. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  95. AssemblyName = "BPASmartClient.CustomResource",
  96. ToggleWindowPath = "Pages.View.UserLogView"
  97. });
  98. InfoLog.Add(new SubMenumodel()
  99. {
  100. SubMenuName = "运行日志",
  101. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  102. AssemblyName = "BPASmartClient.CustomResource",
  103. ToggleWindowPath = "Pages.View.RunLogView"
  104. });
  105. InfoLog.Add(new SubMenumodel()
  106. {
  107. SubMenuName = "报警记录",
  108. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  109. AssemblyName = "BPASmartClient.CustomResource",
  110. ToggleWindowPath = "Pages.View.AlarmView"
  111. });
  112. InfoLog.Add(new SubMenumodel()
  113. {
  114. SubMenuName = "炒锅状态记录",
  115. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  116. AssemblyName = "FryPot_DosingSystem",
  117. ToggleWindowPath = "View.SqliteDataView"
  118. });
  119. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  120. {
  121. MainMenuIcon = "&#xe668;",
  122. MainMenuName = "消息日志",
  123. Alias = "Message Log",
  124. MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  125. subMenumodels = InfoLog,
  126. });
  127. #endregion
  128. #region 硬件设备监控
  129. ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
  130. DeviceMonitor.Add(new SubMenumodel()
  131. {
  132. SubMenuName = "PLC通讯设置",
  133. SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
  134. AssemblyName = "FryPot_DosingSystem",
  135. ToggleWindowPath = "View.DeviceListVIew"
  136. });
  137. DeviceMonitor.Add(new SubMenumodel()
  138. {
  139. SubMenuName = "PLC变量配置",
  140. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  141. AssemblyName = "BPASmartClient.CustomResource",
  142. ToggleWindowPath = "Pages.View.VariableConfigView"
  143. });
  144. DeviceMonitor.Add(new SubMenumodel()
  145. {
  146. SubMenuName = "滚筒线运行状态",
  147. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员, Permission.观察员 },
  148. AssemblyName = "FryPot_DosingSystem",
  149. ToggleWindowPath = "View.HardWareStatusView"
  150. });
  151. DeviceMonitor.Add(new SubMenumodel()
  152. {
  153. SubMenuName = "炒锅状态监控",
  154. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员, Permission.观察员 },
  155. AssemblyName = "FryPot_DosingSystem",
  156. ToggleWindowPath = "View.FryPotMonitorView"
  157. });
  158. DeviceMonitor.Add(new SubMenumodel()
  159. {
  160. SubMenuName = "AGV视图",
  161. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  162. AssemblyName = "FryPot_DosingSystem",
  163. ToggleWindowPath = "View.AgvView"
  164. });
  165. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  166. {
  167. MainMenuIcon = "&#xe603;",
  168. MainMenuName = "设备监控",
  169. Alias = "Device Monitor",
  170. MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员, Permission.观察员 },
  171. subMenumodels = DeviceMonitor,
  172. });
  173. #endregion
  174. #region 用户管理
  175. ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
  176. UserManager.Add(new SubMenumodel()
  177. {
  178. SubMenuName = "用户登录",
  179. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  180. AssemblyName = "BPASmartClient.CustomResource",
  181. ToggleWindowPath = "Pages.View.SubPagLoginView"
  182. });
  183. UserManager.Add(new SubMenumodel()
  184. {
  185. SubMenuName = "密码修改",
  186. SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
  187. AssemblyName = "BPASmartClient.CustomResource",
  188. ToggleWindowPath = "Pages.View.PasswordChangeView"
  189. });
  190. UserManager.Add(new SubMenumodel()
  191. {
  192. SubMenuName = "账号管理",
  193. SubMenuPermission = new Permission[] { Permission.管理员 },
  194. AssemblyName = "BPASmartClient.CustomResource",
  195. ToggleWindowPath = "Pages.View.UserManageView"
  196. });
  197. UserManager.Add(new SubMenumodel()
  198. {
  199. SubMenuName = "NFC登录设置",
  200. SubMenuPermission = new Permission[] { Permission.管理员 },
  201. AssemblyName = "BPASmartClient.CustomResource",
  202. ToggleWindowPath = "Pages.View.NfcSetView"
  203. });
  204. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  205. {
  206. MainMenuIcon = "&#xe66d;",
  207. MainMenuName = "用户管理",
  208. Alias = "User Management",
  209. MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  210. subMenumodels = UserManager,
  211. });
  212. #endregion
  213. #region 调试界面
  214. ObservableCollection<SubMenumodel> DebugManage = new ObservableCollection<SubMenumodel>();
  215. DebugManage.Add(new SubMenumodel()
  216. {
  217. SubMenuName = "单一流程调试",
  218. SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
  219. AssemblyName = "FryPot_DosingSystem",
  220. ToggleWindowPath = "View.DebugView"
  221. });
  222. #endregion
  223. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  224. {
  225. MainMenuIcon = "&#xe683;",
  226. MainMenuName = "调试界面",
  227. Alias = "Debug Management",
  228. MainMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
  229. subMenumodels = DebugManage,
  230. });
  231. }
  232. private void LoginDataInite()
  233. {
  234. Config.GetInstance.Init();//用户数据初始化
  235. Json<RecipeManage>.Read();
  236. }
  237. }
  238. }