|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- using BPASmartClient.AGV.Feedback;
- using BPASmartClient.CustomResource.Pages.Enums;
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.CustomResource.Pages.View;
- using BPASmartClient.Helper;
- using BPASmartClient.HubHelper;
- using FryPot_DosingSystem.Control;
- using FryPot_DosingSystem.Model;
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Configuration;
- using System.Data;
- using System.IO;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Windows;
- using AlarmInfo = BPASmartClient.CustomResource.Pages.Model.AlarmInfo;
-
- namespace FryPot_DosingSystem
- {
- /// <summary>
- /// Interaction logic for App.xaml
- /// </summary>
- public partial class App : Application
- {
- protected override void OnStartup(StartupEventArgs e)
- {
- base.OnStartup(e);
- MenuInite();
- LoginDataInite();
-
- MainView mv = new MainView();
- LoginView lv = new LoginView();
- var res = lv.ShowDialog();
- if (res != null && res == true)
- {
- mv.Show();
- DeviceOperate deviceOperate = DeviceOperate.GetInstance;//开启实时PLC数据读取
- DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序
- HubHelper.GetInstance.Connect("192.168.1.14", 8089);
- AlarmHelper<AlarmInfo>.Init();
- }
- else
- mv.Close();
-
-
- //HubHelper.GetInstance.Report = new Action<object>((o) =>
- //{
- // var res = JsonConvert.DeserializeObject<AGVToUpSystem>(o.ToString());
- //});
-
- //HubHelper.GetInstance.Upstreamrequest = new Action<object>((o) =>
- //{
- // var res = JsonConvert.DeserializeObject<Upstreamrequest>(o.ToString());
- //});
- //本地服务连接
-
-
- }
-
-
-
- protected override void OnExit(ExitEventArgs e)
- {
- base.OnExit(e);
- Json<RecipeManage>.Save();
- MessageLog.GetInstance.LogSave();
- }
- private void MenuInite()
- {
- NfcServer.GetInstance.Init();
- #region 配方管理菜单
- ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
- RecipeManage.Add(new SubMenumodel()
- {
- SubMenuName = "配方管理",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
- AssemblyName = "FryPot_DosingSystem",
- ToggleWindowPath = "View.RecipeManageView"
- });
-
- RecipeManage.Add(new SubMenumodel()
- {
- SubMenuName = "配方下发",
- SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
- AssemblyName = "FryPot_DosingSystem",
- ToggleWindowPath = "View.RecipeSendDownView"
- });
-
- MenuManage.GetInstance.menuModels.Add(new MenuModel()
- {
- MainMenuIcon = "",
- MainMenuName = "配方管理",
- Alias = "Recipe Management",
- MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
- subMenumodels = RecipeManage,
- });
- #endregion
-
- #region 消息日志
- ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
- InfoLog.Add(new SubMenumodel()
- {
- SubMenuName = "操作日志",
- SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
- AssemblyName = "BPASmartClient.CustomResource",
- ToggleWindowPath = "Pages.View.UserLogView"
- });
-
- InfoLog.Add(new SubMenumodel()
- {
- SubMenuName = "运行日志",
- SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
- AssemblyName = "BPASmartClient.CustomResource",
- ToggleWindowPath = "Pages.View.RunLogView"
- });
-
- InfoLog.Add(new SubMenumodel()
- {
- SubMenuName = "报警记录",
- SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
- AssemblyName = "BPASmartClient.CustomResource",
- ToggleWindowPath = "Pages.View.AlarmView"
- });
- InfoLog.Add(new SubMenumodel()
- {
- SubMenuName = "炒锅状态记录",
- SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
- AssemblyName = "FryPot_DosingSystem",
- ToggleWindowPath = "View.SqliteDataView"
- });
-
- MenuManage.GetInstance.menuModels.Add(new MenuModel()
- {
- MainMenuIcon = "",
- MainMenuName = "消息日志",
- Alias = "Message Log",
- MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
- subMenumodels = InfoLog,
- });
- #endregion
-
- #region 硬件设备监控
- ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
- DeviceMonitor.Add(new SubMenumodel()
- {
- SubMenuName = "PLC通讯设置",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
- AssemblyName = "FryPot_DosingSystem",
- ToggleWindowPath = "View.DeviceListVIew"
- });
- DeviceMonitor.Add(new SubMenumodel()
- {
- SubMenuName = "PLC变量配置",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
- AssemblyName = "BPASmartClient.CustomResource",
- ToggleWindowPath = "Pages.View.VariableConfigView"
- });
-
- DeviceMonitor.Add(new SubMenumodel()
- {
- SubMenuName = "滚筒线运行状态",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员, Permission.观察员 },
- AssemblyName = "FryPot_DosingSystem",
- ToggleWindowPath = "View.HardWareStatusView"
-
- });
- DeviceMonitor.Add(new SubMenumodel()
- {
- SubMenuName = "炒锅状态监控",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员, Permission.观察员 },
- AssemblyName = "FryPot_DosingSystem",
- ToggleWindowPath = "View.FryPotMonitorView"
-
- });
-
- DeviceMonitor.Add(new SubMenumodel()
- {
- SubMenuName = "AGV视图",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
- AssemblyName = "FryPot_DosingSystem",
- ToggleWindowPath = "View.AgvView"
- });
-
- MenuManage.GetInstance.menuModels.Add(new MenuModel()
- {
- MainMenuIcon = "",
- MainMenuName = "设备监控",
- Alias = "Device Monitor",
- MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员, Permission.观察员 },
- subMenumodels = DeviceMonitor,
- });
- #endregion
-
- #region 用户管理
- ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
- UserManager.Add(new SubMenumodel()
- {
- SubMenuName = "用户登录",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
- AssemblyName = "BPASmartClient.CustomResource",
- ToggleWindowPath = "Pages.View.SubPagLoginView"
- });
-
- UserManager.Add(new SubMenumodel()
- {
- SubMenuName = "密码修改",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
- AssemblyName = "BPASmartClient.CustomResource",
- ToggleWindowPath = "Pages.View.PasswordChangeView"
- });
- UserManager.Add(new SubMenumodel()
- {
- SubMenuName = "账号管理",
- SubMenuPermission = new Permission[] { Permission.管理员 },
- AssemblyName = "BPASmartClient.CustomResource",
- ToggleWindowPath = "Pages.View.UserManageView"
- });
- UserManager.Add(new SubMenumodel()
- {
- SubMenuName = "NFC登录设置",
- SubMenuPermission = new Permission[] { Permission.管理员 },
- AssemblyName = "BPASmartClient.CustomResource",
- ToggleWindowPath = "Pages.View.NfcSetView"
- });
- MenuManage.GetInstance.menuModels.Add(new MenuModel()
- {
- MainMenuIcon = "",
- MainMenuName = "用户管理",
- Alias = "User Management",
- MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
- subMenumodels = UserManager,
- });
- #endregion
- #region 调试界面
- ObservableCollection<SubMenumodel> DebugManage = new ObservableCollection<SubMenumodel>();
- DebugManage.Add(new SubMenumodel()
- {
- SubMenuName = "单一流程调试",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
- AssemblyName = "FryPot_DosingSystem",
- ToggleWindowPath = "View.DebugView"
- });
- #endregion
- MenuManage.GetInstance.menuModels.Add(new MenuModel()
- {
- MainMenuIcon = "",
- MainMenuName = "调试界面",
- Alias = "Debug Management",
- MainMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
- subMenumodels = DebugManage,
- });
-
- }
- private void LoginDataInite()
- {
- Config.GetInstance.Init();//用户数据初始化
- Json<RecipeManage>.Read();
- }
- }
- }
|