更新 测试次数

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 => "湿态 - 洗涤剂",