From d9e59ed2e947aff29b7c21a9b0e8b6e12d741692 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期五, 30 八月 2024 14:54:18 +0800
Subject: [PATCH] 解决冲突

---
 Admin.NET/WCS.Application/Service/WcsAlarmInfo/WcsAlarmInfoService.cs |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/Admin.NET/WCS.Application/Service/WcsAlarmInfo/WcsAlarmInfoService.cs b/Admin.NET/WCS.Application/Service/WcsAlarmInfo/WcsAlarmInfoService.cs
index eb15497..5860a85 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,12 @@
 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>
@@ -102,11 +107,27 @@
     [DisplayName("鑾峰彇鎶ヨ淇℃伅琛ㄥ垪琛�")]
     public async Task<List<WcsAlarmInfoOutput>> List([FromQuery] PageWcsAlarmInfoInput input)
     {
-        return await _wcsAlarmInfoRep.AsQueryable().Select<WcsAlarmInfoOutput>().ToListAsync();
+        return await _wcsAlarmInfoRep.AsQueryable()
+            //.WhereIF(!input.Status.IsNullOrEmpty(), s => s.Status == input.Status)
+            .Select<WcsAlarmInfoOutput>().ToListAsync();
     }
 
 
+    /// <summary>
+    /// 澶嶄綅鎶ヨ
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    [HttpPost]
+    [ApiDescriptionSettings(Name = "Reset")]
+    [DisplayName("澶嶄綅鎶ヨ")]
+    public async Task Reset()
+    {
+        //娴嬭瘯鎺ㄦ暟鎹敤鐨�
+        await _plcHubContext.Clients.All.PublicAlarm(new WcsAlarmInfoOutput() { Id = new Random().Next(), StationNum = "205", AlarmCode = "MB102", AlarmName = "鏈夌墿鍝侀伄鎸�", AlarmTime = DateTime.Now });
+        //throw Oops.Bah("寮�鍙戜腑");
 
+    }
 
 
 }

--
Gitblit v1.8.0