2022-01-27 09:59:33 +03:00
|
|
|
|
using Microsoft.Office.Interop.Excel;
|
|
|
|
|
using System;
|
2022-01-27 10:22:30 +03:00
|
|
|
|
using System.Collections.Generic;
|
2022-01-27 09:59:33 +03:00
|
|
|
|
|
|
|
|
|
namespace RehauSku.PriceListTools
|
|
|
|
|
{
|
2022-01-27 10:22:30 +03:00
|
|
|
|
internal class Target : PriceList
|
2022-01-27 09:59:33 +03:00
|
|
|
|
{
|
2022-01-27 10:22:30 +03:00
|
|
|
|
public Dictionary<PriceListPosition, Range> Map { get; private set; }
|
2022-01-27 09:59:33 +03:00
|
|
|
|
|
2022-01-27 10:22:30 +03:00
|
|
|
|
public Target(Workbook workbook)
|
2022-01-27 09:59:33 +03:00
|
|
|
|
{
|
|
|
|
|
Sheet = workbook.ActiveSheet;
|
2022-01-27 10:22:30 +03:00
|
|
|
|
Name = workbook.Name;
|
2022-01-27 09:59:33 +03:00
|
|
|
|
|
|
|
|
|
amountCell = Sheet.Cells.Find(amountHeader);
|
|
|
|
|
skuCell = Sheet.Cells.Find(skuHeader);
|
|
|
|
|
groupCell = Sheet.Cells.Find(groupHeader);
|
|
|
|
|
|
|
|
|
|
if (amountCell == null || skuCell == null || groupCell == null)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException($"Лист { Name } не распознан");
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-27 10:22:30 +03:00
|
|
|
|
CreateMap();
|
2022-01-27 09:59:33 +03:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-27 10:22:30 +03:00
|
|
|
|
private void CreateMap()
|
2022-01-27 09:59:33 +03:00
|
|
|
|
{
|
|
|
|
|
Range amountCell = Sheet.Cells.Find(amountHeader);
|
|
|
|
|
Range skuCell = Sheet.Cells.Find(skuHeader);
|
|
|
|
|
Range groupCell = Sheet.Cells.Find(groupHeader);
|
|
|
|
|
|
|
|
|
|
//headerRowNumber = amountCell.Row;
|
|
|
|
|
//skuColumnNumber = skuCell.Column;
|
|
|
|
|
//amountColumnNumber = amountCell.Column;
|
|
|
|
|
//groupColumnNumber = groupCell.Column;
|
|
|
|
|
|
|
|
|
|
//for (int row = headerRowNumber + 1; row < skuCell.Rows.Count; row++)
|
|
|
|
|
//{
|
|
|
|
|
// string sku =
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|