AdoS8MonitorMetric.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. namespace Admin.NET.Plugin.AiDOP.Entity.S8;
  2. /// <summary>
  3. /// S8 监控指标字典。每条指标绑定一个 object_code + 一个 mechanism(DATE/VALUE_RANGE/RATIO)。
  4. /// 字段映射:DATE 用 due_at_field/status_field;VALUE_RANGE/RATIO 用 measured_value_field。
  5. /// is_result_kpi=true 时表示该指标是 S9 结果 KPI 范畴(如交付满足率),本轮 seed 默认 enabled=false。
  6. /// CONFIG-MONITOR-DICT-READONLY-SEED-1:本轮只读字典。
  7. /// </summary>
  8. [SugarTable("ado_s8_monitor_metric", "S8 监控指标字典")]
  9. [SugarIndex("uk_s8_monitor_metric_tenant_factory_code", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(MetricCode), OrderByType.Asc, IsUnique = true)]
  10. [SugarIndex("idx_s8_monitor_metric_object_mech", nameof(ObjectCode), OrderByType.Asc, nameof(Mechanism), OrderByType.Asc, nameof(Enabled), OrderByType.Asc, nameof(SortNo), OrderByType.Asc)]
  11. [SugarIndex("idx_s8_monitor_metric_tfe", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(Enabled), OrderByType.Asc)]
  12. public class AdoS8MonitorMetric
  13. {
  14. [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true, ColumnDataType = "bigint")]
  15. public long Id { get; set; }
  16. [SugarColumn(ColumnName = "tenant_id", ColumnDataType = "bigint")]
  17. public long TenantId { get; set; }
  18. [SugarColumn(ColumnName = "factory_id", ColumnDataType = "bigint")]
  19. public long FactoryId { get; set; }
  20. /// <summary>所属对象编码(关联 ado_s8_monitor_object.object_code)。</summary>
  21. [SugarColumn(ColumnName = "object_code", Length = 64)]
  22. public string ObjectCode { get; set; } = string.Empty;
  23. /// <summary>指标编码(业务唯一),如 ORDER_DUE_AT / IQC_VALUE / WO_COMPLETION_RATE。</summary>
  24. [SugarColumn(ColumnName = "metric_code", Length = 64)]
  25. public string MetricCode { get; set; } = string.Empty;
  26. [SugarColumn(ColumnName = "metric_name", Length = 128)]
  27. public string MetricName { get; set; } = string.Empty;
  28. /// <summary>报警机制:DATE / VALUE_RANGE / RATIO(与 watch_rule.rule_mechanism 一致)。</summary>
  29. [SugarColumn(ColumnName = "mechanism", Length = 32)]
  30. public string Mechanism { get; set; } = string.Empty;
  31. [SugarColumn(ColumnName = "unit", Length = 32, IsNullable = true)]
  32. public string? Unit { get; set; }
  33. [SugarColumn(ColumnName = "due_at_field", Length = 64, IsNullable = true)]
  34. public string? DueAtField { get; set; }
  35. [SugarColumn(ColumnName = "status_field", Length = 64, IsNullable = true)]
  36. public string? StatusField { get; set; }
  37. [SugarColumn(ColumnName = "measured_value_field", Length = 64, IsNullable = true)]
  38. public string? MeasuredValueField { get; set; }
  39. [SugarColumn(ColumnName = "object_id_field", Length = 64, IsNullable = true)]
  40. public string? ObjectIdField { get; set; }
  41. [SugarColumn(ColumnName = "object_code_field", Length = 64, IsNullable = true)]
  42. public string? ObjectCodeField { get; set; }
  43. [SugarColumn(ColumnName = "object_name_field", Length = 64, IsNullable = true)]
  44. public string? ObjectNameField { get; set; }
  45. [SugarColumn(ColumnName = "default_grace_minutes", IsNullable = true)]
  46. public int? DefaultGraceMinutes { get; set; }
  47. [SugarColumn(ColumnName = "default_completed_states", Length = 256, IsNullable = true)]
  48. public string? DefaultCompletedStates { get; set; }
  49. [SugarColumn(ColumnName = "default_target_ratio", ColumnDataType = "decimal(10,2)", IsNullable = true)]
  50. public decimal? DefaultTargetRatio { get; set; }
  51. [SugarColumn(ColumnName = "default_lower_bound", ColumnDataType = "decimal(18,6)", IsNullable = true)]
  52. public decimal? DefaultLowerBound { get; set; }
  53. [SugarColumn(ColumnName = "default_upper_bound", ColumnDataType = "decimal(18,6)", IsNullable = true)]
  54. public decimal? DefaultUpperBound { get; set; }
  55. /// <summary>是否为 S9 结果 KPI 类指标(交付满足率/完工率/合格率等);true 时本轮 seed 默认 disabled。</summary>
  56. [SugarColumn(ColumnName = "is_result_kpi", ColumnDataType = "boolean")]
  57. public bool IsResultKpi { get; set; }
  58. [SugarColumn(ColumnName = "enabled", ColumnDataType = "boolean")]
  59. public bool Enabled { get; set; } = true;
  60. [SugarColumn(ColumnName = "sort_no")]
  61. public int SortNo { get; set; }
  62. [SugarColumn(ColumnName = "remark", Length = 512, IsNullable = true)]
  63. public string? Remark { get; set; }
  64. [SugarColumn(ColumnName = "created_at")]
  65. public DateTime CreatedAt { get; set; } = DateTime.Now;
  66. [SugarColumn(ColumnName = "updated_at", IsNullable = true)]
  67. public DateTime? UpdatedAt { get; set; }
  68. }