namespace Admin.NET.Plugin.AiDOP.Entity.S8;
///
/// 异常主表(业务实体;列表为查询该表及关联展示字段,非独立「列表视图表」)。
///
[SugarTable("ado_s8_exception", "S8 异常主表")]
[SugarIndex("uk_ado_s8_exception_tenant_factory_code", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(ExceptionCode), OrderByType.Asc, IsUnique = true)]
[SugarIndex("idx_ado_s8_exception_type_time", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(ExceptionTypeCode), OrderByType.Asc, nameof(CreatedAt), OrderByType.Desc)]
public class AdoS8Exception
{
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true, ColumnDataType = "bigint")]
public long Id { get; set; }
[SugarColumn(ColumnName = "tenant_id", ColumnDataType = "bigint")]
public long TenantId { get; set; }
[SugarColumn(ColumnName = "factory_id", ColumnDataType = "bigint")]
public long FactoryId { get; set; }
[SugarColumn(ColumnName = "exception_code", Length = 64)]
public string ExceptionCode { get; set; } = string.Empty;
[SugarColumn(ColumnName = "title", Length = 256)]
public string Title { get; set; } = string.Empty;
[SugarColumn(ColumnName = "description", Length = 4000, IsNullable = true)]
public string? Description { get; set; }
[SugarColumn(ColumnName = "scene_code", Length = 64)]
public string SceneCode { get; set; } = string.Empty;
[SugarColumn(ColumnName = "source_type", Length = 32)]
public string SourceType { get; set; } = "MANUAL";
[SugarColumn(ColumnName = "status", Length = 32)]
public string Status { get; set; } = "NEW";
[SugarColumn(ColumnName = "severity", Length = 32)]
public string Severity { get; set; } = "MEDIUM";
[SugarColumn(ColumnName = "priority_score", ColumnDataType = "decimal(10,2)")]
public decimal PriorityScore { get; set; }
[SugarColumn(ColumnName = "priority_level", Length = 16)]
public string PriorityLevel { get; set; } = "P3";
[SugarColumn(ColumnName = "occurrence_dept_id", ColumnDataType = "bigint")]
public long OccurrenceDeptId { get; set; }
[SugarColumn(ColumnName = "responsible_dept_id", ColumnDataType = "bigint")]
public long ResponsibleDeptId { get; set; }
[SugarColumn(ColumnName = "responsible_group_id", ColumnDataType = "bigint", IsNullable = true)]
public long? ResponsibleGroupId { get; set; }
[SugarColumn(ColumnName = "assignee_id", ColumnDataType = "bigint", IsNullable = true)]
public long? AssigneeId { get; set; }
[SugarColumn(ColumnName = "reporter_id", ColumnDataType = "bigint", IsNullable = true)]
public long? ReporterId { get; set; }
[SugarColumn(ColumnName = "sla_deadline", IsNullable = true)]
public DateTime? SlaDeadline { get; set; }
[SugarColumn(ColumnName = "timeout_flag", ColumnDataType = "boolean")]
public bool TimeoutFlag { get; set; }
[SugarColumn(ColumnName = "created_at")]
public DateTime CreatedAt { get; set; } = DateTime.Now;
[SugarColumn(ColumnName = "updated_at", IsNullable = true)]
public DateTime? UpdatedAt { get; set; }
[SugarColumn(ColumnName = "assigned_at", IsNullable = true)]
public DateTime? AssignedAt { get; set; }
[SugarColumn(ColumnName = "closed_at", IsNullable = true)]
public DateTime? ClosedAt { get; set; }
/// 所属模块码(S1-S7),标识异常产生于哪个业务环节
[SugarColumn(ColumnName = "module_code", Length = 16, IsNullable = true)]
public string? ModuleCode { get; set; }
[SugarColumn(ColumnName = "process_node_code", Length = 64, IsNullable = true)]
public string? ProcessNodeCode { get; set; }
[SugarColumn(ColumnName = "related_object_code", Length = 64, IsNullable = true)]
public string? RelatedObjectCode { get; set; }
/// 当前进行中的审批实例ID(用于并发控制)
[SugarColumn(ColumnName = "active_flow_instance_id", IsNullable = true)]
public long? ActiveFlowInstanceId { get; set; }
/// 当前进行中的审批业务类型(EXCEPTION_ESCALATION / EXCEPTION_CLOSURE)
[SugarColumn(ColumnName = "active_flow_biz_type", Length = 32, IsNullable = true)]
public string? ActiveFlowBizType { get; set; }
[SugarColumn(ColumnName = "is_deleted", ColumnDataType = "boolean")]
public bool IsDeleted { get; set; }
[SugarColumn(ColumnName = "created_by", Length = 64, IsNullable = true)]
public string? CreatedBy { get; set; }
[SugarColumn(ColumnName = "updated_by", Length = 64, IsNullable = true)]
public string? UpdatedBy { get; set; }
/// 异常类型编码(关联 ado_s8_exception_type.type_code)。配置化改造后新增。
[SugarColumn(ColumnName = "exception_type_code", Length = 64, IsNullable = true)]
public string? ExceptionTypeCode { get; set; }
/// 来源数据源 ID(自动建单时填充;人工提报为空)。关联 ado_s8_data_source.id
[SugarColumn(ColumnName = "source_data_source_id", ColumnDataType = "bigint", IsNullable = true)]
public long? SourceDataSourceId { get; set; }
/// 来源监视规则 ID(自动建单时填充)。关联 ado_s8_watch_rule.id
[SugarColumn(ColumnName = "source_rule_id", ColumnDataType = "bigint", IsNullable = true)]
public long? SourceRuleId { get; set; }
/// 命中规则时的原始数据快照(JSON 文本,便于追溯)
[SugarColumn(ColumnName = "source_payload", Length = 4000, IsNullable = true)]
public string? SourcePayload { get; set; }
/// 检验人ID(提交复检时手选)
[SugarColumn(ColumnName = "verifier_id", ColumnDataType = "bigint", IsNullable = true)]
public long? VerifierId { get; set; }
/// 提交复检时间
[SugarColumn(ColumnName = "verification_assigned_at", IsNullable = true)]
public DateTime? VerificationAssignedAt { get; set; }
/// 检验完成时间
[SugarColumn(ColumnName = "verified_at", IsNullable = true)]
public DateTime? VerifiedAt { get; set; }
/// 检验结果(APPROVED / REJECTED)
[SugarColumn(ColumnName = "verification_result", Length = 32, IsNullable = true)]
public string? VerificationResult { get; set; }
/// 检验意见
[SugarColumn(ColumnName = "verification_remark", Length = 2000, IsNullable = true)]
public string? VerificationRemark { get; set; }
}