修复CNC复核标记归档

This commit is contained in:
zhengxuan.zhang
2026-08-14 09:41:36 +08:00
parent d64449ce74
commit 1d26cc279b
4 changed files with 17 additions and 5 deletions
@@ -270,7 +270,7 @@ namespace XplorePlane.Tests.Services
var opts = new JsonSerializerOptions { Converters = { new JsonStringEnumConverter() } };
var detail = JsonSerializer.Deserialize<InspectionRunDetail>(json, opts);
Assert.NotNull(detail);
Assert.Equal(2, detail.SchemaVersion);
Assert.Equal(3, detail.SchemaVersion);
Assert.NotNull(detail.Map);
Assert.Equal(map.MapId, detail.Map.MapId);
Assert.Equal("marks/inspection-map.xpmap", detail.Map.DocumentPath);
@@ -841,6 +841,11 @@ namespace XplorePlane.Services.Cnc
var markedOverviewImage = rawOverviewImage;
if (_navigationFrameProvider?.TryCaptureCompositeBitmapSource(out var reviewedOverview) == true)
markedOverviewImage = reviewedOverview;
// 数据库是标记权威来源;绑定新建地图时恢复已归档标记,避免空地图覆盖 .xpmap。
if (detail.Marks != null && detail.Marks.Count > 0)
map.Marks.AddRange(detail.Marks);
map.OverviewImageRelativePath = await _archive
.SaveOverviewAsync(map, "overview.bmp", markedOverviewImage, ct)
.ConfigureAwait(false);
@@ -18,7 +18,9 @@ namespace XplorePlane.Services.Inspection.Documentation
{
InspectionMapDocument CreateMap(string name);
Task<InspectionMarkRecord?> AddMarkAsync(InspectionMapDocument map, InspectionMarkType type, Point imagePixelPoint, string comment, CancellationToken ct = default);
Task<InspectionMarkRecord?> AddMarkAsync(InspectionMapDocument map, InspectionMarkType type, Point imagePixelPoint, string comment, CancellationToken ct = default);
Task SaveMarkAsync(InspectionMapDocument map, InspectionMarkRecord mark, CancellationToken ct = default);
void UpdateMark(InspectionMapDocument map, InspectionMarkRecord updatedMark);
@@ -107,8 +109,11 @@ namespace XplorePlane.Services.Inspection.Documentation
map.Marks.Add(mark);
Touch(map);
return mark;
}
return mark;
}
public Task SaveMarkAsync(InspectionMapDocument map, InspectionMarkRecord mark, CancellationToken ct = default)
=> _archive.SaveMarkAsync(map, mark, ct);
public void UpdateMark(InspectionMapDocument map, InspectionMarkRecord updatedMark)
{
@@ -222,4 +227,4 @@ namespace XplorePlane.Services.Inspection.Documentation
_ => 5
};
}
}
}
@@ -221,6 +221,7 @@ namespace XplorePlane.ViewModels.Inspection.Documentation
// 用户选择的状态回写到标记类型,保证导航区标记图标(OK/NG/警告)显示正确
mark.Type = StatusToMarkType(mark.Status);
_documentationService.UpdateMark(CurrentMap, mark);
await _documentationService.SaveMarkAsync(CurrentMap, mark);
// 同步到导航区标记集合;同一位置节点只允许保留一个标记。
AddOrReplaceCncMark(mark);
@@ -276,6 +277,7 @@ namespace XplorePlane.ViewModels.Inspection.Documentation
: string.Empty;
mark.ReviewedAtUtc = reviewedAtUtc ?? DateTime.UtcNow;
_documentationService.UpdateMark(CurrentMap, mark);
await _documentationService.SaveMarkAsync(CurrentMap, mark);
// 同一位置节点重复触发复核时更新原标记,不追加新的图标。
AddOrReplaceCncMark(mark);