This commit is contained in:
@@ -320,18 +320,20 @@ namespace 外科辅料和患者防护罩激光抗性测试仪
|
||||
{
|
||||
uiLabel31.Text = currentRunStatus ? "运行中" : "空闲中";
|
||||
}));
|
||||
if (!_lastRunStatus && currentRunStatus)
|
||||
{
|
||||
_isCurrentRecordAdded = false; // 添加这一行
|
||||
_isReported = false;
|
||||
Debug.WriteLine("检测到运行开始,重置报表插入标记");
|
||||
}
|
||||
|
||||
if (_lastRunStatus && !currentRunStatus && !_isCurrentRecordAdded)
|
||||
// 关键修复:只在状态从运行变为停止时插入报表
|
||||
if (_lastRunStatus && !currentRunStatus)
|
||||
{
|
||||
// 添加延迟确保数据稳定
|
||||
await Task.Delay(500);
|
||||
|
||||
var model = await InsertReportAsync();
|
||||
conductivityRepository.InsertReportItems(model);
|
||||
_isReported = true;
|
||||
if (model != null && !string.IsNullOrEmpty(model.Id2))
|
||||
{
|
||||
conductivityRepository.InsertReportItems(model);
|
||||
_isReported = true;
|
||||
//Debug.WriteLine($"报表插入成功:样品{model.sampleType}, 分类{model.result}");
|
||||
}
|
||||
}
|
||||
|
||||
_lastRunStatus = currentRunStatus;
|
||||
@@ -365,7 +367,7 @@ namespace 外科辅料和患者防护罩激光抗性测试仪
|
||||
|
||||
private async Task<PenetrationModel> InsertReportAsync()
|
||||
{
|
||||
if (!_isCurrentRecordAdded)
|
||||
if (!_isReported)
|
||||
{
|
||||
|
||||
var report = new PenetrationModel();
|
||||
|
||||
@@ -287,14 +287,22 @@ namespace 外科辅料和患者防护罩激光抗性测试仪
|
||||
uiLabel23.Text = currentRunStatus ? "运行中" : "空闲中";
|
||||
}));
|
||||
|
||||
if (!_lastRunStatus && currentRunStatus)
|
||||
// 关键修复:只在状态从运行变为停止时插入报表
|
||||
if (_lastRunStatus && !currentRunStatus)
|
||||
{
|
||||
_isCurrentRecordAdded = false; // 添加这一行
|
||||
_isReported = false;
|
||||
Debug.WriteLine("检测到运行开始,重置报表插入标记");
|
||||
// 添加延迟确保数据稳定
|
||||
await Task.Delay(500);
|
||||
|
||||
var model = await InsertReportAsync();
|
||||
if (model != null && !string.IsNullOrEmpty(model.Id))
|
||||
{
|
||||
conductivityRepository.InsertReportItems(model);
|
||||
_isReported = true;
|
||||
Debug.WriteLine($"报表插入成功:样品{model.sampleType}, 分类{model.result}");
|
||||
}
|
||||
}
|
||||
|
||||
if (_lastRunStatus && !currentRunStatus && !_isCurrentRecordAdded)
|
||||
if (_lastRunStatus && !currentRunStatus && !_isReported)
|
||||
{
|
||||
var model = await InsertReportAsync();
|
||||
conductivityRepository.InsertReportItems(model);
|
||||
@@ -332,7 +340,7 @@ namespace 外科辅料和患者防护罩激光抗性测试仪
|
||||
private bool _isCurrentRecordAdded = true;//重复添加标记
|
||||
private async Task<PrimaryIgnitionModel> InsertReportAsync()
|
||||
{
|
||||
if (!_isCurrentRecordAdded)
|
||||
if (!_isReported)
|
||||
{
|
||||
if (uiLabel10.Text != null && uiLabel10.Text.Trim() == "1")
|
||||
{
|
||||
|
||||
@@ -265,18 +265,19 @@ namespace 外科辅料和患者防护罩激光抗性测试仪
|
||||
{
|
||||
uiLabel23.Text = currentRunStatus ? "运行中" : "空闲中";
|
||||
}));
|
||||
if (!_lastRunStatus && currentRunStatus)
|
||||
// 关键修复:只在状态从运行变为停止时插入报表
|
||||
if (_lastRunStatus && !currentRunStatus)
|
||||
{
|
||||
_isReported = false;
|
||||
_isCurrentRecordAdded = false; // 添加这一行
|
||||
Debug.WriteLine("检测到运行开始,重置报表插入标记");
|
||||
}
|
||||
// 添加延迟确保数据稳定
|
||||
await Task.Delay(500);
|
||||
|
||||
if (_lastRunStatus && !currentRunStatus && !_isCurrentRecordAdded)
|
||||
{
|
||||
var model = await InsertReportAsync();
|
||||
conductivityRepository.InsertReportItems(model);
|
||||
_isReported = true;
|
||||
if (model != null && !string.IsNullOrEmpty(model.Id3))
|
||||
{
|
||||
conductivityRepository.InsertReportItems(model);
|
||||
_isReported = true;
|
||||
//Debug.WriteLine($"报表插入成功:样品{model.sampleType}, 分类{model.result}");
|
||||
}
|
||||
}
|
||||
|
||||
_lastRunStatus = currentRunStatus;
|
||||
@@ -309,7 +310,7 @@ namespace 外科辅料和患者防护罩激光抗性测试仪
|
||||
private bool _isCurrentRecordAdded = false;//重复添加标记
|
||||
private async Task<SecondaryIgnitionModel> InsertReportAsync()
|
||||
{
|
||||
if (!_isCurrentRecordAdded)
|
||||
if (!_isReported)
|
||||
{
|
||||
if (uiComboBox2.Text != null && uiComboBox2.Text.Trim() == "样品1")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user