using System; using SqlSugar; namespace IvfTl.Control.Entity.DBEntitys { /// /// 本地自动对焦标定结果的库内镜像实体(M2-04)。 /// 依据:sql/migrations/2026-06-17-autofocus-data-layer.sql 的 house_autofocus_calibration; /// 需求文档/12 §2.7(真相源=本地 calibration.json;本表为镜像;scene 0 基准/1 日常)。 /// 列名按迁移脚本的蛇形命名,用 [SugarColumn(ColumnName=...)] 显式映射(control 端其余实体 /// 多为 camelCase 直映,此表为对齐中央端 MySQL 迁移列名,统一走蛇形 ColumnName)。 /// scene:0=出厂基准(每 well 一条 upsert) 1=日常对焦(append,受清理周期约束,只删 scene=1)。 /// [SugarTable("house_autofocus_calibration")] public partial class HouseAutofocusCalibrationDB { public HouseAutofocusCalibrationDB() { } /// 自增 id。 [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)] // D1-09 修复:本地 SQLite 的 AUTOINCREMENT 只允许 INTEGER PRIMARY KEY; // C# long → SQLite BIGINT 触发 "AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY" // 致 CodeFirst.InitTables 建表失败。改 int(→SQLite INTEGER)即修。id 仅作自增主键, // 业务从不按值读取(查询均按 tl_sn/house_sn/well_sn/scene),int 范围对标定记录足够。 public int id { get; set; } /// tl 设备 sn。 [SugarColumn(ColumnName = "tl_sn")] public string tlSn { get; set; } /// 仓室编号(1-11,11 号为缓冲瓶无相机不对焦)。 [SugarColumn(ColumnName = "house_sn")] public int houseSn { get; set; } /// well 编号(1-16)。 [SugarColumn(ColumnName = "well_sn")] public int wellSn { get; set; } /// 场景:0=出厂基准 1=日常对焦。 [SugarColumn(ColumnName = "scene")] public int scene { get; set; } /// 对焦算出的最清晰层 Z 脉冲(锚点)。 [SugarColumn(ColumnName = "focus_z")] public int focusZ { get; set; } /// 曝光(×100µs)。 [SugarColumn(ColumnName = "exposure", IsNullable = true)] public int? exposure { get; set; } /// 水平电机位置脉冲。 [SugarColumn(ColumnName = "horizontal_pulse", IsNullable = true)] public int? horizontalPulse { get; set; } /// 清晰度峰比(合格判据,阈值见 tl_setting.focus_peak_ratio_threshold)。 [SugarColumn(ColumnName = "peak_ratio", IsNullable = true)] public decimal? peakRatio { get; set; } /// 是否检到 well 圆:0 否 1 是。 [SugarColumn(ColumnName = "circle_found", IsNullable = true)] public int? circleFound { get; set; } /// 居中偏移百分比。 [SugarColumn(ColumnName = "center_offset_pct", IsNullable = true)] public decimal? centerOffsetPct { get; set; } /// 标定时间。 [SugarColumn(ColumnName = "calib_time")] public DateTime calibTime { get; set; } /// 结果来源(LOCAL_JSON=本地标定镜像)。 [SugarColumn(ColumnName = "source")] public string source { get; set; } /// 备注。 [SugarColumn(ColumnName = "note", IsNullable = true)] public string note { get; set; } /// 创建人。 [SugarColumn(ColumnName = "create_by", IsNullable = true)] public string createBy { get; set; } /// 创建时间。 [SugarColumn(ColumnName = "create_time", IsNullable = true)] public DateTime? createTime { get; set; } /// 修改人。 [SugarColumn(ColumnName = "update_by", IsNullable = true)] public string updateBy { get; set; } /// 修改时间。 [SugarColumn(ColumnName = "update_time", IsNullable = true)] public DateTime? updateTime { get; set; } /// 逻辑删除标记:操作时间戳(mybatis-plus 逻辑删除约定)。 [SugarColumn(ColumnName = "deleted", IsNullable = true)] public DateTime? deleted { get; set; } /// 操作终端。 [SugarColumn(ColumnName = "platform_id", IsNullable = true)] public int? platformId { get; set; } } }