aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--RhSolutions.AddIn/RhSolutions.AddIn.csproj2
-rw-r--r--RhSolutions.AddIn/Services/DxfWriter.cs2
-rw-r--r--RhSolutions.AddIn/Services/ExcelReader.cs4
-rw-r--r--RhSolutions.AddIn/Services/ExcelWriter.cs6
-rw-r--r--RhSolutions.AddIn/Tools/WorksheetExtensions.cs4
-rw-r--r--RhSolutions.Tests/CanReadProducts.cs2
-rw-r--r--RhSolutions.Tests/TestWorkbooks/Specifications/HeatingFloor.xlsxbin10005 -> 10391 bytes
7 files changed, 11 insertions, 9 deletions
diff --git a/RhSolutions.AddIn/RhSolutions.AddIn.csproj b/RhSolutions.AddIn/RhSolutions.AddIn.csproj
index c77a8b8..9e85751 100644
--- a/RhSolutions.AddIn/RhSolutions.AddIn.csproj
+++ b/RhSolutions.AddIn/RhSolutions.AddIn.csproj
@@ -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.5" />
+ <PackageReference Include="RhSolutions.Sku" Version="0.1.8" />
<PackageReference Include="System.Buffers" Version="4.5.1" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
</ItemGroup>
diff --git a/RhSolutions.AddIn/Services/DxfWriter.cs b/RhSolutions.AddIn/Services/DxfWriter.cs
index d8ed26a..9dccd05 100644
--- a/RhSolutions.AddIn/Services/DxfWriter.cs
+++ b/RhSolutions.AddIn/Services/DxfWriter.cs
@@ -47,7 +47,7 @@ public class DxfWriter : IWriter
Alignment = TextAlignment.MiddleLeft,
WidthFactor = 0.85
},
- new Text(product.ProductSku, new Vector2(x + 24750, y), 250)
+ new Text(product.ProductSku.ToString(), new Vector2(x + 24750, y), 250)
{
Alignment = TextAlignment.MiddleCenter,
WidthFactor = 0.85
diff --git a/RhSolutions.AddIn/Services/ExcelReader.cs b/RhSolutions.AddIn/Services/ExcelReader.cs
index d2b77cd..0403d7f 100644
--- a/RhSolutions.AddIn/Services/ExcelReader.cs
+++ b/RhSolutions.AddIn/Services/ExcelReader.cs
@@ -60,7 +60,7 @@ public class ExcelReader : IReader, IDisposable
continue;
}
- Product product = new() { ProductSku = currentSku };
+ Product product = new() { ProductSku = new(currentSku) };
if (readResult.ContainsKey(product))
{
@@ -126,7 +126,7 @@ public class ExcelReader : IReader, IDisposable
Product p = new()
{
- ProductSku = sku.ToString(),
+ ProductSku = new (sku.ToString()),
ProductLine = productLine.ToString(),
Name = name.ToString(),
ProductMeasure = productMeasure
diff --git a/RhSolutions.AddIn/Services/ExcelWriter.cs b/RhSolutions.AddIn/Services/ExcelWriter.cs
index 445e2d5..7685eac 100644
--- a/RhSolutions.AddIn/Services/ExcelWriter.cs
+++ b/RhSolutions.AddIn/Services/ExcelWriter.cs
@@ -110,7 +110,7 @@ public class ExcelWriter : IWriter, IDisposable
Range worksheetCells = _worksheet.Cells;
Range skuColumn = _skuCell.EntireColumn;
- int? row = GetPositionRow(skuColumn, positionAmount.Key.ProductSku, positionAmount.Key.ProductLine);
+ int? row = GetPositionRow(skuColumn, positionAmount.Key.ProductSku.ToString(), positionAmount.Key.ProductLine);
if (row != null)
{
@@ -126,7 +126,7 @@ public class ExcelWriter : IWriter, IDisposable
if (_oldSkuCell != null)
{
- row = GetPositionRow(_oldSkuCell.EntireColumn, positionAmount.Key.ProductSku, positionAmount.Key.ProductLine);
+ row = GetPositionRow(_oldSkuCell.EntireColumn, positionAmount.Key.ProductSku.ToString(), positionAmount.Key.ProductLine);
if (row != null)
{
@@ -141,7 +141,7 @@ public class ExcelWriter : IWriter, IDisposable
}
}
- string sku = positionAmount.Key.ProductSku.Substring(1, 6);
+ string sku = positionAmount.Key.ProductSku.Article;
row = GetPositionRow(skuColumn, sku, positionAmount.Key.ProductLine);
if (row != null)
diff --git a/RhSolutions.AddIn/Tools/WorksheetExtensions.cs b/RhSolutions.AddIn/Tools/WorksheetExtensions.cs
index 29ab798..7d317a8 100644
--- a/RhSolutions.AddIn/Tools/WorksheetExtensions.cs
+++ b/RhSolutions.AddIn/Tools/WorksheetExtensions.cs
@@ -18,13 +18,15 @@ public static class WorksheetExtensions
Range skuCell;
Range programLineCell;
Range nameCell;
+ Range measureCell;
Range[] cells = new[]
{
amountCell = worksheet.Cells.Find(pricelistParameters["Amount"]),
skuCell = worksheet.Cells.Find(pricelistParameters["Sku"]),
programLineCell = worksheet.Cells.Find(pricelistParameters["ProductLine"]),
- nameCell = worksheet.Cells.Find(pricelistParameters["Name"])
+ nameCell = worksheet.Cells.Find(pricelistParameters["Name"]),
+ measureCell = worksheet.Cells.Find(pricelistParameters["Measure"])
};
return cells.All(x => x != null);
diff --git a/RhSolutions.Tests/CanReadProducts.cs b/RhSolutions.Tests/CanReadProducts.cs
index fd33a69..1fa7357 100644
--- a/RhSolutions.Tests/CanReadProducts.cs
+++ b/RhSolutions.Tests/CanReadProducts.cs
@@ -39,7 +39,7 @@ public class CanReadProducts : IDisposable
Assert.NotNull(products);
Assert.NotEmpty(products);
- Assert.Equal("11600011001", products.First().Key.ProductSku);
+ Assert.Equal("11600011001", products.First().Key.ProductSku?.ToString());
Assert.Equal(20.0, products.First().Value);
Assert.Equal(125.0, products.Sum(p => p.Value));
Assert.Equal(3, products.Count());
diff --git a/RhSolutions.Tests/TestWorkbooks/Specifications/HeatingFloor.xlsx b/RhSolutions.Tests/TestWorkbooks/Specifications/HeatingFloor.xlsx
index f0b76f3..20416e0 100644
--- a/RhSolutions.Tests/TestWorkbooks/Specifications/HeatingFloor.xlsx
+++ b/RhSolutions.Tests/TestWorkbooks/Specifications/HeatingFloor.xlsx
Binary files differ