| | |
| | | namespace WCS.Application; |
| | | |
| | | /// <summary> |
| | | /// PLC集线器 |
| | | /// 任务日志集线器 |
| | | /// </summary> |
| | | [MapHub("/hubs/Plc")] |
| | | public class PlcHub : Hub<IPlcHub> |
| | |
| | | /// </summary> |
| | | /// <param name="context"></param> |
| | | /// <returns></returns> |
| | | //public async Task PublicPlcConn(WcsPlc context) |
| | | //{ |
| | | // await _plcHubContext.Clients.All.PublicPlcConn(context); |
| | | //} |
| | | public async Task PublicPlcConn(WcsPlc context) |
| | | { |
| | | await _plcHubContext.Clients.All.PublicPlcConn(context); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 下发工位状态 |
| | |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// 下发报警信息 |
| | | /// 下发服务状态 |
| | | /// </summary> |
| | | /// <param name="context"></param> |
| | | /// <returns></returns> |
| | | //public async Task PublicAlarm(WcsAlarmInfoOutput context) |
| | | //{ |
| | | // await _plcHubContext.Clients.All.PublicAlarm(context); |
| | | //} |
| | | public async Task UpdateService(PLCServiceModel context) |
| | | { |
| | | //运行状态 |
| | | if (context.BoRunningState.HasValue) |
| | | { |
| | | PLCTaskAction.boRunningState = context.BoRunningState.Value; |
| | | if (context.BoRunningState.Value) |
| | | PLCTaskAction.Init(); |
| | | else |
| | | PLCTaskAction.Stop(); |
| | | } |
| | | //脱机模式 |
| | | if (context.BoOffline.HasValue) |
| | | PLCTaskAction.boOffline = context.BoOffline.Value; |
| | | //自刷新 |
| | | if (context.BoRefresh.HasValue) |
| | | PLCTaskAction.boRefresh = context.BoRefresh.Value; |
| | | await _plcHubContext.Clients.All.UpdateService(context); |
| | | } |
| | | } |
| | | public class PLCServiceModel |
| | | { |
| | | public bool? BoRunningState { get; set; } |
| | | |
| | | |
| | | public bool? BoOffline { get; set; } |
| | | |
| | | |
| | | public bool? BoRefresh { get; set; } |
| | | } |