diff --git a/Docs/用户使用手册.md b/Docs/用户使用手册.md
index 99f71ce..688828c 100644
--- a/Docs/用户使用手册.md
+++ b/Docs/用户使用手册.md
@@ -783,7 +783,7 @@ PowerShell.exe -ExecutionPolicy Bypass -File .\run.ps1
| 字段 | 含义 |
| ------------- | ------------------------------------------ |
-| **产品名称** | 例如 "24 路固态功率控制器" |
+| **设备名称** | 例如 "24 路固态功率控制器" |
| **型号** | 产品型号 |
| **编号** | 被测件序列号 / 单号;建议唯一 |
| **生产厂家** | 被测件来源 |
@@ -1370,7 +1370,7 @@ $$
| 字段 | 填入 |
| -------- | -------------------------- |
-| 产品名称 | 24 路固态功率控制器 |
+| 设备名称 | 24 路固态功率控制器 |
| 型号 | SSPC-24P-A |
| 编号 | SSPC-2026-001 |
| 生产厂家 | XX 公司 |
diff --git a/SSPCTester.Logic/Models/Results.cs b/SSPCTester.Logic/Models/Results.cs
index b3add4b..fdddf24 100644
--- a/SSPCTester.Logic/Models/Results.cs
+++ b/SSPCTester.Logic/Models/Results.cs
@@ -89,8 +89,19 @@ public partial class PowerLossRow : ObservableObject
/// 保护功能单项结果。
public partial class ProtectRow : ObservableObject
{
+ [ObservableProperty] private int _index;
[ObservableProperty] private string _protectType = "";
[ObservableProperty] private string _trigger = "";
+ [ObservableProperty] private string _measuredValue = "----";
+ [ObservableProperty] private string _judgeMode = "人工判别";
[ObservableProperty] private double _tripTimeMs;
[ObservableProperty] private TestStatus _status = TestStatus.Untested;
+
+ public static string BuildMeasuredValue(string protectType, double? inputVoltage, double? inputCurrent) => protectType switch
+ {
+ "跳闸" when inputCurrent.HasValue => $"{inputCurrent.Value:F3} A",
+ "过压" or "欠压" when inputVoltage.HasValue => $"{inputVoltage.Value:F3} V",
+ "限流" when inputCurrent.HasValue => $"{inputCurrent.Value:F3} A",
+ _ => "----"
+ };
}
diff --git a/SSPCTester.Logic/Report/ProfessionalReportGenerator.cs b/SSPCTester.Logic/Report/ProfessionalReportGenerator.cs
index 27bb349..3fe8e25 100644
--- a/SSPCTester.Logic/Report/ProfessionalReportGenerator.cs
+++ b/SSPCTester.Logic/Report/ProfessionalReportGenerator.cs
@@ -95,9 +95,9 @@ public sealed class ReportGenerator
});
IdentityRow(table, "报告编号", reportNo, true);
IdentityRow(table, "项目名称", ValueOrDash(p.Name));
- IdentityRow(table, "产品名称", ValueOrDash(p.Dut.ProductName));
- IdentityRow(table, "产品型号", ValueOrDash(p.Dut.Model));
- IdentityRow(table, "产品编号", ValueOrDash(p.Dut.SerialNumber));
+ IdentityRow(table, "设备编号", ValueOrDash(p.Dut.SerialNumber));
+ IdentityRow(table, "设备名称", ValueOrDash(p.Dut.ProductName));
+ IdentityRow(table, "设备型号", ValueOrDash(p.Dut.Model));
IdentityRow(table, "委托/生产单位", ValueOrDash(p.Dut.Manufacturer));
IdentityRow(table, "检测日期", p.Site.TestDate.ToString("yyyy年MM月dd日"));
});
@@ -275,9 +275,9 @@ public sealed class ReportGenerator
columns.ConstantColumn(82); columns.RelativeColumn();
columns.ConstantColumn(82); columns.RelativeColumn();
});
- OverviewCell(table, "设备名称", p.Dut.ProductName);
- OverviewCell(table, "设备型号", p.Dut.Model);
OverviewCell(table, "设备编号", p.Dut.SerialNumber);
+ OverviewCell(table, "设备名称", p.Dut.ProductName);
+ OverviewCell(table, "设备型号", p.Dut.Model);
OverviewCell(table, "生产厂家", p.Dut.Manufacturer);
OverviewCell(table, "测试人员", p.Site.Tester);
OverviewCell(table, "测试日期", p.Site.TestDate.ToString("yyyy-MM-dd"));
@@ -377,12 +377,16 @@ public sealed class ReportGenerator
})));
private static void ProtectTable(IContainer container, Project p) =>
- DataTable(container, new[] { 1.2f, 1.6f, 1f, 0.72f },
- new[] { "保护类型", "触发条件", "关断时间 ms", "判定" },
+ DataTable(container, new[] { 0.55f, 1.1f, 1.45f, 1f, 0.95f, 0.75f },
+ new[] { "序号", "保护类型", "触发条件", "实测值", "判别模式", "判别结果" },
p.ProtectResults.Select(r => new ReportRow(r.Status, new[]
{
- ValueOrDash(r.ProtectType), ValueOrDash(r.Trigger),
- Format(r.TripTimeMs, "F2"), StatusText(r.Status)
+ r.Index > 0 ? r.Index.ToString() : "—",
+ ValueOrDash(r.ProtectType),
+ ValueOrDash(r.Trigger),
+ ValueOrDash(r.MeasuredValue),
+ ValueOrDash(r.JudgeMode),
+ StatusText(r.Status)
})));
private static void DataTable(IContainer container, IReadOnlyList widths,
diff --git a/SSPCTester.Logic/Report/ReportGenerator.cs b/SSPCTester.Logic/Report/ReportGenerator.cs
index c9b5ac7..8817d41 100644
--- a/SSPCTester.Logic/Report/ReportGenerator.cs
+++ b/SSPCTester.Logic/Report/ReportGenerator.cs
@@ -145,9 +145,9 @@ internal sealed class LegacyReportGenerator
c.Table(t =>
{
t.ColumnsDefinition(cd => { cd.ConstantColumn(120); cd.RelativeColumn(); });
- Row(t, "设备名称", p.Dut.ProductName);
- Row(t, "设备型号", p.Dut.Model);
Row(t, "设备编号", p.Dut.SerialNumber);
+ Row(t, "设备名称", p.Dut.ProductName);
+ Row(t, "设备型号", p.Dut.Model);
Row(t, "生产厂家", p.Dut.Manufacturer);
});
}
@@ -256,14 +256,21 @@ internal sealed class LegacyReportGenerator
{
t.ColumnsDefinition(cd =>
{
- cd.RelativeColumn(); cd.RelativeColumn(); cd.RelativeColumn(); cd.ConstantColumn(60);
+ cd.ConstantColumn(40);
+ cd.RelativeColumn();
+ cd.RelativeColumn();
+ cd.RelativeColumn();
+ cd.ConstantColumn(70);
+ cd.ConstantColumn(60);
});
- HeaderRow(t, "保护类型", "触发条件", "关断时间(ms)", "结果");
+ HeaderRow(t, "序号", "保护类型", "触发条件", "实测值", "判别模式", "判别结果");
foreach (var r in p.ProtectResults)
{
+ t.Cell().Padding(3).Text(r.Index.ToString());
t.Cell().Padding(3).Text(r.ProtectType);
t.Cell().Padding(3).Text(r.Trigger);
- t.Cell().Padding(3).Text(r.TripTimeMs.ToString("F2"));
+ t.Cell().Padding(3).Text(r.MeasuredValue);
+ t.Cell().Padding(3).Text(r.JudgeMode);
t.Cell().Padding(3).Text(StatusText(r.Status)).FontColor(StatusColor(r.Status));
}
});
diff --git a/SSPCTester.Logic/Report/WordReportGenerator.cs b/SSPCTester.Logic/Report/WordReportGenerator.cs
index 177d000..b098e6a 100644
--- a/SSPCTester.Logic/Report/WordReportGenerator.cs
+++ b/SSPCTester.Logic/Report/WordReportGenerator.cs
@@ -87,9 +87,9 @@ public sealed class WordReportGenerator
{
("报告编号", reportNo),
("项目名称", ValueOrDash(p.Name)),
- ("设备名称", ValueOrDash(p.Dut.ProductName)),
- ("设备型号", ValueOrDash(p.Dut.Model)),
("设备编号", ValueOrDash(p.Dut.SerialNumber)),
+ ("设备名称", ValueOrDash(p.Dut.ProductName)),
+ ("设备型号", ValueOrDash(p.Dut.Model)),
("委托/生产单位", ValueOrDash(p.Dut.Manufacturer)),
("检测日期", p.Site.TestDate.ToString("yyyy-MM-dd"))
}),
@@ -166,11 +166,15 @@ public sealed class WordReportGenerator
Section(body, section++, "保护功能", "PROTECTION FUNCTION");
if (p.ProtectResults.Count > 0)
body.Append(ResultTable(
- new[] { "保护类型", "触发条件", "关断时间 ms", "判定" },
+ new[] { "序号", "保护类型", "触发条件", "实测值", "判别模式", "判别结果" },
p.ProtectResults.Select(r => new[]
{
- ValueOrDash(r.ProtectType), ValueOrDash(r.Trigger),
- Format(r.TripTimeMs, "F2"), StatusText(r.Status)
+ r.Index > 0 ? r.Index.ToString() : "—",
+ ValueOrDash(r.ProtectType),
+ ValueOrDash(r.Trigger),
+ ValueOrDash(r.MeasuredValue),
+ ValueOrDash(r.JudgeMode),
+ StatusText(r.Status)
})));
ManualNote(body, p.TestFunction?.Protect);
}
@@ -189,8 +193,7 @@ public sealed class WordReportGenerator
private static Table OverviewTable(Project p) => KeyValueGrid(new[]
{
- ("产品名称", p.Dut.ProductName), ("产品型号", p.Dut.Model),
- ("产品编号", p.Dut.SerialNumber), ("生产厂家", p.Dut.Manufacturer),
+ ("设备编号", p.Dut.SerialNumber), ("设备名称", p.Dut.ProductName), ("设备型号", p.Dut.Model),
("测试人员", p.Site.Tester), ("测试日期", p.Site.TestDate.ToString("yyyy-MM-dd")),
("环境温度", $"{p.Site.TemperatureC:F1} ℃"), ("相对湿度", $"{p.Site.HumidityPct:F1} %RH"),
("环境气压", $"{p.Site.PressureKpa:F1} kPa"), ("项目创建", p.CreatedAt.ToString("yyyy-MM-dd HH:mm")),
diff --git a/SSPCTester.Logic/Testing/ProtectTest.cs b/SSPCTester.Logic/Testing/ProtectTest.cs
index a3cc27a..624c67a 100644
--- a/SSPCTester.Logic/Testing/ProtectTest.cs
+++ b/SSPCTester.Logic/Testing/ProtectTest.cs
@@ -22,13 +22,17 @@ public sealed class ProtectTest : ITestModule
public async Task RunAsync(TestContext ctx, IProgress progress, CancellationToken ct)
{
ctx.Project.ProtectResults.Clear();
+ var latestPower = ctx.Project.PowerResults.LastOrDefault();
for (int i = 0; i < _items.Length; i++)
{
ct.ThrowIfCancellationRequested();
var row = new ProtectRow
{
+ Index = i + 1,
ProtectType = _items[i].Type,
Trigger = _items[i].Trigger,
+ MeasuredValue = ProtectRow.BuildMeasuredValue(_items[i].Type, latestPower?.Vin, latestPower?.Iin),
+ JudgeMode = "人工判别",
Status = TestStatus.Running
};
ctx.Project.ProtectResults.Add(row);
diff --git a/SSPCTester.Seed/Program.cs b/SSPCTester.Seed/Program.cs
index 2313786..46241c2 100644
--- a/SSPCTester.Seed/Program.cs
+++ b/SSPCTester.Seed/Program.cs
@@ -163,8 +163,11 @@ public static class Program
{
p.ProtectResults.Add(new ProtectRow
{
+ Index = i + 1,
ProtectType = protects[i].Type,
Trigger = protects[i].Trigger,
+ MeasuredValue = ProtectRow.BuildMeasuredValue(protects[i].Type, 28.0, 1.0),
+ JudgeMode = "人工判别",
TripTimeMs = Math.Round(2.0 + i * 0.3 + rng.NextDouble() * 0.2, 2),
Status = TestStatus.Pass
});
diff --git a/SSPCTester.UI/ViewModels/MainViewModel.cs b/SSPCTester.UI/ViewModels/MainViewModel.cs
index 26bd5f4..f3dc16a 100644
--- a/SSPCTester.UI/ViewModels/MainViewModel.cs
+++ b/SSPCTester.UI/ViewModels/MainViewModel.cs
@@ -354,7 +354,7 @@ public partial class MainViewModel : ObservableObject
Name = dlg.ProjectName,
Dut = new DutInfo
{
- ProductName = "固态功率控制器",
+ ProductName = dlg.ProductName,
SerialNumber = dlg.SerialNumber,
Model = dlg.Model,
},
diff --git a/SSPCTester.UI/ViewModels/ProtectViewModel.cs b/SSPCTester.UI/ViewModels/ProtectViewModel.cs
index 77aa453..1a308f1 100644
--- a/SSPCTester.UI/ViewModels/ProtectViewModel.cs
+++ b/SSPCTester.UI/ViewModels/ProtectViewModel.cs
@@ -30,8 +30,25 @@ public partial class ProtectViewModel : ObservableObject
public void SetProject(Project p)
{
Project = p;
+ SyncRowsFromProject();
+ }
+
+ private void SyncRowsFromProject()
+ {
+ if (Project == null) return;
+
+ var latestPower = Project.PowerResults.LastOrDefault();
+ for (int i = 0; i < Project.ProtectResults.Count; i++)
+ {
+ var row = Project.ProtectResults[i];
+ row.Index = i + 1;
+ row.MeasuredValue = ProtectRow.BuildMeasuredValue(row.ProtectType, latestPower?.Vin, latestPower?.Iin);
+ if (string.IsNullOrWhiteSpace(row.JudgeMode))
+ row.JudgeMode = "人工判别";
+ }
+
Rows.Clear();
- foreach (var r in p.ProtectResults) Rows.Add(r);
+ foreach (var row in Project.ProtectResults) Rows.Add(row);
}
[RelayCommand]
@@ -40,6 +57,7 @@ public partial class ProtectViewModel : ObservableObject
if (Project == null) return;
Project.ProtectResults.Clear();
Rows.Clear();
+ var latestPower = Project.PowerResults.LastOrDefault();
var items = new (string, string)[]
{
("跳闸", "1.5x额定电流"),
@@ -51,7 +69,16 @@ public partial class ProtectViewModel : ObservableObject
};
for (int i = 0; i < items.Length; i++)
{
- var r = new ProtectRow { ProtectType = items[i].Item1, Trigger = items[i].Item2, TripTimeMs = 2 + i * 0.3, Status = TestStatus.Pass };
+ var r = new ProtectRow
+ {
+ Index = i + 1,
+ ProtectType = items[i].Item1,
+ Trigger = items[i].Item2,
+ MeasuredValue = ProtectRow.BuildMeasuredValue(items[i].Item1, latestPower?.Vin, latestPower?.Iin),
+ JudgeMode = "人工判别",
+ TripTimeMs = 2 + i * 0.3,
+ Status = TestStatus.Pass
+ };
Project.ProtectResults.Add(r);
Rows.Add(r);
}
diff --git a/SSPCTester.UI/Views/NewProjectDialog.xaml b/SSPCTester.UI/Views/NewProjectDialog.xaml
index 094d8d5..d23d59e 100644
--- a/SSPCTester.UI/Views/NewProjectDialog.xaml
+++ b/SSPCTester.UI/Views/NewProjectDialog.xaml
@@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="新建项目"
- Width="480" Height="380"
+ Width="480" Height="420"
WindowStartupLocation="CenterOwner"
ResizeMode="NoResize"
Background="{StaticResource BgAppBrush}"
@@ -31,6 +31,8 @@
+
+
@@ -39,11 +41,14 @@
-
-
+
+
-
-
+
+
+
+
+
diff --git a/SSPCTester.UI/Views/NewProjectDialog.xaml.cs b/SSPCTester.UI/Views/NewProjectDialog.xaml.cs
index 145bd7e..3e559b8 100644
--- a/SSPCTester.UI/Views/NewProjectDialog.xaml.cs
+++ b/SSPCTester.UI/Views/NewProjectDialog.xaml.cs
@@ -6,6 +6,7 @@ public partial class NewProjectDialog : Window
{
public string ProjectName { get; private set; } = "";
public string SerialNumber { get; private set; } = "";
+ public string ProductName { get; private set; } = "";
public string Model { get; private set; } = "";
public string Tester { get; private set; } = "";
@@ -31,6 +32,7 @@ public partial class NewProjectDialog : Window
}
ProjectName = name;
SerialNumber = SerialBox.Text?.Trim() ?? "";
+ ProductName = ProductNameBox.Text?.Trim() ?? "";
Model = ModelBox.Text?.Trim() ?? "";
Tester = TesterBox.Text?.Trim() ?? "";
DialogResult = true;
diff --git a/SSPCTester.UI/Views/ProjectInfoView.xaml b/SSPCTester.UI/Views/ProjectInfoView.xaml
index 2cc5383..f188426 100644
--- a/SSPCTester.UI/Views/ProjectInfoView.xaml
+++ b/SSPCTester.UI/Views/ProjectInfoView.xaml
@@ -35,12 +35,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
@@ -62,27 +62,35 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
+
-
-
+
diff --git a/SSPCTester.UI/Views/ProtectView.xaml b/SSPCTester.UI/Views/ProtectView.xaml
index 6c88457..067a31f 100644
--- a/SSPCTester.UI/Views/ProtectView.xaml
+++ b/SSPCTester.UI/Views/ProtectView.xaml
@@ -1,6 +1,7 @@
-
-
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
+
-
-
+
+
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+