2022-02-02 09:46:47 +03:00
|
|
|
|
using RehauSku.Interface;
|
2022-02-12 16:02:55 +03:00
|
|
|
|
using System;
|
2022-02-02 09:46:47 +03:00
|
|
|
|
using System.Collections.Generic;
|
2022-02-02 10:23:50 +03:00
|
|
|
|
using System.Linq;
|
2022-01-27 17:34:03 +03:00
|
|
|
|
|
|
|
|
|
namespace RehauSku.PriceListTools
|
2021-12-24 16:22:03 +03:00
|
|
|
|
{
|
2022-02-02 18:02:17 +03:00
|
|
|
|
internal class MergeTool : AbstractTool
|
2021-12-24 16:22:03 +03:00
|
|
|
|
{
|
2022-02-12 16:02:55 +03:00
|
|
|
|
private List<SourcePriceList> SourceFiles { get; set; }
|
2022-01-27 17:34:03 +03:00
|
|
|
|
|
2022-02-12 16:02:55 +03:00
|
|
|
|
public MergeTool()
|
|
|
|
|
{
|
|
|
|
|
string[] files = Dialog.GetMultiplyFiles();
|
|
|
|
|
|
|
|
|
|
if (files != null)
|
|
|
|
|
{
|
|
|
|
|
SourceFiles = SourcePriceList.GetSourceLists(files);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Не выбраны файлы");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void FillTarget()
|
2022-01-27 17:34:03 +03:00
|
|
|
|
{
|
2022-02-04 09:17:12 +03:00
|
|
|
|
ProgressBar = new ProgressBar("Заполняю строки...", SourceFiles.Sum(x => x.PositionAmount.Count));
|
|
|
|
|
ResultBar = new ResultBar();
|
2022-02-02 10:23:50 +03:00
|
|
|
|
|
2022-02-02 18:05:49 +03:00
|
|
|
|
foreach (SourcePriceList source in SourceFiles)
|
2022-01-27 20:43:19 +03:00
|
|
|
|
{
|
2022-02-01 20:32:29 +03:00
|
|
|
|
foreach (var kvp in source.PositionAmount)
|
2022-02-02 10:23:50 +03:00
|
|
|
|
{
|
2022-02-03 21:44:24 +03:00
|
|
|
|
FillPositionAmountToColumns(kvp, TargetFile.amountCell.Column);
|
2022-02-04 09:17:12 +03:00
|
|
|
|
ProgressBar.Update();
|
2022-02-02 10:23:50 +03:00
|
|
|
|
}
|
2022-01-27 20:43:19 +03:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-27 17:34:03 +03:00
|
|
|
|
FilterByAmount();
|
2022-02-04 09:17:12 +03:00
|
|
|
|
ResultBar.Update();
|
2021-12-24 16:22:03 +03:00
|
|
|
|
|
2022-02-08 16:03:28 +03:00
|
|
|
|
Dialog.SaveWorkbookAs();
|
2022-02-04 09:17:12 +03:00
|
|
|
|
ExcelApp.StatusBar = false;
|
2022-01-27 17:34:03 +03:00
|
|
|
|
}
|
2021-12-24 16:22:03 +03:00
|
|
|
|
}
|
|
|
|
|
}
|