Merge pull request #10 from schebotar/dev

Dev
This commit is contained in:
Serghei Cebotari 2022-01-03 13:17:49 +03:00 committed by GitHub
commit 72908aaaf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,11 +40,24 @@ namespace RehauSku.PriceListTools
int amountColumn = OfferSheet.amountColumn.Value; int amountColumn = OfferSheet.amountColumn.Value;
int skuColumn = OfferSheet.skuColumn.Value; int skuColumn = OfferSheet.skuColumn.Value;
int exportedValues = 0;
foreach (KeyValuePair<string, double> kvp in values) foreach (KeyValuePair<string, double> kvp in values)
{ {
Range cell = ws.Columns[skuColumn].Find(kvp.Key); Range cell = ws.Columns[skuColumn].Find(kvp.Key);
ws.Cells[cell.Row, amountColumn].Value = kvp.Value; if (cell == null)
{
System.Windows.Forms.MessageBox.Show
($"Артикул {kvp.Key} отсутствует в таблице заказов {RegistryUtil.PriceListPath}",
"Отсутствует позиция в конечной таблице заказов",
System.Windows.Forms.MessageBoxButtons.OK,
System.Windows.Forms.MessageBoxIcon.Information);
}
else
{
ws.Cells[cell.Row, amountColumn].Value = kvp.Value;
exportedValues++;
}
} }
AutoFilter filter = ws.AutoFilter; AutoFilter filter = ws.AutoFilter;
@ -52,6 +65,7 @@ namespace RehauSku.PriceListTools
filter.Range.AutoFilter(amountColumn - firstFilterColumn + 1, "<>"); filter.Range.AutoFilter(amountColumn - firstFilterColumn + 1, "<>");
ws.Range["A1"].Activate(); ws.Range["A1"].Activate();
ws.Application.StatusBar = $"Экспортировано {exportedValues} строк из {values.Count}";
} }
public class PriceListSheet public class PriceListSheet