Update ProductSku library

This commit is contained in:
Sergey Chebotar 2023-05-12 09:54:28 +03:00
parent 4201b51511
commit 9c5ba835b1
5 changed files with 10 additions and 12 deletions

View File

@ -12,7 +12,7 @@
<Reference Path="Microsoft.Extensions.Primitives.dll" Pack="true" />
<Reference Path="Newtonsoft.Json.dll" Pack="true" />
<Reference Path="netDxf.dll" Pack="true" />
<Reference Path="RhSolutions.Sku.dll" Pack="true" />
<Reference Path="RhSolutions.ProductSku.dll" Pack="true" />
<Reference Path="System.Buffers.dll" Pack="true" />
<Reference Path="System.Diagnostics.DiagnosticSource.dll" Pack="true" />
<Reference Path="System.Memory.dll" Pack="true" />

View File

@ -36,7 +36,7 @@
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="netDxf" Version="2022.11.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="RhSolutions.Sku" Version="0.1.8" />
<PackageReference Include="RhSolutions.ProductSku" Version="1.0.2" />
<PackageReference Include="System.Buffers" Version="4.5.1" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
</ItemGroup>

View File

@ -38,7 +38,6 @@ public class DatabaseClient : IDatabaseClient
string json = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<IEnumerable<Product>>(json) ?? Enumerable.Empty<Product>();
}
catch
{
StatusCode = response.StatusCode;

View File

@ -60,7 +60,7 @@ public class ExcelReader : IReader, IDisposable
continue;
}
Product product = new() { ProductSku = new(currentSku) };
Product product = new(currentSku);
if (readResult.ContainsKey(product))
{
@ -124,10 +124,9 @@ public class ExcelReader : IReader, IDisposable
if (!ProductSku.TryParse(sku.ToString(), out _))
continue;
Product p = new()
{
ProductSku = new (sku.ToString()),
ProductLine = productLine.ToString(),
Product p = new(sku.ToString())
{
ProductLines = new List<string>() { productLine.ToString() },
Name = name.ToString(),
ProductMeasure = productMeasure
};

View File

@ -110,7 +110,7 @@ public class ExcelWriter : IWriter, IDisposable
Range worksheetCells = _worksheet.Cells;
Range skuColumn = _skuCell.EntireColumn;
int? row = GetPositionRow(skuColumn, positionAmount.Key.ProductSku.ToString(), positionAmount.Key.ProductLine);
int? row = GetPositionRow(skuColumn, positionAmount.Key.ProductSku.ToString(), positionAmount.Key.ProductLines.First());
if (row != null)
{
@ -126,7 +126,7 @@ public class ExcelWriter : IWriter, IDisposable
if (_oldSkuCell != null)
{
row = GetPositionRow(_oldSkuCell.EntireColumn, positionAmount.Key.ProductSku.ToString(), positionAmount.Key.ProductLine);
row = GetPositionRow(_oldSkuCell.EntireColumn, positionAmount.Key.ProductSku.ToString(), positionAmount.Key.ProductLines.First());
if (row != null)
{
@ -142,7 +142,7 @@ public class ExcelWriter : IWriter, IDisposable
}
string sku = positionAmount.Key.ProductSku.Article;
row = GetPositionRow(skuColumn, sku, positionAmount.Key.ProductLine);
row = GetPositionRow(skuColumn, sku, positionAmount.Key.ProductLines.First());
if (row != null)
{
@ -182,7 +182,7 @@ public class ExcelWriter : IWriter, IDisposable
previous.Copy(current);
current.ClearContents();
worksheetCells[row, groupColumn].Value2 = positionAmount.Key.ProductLine;
worksheetCells[row, groupColumn].Value2 = positionAmount.Key.ProductLines.First();
worksheetCells[row, nameColumn].Value2 = positionAmount.Key.Name;
if (_oldSkuCell != null)