fix: auto run bga detection in task wizard

This commit is contained in:
zhengxuan.zhang
2026-08-04 14:47:40 +08:00
parent fd9d863494
commit 2760bd6dac
2 changed files with 12 additions and 4 deletions
@@ -28,9 +28,13 @@ namespace XplorePlane.Services.Inspection.Tasks
{
ArgumentNullException.ThrowIfNull(balls);
ArgumentNullException.ThrowIfNull(context);
var labels = BgaBallGroupLabeler.AssignLabels(
balls,
XplorePlane.Models.Inspection.BgaGridIndexingMode.AlphaNumericTopLeft);
_overlay.PublishBgaBalls(balls.Select(ball => new BallOverlayItem
{
Id = ball.Id,
Label = labels.TryGetValue(ball.Id, out var label) ? label : string.Empty,
CenterX = (ball.X - context.OriginX) * context.ScaleX,
CenterY = (ball.Y - context.OriginY) * context.ScaleY,
Diameter = ball.Diameter * ((context.ScaleX + context.ScaleY) / 2),
@@ -179,7 +179,8 @@ namespace XplorePlane.ViewModels.Inspection.TaskWizard
}
}
private int _poolColumns = 2;
// 参考 BGA_Insp_Tang_14 列 × 4 行,编号从左上角开始 A1,右下角为 D4。
private int _poolColumns = 4;
public int PoolColumns
{
@@ -187,7 +188,7 @@ namespace XplorePlane.ViewModels.Inspection.TaskWizard
set => SetProperty(ref _poolColumns, value);
}
private int _poolRows = 2;
private int _poolRows = 4;
public int PoolRows
{
@@ -195,7 +196,7 @@ namespace XplorePlane.ViewModels.Inspection.TaskWizard
set => SetProperty(ref _poolRows, value);
}
private int _ballsPerBlock = 16;
private int _ballsPerBlock = 1;
public int BallsPerBlock
{
@@ -609,12 +610,15 @@ namespace XplorePlane.ViewModels.Inspection.TaskWizard
}
CurrentStage = InspectionTaskStage.BGADetected;
// 锁定流水线后立即执行一次识别,避免用户必须再次点击“开始识别”才能继续。
_ = ExecuteRunBgaDetectionUnified();
}
private async Task ExecuteRunBgaDetectionUnified()
{
var pipeline = InspectionTask?.PipelineSnapshot;
var sourceImage = _viewportService?.LatestDetectorImage as BitmapSource
var sourceImage = _viewportService?.CurrentHistogramSource16 as BitmapSource
?? _viewportService?.LatestDetectorImage as BitmapSource
?? _viewportService?.CurrentDisplayImage as BitmapSource;
if (pipeline == null || sourceImage == null)
{