修改批量导入变量返回实体,防止Io为0的问题

This commit is contained in:
2025-09-15 13:12:14 +08:00
parent d622d73057
commit 4773e87886
26 changed files with 171 additions and 139 deletions

View File

@@ -261,10 +261,10 @@ partial class VariableTableViewModel : ViewModelBase, INavigatable
if (improtVariableDtos.Count != 0)
{
var isSuccess = await _variableAppService.BatchImportVariablesAsync(improtVariableDtos);
if (isSuccess)
var addVariableDtos = await _variableAppService.BatchImportVariablesAsync(improtVariableDtos);
if (addVariableDtos is { Count: > 0 })
{
_variableItemList.AddRange(_mapper.Map<List<VariableItemViewModel>>(improtVariableDtos));
_variableItemList.AddRange(_mapper.Map<List<VariableItemViewModel>>(addVariableDtos));
_notificationService.ShowSuccess($"从Excel导入变量成功共导入变量{improtVariableDtos.Count}个");
}
}
@@ -338,12 +338,9 @@ partial class VariableTableViewModel : ViewModelBase, INavigatable
// 如果还有变量需要导入,则执行导入操作
if (importedVariableDtos.Count != 0)
{
var isSuccess = await _variableAppService.BatchImportVariablesAsync(importedVariableDtos);
if (isSuccess)
var addVariableDtos = await _variableAppService.BatchImportVariablesAsync(importedVariableDtos);
if (addVariableDtos is { Count: > 0 })
{
var addVariableDtos = await _variableAppService.GetVariableByOpcUaNodeIdsAsync(
importedVariableDtos.Select(v => v.OpcUaNodeId)
.ToList());
_variableItemList.AddRange(_mapper.Map<List<VariableItemViewModel>>(addVariableDtos));
_notificationService.ShowSuccess($"从OPC UA服务器导入变量成功共导入变量{importedVariableDtos.Count}个");
}