From 04d10bce51a6272d02a4a0f1b05a4f64bf73f273 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周二, 05 8月 2025 16:48:03 +0800
Subject: [PATCH] 休眠10秒 ,2秒改为10秒 【Editby shaocx,2025-08-05】

---
 CC/iWareCC_ASRS/Handler/DeviceWarningHandler.cs |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/CC/iWareCC_ASRS/Handler/DeviceWarningHandler.cs b/CC/iWareCC_ASRS/Handler/DeviceWarningHandler.cs
index b100a0d..2625338 100644
--- a/CC/iWareCC_ASRS/Handler/DeviceWarningHandler.cs
+++ b/CC/iWareCC_ASRS/Handler/DeviceWarningHandler.cs
@@ -1,4 +1,5 @@
-锘縰sing iWareCommon.Common.Globle;
+锘縰sing Admin.NET.Application;
+using iWareCommon.Common.Globle;
 using iWareCommon.Utils;
 using iWareModel;
 using iWareSql.WmsDBModel;
@@ -23,13 +24,27 @@
             DeviceWarningOutput output = new DeviceWarningOutput();
             System.Collections.Generic.List<iWareCC.StationService.WmsConfigDeviceWarning> retList = new System.Collections.Generic.List<iWareCC.StationService.WmsConfigDeviceWarning>();
             System.Collections.Generic.List<wms_config_device_warning> dbList = new System.Collections.Generic.List<wms_config_device_warning>();
+            System.Collections.Generic.List<wms_config_device_warning> real_dbList = new System.Collections.Generic.List<wms_config_device_warning>();
             try
             {
                 using (WmsDBModel edm = new WmsDBModel())
                 {
-                    dbList = edm.wms_config_device_warning.ToList();
+                    //娉ㄦ剰锛氬彧鏌ヨ  瀹夊叏鎶ヨ銆佺‖浠舵姤璀︿俊鎭�
+                    var query1 = (int)DeviceWarningTypeEnum.瀹夊叏鎶ヨ;
+                    var query2 = (int)DeviceWarningTypeEnum.纭欢鎶ヨ;
+                    dbList = edm.wms_config_device_warning.Where(x => x.DeviceWarningType == query1 || x.DeviceWarningType == query2).ToList();
+                    //姣忕鍖哄煙鐨勬瘡绉嶇被鍨嬶紝鍙彇鍓�20鏉¤褰�
+                    var groupedData = dbList.GroupBy(x => new { x.DeviceAreaCode, x.DeviceWarningType }).Select(group => new
+                    {
+                        GroupKey = group.Key,
+                        Top20Items = group.ToList().OrderBy(x => x.Id).Take(20)
+                    });
+                    foreach (var item in groupedData)
+                    {
+                        real_dbList.AddRange(item.Top20Items);
+                    }
                 }
-                foreach (var item in dbList)
+                foreach (var item in real_dbList)
                 {
                     retList.Add(new StationService.WmsConfigDeviceWarning()
                     {
@@ -43,7 +58,7 @@
             }
 
             output.wmsConfigDeviceWarnings = retList;
-            output.wms_config_device_warning_list = dbList;
+            output.wms_config_device_warning_list = real_dbList;
             return output;
         }
 

--
Gitblit v1.9.3