Fix replace and missing descriptions duplicates

This commit is contained in:
Sergey Chebotar 2023-05-19 08:16:40 +03:00
parent ea69a77a0e
commit 08fcc33f9d

View File

@ -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)
{