namespace Admin.NET.Plugin.AiDOP.Dto.S8; public class AdoS8ExceptionQueryDto { public long TenantId { get; set; } = 1; public long FactoryId { get; set; } = 1; public string? Keyword { get; set; } public string? Status { get; set; } public string? StatusBucket { get; set; } public string? Severity { get; set; } public string? SceneCode { get; set; } /// 模块码过滤(S1-S7),用于监控页下钻 public string? ModuleCode { get; set; } public long? DeptId { get; set; } public bool? TimeoutFlag { get; set; } public string? ProcessNodeCode { get; set; } public string? RelatedObjectCode { get; set; } public DateTime? BeginTime { get; set; } public DateTime? EndTime { get; set; } /// 是否包含 exception_type_code 为 NULL 的未分类历史异常;默认 false(隐藏)。 public bool? IncludeUnclassified { get; set; } /// 恢复状态筛选:RECOVERED / ACTIVE / 空=不限。 public string? RecoveredStatus { get; set; } /// 规则类型筛选:OUT_OF_RANGE / TIMEOUT / SHORTAGE / 空=不限;通过 source_rule_code join watch_rule.rule_type。 public string? RuleType { get; set; } /// S8-DASHBOARD-DATA-ALIGN-S1S7-1:仅返回 module_code IN S1-S7 的异常;看板明细表传 true 与 KPI 口径对齐。 /// 默认 false 以保证异常列表页(/aidop/s8/exceptions)行为不变。 public bool? OnlyS1S7Modules { get; set; } /// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t3j:按订单链路阶段(大写 ORDER_FLOW code)筛选。 public string? OrderFlowCode { get; set; } /// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t3j:按 S_STAGE 阶段筛选。 public string? StageCode { get; set; } /// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t3j:按规则机制筛选。 public string? RuleMechanism { get; set; } public int Page { get; set; } = 1; public int PageSize { get; set; } = 20; /// S8-DEMO-IMPACT-SORT-NOTICE-1:排序字段白名单。 /// 允许值:createdAt / severity / priorityScore / repeatCount30d / cumulativeLossHours30d / impactScore。 /// 空或非白名单 → 默认 createdAt DESC。 public string? SortField { get; set; } /// S8-DEMO-IMPACT-SORT-NOTICE-1:排序方向。asc / desc;非法值降级为 desc。 public string? SortOrder { get; set; } } public class AdoS8ExceptionListItemDto { public long Id { get; set; } public long FactoryId { get; set; } public string ExceptionCode { get; set; } = string.Empty; public string Title { get; set; } = string.Empty; public string Status { get; set; } = string.Empty; public string? StatusLabel { get; set; } public string Severity { get; set; } = string.Empty; public string? SeverityLabel { get; set; } public decimal PriorityScore { get; set; } public string PriorityLevel { get; set; } = string.Empty; public string SceneCode { get; set; } = string.Empty; public string? SceneName { get; set; } /// S8-EXCEPTION-MODULE-DISPLAY-1:业务展示主口径(S1-S7)。SceneCode/SceneName 保留兼容期。 public string? ModuleCode { get; set; } public string? ModuleName { get; set; } public long ResponsibleDeptId { get; set; } public string? ResponsibleDeptName { get; set; } public long OccurrenceDeptId { get; set; } public string? OccurrenceDeptName { get; set; } public long? AssigneeId { get; set; } public string? AssigneeName { get; set; } public DateTime? SlaDeadline { get; set; } public bool TimeoutFlag { get; set; } public DateTime CreatedAt { get; set; } public DateTime? ClosedAt { get; set; } /// S8-DEMO-CORE-FIELD-COMPLETE-1:损失时间(小时,保留 1 位小数)= ClosedAt - CreatedAt。未关闭为 null。 public decimal? LossHours { get; set; } /// S8-DEMO-CORE-FIELD-COMPLETE-1:是否超时关闭(冻结判定)= ClosedAt > SlaDeadline。未关闭或无 SLA 为 null。与运行时 TimeoutFlag 含义不同。 public bool? IsOverdueClosed { get; set; } public string? ExceptionTypeCode { get; set; } public DateTime? RecoveredAt { get; set; } public string? SourceRuleCode { get; set; } public string? SourceObjectType { get; set; } public string? SourceObjectId { get; set; } public string? DedupKey { get; set; } public DateTime? LastDetectedAt { get; set; } public string? RuleType { get; set; } /// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t3j:关联对象编码(订单链路场景下为 order_code)。 public string? RelatedObjectCode { get; set; } /// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t3j:订单链路大写 code(5 阶段协议枚举)。 public string? OrderFlowCode { get; set; } /// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t3j:S_STAGE 阶段。 public string? StageCode { get; set; } /// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t3j:规则机制。 public string? RuleMechanism { get; set; } // ============================================================ // S8-DEMO-IMPACT-SORT-NOTICE-1:影响统计字段(运行期计算,不落库)。 // 同类异常归类键 = (tenant_id, factory_id, exception_type_code);窗口 = 滚动 30 天。 // ============================================================ /// 过去 30 天同 exception_type_code 异常出现次数;exception_type_code 为 NULL 时回退 1。 public int RepeatCount30d { get; set; } /// 过去 30 天同 exception_type_code 已关闭异常累计损失小时数(closed_at - created_at),未关闭不计入;保留 1 位小数。 public decimal CumulativeLossHours30d { get; set; } /// 综合影响分(severityWeight + repeatWeight + lossWeight + timeoutWeight),保留 1 位小数。 public decimal ImpactScore { get; set; } /// 建议关注级别枚举:HIGH / MEDIUM / LOW。 public string? SuggestedAttentionLevel { get; set; } /// 建议关注级别中文标签:高 / 中 / 低。 public string? SuggestedAttentionLabel { get; set; } /// 影响判定原因简述(如 "重复 5 次/累计损失 30 小时")。 public string? ImpactReason { get; set; } } public class AdoS8ExceptionDetailDto : AdoS8ExceptionListItemDto { public string? Description { get; set; } public string SourceType { get; set; } = string.Empty; public long? ResponsibleGroupId { get; set; } public long? ReporterId { get; set; } public string? ReporterName { get; set; } public DateTime? AssignedAt { get; set; } public DateTime? UpdatedAt { get; set; } public long? ActiveFlowInstanceId { get; set; } public string? ActiveFlowBizType { get; set; } public long? VerifierId { get; set; } public string? VerifierName { get; set; } public DateTime? VerificationAssignedAt { get; set; } public DateTime? VerifiedAt { get; set; } public string? VerificationResult { get; set; } public string? VerificationRemark { get; set; } public long? SourceRuleId { get; set; } } public class AdoS8ManualReportCreateDto { public long TenantId { get; set; } = 1; public long FactoryId { get; set; } = 1; public string Title { get; set; } = string.Empty; public string? Description { get; set; } public string SceneCode { get; set; } = string.Empty; public string Severity { get; set; } = "FOLLOW"; public long OccurrenceDeptId { get; set; } public long ResponsibleDeptId { get; set; } public long? ReporterId { get; set; } /// 关联对象编码:当前按订单项 / 类订单项对象理解,允许重复,可为空。最长 64 字符(与 ado_s8_exception.related_object_code 一致)。 public string? RelatedObjectCode { get; set; } // TASK-002-RESET-DIMENSION-MODEL-DEV-2B:手工提报维度选择(前端首版可不传,按 module_code 兜底;rule_mechanism 固定 MANUAL_REPORT)。 public string? StageCode { get; set; } public string? OrderFlowCode { get; set; } } public class AdoS8ManualReportResultDto { public long ExceptionId { get; set; } public string ExceptionCode { get; set; } = string.Empty; public long TaskId { get; set; } } public class AdoS8TimelineItemDto { public long Id { get; set; } public string ActionCode { get; set; } = string.Empty; public string ActionLabel { get; set; } = string.Empty; public string? FromStatus { get; set; } public string? ToStatus { get; set; } public long? OperatorId { get; set; } public string? OperatorName { get; set; } public string? ActionRemark { get; set; } public DateTime CreatedAt { get; set; } } public class AdoS8DecisionItemDto { public long Id { get; set; } public string DecisionType { get; set; } = string.Empty; public long DecisionMakerId { get; set; } public string DecisionMakerName { get; set; } = string.Empty; public string? DecisionBasis { get; set; } public string? DecisionResult { get; set; } public string? DecisionRemark { get; set; } public DateTime DecisionTime { get; set; } } public class AdoS8EvidenceItemDto { public long Id { get; set; } public string EvidenceType { get; set; } = string.Empty; public string FileName { get; set; } = string.Empty; public string FileUrl { get; set; } = string.Empty; public string? SourceSystem { get; set; } public long? UploadedBy { get; set; } public DateTime UploadedAt { get; set; } } public class AdoS8CommentDto { public string? Remark { get; set; } } public class AdoS8TransferDto { public long AssigneeId { get; set; } public string? Remark { get; set; } } public class AdoS8AttachmentCreateDto { public string EvidenceType { get; set; } = "file"; public string FileName { get; set; } = string.Empty; public string FileUrl { get; set; } = string.Empty; public string? SourceSystem { get; set; } public long? UploadedBy { get; set; } } // ── 监控汇总 DTO ───────────────────────────────────────────────────────────── public class AdoS8MonitoringSummaryQueryDto { public long TenantId { get; set; } = 1; public long FactoryId { get; set; } = 1; /// 场景码过滤(不传 = 全部) public string? SceneCode { get; set; } /// 模块码过滤(不传 = 全部) public string? ModuleCode { get; set; } public DateTime? BizDateFrom { get; set; } public DateTime? BizDateTo { get; set; } /// 统一时间筛选:today / this_week / this_month。BizDateFrom/BizDateTo 已传时优先于 Period。 public string? Period { get; set; } } /// 单个模块的异常汇总行 public class AdoS8ModuleSummaryItem { public string ModuleCode { get; set; } = string.Empty; public string ModuleLabel { get; set; } = string.Empty; public string SceneCode { get; set; } = string.Empty; public string SceneLabel { get; set; } = string.Empty; public int Total { get; set; } public int Red { get; set; } public int Yellow { get; set; } public int Green { get; set; } public int Timeout { get; set; } // S8-OVERVIEW-STAGE-CARD-LIFECYCLE-COPY-AND-METRIC-FIX-1:severity × timeout 双桶,与 Timeout 同 SLA 口径。 public int SeriousTimeout { get; set; } public int FollowTimeout { get; set; } } /// 监控汇总出参(综合全景页顶部 + 表格数据) public class AdoS8MonitoringSummaryDto { public int Total { get; set; } public int Red { get; set; } public int Yellow { get; set; } public int Green { get; set; } public int Timeout { get; set; } public int SeriousTimeout { get; set; } public int FollowTimeout { get; set; } public List ByModule { get; set; } = new(); } // ── 9宫格 OrderGrid DTO ────────────────────────────────────────────────────── /// S1-S7 单个模块的订单健康分布(9宫格前7格) public class AdoS8ModuleOrderSummary { public string ModuleCode { get; set; } = string.Empty; public string ModuleLabel { get; set; } = string.Empty; /// 绿色订单数(来自订单主数据,不从异常 severity 推导)。 public int Green { get; set; } /// 黄色订单数(FOLLOW 关注)。 public int Yellow { get; set; } /// 红色订单数(SERIOUS 严重,或黄色超时)。 public int Red { get; set; } public int Total { get; set; } /// 异常发生频率(每百订单异常数) public double Frequency { get; set; } /// 平均处理时效(小时) public double AvgProcessHours { get; set; } /// 异常关闭百分比 public double CloseRate { get; set; } } /// S8格:按业务类别汇总(第8格) public class AdoS8CategorySummary { public string Category { get; set; } = string.Empty; public int Total { get; set; } public double AvgProcessHours { get; set; } public double CloseRate { get; set; } } /// S9格:按责任部门汇总(第9格) public class AdoS8DeptSummary { public string DeptName { get; set; } = string.Empty; public int Total { get; set; } public double AvgProcessHours { get; set; } public double CloseRate { get; set; } } /// 9宫格完整出参 public class AdoS8OrderGridDto { public List Modules { get; set; } = new(); public List ByCategory { get; set; } = new(); public List ByDept { get; set; } = new(); } /// S9 QDC 四主线聚合单项 public class AdoS8QdcSummaryItemDto { /// 主线码:QUALITY / DELIVERY / COST / INVENTORY public string Code { get; set; } = string.Empty; public string Title { get; set; } = string.Empty; public int Total { get; set; } public double? AvgProcessHours { get; set; } public double? OnTimeCloseRate { get; set; } public double? CloseRate { get; set; } public string? Remark { get; set; } } /// S9 QDC 四主线聚合出参 public class AdoS8QdcSummaryDto { public List Items { get; set; } = new(); } /// /// S9 result KPI 单项。currentValue/targetRatio 由 service 按 metricCode 决定。 /// public class AdoS8ResultKpiItemDto { /// 指标码(与 ado_s8_monitor_metric.metric_code 同源) public string MetricCode { get; set; } = string.Empty; public string MetricName { get; set; } = string.Empty; public string ObjectCode { get; set; } = string.Empty; public string Unit { get; set; } = "%"; public decimal? CurrentValue { get; set; } public decimal? TargetRatio { get; set; } public bool DictionaryEnabled { get; set; } public string? Remark { get; set; } /// 每项来源:DEMO_BASELINE / ORDER_FLOW_CALC / ORDER_FLOW_CALC_EMPTY / PENDING_REAL。 public string Source { get; set; } = "DEMO_BASELINE"; } /// S9 result KPI summary 出参。Source 顶层:DICTIONARY_MOCK / MIXED_BASELINE / REAL。 public class AdoS8ResultKpiSummaryDto { public List Items { get; set; } = new(); public string Source { get; set; } = "DICTIONARY_MOCK"; } /// S8-DELIVERY-TREND-CHART-REPLACE-DUPLICATE-SECTION-1:Delivery 页近 N 日交付异常趋势出参。 public class AdoS8DeliveryTrendDto { public List Days { get; set; } = new(); public AdoS8DeliveryTrendSummaryDto Summary { get; set; } = new(); } public class AdoS8DeliveryTrendDayDto { /// 日期短格式 MM/dd(图表 X 轴) public string Date { get; set; } = string.Empty; /// 原始日期 yyyy-MM-dd public string RawDate { get; set; } = string.Empty; /// 订单交期延期(ORDER_DUE_DATE_DELAY)当日计数 public int OrderDueDateDelay { get; set; } /// 产品设计延期(PRODUCT_DESIGN_DELAY)当日计数 public int ProductDesignDelay { get; set; } /// 总装发货延期(DELIVERY_DELAY_WARNING)当日计数 public int DeliveryDelayWarning { get; set; } public int Total { get; set; } } public class AdoS8DeliveryTrendSummaryDto { public int PeakValue { get; set; } public string? PeakDate { get; set; } public double AvgValue { get; set; } public int TodayValue { get; set; } /// 今日相对昨日变化率(%);昨日为 0 时返回 null。 public double? TodayChangeRate { get; set; } } /// S8-PROD-SUPPLY-TREND-CHART-REPLACE-DUPLICATE-SECTION-1:Production 页近 N 日生产异常趋势出参。 public class AdoS8ProductionTrendDto { public List Days { get; set; } = new(); public AdoS8DeliveryTrendSummaryDto Summary { get; set; } = new(); } public class AdoS8ProductionTrendDayDto { public string Date { get; set; } = string.Empty; public string RawDate { get; set; } = string.Empty; public int EquipmentFault { get; set; } public int MaterialFault { get; set; } public int QualityFault { get; set; } /// 本体生产延期(BODY_PRODUCTION_DELAY_WARNING)当日计数 public int BodyProductionDelay { get; set; } public int Total { get; set; } } /// S8-PROD-SUPPLY-TREND-CHART-REPLACE-DUPLICATE-SECTION-1:Supply 页近 N 日供应异常趋势出参。 public class AdoS8SupplyTrendDto { public List Days { get; set; } = new(); public AdoS8DeliveryTrendSummaryDto Summary { get; set; } = new(); } public class AdoS8SupplyTrendDayDto { public string Date { get; set; } = string.Empty; public string RawDate { get; set; } = string.Empty; public int SupplierEtaIssue { get; set; } public int SupplierShipIssue { get; set; } /// 供应商交付延期预警(SUPPLIER_DELIVERY_DELAY_WARNING)当日计数 public int SupplierDeliveryDelayWarning { get; set; } public int WarehouseReceiptAbnormal { get; set; } public int IqcIssue { get; set; } public int WarehousePutawayIssue { get; set; } public int WorkOrderKittingAbnormal { get; set; } public int WorkOrderIssueAbnormal { get; set; } /// 采购执行延期(PURCHASE_EXECUTION_DELAY)当日计数 public int PurchaseExecutionDelay { get; set; } /// 物料库存异常(MATERIAL_STOCK_ABNORMAL)当日计数 public int MaterialStockAbnormal { get; set; } /// 库存周转异常(INVENTORY_TURNOVER_ABNORMAL)当日计数 public int InventoryTurnoverAbnormal { get; set; } public int Total { get; set; } } /// /// S8-SIDEBAR-TYPE-CARD-WINDOW-TOGGLE-1:右侧异常类型卡按时间窗口切片(LAST_24H / LAST_7D)出参。 /// 同一窗口内 total / open / closed / avgProcessHours / closeRate 共用同一分母,避免跨窗口拼接误读。 /// public class AdoS8DomainTypeMetricsDto { public string Domain { get; set; } = string.Empty; public string Window { get; set; } = string.Empty; public int Total { get; set; } public List Items { get; set; } = new(); } public class AdoS8DomainTypeMetricItemDto { public string Key { get; set; } = string.Empty; public string Label { get; set; } = string.Empty; public string TypeCode { get; set; } = string.Empty; public int Total { get; set; } public int OpenCount { get; set; } public int ClosedCount { get; set; } /// 已关闭样本均时(小时);无 closed 样本时 null,前端展示 --。 public double? AvgProcessHours { get; set; } /// 关闭率 %;total=0 时 null,前端展示 --。 public double? CloseRate { get; set; } } public class AdoS8SubmitVerificationDto { public long VerifierId { get; set; } public string? Remark { get; set; } } public class AdoS8ApproveVerificationDto { public string? Remark { get; set; } } public class AdoS8RejectVerificationDto { public string Remark { get; set; } = string.Empty; } // TASK-002-RESET-DIMENSION-MODEL-DEV-1: S8 业务维度元数据 DTO public class AdoS8DimensionDto { public string DimensionCode { get; set; } = string.Empty; public string DimensionName { get; set; } = string.Empty; public bool Enabled { get; set; } public int SortNo { get; set; } public string? Remark { get; set; } } // ── TASK-015-TREE-DEV-1:异常类型树形结构 DTO ───────────────────────────── /// /// 异常类型树节点;2 层结构(父节点 IsGroup=true → 子节点 IsGroup=false)。 /// 父节点不可作为业务异常类型;未归类子节点(ParentId=null AND IsGroup=false)由前端组装虚拟根。 /// public class AdoS8ExceptionTypeTreeNodeDto { public long Id { get; set; } public string TypeCode { get; set; } = string.Empty; public string TypeName { get; set; } = string.Empty; public long? ParentId { get; set; } public bool IsGroup { get; set; } public string SceneCode { get; set; } = string.Empty; public string SeverityDefault { get; set; } = string.Empty; public int SlaMinutes { get; set; } public string? OwnerRoleCode { get; set; } public string? EscalateRoleCode { get; set; } public string StatsMode { get; set; } = string.Empty; public string? MonitoringCategoryKey { get; set; } public bool MobileVisible { get; set; } public string? Icon { get; set; } public bool Enabled { get; set; } public int SortNo { get; set; } public string? Remark { get; set; } public DateTime CreatedAt { get; set; } public DateTime? UpdatedAt { get; set; } public List Children { get; set; } = new(); } /// /// 异常类型树出参:顶层只包含 5 个真实父节点(IsGroup=true)。 /// 未归类节点单独以 Orphans 列表返回,由前端拼装虚拟根,避免 DB 引入未归类父节点。 /// public class AdoS8ExceptionTypeTreeDto { public List Roots { get; set; } = new(); public List Orphans { get; set; } = new(); } public class AdoS8DimensionNodeDto { public long Id { get; set; } public string DimensionCode { get; set; } = string.Empty; public string NodeCode { get; set; } = string.Empty; public string NodeName { get; set; } = string.Empty; public long? ParentId { get; set; } public int Level { get; set; } public string Path { get; set; } = string.Empty; public bool IsSelectable { get; set; } /// = !IsSelectable,供前端树选择器直接消费 public bool Disabled { get; set; } public bool Enabled { get; set; } public int SortNo { get; set; } public string? Remark { get; set; } public List Children { get; set; } = new(); }