| | |
| | | using Bro.Common.Helper; |
| | | using Bro.Common.Interface; |
| | | using Bro.Common.Model; |
| | | using Bro.Common.Model.Interface; |
| | | using Bro.Common.PubSub; |
| | | using Bro.Device.AuboRobot; |
| | | using Bro.Device.OmronFins; |
| | |
| | | { |
| | | #region AutoFac注册 |
| | | builder.RegisterInstance<ProcessConfig>(StationConfig as ProcessConfig); |
| | | builder.RegisterInstance<List<IDevice>>(GetDeviceList()); |
| | | builder.RegisterInstance<List<IDevice>>(DeviceList); |
| | | builder.RegisterInstance<List<ProcessMethodAttribute>>(CollectProcessMethods()); |
| | | |
| | | if (isBuild) |
| | |
| | | Dictionary<string, AuboRobotDriver> RobotDict = new Dictionary<string, AuboRobotDriver>(); |
| | | Dictionary<string, SeerAGVDriver> AGVDict = new Dictionary<string, SeerAGVDriver>(); |
| | | Dictionary<string, CameraBase> CameraDict = new Dictionary<string, CameraBase>(); |
| | | |
| | | public List<IDevice> DeviceList { get; set; } = new List<IDevice>(); |
| | | |
| | | private ProcessConfig Config { get => StationConfig as ProcessConfig; } |
| | | |
| | |
| | | WarningRemains.CollectionChanged -= _warningRemains_CollectionChanged; |
| | | WarningRemains.CollectionChanged += _warningRemains_CollectionChanged; |
| | | |
| | | #region 设备初始化 |
| | | DeviceList = new List<IDevice>(); |
| | | |
| | | InitialPLCs(); |
| | | InitialAGVs(); |
| | | InitialRobots(); |
| | | InitialCameras(); |
| | | InitialAGVBindUnit(); |
| | | //InitialMachineTrayNums(); |
| | | #endregion |
| | | |
| | | AutoFacRegister(); |
| | | |
| | |
| | | CameraBase camera = CameraHelper.GetCameraInstance(c.DriverType); |
| | | camera.InitialConfig = c; |
| | | CameraDict[camera.InitialConfig.ID] = camera; |
| | | |
| | | DeviceList.Add(camera); |
| | | }); |
| | | } |
| | | |
| | |
| | | |
| | | plc.OnMonitorAlarm += OnMonitorAlarm; |
| | | plc.OnMonitorInvoke += OnMonitorInvoke; |
| | | |
| | | DeviceList.Add(plc); |
| | | }); |
| | | } |
| | | |
| | |
| | | |
| | | robot.OnMonitorAlarm += OnMonitorAlarm; |
| | | robot.OnMonitorInvoke += OnMonitorInvoke; |
| | | |
| | | DeviceList.Add(robot); |
| | | }); |
| | | } |
| | | |
| | |
| | | agv.OnMonitorAlarm -= OnMonitorAlarm; |
| | | agv.OnMonitorInvoke -= OnMonitorInvoke; |
| | | |
| | | agv.OnMonitorAlarm += OnMonitorAlarm; |
| | | agv.OnMonitorInvoke += OnMonitorInvoke; |
| | | |
| | | agv.OnLog = OnDeviceLog; |
| | | agv.OnAGVPositoinChanged = OnAGVPositionChanged; |
| | | agv.OnAGVTaskStatusChanged = OnAGVTaskStatusChanged; |
| | | agv.OnAGVBatteryLvlChanged = OnAGVBatteryLvlChanged; |
| | | |
| | | DeviceList.Add(agv); |
| | | }); |
| | | } |
| | | |
| | |
| | | }); |
| | | } |
| | | |
| | | public List<IDevice> GetDeviceList() |
| | | { |
| | | List<IDevice> list = new List<IDevice>(); |
| | | //public List<IDevice> GetDeviceList() |
| | | //{ |
| | | // List<IDevice> list = new List<IDevice>(); |
| | | |
| | | list.AddRange(PLCDict.Values); |
| | | list.AddRange(RobotDict.Values); |
| | | list.AddRange(AGVDict.Values); |
| | | list.AddRange(CameraDict.Values); |
| | | // list.AddRange(PLCDict.Values); |
| | | // list.AddRange(RobotDict.Values); |
| | | // list.AddRange(AGVDict.Values); |
| | | // list.AddRange(CameraDict.Values); |
| | | |
| | | return list; |
| | | } |
| | | // return list; |
| | | //} |
| | | |
| | | #region IMonitor监听 |
| | | private void OnMonitorInvoke(DateTime dt, IDevice device, MonitorSet monitorSet) |
| | |
| | | #endregion |
| | | } |
| | | |
| | | private void OnMonitorAlarm(DateTime dt, IDevice device, WarningSet warning, bool isAlarmRaised) |
| | | private void OnMonitorAlarm(DateTime dt, IDevice device, WarningSet warning) |
| | | { |
| | | var bind = Config.AGVBindCollection.FirstOrDefault(u => u.CameraId == device.Id || u.RobotId == device.Id || u.AGVId == device.Id); |
| | | |
| | | if (bind == null) |
| | | { |
| | | throw new ProcessException($"{device.Name}的异常信息未能获取相关绑定设备信息"); |
| | | } |
| | | |
| | | if (warning.CurrentStatus == warning.TriggerValue) |
| | | { |
| | | bind.WarningMsg.Add(warning.WarningDescription); |
| | | bind.UnitState = AGVState.Warning; |
| | | } |
| | | |
| | | //暂时不执行自动复位,需要手工复位 |
| | | } |
| | | |
| | | //List<int> _monitorList = new List<int>(); |