更新 测试次数

This commit is contained in:
GukSang.Jin
2026-06-08 18:08:30 +08:00
parent 7fff3ae45d
commit 9ccf012cec
2 changed files with 82 additions and 7 deletions

View File

@@ -67,6 +67,7 @@ namespace Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance.ViewModel
private double runStartDisplacementMm;
private double slidingStartDisplacementMm;
private double? slidingStartTimeSeconds;
private int activeRunLubricantIndex;
[ObservableProperty]
private string testNumber = $"SLIP-{DateTime.Now:yyyyMMdd-HHmm}";
@@ -167,6 +168,18 @@ namespace Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance.ViewModel
[ObservableProperty]
private string resetButtonText = "复位";
[ObservableProperty]
private int completedTestCount;
[ObservableProperty]
private int dryTestCount;
[ObservableProperty]
private int wetTestCount;
[ObservableProperty]
private int frostTestCount;
[ObservableProperty]
private string staticCoefficient = "0.00";
@@ -689,6 +702,7 @@ namespace Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance.ViewModel
runStartDisplacementMm = deviceService.CurrentSnapshot.DisplacementMm;
slidingStartDisplacementMm = runStartDisplacementMm;
slidingStartTimeSeconds = null;
activeRunLubricantIndex = SelectedLubricantIndex;
runStopwatch.Restart();
UploadProgress = 0;
lastRealtimeCurveTraceLoggedAt = DateTime.MinValue;
@@ -746,6 +760,7 @@ namespace Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance.ViewModel
{
runStopwatch.Stop();
LogRealtimeCurveSummary("测试停止");
RecordCompletedTest();
if (!slidingStartTimeSeconds.HasValue)
{
Log.Warning(
@@ -871,6 +886,33 @@ namespace Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance.ViewModel
verdict);
}
private void RecordCompletedTest()
{
CompletedTestCount++;
switch (activeRunLubricantIndex)
{
case 1:
case 2:
WetTestCount++;
break;
case 3:
FrostTestCount++;
break;
default:
DryTestCount++;
break;
}
Log.Information(
"完整测试次数已更新TestNumber={TestNumber}, Lubricant={Lubricant}, CompletedTestCount={CompletedTestCount}, DryTestCount={DryTestCount}, WetTestCount={WetTestCount}, FrostTestCount={FrostTestCount}",
TestNumber,
CurrentLubricant(activeRunLubricantIndex),
CompletedTestCount,
DryTestCount,
WetTestCount,
FrostTestCount);
}
private void AbortRun(string message)
{
runStopwatch.Stop();
@@ -1386,7 +1428,9 @@ namespace Footwear_Test_methodsfor_wholeshoe_Slipresistanceperformance.ViewModel
_ => "250(含)以上"
};
private string CurrentLubricant() => SelectedLubricantIndex switch
private string CurrentLubricant() => CurrentLubricant(SelectedLubricantIndex);
private static string CurrentLubricant(int lubricantIndex) => lubricantIndex switch
{
1 => "湿态 - 蒸馏水",
2 => "湿态 - 洗涤剂",

View File

@@ -249,13 +249,44 @@
<DockPanel Grid.Row="1" LastChildFill="True" MinHeight="0" ClipToBounds="True">
<Border DockPanel.Dock="Left" Width="280" Classes="panel" Margin="0,0,10,0">
<Grid RowDefinitions="Auto,Auto,*" RowSpacing="8">
<TextBlock Text="实时数据"
Classes="section-title"
HorizontalAlignment="Center"
Margin="0,-4,0,0"/>
<Grid RowDefinitions="Auto,Auto,Auto,*" RowSpacing="8">
<Grid ColumnDefinitions="*,Auto" Margin="0,-4,0,0">
<TextBlock Text="实时数据"
Classes="section-title"
VerticalAlignment="Center"/>
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="4" VerticalAlignment="Center">
<TextBlock Text="完整测试" Classes="caption" VerticalAlignment="Center"/>
<TextBlock Text="{Binding CompletedTestCount}" FontWeight="SemiBold" Foreground="#1D4ED8" VerticalAlignment="Center"/>
<TextBlock Text="次" Classes="caption" VerticalAlignment="Center"/>
</StackPanel>
</Grid>
<Border Grid.Row="1"
Background="#F8FAFD"
BorderBrush="{StaticResource LineBrush}"
BorderThickness="1"
CornerRadius="8"
Padding="8,6">
<Grid ColumnDefinitions="*,*,*">
<StackPanel Orientation="Horizontal" Spacing="3" HorizontalAlignment="Center">
<TextBlock Text="干态" Classes="caption"/>
<TextBlock Text="{Binding DryTestCount}" FontWeight="SemiBold" Foreground="#047857"/>
<TextBlock Text="次" Classes="caption"/>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="3" HorizontalAlignment="Center">
<TextBlock Text="湿态" Classes="caption"/>
<TextBlock Text="{Binding WetTestCount}" FontWeight="SemiBold" Foreground="#1D4ED8"/>
<TextBlock Text="次" Classes="caption"/>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="3" HorizontalAlignment="Center">
<TextBlock Text="冰霜" Classes="caption"/>
<TextBlock Text="{Binding FrostTestCount}" FontWeight="SemiBold" Foreground="#7E22CE"/>
<TextBlock Text="次" Classes="caption"/>
</StackPanel>
</Grid>
</Border>
<Border Grid.Row="2"
Background="#F8FAFD"
BorderBrush="{StaticResource LineBrush}"
BorderThickness="1"
@@ -280,7 +311,7 @@
</Grid>
</Border>
<ScrollViewer Grid.Row="2"
<ScrollViewer Grid.Row="3"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto"
ClipToBounds="True">