Files
XplorePlane/.codebuddy/memory/2026-07-24.md
T
XplorePlane Developer 957157ae80 fix: 修复编译错误、BGA向导预览、算子重复插入及状态栏消息
## Compilation fixes
- Fix XAML namespace reference XplorePlane.Converters → XplorePlane.Helpers (EventLogView, StateDisplayView)
- Add missing using for ISampleTypeRepository / JsonSampleTypeRepository in App.xaml.cs
- Fix ILoggerService.Warn() calls using Exception as first arg instead of message string
- Serialize CncProgram to JSON when passing to MatrixLayout (expects string, not CncProgram object)
- Suppress CS8632 nullable annotation warnings project-wide

## BGA wizard fixes
- Fix preview not showing on step 3: force RefreshBgaPreview() when entering final step
- Add step validation in CanNext() to prevent skipping to preview with invalid inputs
- Notify NextCommand.CanExecuteChanged when inputs change
- Fix RunProgress runtime binding error: set Mode=OneWay for ProgressBar.Value

## Operator toolbox: prevent duplicate insertion
- Add static OperatorTarget property for direct dispatch to active pipeline
- PipelineEditorView registers as toolbox target on load (floating window only)
- CNC page sets initial target; PipelineEditorWindow resets to CNC pipeline on close
- '+' button inserts only to the active pipeline instead of broadcasting to all subscribers

## Pipeline editor status bar messages
- Add StatusBarMessageEvent / StatusBarMessagePayload to CommonEvents.cs
- PipelineEditorViewModel publishes status on all ops (add/remove/reorder/save/execute)
- MainViewModel subscribes and displays on main window bottom status bar
- Auto-clear after timeout (3s info, 5s error)

## docs
- Merge three architecture docs into consolidated XplorePlane-架构与结构说明.md
2026-07-24 15:59:16 +08:00

9.7 KiB
Raw Blame History

2026-07-24 工作日志

任务1:Sample Type(样品类型)一体化 UI 已完成

按方案 B 实现了 YXLON 式"样品类型 + 绑定检测程序 + 阵列"一体化 UI,作为检测池对标整改的一部分。

新增文件:

  • XplorePlane/Models/Inspection/SampleTypeDefinition.cs — 模型:SampleTypeDefinition(绑定 Programs + SampleTypeGridConfig 阵列)、SampleTypeProgramBinding、GridScanOrder 枚举。
  • XplorePlane/Services/Inspection/SampleType/JsonSampleTypeRepository.cs — ISampleTypeRepository + JSON 仓储(存于 {RootPath}/SampleType/*.xptype,与 JsonInspectionDefinitionRepository 同构)。
  • XplorePlane/ViewModels/Inspection/SampleType/SampleTypeViewModel.cs — 列表/CRUD/绑定程序/阵列配置 + Run。
  • XplorePlane/Views/Inspection/SampleType/SampleTypeWindow.xaml(.cs) — 一体化窗口。

修改文件:

  • App.xaml.cs 注册 ISampleTypeRepository(在 IInspectionDefinitionRepository 之后)。
  • MainViewModel.cs 增加 OpenSampleTypeCommand + ExecuteOpenSampleTypeShowOrActivate 单例窗口,DataContext=Resolve)。
  • MainWindow.xaml Ribbon "检测池" 旁新增 "样品类型" 按钮(复用 matrix.png 图标)。

Run 逻辑(复用 R1 已打通的执行链,无需改核心):组装含 InspectionDefinitionNode 的 CncProgram(快照经 JsonInspectionDefinitionRepository.Clone+ 由 Grid 生成 MatrixLayoutcells 行/列优先)+ 调 IMatrixExecutionCoordinator.RunAsync。R1 风险已确认不阻塞。

验证:dotnet build 在本机 CLI 因 WPF 临时项目(_wpftmp)引用解析失败而中断(报 IReadOnlyList<>/IApplicationDialogService/XplorePlane.Converters 找不到,均在未改动的基线文件),属环境假象;语言服务器对我新增/修改的 7 个文件均报 0 诊断,代码干净。

任务2BGA 引导式弹窗已完成

将检测池页面(InspectionPoolPageViewModel)内嵌的 BGA 编辑抽成独立引导式向导窗口。

新增文件:

  • ViewModels/Inspection/Pool/Bga/BgaWizardViewModel.cs — 分步向导(4 步:网格尺寸→焊球间距→编号与排除→预览确认)+ 实时 BgaTargetIdGenerator 预览 + 产出 BgaGridGeometryResult)。含 WizardStep 描述类。
  • Views/Inspection/Pool/Bga/BgaWizardWindow.xaml(.cs) — 模态向导窗口(步骤条高亮 + 分步内容 + 上一步/下一步/完成/取消)。
  • Views/Inspection/Pool/Bga/StepIndexToVisibilityConverter.cs — 步骤索引→可见性 + StepActiveConverterMultiBinding 步骤高亮)。

修改文件:

  • InspectionPoolPageViewModel.cs — 新增 OpenBgaWizardCommandCanExecute: CanEdit() && IsBgaKind+ OpenBgaWizard()(以 BuildBgaGrid() 预填、ShowDialog、结果非空则 ApplyBgaGrid 写回字段并 OnBgaGridDefinitionChanged+ ApplyBgaGrid(BgaGridGeometry)RaiseCommandStates 增加刷新该命令。
  • InspectionPoolPageView.xaml — BGA 步骤面板由内嵌编辑改为「打开 BGA 向导」按钮 + 只读摘要(行×列/Pitch/编号方式/交换行列/排除 ID)+ 保留只读预览。

关键约束:BgaGridGeometry 字段(Pitch 为 double,勿取整)、ExcludedTargetIds 解析(逗号/分号/全角逗号/换行)、HasValidBgaConfig 页级还依赖 TileRows.Count>0(向导只校验网格几何)。

验证:语言服务器对 5 个新增/修改文件均报 0 诊断。

提交记录

  • 任务2 已提交:aeadc86 "feat: 检测池 YXLON 对标 - 任务2 BGA 引导式向导弹窗"10 文件,+547/-20)。含 4 个 BGA 新文件 + InspectionPoolPageViewModel/View 改动 + 其他遗留源文件改动。排除 bin/ 删除(构建产物)与 .codebuddy/。

清理 ViewportPanelView 检测池运行时死代码(用户移除主视口检测池运行时界面层后)

XAML 中 InspectionPoolRuntime* 控件及 InspectionPoolNew/Settings/Start 按钮已全部移除,但 .xaml.cs 残留引用报 CS0103。清理 Views/Main/ViewportPanelView.xaml.cs

  • 重写 OnInspectionPoolRuntimeChanged:保留 viewportViewModel.ImageSourceRenderInspectionPoolOverlay(主视口仍显示检测图与 overlay),移除对所有已删 InspectionPoolRuntime*Panel/Title/Progress/StageText/StartButton/Summary/TileList)的引用。
  • 删除 GetInspectionPoolStageTextUpdateInspectionPoolSummaryUpdateInspectionPoolTileList 三个仅为已删控件服务的方法。
  • 删除 InspectionPoolSettings_Click/InspectionPoolNew_Click/InspectionPoolStart_Click 三个已无调用者的按钮事件方法(界面层已移除)。
  • 移除 InspectionPoolStartButton.IsEnabled 两处引用。
  • 验证:语言服务器对该文件报 0 诊断;9 个 CS0103 全消。

注:OperatorToolboxWindow.xaml 的 XDG0003"You must initialize the Current Container")是 Prism 设计器解析 OperatorToolboxViewAutoWireViewModel 时访问 ContainerLocator.Current假象,与检测池移除无关;OperatorToolbox 仍被 MainViewModel.cs:864 打开、App.xaml.cs:846 注册 DI、PipelineEditorView 拖拽引用,属在用功能,未处理(如要消除可加设计时 DataContext,非破坏性)。

ShowShell 置顶优化(2026-07-24

Splash 关闭后 MainWindow 可能被其他窗口遮挡。修改 App.xaml.cs:ShowShell()Show 后设 Topmost=true + Activate(),再用 Dispatcher.Loaded 优先级异步恢复 Topmost=false。仅一次布局周期置顶,不干扰后续用户操作。

Services 目录结构分析(team-lead 分派,2026-07-24

XplorePlane/Services 做静态盘点:89 个 .cs,17 个子目录,56 个接口。

  • 规模:Inspection 36、Cnc 18 为核心;最大文件 Cnc/CncExecutionService.cs 2298 行、Inspection/Results/InspectionResultStore.cs 1536 行(重构首选)。
  • 重叠点:5+ 套 JSON 持久化(JsonInspectionDefinitionRepository / JsonSampleTypeRepository / InspectionResultStore / PipelinePersistenceService / Archive+Documentation+Results 三套资产落盘)职责边界模糊,最值得合并;执行链 4 层 MatrixExecutionCoordinator→MatrixOrchestrationService→CncExecutionService→InspectionExecutionCoordinator 合理,但 PipelineExecutionService 与 CncExecutionService 概念重叠;IInspectionDialogService 与 IInspectionPoolDialogService 可合并;报告双轨(InspectionReportGenerator vs CncReportService);坐标变换 4 处(InspectionCoordinateTransform / NavigationTransform / IViewCoordinateMapper / AxisAdjustmentConverter)建议统一。
  • 结果已 send_message 回报 team-lead。

Models/Views 目录结构分析(team-lead 分派,2026-07-24

XplorePlane/ModelsXplorePlane/Views 做静态盘点:

  • Models16 个 .cs8 个子目录(Cnc/Debug/ImageProcessing/Inspection/Main/Recipe/Security + 根目录 GlobalUsings.cs)。
  • Views121 个文件(67 .cs + 54 .xaml),11 个子目录(Cnc/Debug/Dialogs/Hardware/Help/Helpers/ImageProcessing/Inspection/Main/Setting + 根目录 GlobalUsings.cs)。
  • 项目总体:417 个文件,72,133 行(排除 bin/obj)。
  • Top 10 最大 .cs 文件:Services/Cnc/CncExecutionService.cs 2,066 行、ViewModels/Main/MainViewModel.cs 2,057 行、Views/Main/ViewportPanelView.xaml.cs 1,996 行、ViewModels/Inspection/Pool/InspectionPoolPageViewModel.cs 1,536 行、ViewModels/Cnc/CncEditorViewModel.cs 1,438 行、Services/Inspection/Results/InspectionResultStore.cs 1,339 行、ViewModels/Cnc/MatrixEditorViewModel.cs 1,147 行、ViewModels/ImageProcessing/PipelineEditorViewModel.cs 996 行、App.xaml.cs 973 行、ViewModels/Cnc/InspectionReportViewerViewModel.cs 934 行。
  • 结果已 send_message 回报 team-lead。

P0 重构执行并提交(2026-07-24

基于团队分析报告的 P0 优先级任务已完成并提交:

P0-1 泛型仓储基类b504dc4):

  • 新增 JsonRepositoryBase.cs157 行)— IRepository<T> + JsonRepositoryBase<T> 泛型基类,线程安全(SemaphoreSlim),虚拟钩子(验证/清理/克隆)
  • 重构 JsonInspectionDefinitionRepository.cs219→93 行)、JsonSampleTypeRepository.cs123→46 行)
  • 修复 JsonSampleTypeRepository.CloneAsync 未持久化到磁盘的 bug

P0-2 MainViewModel partial 拆分b504dc4):

  • 新增 MainViewModel.Measurement.cs281 行 partial),含 MeasurementToolMode/BackgroundDefectMode 枚举、10 个测量命令、7 个 bool 属性
  • MainViewModel.cs2355→2085 行),添加 partial 关键字,移除测量工具区域代码

提交记录:b504dc4 refactor(P0): 泛型仓储基类 + MainViewModel partial 拆分(5 文件,+580/-615 行)

TryAutoLoadCalibration 默认图像替换(2026-07-24

将虚拟仿真导航快照从 相机1.bmp 改为 PhotoImage.pngCalibration 文件夹下)。提交 8f950ac

移除 InsertInspectionModule 工具栏按钮(2026-07-24

移除 CncPageView 工具栏中"检测模块"按钮及对应命令(CncEditorViewModel + MainViewModel)。底层 InspectionModuleNode 模型和执行逻辑保留,ribbon「内置检测模块」插入功能不受影响。

修复:CNC 插入模块不再弹出独立窗口(2026-07-24)

MainViewModel 中以下两个入口原先调用 _windowLauncher.ShowOrActivate(CncEditorWindowKey, ...) 弹出 CNC 编辑器弹窗,现已改为切换到嵌入式 CNC 面板(IsCncEditorMode = true + ImagePanelWidth = 540 + TryRestoreSessionAsync):

  • ExecuteInsertBuiltInInspectionModuleAsyncRibbon「插入模块」按钮)
  • OnAddPipelineToCncRequested(把实时流水线加入 CNC

同时移除了不再使用的 CncEditorWindowKey 常量。CncEditorWindow.xaml/.cs 目前无其他引用,但本次未删除文件。

待办