diff --git a/src/Commands/ImportPathCommand.cs b/src/Commands/ImportPathCommand.cs index 4c23200..8ff73fa 100644 --- a/src/Commands/ImportPathCommand.cs +++ b/src/Commands/ImportPathCommand.cs @@ -158,6 +158,11 @@ namespace NavisworksTransport.Commands /// public int SkippedCount { get; set; } + /// + /// 因重名被重命名的路径数量 + /// + public int RenamedCount { get; set; } + /// /// 失败的路径数量 /// @@ -436,6 +441,7 @@ namespace NavisworksTransport.Commands case DuplicateNameHandling.Rename: finalRouteName = GenerateUniqueName(route.Name, _pathPlanningManager.Routes); route.Name = finalRouteName; + result.RenamedCount++; LogInfo($"重命名路径: {route.Name} -> {finalRouteName}"); break; @@ -512,7 +518,7 @@ namespace NavisworksTransport.Commands result.ExecutionTimeMs = (long)elapsedMs; LogInfo($"导入路径执行完成,总耗时: {elapsedMs:F0}ms"); - LogInfo($"导入结果 - 文件中: {result.TotalInFile}, 导入: {result.ImportedCount}, 失败: {result.FailedCount}, 跳过: {result.SkippedCount}"); + LogInfo($"导入结果 - 文件中: {result.TotalInFile}, 导入: {result.ImportedCount}, 失败: {result.FailedCount}, 跳过: {result.SkippedCount}, 重命名: {result.RenamedCount}"); // 创建结果对象 string resultMessage; @@ -531,6 +537,10 @@ namespace NavisworksTransport.Commands { resultMessage += $",跳过 {result.SkippedCount} 项"; } + if (result.RenamedCount > 0) + { + resultMessage += $",重命名 {result.RenamedCount} 项"; + } } var commandResult = PathPlanningResult.Success(result, resultMessage); diff --git a/src/UI/WPF/ViewModels/PathEditingViewModel.cs b/src/UI/WPF/ViewModels/PathEditingViewModel.cs index 8cb134f..ce7eba1 100644 --- a/src/UI/WPF/ViewModels/PathEditingViewModel.cs +++ b/src/UI/WPF/ViewModels/PathEditingViewModel.cs @@ -5737,6 +5737,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels var filePaths = openFileDialog.FileNames; int totalImported = 0; int totalFailed = 0; + int totalRenamed = 0; foreach (var filePath in filePaths) { @@ -5778,6 +5779,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels { totalImported += importResult.ImportedCount; totalFailed += importResult.FailedCount; + totalRenamed += importResult.RenamedCount; } } else @@ -5806,6 +5808,8 @@ namespace NavisworksTransport.UI.WPF.ViewModels dialogMsg.AppendLine($"成功导入: {totalImported} 个路径"); if (totalFailed > 0) dialogMsg.AppendLine($"导入失败: {totalFailed} 个路径"); + if (totalRenamed > 0) + dialogMsg.AppendLine($"重名自动重命名: {totalRenamed} 个路径"); dialogMsg.AppendLine($"来源文件数: {filePaths.Length}"); DialogHelper.ShowAutoClosingMessageBox( dialogMsg.ToString(),