From 8893638de46547923e0684220df3d9782f7ec283 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周一, 10 3月 2025 11:01:49 +0800
Subject: [PATCH] 缓存岛需要加个批次号条件、可以选择某个批次出
---
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