namespace Admin.NET.Plugin.AiDOP.Entity.S8; /// /// S8 监控指标字典。每条指标绑定一个 object_code + 一个 mechanism(DATE/VALUE_RANGE/RATIO)。 /// 字段映射:DATE 用 due_at_field/status_field;VALUE_RANGE/RATIO 用 measured_value_field。 /// is_result_kpi=true 时表示该指标是 S9 结果 KPI 范畴(如交付满足率),本轮 seed 默认 enabled=false。 /// CONFIG-MONITOR-DICT-READONLY-SEED-1:本轮只读字典。 /// [SugarTable("ado_s8_monitor_metric", "S8 监控指标字典")] [SugarIndex("uk_s8_monitor_metric_tenant_factory_code", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(MetricCode), OrderByType.Asc, IsUnique = true)] [SugarIndex("idx_s8_monitor_metric_object_mech", nameof(ObjectCode), OrderByType.Asc, nameof(Mechanism), OrderByType.Asc, nameof(Enabled), OrderByType.Asc, nameof(SortNo), OrderByType.Asc)] [SugarIndex("idx_s8_monitor_metric_tfe", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(Enabled), OrderByType.Asc)] public class AdoS8MonitorMetric { [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; } /// 所属对象编码(关联 ado_s8_monitor_object.object_code)。 [SugarColumn(ColumnName = "object_code", Length = 64)] public string ObjectCode { get; set; } = string.Empty; /// 指标编码(业务唯一),如 ORDER_DUE_AT / IQC_VALUE / WO_COMPLETION_RATE。 [SugarColumn(ColumnName = "metric_code", Length = 64)] public string MetricCode { get; set; } = string.Empty; [SugarColumn(ColumnName = "metric_name", Length = 128)] public string MetricName { get; set; } = string.Empty; /// 报警机制:DATE / VALUE_RANGE / RATIO(与 watch_rule.rule_mechanism 一致)。 [SugarColumn(ColumnName = "mechanism", Length = 32)] public string Mechanism { get; set; } = string.Empty; [SugarColumn(ColumnName = "unit", Length = 32, IsNullable = true)] public string? Unit { get; set; } [SugarColumn(ColumnName = "due_at_field", Length = 64, IsNullable = true)] public string? DueAtField { get; set; } [SugarColumn(ColumnName = "status_field", Length = 64, IsNullable = true)] public string? StatusField { get; set; } [SugarColumn(ColumnName = "measured_value_field", Length = 64, IsNullable = true)] public string? MeasuredValueField { get; set; } [SugarColumn(ColumnName = "object_id_field", Length = 64, IsNullable = true)] public string? ObjectIdField { get; set; } [SugarColumn(ColumnName = "object_code_field", Length = 64, IsNullable = true)] public string? ObjectCodeField { get; set; } [SugarColumn(ColumnName = "object_name_field", Length = 64, IsNullable = true)] public string? ObjectNameField { get; set; } [SugarColumn(ColumnName = "default_grace_minutes", IsNullable = true)] public int? DefaultGraceMinutes { get; set; } [SugarColumn(ColumnName = "default_completed_states", Length = 256, IsNullable = true)] public string? DefaultCompletedStates { get; set; } [SugarColumn(ColumnName = "default_target_ratio", ColumnDataType = "decimal(10,2)", IsNullable = true)] public decimal? DefaultTargetRatio { get; set; } [SugarColumn(ColumnName = "default_lower_bound", ColumnDataType = "decimal(18,6)", IsNullable = true)] public decimal? DefaultLowerBound { get; set; } [SugarColumn(ColumnName = "default_upper_bound", ColumnDataType = "decimal(18,6)", IsNullable = true)] public decimal? DefaultUpperBound { get; set; } /// 是否为 S9 结果 KPI 类指标(交付满足率/完工率/合格率等);true 时本轮 seed 默认 disabled。 [SugarColumn(ColumnName = "is_result_kpi", ColumnDataType = "boolean")] public bool IsResultKpi { get; set; } [SugarColumn(ColumnName = "enabled", ColumnDataType = "boolean")] public bool Enabled { get; set; } = true; [SugarColumn(ColumnName = "sort_no")] public int SortNo { get; set; } [SugarColumn(ColumnName = "remark", Length = 512, IsNullable = true)] public string? Remark { get; set; } [SugarColumn(ColumnName = "created_at")] public DateTime CreatedAt { get; set; } = DateTime.Now; [SugarColumn(ColumnName = "updated_at", IsNullable = true)] public DateTime? UpdatedAt { get; set; } }