CalibProgressDto.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Collections.Generic;
  2. using Newtonsoft.Json;
  3. namespace ivf_tl_Operate.Debug
  4. {
  5. /// <summary>
  6. /// operate 端标定进度反序列化 DTO,对齐 control 端 CalibProgress(Task3.1/3.2a)的 JSON。
  7. /// control 端 CalibProgress/WellCalibProgress 是公有字段、用 JsonConvert.SerializeObject 默认序列化,
  8. /// 故属性名为 PascalCase(Total/Wells/WellSn...);WellCalibState 枚举无 StringEnumConverter,
  9. /// 默认序列化为【数字】(Pending=0 Running=1 Qualified=2 FakePeak=3 Failed=4),故 State 用 int 接。
  10. /// 取法:轮询 /debug/calibrate/progress 返回 DebugCommandResult{ok,result=CalibProgress},
  11. /// 本 DTO 对应 result 内嵌对象,由 CalibrationClient 经 envelope 取出。
  12. /// </summary>
  13. public sealed class CalibProgressDto
  14. {
  15. [JsonProperty("Total")] public int Total { get; set; }
  16. [JsonProperty("Completed")] public int Completed { get; set; }
  17. [JsonProperty("CurrentWell")] public int? CurrentWell { get; set; }
  18. [JsonProperty("IsRunning")] public bool IsRunning { get; set; }
  19. [JsonProperty("Wells")] public List<WellCalibProgressDto> Wells { get; set; } = new List<WellCalibProgressDto>();
  20. }
  21. /// <summary>单 well 进度(对齐 control 端 WellCalibProgress);State 接数字枚举值。</summary>
  22. public sealed class WellCalibProgressDto
  23. {
  24. [JsonProperty("WellSn")] public int WellSn { get; set; }
  25. [JsonProperty("State")] public int State { get; set; } // WellCalibState:0待标定/1标定中/2合格/3伪峰/4失败
  26. [JsonProperty("FocusZ")] public int FocusZ { get; set; }
  27. [JsonProperty("Exposure")] public int Exposure { get; set; }
  28. [JsonProperty("PeakRatio")] public double PeakRatio { get; set; }
  29. [JsonProperty("CenterOffsetPct")] public double CenterOffsetPct { get; set; }
  30. [JsonProperty("CircleFound")] public bool CircleFound { get; set; }
  31. [JsonProperty("Note")] public string Note { get; set; } = "";
  32. }
  33. }