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