diff --git a/RhSolutions.AddIn/Services/ExcelWriter.cs b/RhSolutions.AddIn/Services/ExcelWriter.cs index c9ab4e2..7606ad7 100644 --- a/RhSolutions.AddIn/Services/ExcelWriter.cs +++ b/RhSolutions.AddIn/Services/ExcelWriter.cs @@ -4,6 +4,8 @@ using RhSolutions.Tools; #endif +using System.Text.RegularExpressions; + namespace RhSolutions.Services; #if !NET472 @@ -131,7 +133,10 @@ public class ExcelWriter : IWriter, IDisposable if (row != null) { Range nameCell = worksheetCells[row, _nameCell.Column]; - nameCell.AddValue($"(замена арт. {positionAmount.Key.ProductSku})"); + if (!Regex.IsMatch(nameCell.Value2, @"(арт. \d{11})")) + { + nameCell.AddValue($"-> замена (арт. {positionAmount.Key.ProductSku})"); + } foreach (int column in columns) { @@ -150,7 +155,10 @@ public class ExcelWriter : IWriter, IDisposable if (row != null) { Range nameCell = worksheetCells[row, _nameCell.Column]; - nameCell.AddValue($"(замена арт. {positionAmount.Key.ProductSku})"); + if (!Regex.IsMatch(nameCell.Value2, @"(арт. \d{11})")) + { + nameCell.AddValue($" -> замена (арт. {positionAmount.Key.ProductSku})"); + } foreach (int column in columns) { @@ -190,8 +198,7 @@ public class ExcelWriter : IWriter, IDisposable current.ClearContents(); worksheetCells[row, groupColumn].Value2 = product.ProductLines.FirstOrDefault() ?? string.Empty; - worksheetCells[row, nameColumn].Value2 = $"{product.Name} не найден ({product.ProductSku})"; - + worksheetCells[row, nameColumn].Value2 = $"{product.Name} -> не найден (арт. {product.ProductSku})"; worksheetCells[row, skuColumn].Value2 = "???"; if (_oldSkuCell != null) {