AdoSmartOpsKpiDimensionValueDay.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. using Admin.NET.Core;
  2. using SqlSugar;
  3. namespace Admin.NET.Plugin.AiDOP.Entity;
  4. /// <summary>
  5. /// KPI 维度结果(配置化维度执行产物)。由 DIMENSION_SQL 经数据中台执行后落库,
  6. /// 供筛选与下钻读取。每行记录归属的汇总/维度配置版本,查询时校验版本一致。
  7. /// 独立新表,绝不复用被旧硬编码污染的 ado_smart_ops_kpi_atomic_day。
  8. /// </summary>
  9. [SugarTable("ado_smart_ops_kpi_dimension_value_day", "KPI 维度结果(配置化)")]
  10. [SugarIndex("uk_kpi_dim_val_rowhash", nameof(RowHash), OrderByType.Asc, true)]
  11. [SugarIndex("ix_kpi_dim_val_query", nameof(TenantId), OrderByType.Asc, nameof(MetricCode), OrderByType.Asc, nameof(DimensionConfigVersion), OrderByType.Asc, nameof(ValueDate), OrderByType.Asc)]
  12. public class AdoSmartOpsKpiDimensionValueDay : ITenantIdFilter
  13. {
  14. [SugarColumn(ColumnDescription = "主键", IsPrimaryKey = true, IsIdentity = true, ColumnDataType = "bigint")]
  15. public long Id { get; set; }
  16. [SugarColumn(ColumnDescription = "租户 ID", ColumnDataType = "bigint", IsNullable = true)]
  17. public long? TenantId { get; set; }
  18. [SugarColumn(ColumnDescription = "模块 S1~S9", Length = 20)]
  19. public string ModuleCode { get; set; } = string.Empty;
  20. [SugarColumn(ColumnDescription = "指标编码", Length = 50)]
  21. public string MetricCode { get; set; } = string.Empty;
  22. [SugarColumn(ColumnDescription = "绑定的汇总配置 Id")]
  23. public long SummaryConfigId { get; set; }
  24. [SugarColumn(ColumnDescription = "绑定的汇总配置版本号")]
  25. public int SummaryConfigVersion { get; set; }
  26. [SugarColumn(ColumnDescription = "维度配置 Id")]
  27. public long DimensionConfigId { get; set; }
  28. [SugarColumn(ColumnDescription = "维度配置版本号")]
  29. public int DimensionConfigVersion { get; set; }
  30. [SugarColumn(ColumnDescription = "数据源编码", Length = 100, IsNullable = true)]
  31. public string? DataSourceCode { get; set; }
  32. [SugarColumn(ColumnDescription = "业务日期(日粒度取日、月粒度取月首日)")]
  33. public DateTime ValueDate { get; set; }
  34. [SugarColumn(ColumnDescription = "维度类型 如 ORDER / MATERIAL / CATEGORY", Length = 40)]
  35. public string DimensionType { get; set; } = string.Empty;
  36. [SugarColumn(ColumnDescription = "维度编码", Length = 200)]
  37. public string DimensionCode { get; set; } = string.Empty;
  38. [SugarColumn(ColumnDescription = "维度名称", Length = 300, IsNullable = true)]
  39. public string? DimensionName { get; set; }
  40. [SugarColumn(ColumnDescription = "组织 ID", ColumnDataType = "bigint", IsNullable = true)]
  41. public long? OrgId { get; set; }
  42. [SugarColumn(ColumnDescription = "工厂 ID", ColumnDataType = "bigint", IsNullable = true)]
  43. public long? FactoryId { get; set; }
  44. [SugarColumn(ColumnDescription = "物料编码", Length = 100, IsNullable = true)]
  45. public string? MaterialCode { get; set; }
  46. [SugarColumn(ColumnDescription = "工单号", Length = 100, IsNullable = true)]
  47. public string? WorkOrderNo { get; set; }
  48. [SugarColumn(ColumnDescription = "品类编码", Length = 100, IsNullable = true)]
  49. public string? CategoryCode { get; set; }
  50. [SugarColumn(ColumnDescription = "仓库编码", Length = 100, IsNullable = true)]
  51. public string? WarehouseCode { get; set; }
  52. [SugarColumn(ColumnDescription = "订单号", Length = 100, IsNullable = true)]
  53. public string? OrderNo { get; set; }
  54. [SugarColumn(ColumnDescription = "客户编码", Length = 100, IsNullable = true)]
  55. public string? CustomerCode { get; set; }
  56. [SugarColumn(ColumnDescription = "产品编码", Length = 100, IsNullable = true)]
  57. public string? ProductCode { get; set; }
  58. [SugarColumn(ColumnDescription = "设备编码", Length = 100, IsNullable = true)]
  59. public string? EquipmentCode { get; set; }
  60. [SugarColumn(ColumnDescription = "指标值", ColumnDataType = "decimal(18,6)", IsNullable = true)]
  61. public decimal? MetricValue { get; set; }
  62. [SugarColumn(ColumnDescription = "分子", ColumnDataType = "decimal(18,6)", IsNullable = true)]
  63. public decimal? Numerator { get; set; }
  64. [SugarColumn(ColumnDescription = "分母", ColumnDataType = "decimal(18,6)", IsNullable = true)]
  65. public decimal? Denominator { get; set; }
  66. [SugarColumn(ColumnDescription = "求和值", ColumnDataType = "decimal(18,6)", IsNullable = true)]
  67. public decimal? SumValue { get; set; }
  68. [SugarColumn(ColumnDescription = "样本数", IsNullable = true)]
  69. public int? SampleCount { get; set; }
  70. [SugarColumn(ColumnDescription = "来源业务键", Length = 200, IsNullable = true)]
  71. public string? SourceKey { get; set; }
  72. [SugarColumn(ColumnDescription = "幂等行哈希(SHA256 hex)", Length = 64)]
  73. public string RowHash { get; set; } = string.Empty;
  74. [SugarColumn(ColumnDescription = "批次号", Length = 100, IsNullable = true)]
  75. public string? BatchId { get; set; }
  76. [SugarColumn(ColumnDescription = "计算时间")]
  77. public DateTime CalcTime { get; set; }
  78. [SugarColumn(ColumnDescription = "创建时间")]
  79. public DateTime CreatedTime { get; set; }
  80. [SugarColumn(ColumnDescription = "更新时间", IsNullable = true)]
  81. public DateTime? UpdatedTime { get; set; }
  82. }