Implement filling positions to correct sku group
This commit is contained in:
parent
711cc313e0
commit
952ca22316
17
src/PriceListTools/Position.cs
Normal file
17
src/PriceListTools/Position.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace RehauSku.PriceListTools
|
||||||
|
{
|
||||||
|
public class Position
|
||||||
|
{
|
||||||
|
public string Group { get; private set; }
|
||||||
|
public string Sku { get; private set; }
|
||||||
|
public string Name { get; private set; }
|
||||||
|
|
||||||
|
public Position(string group, string sku, string name)
|
||||||
|
{
|
||||||
|
Group = group;
|
||||||
|
Sku = sku;
|
||||||
|
Name = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -34,19 +34,27 @@ namespace RehauSku.PriceListTools
|
|||||||
protected private void FillColumn(IEnumerable<KeyValuePair<Position, double>> dictionary, int column)
|
protected private void FillColumn(IEnumerable<KeyValuePair<Position, double>> dictionary, int column)
|
||||||
{
|
{
|
||||||
List<KeyValuePair<Position, double>> missing = new List<KeyValuePair<Position, double>>();
|
List<KeyValuePair<Position, double>> missing = new List<KeyValuePair<Position, double>>();
|
||||||
|
object[,] groupColumn = TargetFile.groupCell.EntireColumn.Value2;
|
||||||
|
|
||||||
foreach (var kvp in dictionary)
|
foreach (var kvp in dictionary)
|
||||||
{
|
{
|
||||||
Range cell = TargetFile.skuCell.EntireColumn.Find(kvp.Key.Sku);
|
Range foundCell = TargetFile.skuCell.EntireColumn.Find(kvp.Key.Sku);
|
||||||
|
string foundCellGroup = groupColumn[foundCell.Row, 1].ToString();
|
||||||
|
|
||||||
if (cell == null)
|
while (foundCell != null && foundCellGroup != kvp.Key.Group)
|
||||||
|
{
|
||||||
|
foundCell = TargetFile.skuCell.EntireColumn.FindNext(foundCell);
|
||||||
|
foundCellGroup = groupColumn[foundCell.Row, 1].ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundCell == null)
|
||||||
{
|
{
|
||||||
missing.Add(kvp);
|
missing.Add(kvp);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Range sumCell = TargetFile.Sheet.Cells[cell.Row, column];
|
Range sumCell = TargetFile.Sheet.Cells[foundCell.Row, column];
|
||||||
|
|
||||||
if (sumCell.Value2 == null)
|
if (sumCell.Value2 == null)
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ namespace RehauSku.PriceListTools
|
|||||||
object[,] amountColumn = amountCell.EntireColumn.Value2;
|
object[,] amountColumn = amountCell.EntireColumn.Value2;
|
||||||
object[,] skuColumn = skuCell.EntireColumn.Value2;
|
object[,] skuColumn = skuCell.EntireColumn.Value2;
|
||||||
object[,] nameColumn = nameCell.EntireColumn.Value2;
|
object[,] nameColumn = nameCell.EntireColumn.Value2;
|
||||||
object[,] groupColumn = nameCell.EntireColumn.Value2;
|
object[,] groupColumn = groupCell.EntireColumn.Value2;
|
||||||
|
|
||||||
for (int row = amountCell.Row + 1; row < amountColumn.GetLength(0); row++)
|
for (int row = amountCell.Row + 1; row < amountColumn.GetLength(0); row++)
|
||||||
{
|
{
|
||||||
@ -60,19 +60,5 @@ namespace RehauSku.PriceListTools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Position
|
|
||||||
{
|
|
||||||
public string SkuGroup { get; private set; }
|
|
||||||
public string Sku { get; private set; }
|
|
||||||
public string Name { get; private set; }
|
|
||||||
|
|
||||||
public Position(string group, string sku, string name)
|
|
||||||
{
|
|
||||||
SkuGroup = group;
|
|
||||||
Sku = sku;
|
|
||||||
Name = name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,6 +123,7 @@
|
|||||||
<Compile Include="Assistant\SkuExtensions.cs" />
|
<Compile Include="Assistant\SkuExtensions.cs" />
|
||||||
<Compile Include="PriceListTools\CombineTool.cs" />
|
<Compile Include="PriceListTools\CombineTool.cs" />
|
||||||
<Compile Include="PriceListTools\ConvertTool.cs" />
|
<Compile Include="PriceListTools\ConvertTool.cs" />
|
||||||
|
<Compile Include="PriceListTools\Position.cs" />
|
||||||
<Compile Include="PriceListTools\PriceListTool.cs" />
|
<Compile Include="PriceListTools\PriceListTool.cs" />
|
||||||
<Compile Include="PriceListTools\MergeTool.cs" />
|
<Compile Include="PriceListTools\MergeTool.cs" />
|
||||||
<Compile Include="PriceListTools\PriceList.cs" />
|
<Compile Include="PriceListTools\PriceList.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user