HouseAutofocusCalibrationDB.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. using System;
  2. using SqlSugar;
  3. namespace IvfTl.Control.Entity.DBEntitys
  4. {
  5. /// <summary>
  6. /// 本地自动对焦标定结果的库内镜像实体(M2-04)。
  7. /// 依据:sql/migrations/2026-06-17-autofocus-data-layer.sql 的 house_autofocus_calibration;
  8. /// 需求文档/12 §2.7(真相源=本地 calibration.json;本表为镜像;scene 0 基准/1 日常)。
  9. /// 列名按迁移脚本的蛇形命名,用 [SugarColumn(ColumnName=...)] 显式映射(control 端其余实体
  10. /// 多为 camelCase 直映,此表为对齐中央端 MySQL 迁移列名,统一走蛇形 ColumnName)。
  11. /// scene:0=出厂基准(每 well 一条 upsert) 1=日常对焦(append,受清理周期约束,只删 scene=1)。
  12. /// </summary>
  13. [SugarTable("house_autofocus_calibration")]
  14. public partial class HouseAutofocusCalibrationDB
  15. {
  16. public HouseAutofocusCalibrationDB()
  17. {
  18. }
  19. /// <summary>自增 id。</summary>
  20. [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
  21. // D1-09 修复:本地 SQLite 的 AUTOINCREMENT 只允许 INTEGER PRIMARY KEY;
  22. // C# long → SQLite BIGINT 触发 "AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY"
  23. // 致 CodeFirst.InitTables 建表失败。改 int(→SQLite INTEGER)即修。id 仅作自增主键,
  24. // 业务从不按值读取(查询均按 tl_sn/house_sn/well_sn/scene),int 范围对标定记录足够。
  25. public int id { get; set; }
  26. /// <summary>tl 设备 sn。</summary>
  27. [SugarColumn(ColumnName = "tl_sn")]
  28. public string tlSn { get; set; }
  29. /// <summary>仓室编号(1-11,11 号为缓冲瓶无相机不对焦)。</summary>
  30. [SugarColumn(ColumnName = "house_sn")]
  31. public int houseSn { get; set; }
  32. /// <summary>well 编号(1-16)。</summary>
  33. [SugarColumn(ColumnName = "well_sn")]
  34. public int wellSn { get; set; }
  35. /// <summary>场景:0=出厂基准 1=日常对焦。</summary>
  36. [SugarColumn(ColumnName = "scene")]
  37. public int scene { get; set; }
  38. /// <summary>对焦算出的最清晰层 Z 脉冲(锚点)。</summary>
  39. [SugarColumn(ColumnName = "focus_z")]
  40. public int focusZ { get; set; }
  41. /// <summary>曝光(×100µs)。</summary>
  42. [SugarColumn(ColumnName = "exposure", IsNullable = true)]
  43. public int? exposure { get; set; }
  44. /// <summary>水平电机位置脉冲。</summary>
  45. [SugarColumn(ColumnName = "horizontal_pulse", IsNullable = true)]
  46. public int? horizontalPulse { get; set; }
  47. /// <summary>清晰度峰比(合格判据,阈值见 tl_setting.focus_peak_ratio_threshold)。</summary>
  48. [SugarColumn(ColumnName = "peak_ratio", IsNullable = true)]
  49. public decimal? peakRatio { get; set; }
  50. /// <summary>是否检到 well 圆:0 否 1 是。</summary>
  51. [SugarColumn(ColumnName = "circle_found", IsNullable = true)]
  52. public int? circleFound { get; set; }
  53. /// <summary>居中偏移百分比。</summary>
  54. [SugarColumn(ColumnName = "center_offset_pct", IsNullable = true)]
  55. public decimal? centerOffsetPct { get; set; }
  56. /// <summary>标定时间。</summary>
  57. [SugarColumn(ColumnName = "calib_time")]
  58. public DateTime calibTime { get; set; }
  59. /// <summary>结果来源(LOCAL_JSON=本地标定镜像)。</summary>
  60. [SugarColumn(ColumnName = "source")]
  61. public string source { get; set; }
  62. /// <summary>备注。</summary>
  63. [SugarColumn(ColumnName = "note", IsNullable = true)]
  64. public string note { get; set; }
  65. /// <summary>创建人。</summary>
  66. [SugarColumn(ColumnName = "create_by", IsNullable = true)]
  67. public string createBy { get; set; }
  68. /// <summary>创建时间。</summary>
  69. [SugarColumn(ColumnName = "create_time", IsNullable = true)]
  70. public DateTime? createTime { get; set; }
  71. /// <summary>修改人。</summary>
  72. [SugarColumn(ColumnName = "update_by", IsNullable = true)]
  73. public string updateBy { get; set; }
  74. /// <summary>修改时间。</summary>
  75. [SugarColumn(ColumnName = "update_time", IsNullable = true)]
  76. public DateTime? updateTime { get; set; }
  77. /// <summary>逻辑删除标记:操作时间戳(mybatis-plus 逻辑删除约定)。</summary>
  78. [SugarColumn(ColumnName = "deleted", IsNullable = true)]
  79. public DateTime? deleted { get; set; }
  80. /// <summary>操作终端。</summary>
  81. [SugarColumn(ColumnName = "platform_id", IsNullable = true)]
  82. public int? platformId { get; set; }
  83. }
  84. }