From afcecb06505032ada09a4a2e33eed1f7979250e9 Mon Sep 17 00:00:00 2001 From: hwh <332078369@qq.com> Date: 星期四, 05 九月 2024 11:16:59 +0800 Subject: [PATCH] 报警监控 --- Admin.NET/WCS.Application/Service/WcsAlarmInfo/WcsAlarmInfoService.cs | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Admin.NET/WCS.Application/Service/WcsAlarmInfo/WcsAlarmInfoService.cs b/Admin.NET/WCS.Application/Service/WcsAlarmInfo/WcsAlarmInfoService.cs index a5eda3e..e2eef27 100644 --- a/Admin.NET/WCS.Application/Service/WcsAlarmInfo/WcsAlarmInfoService.cs +++ b/Admin.NET/WCS.Application/Service/WcsAlarmInfo/WcsAlarmInfoService.cs @@ -1,4 +1,6 @@ -锘縩amespace WCS.Application; +锘縰sing Microsoft.AspNetCore.SignalR; + +namespace WCS.Application; /// <summary> /// 鎶ヨ淇℃伅琛ㄦ湇鍔� @@ -7,9 +9,11 @@ public class WcsAlarmInfoService : IDynamicApiController, ITransient { private readonly SqlSugarRepository<WcsAlarmInfo> _wcsAlarmInfoRep; - public WcsAlarmInfoService(SqlSugarRepository<WcsAlarmInfo> wcsAlarmInfoRep) + private readonly IHubContext<PlcHub, IPlcHub> _plcHubContext; + public WcsAlarmInfoService(SqlSugarRepository<WcsAlarmInfo> wcsAlarmInfoRep, IHubContext<PlcHub, IPlcHub> plcHubContext) { _wcsAlarmInfoRep = wcsAlarmInfoRep; + _plcHubContext = plcHubContext; } /// <summary> @@ -119,7 +123,11 @@ [DisplayName("澶嶄綅鎶ヨ")] public async Task Reset() { - throw Oops.Bah("寮�鍙戜腑"); + //娴嬭瘯鎺ㄦ暟鎹敤鐨� + await _plcHubContext.Clients.All.PublicAlarm(new List<WcsAlarmInfo>() { new WcsAlarmInfo() { Id = 100, StationNum = "260", AlarmCode = "MB102", AlarmName = "鏈夌墿鍝侀伄鎸�", AlarmTime = DateTime.Now, Status = YesNoEnum.N } }); + //await _plcHubContext.Clients.All.PublicAlarm(new WcsAlarmInfo() { Id = 100, StationNum = "260", AlarmCode = "MB102", AlarmName = "鏈夌墿鍝侀伄鎸�", AlarmTime = DateTime.Now, Status = YesNoEnum.Y }); + + //throw Oops.Bah("寮�鍙戜腑"); } -- Gitblit v1.8.0