|
|
@@ -1,6 +1,7 @@
|
|
|
using Admin.NET.Plugin.AiDOP.Entity.S0.Manufacturing;
|
|
|
using Admin.NET.Plugin.AiDOP.Entity.S0.Warehouse;
|
|
|
using Admin.NET.Plugin.AiDOP.Entity.S8;
|
|
|
+using Admin.NET.Plugin.AiDOP.Infrastructure.S8;
|
|
|
|
|
|
namespace Admin.NET.Plugin.AiDOP.Service.S8;
|
|
|
|
|
|
@@ -25,8 +26,10 @@ public class S8DashboardService : ITransient
|
|
|
// 看板顶部的"开始/结束日期"通过 beginTime/endTime 透传,与列表的 beginTime/endTime 同语义。
|
|
|
// BUG-12:补 severity 过滤,与异常列表 API 的 severity 口径一致(精确匹配 LOW/MEDIUM/HIGH/CRITICAL)。
|
|
|
// BUG-22:REJECTED 状态归入 pending 桶,避免从总数视角"消失";与列表 statusBucket="pending" 同步对齐。
|
|
|
+ // S8-DASHBOARD-DATA-ALIGN-S1S7-1:统一只统计 module_code IN S1-S7;NULL module 的 legacy 行不参与看板 KPI。
|
|
|
var q = _rep.AsQueryable()
|
|
|
.Where(x => x.TenantId == tenantId && x.FactoryId == factoryId && !x.IsDeleted)
|
|
|
+ .Where(x => S8ModuleCode.All.Contains(x.ModuleCode))
|
|
|
.WhereIF(beginTime.HasValue, x => x.CreatedAt >= beginTime!.Value)
|
|
|
.WhereIF(endTime.HasValue, x => x.CreatedAt <= endTime!.Value)
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(severity), x => x.Severity == severity);
|
|
|
@@ -57,6 +60,7 @@ public class S8DashboardService : ITransient
|
|
|
var from = DateTime.Today.AddDays(-Math.Clamp(days, 1, 90));
|
|
|
var rows = await _rep.AsQueryable()
|
|
|
.Where(x => x.TenantId == tenantId && x.FactoryId == factoryId && !x.IsDeleted && x.CreatedAt >= from)
|
|
|
+ .Where(x => S8ModuleCode.All.Contains(x.ModuleCode))
|
|
|
.Select(x => new { x.CreatedAt })
|
|
|
.ToListAsync();
|
|
|
|
|
|
@@ -71,6 +75,7 @@ public class S8DashboardService : ITransient
|
|
|
{
|
|
|
var list = await _rep.AsQueryable()
|
|
|
.Where(x => x.TenantId == tenantId && x.FactoryId == factoryId && !x.IsDeleted)
|
|
|
+ .Where(x => S8ModuleCode.All.Contains(x.ModuleCode))
|
|
|
.Select(x => new
|
|
|
{
|
|
|
x.Status,
|
|
|
@@ -151,6 +156,7 @@ public class S8DashboardService : ITransient
|
|
|
|
|
|
var list = await _rep.AsQueryable()
|
|
|
.Where(x => x.TenantId == tenantId && x.FactoryId == factoryId && !x.IsDeleted)
|
|
|
+ .Where(x => S8ModuleCode.All.Contains(x.ModuleCode))
|
|
|
.Select(x => new { x.ResponsibleDeptId, x.Status, x.TimeoutFlag })
|
|
|
.ToListAsync();
|
|
|
|
|
|
@@ -186,6 +192,7 @@ public class S8DashboardService : ITransient
|
|
|
|
|
|
var rows = await _rep.AsQueryable()
|
|
|
.Where(x => x.TenantId == tenantId && x.FactoryId == factoryId && !x.IsDeleted && x.CreatedAt >= from)
|
|
|
+ .Where(x => S8ModuleCode.All.Contains(x.ModuleCode))
|
|
|
.Select(x => new
|
|
|
{
|
|
|
x.CreatedAt,
|
|
|
@@ -247,7 +254,9 @@ public class S8DashboardService : ITransient
|
|
|
|
|
|
public async Task<List<AdoS8Exception>> GetQuickExceptionsAsync(long tenantId, long factoryId, string mode)
|
|
|
{
|
|
|
- var q = _rep.AsQueryable().Where(x => x.TenantId == tenantId && x.FactoryId == factoryId && !x.IsDeleted);
|
|
|
+ var q = _rep.AsQueryable()
|
|
|
+ .Where(x => x.TenantId == tenantId && x.FactoryId == factoryId && !x.IsDeleted)
|
|
|
+ .Where(x => S8ModuleCode.All.Contains(x.ModuleCode));
|
|
|
var ordered = mode switch
|
|
|
{
|
|
|
"high-priority" => q.OrderBy(x => x.PriorityScore, OrderByType.Desc),
|