Compare commits
No commits in common. "d6a78c42c7eddcff64c3e97b9877dc5969f80968" and "8902d51c14f2679aa3bf168dc3a02056a1352f57" have entirely different histories.
d6a78c42c7
...
8902d51c14
@ -8,7 +8,6 @@
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
|
||||
<ExcelDnaPackCompressResources>false</ExcelDnaPackCompressResources>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
|
@ -4,8 +4,6 @@ using RhSolutions.Tools;
|
||||
#endif
|
||||
|
||||
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace RhSolutions.Services;
|
||||
|
||||
#if !NET472
|
||||
@ -132,12 +130,6 @@ public class ExcelWriter : IWriter, IDisposable
|
||||
|
||||
if (row != null)
|
||||
{
|
||||
Range nameCell = worksheetCells[row, _nameCell.Column];
|
||||
if (!Regex.IsMatch(nameCell.Value2, @"(арт. \d{11})"))
|
||||
{
|
||||
nameCell.AddValue($"-> замена (арт. {positionAmount.Key.ProductSku})");
|
||||
}
|
||||
|
||||
foreach (int column in columns)
|
||||
{
|
||||
Range cell = worksheetCells[row, column];
|
||||
@ -154,12 +146,6 @@ public class ExcelWriter : IWriter, IDisposable
|
||||
|
||||
if (row != null)
|
||||
{
|
||||
Range nameCell = worksheetCells[row, _nameCell.Column];
|
||||
if (!Regex.IsMatch(nameCell.Value2, @"(арт. \d{11})"))
|
||||
{
|
||||
nameCell.AddValue($" -> замена (арт. {positionAmount.Key.ProductSku})");
|
||||
}
|
||||
|
||||
foreach (int column in columns)
|
||||
{
|
||||
Range cell = worksheetCells[row, column];
|
||||
@ -198,7 +184,8 @@ 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)
|
||||
{
|
||||
|
@ -44,18 +44,5 @@ public static class WorksheetExtensions
|
||||
range.Value2 += value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddValue(this Range range, string value)
|
||||
{
|
||||
if (range.Value2 == null)
|
||||
{
|
||||
range.Value2 = value;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
range.Value2 = $"{range.Value2} {value}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,14 +45,14 @@ public class CanReadProducts : IDisposable
|
||||
Assert.Equal(3, products.Count());
|
||||
}
|
||||
|
||||
[ExcelFact(Workbook = @"TestWorkbooks\TestSpecification.xlsx")]
|
||||
[ExcelFact(Workbook = @"TestWorkbooks\TestSpecificaion.xlsx")]
|
||||
public void CanReadWorkbook()
|
||||
{
|
||||
Worksheet worksheet = Util.Workbook.Worksheets[1];
|
||||
var result = _reader.ReadProducts(new[] { worksheet });
|
||||
Assert.NotNull(result);
|
||||
Assert.NotEmpty(result);
|
||||
Assert.Equal("TestSpecification", result.First().Item1);
|
||||
Assert.Equal("TestSpecificaion", result.First().Item1);
|
||||
var products = result.First().Item2;
|
||||
Assert.Equal(46, products.Count());
|
||||
Assert.Equal(29266, products.Sum(p => p.Value));
|
||||
|
Loading…
x
Reference in New Issue
Block a user