|
- 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
- {
- public static Window MainWindow;
- 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();
- MessageLog.GetInstance.ShowUserLog("用户登录");
- DeviceOperate deviceOperate = DeviceOperate.GetInstance;//开启实时PLC数据读取
- DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序
- HubHelper.GetInstance.Connect("192.168.1.40", 8089);
- AlarmHelper<AlarmInfo>.Init();
- }
- else
- mv.Close();
- MainWindow = mv;
-
- //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.RecipesSendDown"
- });
-
- 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.技术员,Permission.观察员 },
- AssemblyName = "BPASmartClient.CustomResource",
- ToggleWindowPath = "Pages.View.UserLogView"
- });
-
- InfoLog.Add(new SubMenumodel()
- {
- SubMenuName = "运行日志",
- SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.观察员 },
- AssemblyName = "BPASmartClient.CustomResource",
- ToggleWindowPath = "Pages.View.RunLogView"
- });
-
- InfoLog.Add(new SubMenumodel()
- {
- SubMenuName = "报警记录",
- SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.观察员 },
- AssemblyName = "BPASmartClient.CustomResource",
- ToggleWindowPath = "Pages.View.AlarmView"
- });
- InfoLog.Add(new SubMenumodel()
- {
- SubMenuName = "炒锅状态记录",
- SubMenuPermission = new Permission[] { 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.技术员, 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.技术员 },
- 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.技术员, 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.技术员 },
- AssemblyName = "BPASmartClient.CustomResource",
- ToggleWindowPath = "Pages.View.SubPagLoginView"
- });
-
- UserManager.Add(new SubMenumodel()
- {
- SubMenuName = "密码修改",
- SubMenuPermission = new 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.技术员 },
- 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();
- }
- }
- }
|