Remove unnecessary fields
This commit is contained in:
parent
ec1059ed5d
commit
c0139ca228
@ -20,7 +20,7 @@ namespace RehauSku.PriceListTools
|
||||
if (sheet.SkuAmount.Count == 0)
|
||||
continue;
|
||||
|
||||
offer.Sheet.Columns[offer.amountColumnNumber]
|
||||
offer.Sheet.Columns[offer.amountCell.Column]
|
||||
.EntireColumn
|
||||
.Insert(XlInsertShiftDirection.xlShiftToRight, XlInsertFormatOrigin.xlFormatFromRightOrBelow);
|
||||
|
||||
@ -28,7 +28,7 @@ namespace RehauSku.PriceListTools
|
||||
|
||||
foreach (var kvp in sheet.SkuAmount)
|
||||
{
|
||||
Range cell = offer.Sheet.Columns[offer.skuColumnNumber].Find(kvp.Key);
|
||||
Range cell = offer.Sheet.Columns[offer.skuCell.Column].Find(kvp.Key);
|
||||
|
||||
if (cell == null)
|
||||
{
|
||||
@ -41,8 +41,8 @@ namespace RehauSku.PriceListTools
|
||||
|
||||
else
|
||||
{
|
||||
offer.Sheet.Cells[cell.Row, offer.amountColumnNumber].Value2 = kvp.Value;
|
||||
Range sumCell = offer.Sheet.Cells[cell.Row, offer.amountColumnNumber + exportedLists];
|
||||
offer.Sheet.Cells[cell.Row, offer.amountCell.Column].Value2 = kvp.Value;
|
||||
Range sumCell = offer.Sheet.Cells[cell.Row, offer.amountCell.Column + exportedLists];
|
||||
|
||||
if (sumCell.Value2 == null)
|
||||
sumCell.Value2 = kvp.Value;
|
||||
@ -52,14 +52,14 @@ namespace RehauSku.PriceListTools
|
||||
exportedValues++;
|
||||
}
|
||||
|
||||
offer.Sheet.Cells[offer.headerRowNumber, offer.amountColumnNumber].Value2 = $"{priceList.Name}\n{sheet.Name}";
|
||||
offer.Sheet.Cells[offer.amountCell.Row, offer.amountCell.Column].Value2 = $"{priceList.Name}\n{sheet.Name}";
|
||||
}
|
||||
}
|
||||
|
||||
AutoFilter filter = offer.Sheet.AutoFilter;
|
||||
int firstFilterColumn = filter.Range.Column;
|
||||
|
||||
filter.Range.AutoFilter(offer.amountColumnNumber - firstFilterColumn + 1 + exportedLists, "<>");
|
||||
filter.Range.AutoFilter(offer.amountCell.Column - firstFilterColumn + 1 + exportedLists, "<>");
|
||||
offer.Sheet.Range["A1"].Activate();
|
||||
|
||||
AddIn.Excel.StatusBar = $"Экспортировано {exportedValues} строк из {sourcePriceLists.Count} файлов";
|
||||
|
@ -84,7 +84,7 @@ namespace RehauSku.PriceListTools
|
||||
|
||||
foreach (var kvp in SkuAmount)
|
||||
{
|
||||
Range cell = offer.Sheet.Columns[offer.skuColumnNumber].Find(kvp.Key);
|
||||
Range cell = offer.Sheet.Columns[offer.skuCell.Column].Find(kvp.Key);
|
||||
|
||||
if (cell == null)
|
||||
{
|
||||
@ -97,7 +97,7 @@ namespace RehauSku.PriceListTools
|
||||
|
||||
else
|
||||
{
|
||||
Range sumCell = offer.Sheet.Cells[cell.Row, offer.amountColumnNumber];
|
||||
Range sumCell = offer.Sheet.Cells[cell.Row, offer.amountCell.Column];
|
||||
|
||||
if (sumCell.Value2 == null)
|
||||
sumCell.Value2 = kvp.Value;
|
||||
@ -111,7 +111,7 @@ namespace RehauSku.PriceListTools
|
||||
AutoFilter filter = offer.Sheet.AutoFilter;
|
||||
int firstFilterColumn = filter.Range.Column;
|
||||
|
||||
filter.Range.AutoFilter(offer.amountColumnNumber - firstFilterColumn + 1, "<>");
|
||||
filter.Range.AutoFilter(offer.amountCell.Column - firstFilterColumn + 1, "<>");
|
||||
offer.Sheet.Range["A1"].Activate();
|
||||
AddIn.Excel.StatusBar = $"Экспортировано {exportedValues} строк из {SkuAmount.Count}";
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace RehauSku.PriceListTools
|
||||
|
||||
foreach (var kvp in sheet.SkuAmount)
|
||||
{
|
||||
Range cell = offer.Sheet.Columns[offer.skuColumnNumber].Find(kvp.Key);
|
||||
Range cell = offer.Sheet.Columns[offer.skuCell.Column].Find(kvp.Key);
|
||||
|
||||
if (cell == null)
|
||||
{
|
||||
@ -34,7 +34,7 @@ namespace RehauSku.PriceListTools
|
||||
|
||||
else
|
||||
{
|
||||
Range sumCell = offer.Sheet.Cells[cell.Row, offer.amountColumnNumber];
|
||||
Range sumCell = offer.Sheet.Cells[cell.Row, offer.amountCell.Column];
|
||||
|
||||
if (sumCell.Value2 == null)
|
||||
sumCell.Value2 = kvp.Value;
|
||||
@ -49,7 +49,7 @@ namespace RehauSku.PriceListTools
|
||||
AutoFilter filter = offer.Sheet.AutoFilter;
|
||||
int firstFilterColumn = filter.Range.Column;
|
||||
|
||||
filter.Range.AutoFilter(offer.amountColumnNumber - firstFilterColumn + 1, "<>");
|
||||
filter.Range.AutoFilter(offer.amountCell.Column - firstFilterColumn + 1, "<>");
|
||||
offer.Sheet.Range["A1"].Activate();
|
||||
AddIn.Excel.StatusBar = $"Экспортировано {exportedValues} строк из {sourcePriceLists.Count} файлов";
|
||||
|
||||
|
@ -9,34 +9,12 @@ namespace RehauSku.PriceListTools
|
||||
internal class PriceList
|
||||
{
|
||||
public readonly string Name;
|
||||
//public readonly PriceListSheet OfferSheet;
|
||||
public PriceListSheet Sheet { get; private set; }
|
||||
|
||||
|
||||
//private const string offerSheetHeader = "КП";
|
||||
|
||||
public PriceList(Workbook workbook)
|
||||
{
|
||||
Name = workbook.Name;
|
||||
Sheet = new PriceListSheet(workbook.ActiveSheet);
|
||||
|
||||
//foreach (Worksheet worksheet in workbook.Sheets)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// PriceListSheet priceListSheet = new PriceListSheet(worksheet);
|
||||
// //priceListSheet.FillSkuAmount();
|
||||
// Sheets.Add(priceListSheet);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// throw ex;
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
//OfferSheet = Sheet.Where(s => s.Name == offerSheetHeader).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,17 +14,12 @@ namespace RehauSku.PriceListTools
|
||||
public readonly string Name;
|
||||
public Dictionary<string, double> SkuAmount { get; private set; }
|
||||
|
||||
Range amountCell { get; set; }
|
||||
Range skuCell { get; set; }
|
||||
Range groupCell { get; set; }
|
||||
public readonly Range amountCell;
|
||||
public readonly Range skuCell;
|
||||
public readonly Range groupCell;
|
||||
|
||||
public int headerRowNumber { get; private set; }
|
||||
public int amountColumnNumber { get; private set; }
|
||||
public int skuColumnNumber { get; private set; }
|
||||
public int groupColumnNumber { get; private set; }
|
||||
public Dictionary<PriceListPosition, Range> Map { get; private set; }
|
||||
|
||||
|
||||
public PriceListSheet(Worksheet sheet)
|
||||
{
|
||||
Sheet = sheet;
|
||||
@ -45,10 +40,6 @@ namespace RehauSku.PriceListTools
|
||||
|
||||
private void FillSkuAmount()
|
||||
{
|
||||
headerRowNumber = amountCell.Row;
|
||||
skuColumnNumber = skuCell.Column;
|
||||
amountColumnNumber = amountCell.Column;
|
||||
|
||||
object[,] amountColumn = Sheet.Columns[amountCell.Column].Value2;
|
||||
object[,] skuColumn = Sheet.Columns[skuCell.Column].Value2;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user