parent
1e91c34e46
commit
7844ac52b6
@ -45,13 +45,17 @@ namespace RehauSku.PriceListTools
|
|||||||
|
|
||||||
protected void FillPositionAmountToColumns(KeyValuePair<Position, double> positionAmount, params int[] columns)
|
protected void FillPositionAmountToColumns(KeyValuePair<Position, double> positionAmount, params int[] columns)
|
||||||
{
|
{
|
||||||
int? row = GetPositionRow(TargetFile.SkuCell.EntireColumn, positionAmount.Key.Sku, positionAmount.Key.Group);
|
Range worksheetCells = TargetFile.Sheet.Cells;
|
||||||
|
Range skuColumn = TargetFile.SkuCell.EntireColumn;
|
||||||
|
Range oldSkuColumn = TargetFile.OldSkuCell.EntireColumn;
|
||||||
|
|
||||||
|
int? row = GetPositionRow(skuColumn, positionAmount.Key.Sku, positionAmount.Key.Group);
|
||||||
|
|
||||||
if (row != null)
|
if (row != null)
|
||||||
{
|
{
|
||||||
foreach (int column in columns)
|
foreach (int column in columns)
|
||||||
{
|
{
|
||||||
Range cell = TargetFile.Sheet.Cells[row, column];
|
Range cell = worksheetCells[row, column];
|
||||||
cell.AddValue(positionAmount.Value);
|
cell.AddValue(positionAmount.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,13 +65,13 @@ namespace RehauSku.PriceListTools
|
|||||||
|
|
||||||
if (TargetFile.OldSkuCell != null)
|
if (TargetFile.OldSkuCell != null)
|
||||||
{
|
{
|
||||||
row = GetPositionRow(TargetFile.OldSkuCell.EntireColumn, positionAmount.Key.Sku, positionAmount.Key.Group);
|
row = GetPositionRow(oldSkuColumn, positionAmount.Key.Sku, positionAmount.Key.Group);
|
||||||
|
|
||||||
if (row != null)
|
if (row != null)
|
||||||
{
|
{
|
||||||
foreach (int column in columns)
|
foreach (int column in columns)
|
||||||
{
|
{
|
||||||
Range cell = TargetFile.Sheet.Cells[row, column];
|
Range cell = worksheetCells[row, column];
|
||||||
cell.AddValue(positionAmount.Value);
|
cell.AddValue(positionAmount.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,13 +81,13 @@ namespace RehauSku.PriceListTools
|
|||||||
}
|
}
|
||||||
|
|
||||||
string sku = positionAmount.Key.Sku.Substring(1, 6);
|
string sku = positionAmount.Key.Sku.Substring(1, 6);
|
||||||
row = GetPositionRow(TargetFile.SkuCell.EntireColumn, sku, positionAmount.Key.Group);
|
row = GetPositionRow(skuColumn, sku, positionAmount.Key.Group);
|
||||||
|
|
||||||
if (row != null)
|
if (row != null)
|
||||||
{
|
{
|
||||||
foreach (int column in columns)
|
foreach (int column in columns)
|
||||||
{
|
{
|
||||||
Range cell = TargetFile.Sheet.Cells[row, column];
|
Range cell = worksheetCells[row, column];
|
||||||
cell.AddValue(positionAmount.Value);
|
cell.AddValue(positionAmount.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,37 +101,43 @@ namespace RehauSku.PriceListTools
|
|||||||
|
|
||||||
protected void FillMissing(KeyValuePair<Position, double> positionAmount, params int[] columns)
|
protected void FillMissing(KeyValuePair<Position, double> positionAmount, params int[] columns)
|
||||||
{
|
{
|
||||||
int row = TargetFile.Sheet.Cells[TargetFile.Sheet.Rows.Count, TargetFile.SkuCell.Column]
|
Range worksheetCells = TargetFile.Sheet.Cells;
|
||||||
|
Range worksheetRows = TargetFile.Sheet.Rows;
|
||||||
|
int skuColumn = TargetFile.SkuCell.Column;
|
||||||
|
int groupColumn = TargetFile.GroupCell.Column;
|
||||||
|
int nameColumn = TargetFile.NameCell.Column;
|
||||||
|
|
||||||
|
int row = worksheetCells[worksheetRows.Count, skuColumn]
|
||||||
.End[XlDirection.xlUp]
|
.End[XlDirection.xlUp]
|
||||||
.Row + 1;
|
.Row + 1;
|
||||||
|
|
||||||
TargetFile.Sheet.Rows[row]
|
worksheetRows[row]
|
||||||
.EntireRow
|
.EntireRow
|
||||||
.Insert(XlInsertShiftDirection.xlShiftDown, XlInsertFormatOrigin.xlFormatFromLeftOrAbove);
|
.Insert(XlInsertShiftDirection.xlShiftDown, XlInsertFormatOrigin.xlFormatFromLeftOrAbove);
|
||||||
|
|
||||||
Range previous = TargetFile.Sheet.Rows[row - 1];
|
Range previous = worksheetRows[row - 1];
|
||||||
Range current = TargetFile.Sheet.Rows[row];
|
Range current = worksheetRows[row];
|
||||||
|
|
||||||
previous.Copy(current);
|
previous.Copy(current);
|
||||||
current.ClearContents();
|
current.ClearContents();
|
||||||
|
|
||||||
TargetFile.Sheet.Cells[row, TargetFile.GroupCell.Column].Value2 = positionAmount.Key.Group;
|
worksheetCells[row, groupColumn].Value2 = positionAmount.Key.Group;
|
||||||
TargetFile.Sheet.Cells[row, TargetFile.NameCell.Column].Value2 = positionAmount.Key.Name;
|
worksheetCells[row, nameColumn].Value2 = positionAmount.Key.Name;
|
||||||
|
|
||||||
if (TargetFile.OldSkuCell != null)
|
if (TargetFile.OldSkuCell != null)
|
||||||
{
|
{
|
||||||
TargetFile.Sheet.Cells[row, TargetFile.SkuCell.Column].Value2 = "Не найден";
|
worksheetCells[row, skuColumn].Value2 = "Не найден";
|
||||||
TargetFile.Sheet.Cells[row, TargetFile.OldSkuCell.Column].Value2 = positionAmount.Key.Sku;
|
worksheetCells[row, TargetFile.OldSkuCell.Column].Value2 = positionAmount.Key.Sku;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TargetFile.Sheet.Cells[row, TargetFile.SkuCell.Column].Value2 = positionAmount.Key.Sku;
|
worksheetCells[row, skuColumn].Value2 = positionAmount.Key.Sku;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (int column in columns)
|
foreach (int column in columns)
|
||||||
{
|
{
|
||||||
Range cell = TargetFile.Sheet.Cells[row, column];
|
Range cell = worksheetCells[row, column];
|
||||||
cell.AddValue(positionAmount.Value);
|
cell.AddValue(positionAmount.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user