Fix missing positions filling into amount columns during joining sheets

This commit is contained in:
Sergey Chebotar 2022-01-29 17:47:57 +03:00
parent 0fac439d95
commit 913de67a02

View File

@ -65,7 +65,7 @@ namespace RehauSku.PriceListTools
if (Missing.Count > 0) if (Missing.Count > 0)
{ {
FillMissing(); FillMissing(columns);
MessageBox.Show MessageBox.Show
($"{Missing.Count} артикулов отсутствует в таблице заказов {RegistryUtil.PriceListPath}\n" + ($"{Missing.Count} артикулов отсутствует в таблице заказов {RegistryUtil.PriceListPath}\n" +
$"Под основной таблицей составлен список не найденных артикулов", $"Под основной таблицей составлен список не найденных артикулов",
@ -159,7 +159,7 @@ namespace RehauSku.PriceListTools
Missing.Remove(positionAmount); Missing.Remove(positionAmount);
} }
protected private void FillMissing() protected private void FillMissing(int[] columns)
{ {
int startRow = int startRow =
TargetFile.Sheet.AutoFilter.Range.Row + TargetFile.Sheet.AutoFilter.Range.Row +
@ -170,19 +170,23 @@ namespace RehauSku.PriceListTools
Range group = TargetFile.Sheet.Cells[startRow + i, TargetFile.groupCell.Column]; Range group = TargetFile.Sheet.Cells[startRow + i, TargetFile.groupCell.Column];
Range sku = TargetFile.Sheet.Cells[startRow + i, TargetFile.skuCell.Column]; Range sku = TargetFile.Sheet.Cells[startRow + i, TargetFile.skuCell.Column];
Range name = TargetFile.Sheet.Cells[startRow + i, TargetFile.nameCell.Column]; Range name = TargetFile.Sheet.Cells[startRow + i, TargetFile.nameCell.Column];
Range amount = TargetFile.Sheet.Cells[startRow + i, TargetFile.amountCell.Column];
group.Value2 = Missing[i].Key.Group; group.Value2 = Missing[i].Key.Group;
sku.Value2 = Missing[i].Key.Sku; sku.Value2 = Missing[i].Key.Sku;
name.Value2 = Missing[i].Key.Name; name.Value2 = Missing[i].Key.Name;
amount.Value2 = Missing[i].Value;
group.ClearFormats(); group.ClearFormats();
sku.ClearFormats(); sku.ClearFormats();
name.ClearFormats(); name.ClearFormats();
foreach (int column in columns)
{
Range amount = TargetFile.Sheet.Cells[startRow + i, column];
amount.Value2 = Missing[i].Value;
amount.ClearFormats(); amount.ClearFormats();
} }
} }
}
protected private void FilterByAmount() protected private void FilterByAmount()
{ {