This commit is contained in:
xyy
2026-02-03 11:14:27 +08:00
parent 514e8869d9
commit 48b6e81901

View File

@@ -23,8 +23,8 @@ namespace P_RTU_TEST_WinForm
private IModbusMaster _master;
private TcpClient _client = new TcpClient();
// 在类开头部分添加
private string _productModel = ""; // 存储产品
private TextBox txtProductModel; // 产品号输入框
private string _productModel = ""; // 存储产品
private TextBox txtProductModel; // 产品号输入框
// 在类开头部分添加
private int _calculationCount = 1; // 默认计算1次
@@ -54,10 +54,10 @@ namespace P_RTU_TEST_WinForm
InitializeComponent();
// 添加产品号标签和输入框
// 添加产品号标签和输入框
Label lblProductModel = new Label()
{
Text = "产品号:",
Text = "产品号:",
Location = new Point(366, 15),
Size = new Size(68, 15)
};
@@ -596,7 +596,7 @@ namespace P_RTU_TEST_WinForm
return;
}
// 获取产品
// 获取产品
string productModel = string.IsNullOrWhiteSpace(txtProductModel.Text)
? "未命名产品"
: txtProductModel.Text.Trim();
@@ -626,7 +626,7 @@ namespace P_RTU_TEST_WinForm
{
sw.WriteLine("=== 测试报表 ===");
sw.WriteLine($"生成时间: {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
sw.WriteLine($"产品号: {productModel}");
sw.WriteLine($"产品号: {productModel}");
sw.WriteLine($"测试时间: {txtTestTime.Text} 秒");
sw.WriteLine($"计算次数: 1 次");
sw.WriteLine($"数据总数: {_distanceValues.Count}");
@@ -656,7 +656,7 @@ namespace P_RTU_TEST_WinForm
return;
}
// 获取产品
// 获取产品
string productModel = string.IsNullOrWhiteSpace(txtProductModel.Text)
? "未命名产品"
: txtProductModel.Text.Trim();
@@ -684,7 +684,7 @@ namespace P_RTU_TEST_WinForm
{
sw.WriteLine("=== 多次测试报表 ===");
sw.WriteLine($"生成时间: {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
sw.WriteLine($"产品号: {productModel}");
sw.WriteLine($"产品号: {productModel}");
sw.WriteLine($"单次测试时间: {txtTestTime.Text} 秒");
sw.WriteLine($"计算次数: {_calculationCount} 次");
sw.WriteLine($"总数据量: {_allTestResults.Sum(list => list.Count)}");