commit bcddcd0bed90526ddbad1ca40f5a2c000c354922 Author: C# 开发 Date: Wed Aug 19 01:16:32 2026 +0000 交运行工位桩:三口契约、运行服务、六态 VM、跨线程切 UI。 采集/PLC/Inspect 均为桩,验收 1–8 可测。不部署现场。 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..816f864 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +bin/ +obj/ +.vs/ +.idea/ +*.user +*.suo +*.userosscache +*.sln.docstates +[Dd]ebug/ +[Rr]elease/ +*.dll +*.pdb +*.cache +TestResults/ +.dotnet/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..c947f88 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ + +# VisionHost 运行工位桩 + +本迭代只交操作员运行壳(验收 1–7)。采集 / PLC / Inspect 均为桩,不做真检测、不改主干、不部署。 + +## 工程 + +- `VisionHost.Contracts` 三口:`IFrameSource` / `IInspectService` / `IPlcIo` +- `VisionHost.Runtime` 运行服务 + `RunViewModel`(绑定名对齐 WPF 骨架) +- `VisionHost.Runtime.Tests` 运行壳用例 +- `VisionHost.App` 操作员运行页(WPF,hex 转笔刷) + +可点界面:`src/VisionHost.App`(Windows)。`LastResultBrush`/`AlarmBrush` 用 `HexToBrushConverter`。 + +## 行为 + +- 确认启动才清零并开跑;停机保持计数 +- 未连接 / 重连中:不弹确认,`CanStart=false` +- Inspect 桩:1–4 OK,第 5 拍 `NG STUB`,拍号在算法桩内计 +- 六态由运行服务推,VM 不自判 + +## 构建 + +``` +export PATH="$HOME/.dotnet:$PATH" +dotnet test VisionHost.sln +``` diff --git a/VisionHost.sln b/VisionHost.sln new file mode 100644 index 0000000..1c02b7b --- /dev/null +++ b/VisionHost.sln @@ -0,0 +1,34 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisionHost.Contracts", "src\VisionHost.Contracts\VisionHost.Contracts.csproj", "{A1111111-1111-1111-1111-111111111111}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisionHost.Runtime", "src\VisionHost.Runtime\VisionHost.Runtime.csproj", "{A2222222-2222-2222-2222-222222222222}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisionHost.Runtime.Tests", "tests\VisionHost.Runtime.Tests\VisionHost.Runtime.Tests.csproj", "{A3333333-3333-3333-3333-333333333333}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisionHost.App", "src\VisionHost.App\VisionHost.App.csproj", "{A4444444-4444-4444-4444-444444444444}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A1111111-1111-1111-1111-111111111111}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A1111111-1111-1111-1111-111111111111}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A1111111-1111-1111-1111-111111111111}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A1111111-1111-1111-1111-111111111111}.Release|Any CPU.Build.0 = Release|Any CPU + {A2222222-2222-2222-2222-222222222222}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A2222222-2222-2222-2222-222222222222}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A2222222-2222-2222-2222-222222222222}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A2222222-2222-2222-2222-222222222222}.Release|Any CPU.Build.0 = Release|Any CPU + {A3333333-3333-3333-3333-333333333333}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A3333333-3333-3333-3333-333333333333}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A3333333-3333-3333-3333-333333333333}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A3333333-3333-3333-3333-333333333333}.Release|Any CPU.Build.0 = Release|Any CPU + {A4444444-4444-4444-4444-444444444444}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4444444-4444-4444-4444-444444444444}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4444444-4444-4444-4444-444444444444}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4444444-4444-4444-4444-444444444444}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/src/VisionHost.App/App.xaml b/src/VisionHost.App/App.xaml new file mode 100644 index 0000000..8692475 --- /dev/null +++ b/src/VisionHost.App/App.xaml @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/src/VisionHost.App/App.xaml.cs b/src/VisionHost.App/App.xaml.cs new file mode 100644 index 0000000..82e7294 --- /dev/null +++ b/src/VisionHost.App/App.xaml.cs @@ -0,0 +1,7 @@ +using System.Windows; + +namespace VisionHost.App; + +public partial class App : Application +{ +} diff --git a/src/VisionHost.App/Converters/HexToBrushConverter.cs b/src/VisionHost.App/Converters/HexToBrushConverter.cs new file mode 100644 index 0000000..bb9d136 --- /dev/null +++ b/src/VisionHost.App/Converters/HexToBrushConverter.cs @@ -0,0 +1,25 @@ +using System.Globalization; +using System.Windows.Data; +using System.Windows.Media; + +namespace VisionHost.App.Converters; + +public sealed class HexToBrushConverter : IValueConverter +{ + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) + { + if (value is not string hex || hex.Length < 7 || hex[0] != '#') + return Brushes.White; + try + { + return (SolidColorBrush)new BrushConverter().ConvertFromString(hex)!; + } + catch + { + return Brushes.White; + } + } + + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) + => throw new NotSupportedException(); +} diff --git a/src/VisionHost.App/Themes/Station.xaml b/src/VisionHost.App/Themes/Station.xaml new file mode 100644 index 0000000..d501ea4 --- /dev/null +++ b/src/VisionHost.App/Themes/Station.xaml @@ -0,0 +1,110 @@ + + + + #1A1D21 + #252A31 + #3A414B + #F2F4F7 + #9AA3AF + #22C55E + #EF4444 + #F59E0B + #38BDF8 + #9CA3AF + #16A34A + #DC2626 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/VisionHost.App/Views/RunStationView.xaml b/src/VisionHost.App/Views/RunStationView.xaml new file mode 100644 index 0000000..3355508 --- /dev/null +++ b/src/VisionHost.App/Views/RunStationView.xaml @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +