From f8c3e66071ff442b25c17e13c91b0b6e1d1cbea5 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周日, 15 12月 2024 09:00:52 +0800 Subject: [PATCH] 22 --- CC/iWareCC_ASRS/Handler/DeviceWarningHandler.cs | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CC/iWareCC_ASRS/Handler/DeviceWarningHandler.cs b/CC/iWareCC_ASRS/Handler/DeviceWarningHandler.cs index 774a7be..2625338 100644 --- a/CC/iWareCC_ASRS/Handler/DeviceWarningHandler.cs +++ b/CC/iWareCC_ASRS/Handler/DeviceWarningHandler.cs @@ -24,6 +24,7 @@ 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()) @@ -32,8 +33,18 @@ 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() { @@ -47,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