| New file |
| | |
| | | using Microsoft.AspNetCore.SignalR; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WCS.Application.Hub; |
| | | using WCS.Application.Service.WcsDevice.Dto; |
| | | |
| | | namespace WCS.Application; |
| | | public static class HubUtil |
| | | { |
| | | private static readonly IHubContext<PlcHub, IPlcHub> _plcHubContext = App.GetService<IHubContext<PlcHub, IPlcHub>>(); |
| | | private static readonly IHubContext<PlcDeviceHub, IPlcDeviceHub> _plcDeviceHubContext = App.GetService<IHubContext<PlcDeviceHub, IPlcDeviceHub>>(); |
| | | private static readonly IHubContext<TaskLogHub, ITaskLogHub> _taskLogHubContext = App.GetService<IHubContext<TaskLogHub, ITaskLogHub>>(); |
| | | private static readonly IHubContext<CheckTaskHub, ICheckTaskHub> _checkTaskHubContext = App.GetService<IHubContext<CheckTaskHub, ICheckTaskHub>>(); |
| | | |
| | | /// <summary> |
| | | /// 下发PLC连接状态 |
| | | /// </summary> |
| | | /// <param name="context"></param> |
| | | /// <returns></returns> |
| | | public static async Task PublicPlcConn(WcsPlc context) |
| | | { |
| | | if (PLCTaskAction.boRefresh) |
| | | await _plcHubContext.Clients.All.PublicPlcConn(context); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 下发报警信息 |
| | | /// </summary> |
| | | /// <param name="context"></param> |
| | | /// <returns></returns> |
| | | public static async Task PublicAlarm(List<WcsAlarmInfo> context) |
| | | { |
| | | if (PLCTaskAction.boRefresh) |
| | | await _plcHubContext.Clients.All.PublicAlarm(context); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 修改服务状态 |
| | | /// </summary> |
| | | /// <param name="context"></param> |
| | | public static async Task UpdateService(PLCServiceModel context) |
| | | { |
| | | if (PLCTaskAction.boRefresh) |
| | | await _plcHubContext.Clients.All.UpdateService(context); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 下发控制台位置信息 |
| | | /// </summary> |
| | | /// <param name="context"></param> |
| | | /// <returns></returns> |
| | | public static async Task PublicPosition(PlcPositionInfo context) |
| | | { |
| | | if (PLCTaskAction.boRefresh) |
| | | await _plcHubContext.Clients.All.PublicPosition(context); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 下发任务 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static async Task PublicTask(WcsTaskOutput context) |
| | | { |
| | | if (PLCTaskAction.boRefresh) |
| | | await _taskLogHubContext.Clients.All.PublicTask(context); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 下发任务明细 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static async Task PublicTaskMonitor(WcsTaskMonitorOutput context) |
| | | { |
| | | if (PLCTaskAction.boRefresh) |
| | | await _taskLogHubContext.Clients.All.PublicTaskMonitor(context); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 下发设备信息 |
| | | /// </summary> |
| | | /// <param name="context"></param> |
| | | /// <returns></returns> |
| | | public static async Task PublicPlcDevice(WcsDeviceOutput context) |
| | | { |
| | | if (PLCTaskAction.boRefresh) |
| | | await _plcDeviceHubContext.Clients.All.PublicPlcDevice(context); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 下发分拣任务信息 |
| | | /// </summary> |
| | | /// <param name="context"></param> |
| | | /// <returns></returns> |
| | | public static async Task PublicCheckTask(WcsDeviceTaskOrderDto context) |
| | | { |
| | | if (PLCTaskAction.boRefresh) |
| | | await _checkTaskHubContext.Clients.All.PublicCheckTask(context); |
| | | } |
| | | } |