add implementation of StorekeeperReportLogic
This commit is contained in:
parent
237bf21c93
commit
e26de97679
@ -1,4 +1,6 @@
|
||||
using FactoryContracts.BindingModels;
|
||||
using FactoryBusinessLogic.OfficePackage;
|
||||
using FactoryBusinessLogic.OfficePackage.HelperModels;
|
||||
using FactoryContracts.BindingModels;
|
||||
using FactoryContracts.BusinessLogicsContracts;
|
||||
using FactoryContracts.SearchModels;
|
||||
using FactoryContracts.StoragesContracts;
|
||||
@ -10,12 +12,18 @@ namespace FactoryBusinessLogic.BusinessLogics
|
||||
{
|
||||
private readonly IMachineStorage _machineStorage;
|
||||
private readonly IProductStorage _productStorage;
|
||||
public StorekeeperReportLogic(IMachineStorage machineStorage, IProductStorage productStorage)
|
||||
{
|
||||
_machineStorage = machineStorage;
|
||||
_productStorage = productStorage;
|
||||
}
|
||||
public List<ProductPlanProductionReportViewModel> GetPlanProductionsByProduct(List<ProductSearchModel> products)
|
||||
private readonly AbstractSaveToWord _saveToWord;
|
||||
private readonly AbstractSaveToExcel _saveToExcel;
|
||||
private readonly AbstractSaveToPdf _saveToPdf;
|
||||
public StorekeeperReportLogic(IMachineStorage machineStorage, IProductStorage productStorage, AbstractSaveToWord saveToWord, AbstractSaveToExcel saveToExcel, AbstractSaveToPdf saveToPdf)
|
||||
{
|
||||
_machineStorage = machineStorage;
|
||||
_productStorage = productStorage;
|
||||
_saveToWord = saveToWord;
|
||||
_saveToExcel = saveToExcel;
|
||||
_saveToPdf = saveToPdf;
|
||||
}
|
||||
public List<ProductPlanProductionReportViewModel> GetPlanProductionsByProduct(List<ProductSearchModel> products)
|
||||
{
|
||||
List<int> ids = products.Select(x => (int)x.Id).ToList();
|
||||
return _productStorage.GetPlanProductions(ids);
|
||||
@ -24,17 +32,34 @@ namespace FactoryBusinessLogic.BusinessLogics
|
||||
{
|
||||
return _machineStorage.GetMachinesByPeriod(client, model);
|
||||
}
|
||||
public void SaveMachinesToPdfFile(ReportBindingModel model)
|
||||
public void SaveMachinesToPdfFile(ClientSearchModel client, ReportBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
_saveToPdf.CreateStorekeeperDoc(new StorekeeperPdfInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список станков",
|
||||
DateFrom = model.DateFrom!.Value,
|
||||
DateTo = model.DateTo!.Value,
|
||||
Machines = GetMachines(client, model)
|
||||
});
|
||||
}
|
||||
public void SavePlanProductionsToExcelFile(ReportBindingModel model)
|
||||
public void SavePlanProductionsToExcelFile(ReportBindingModel model, List<ProductSearchModel> products)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
_saveToExcel.CreateStorekeeperReport(new StorekeeperExcelInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список планов производств",
|
||||
ProductPlanProductions = GetPlanProductionsByProduct(products)
|
||||
});
|
||||
}
|
||||
public void SavePlanProductionsToWordFile(ReportBindingModel model)
|
||||
public void SavePlanProductionsToWordFile(ReportBindingModel model, List<ProductSearchModel> products)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
_saveToWord.CreateStorekeeperDoc(new StorekeeperWordInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список планов производств",
|
||||
ProductPlanProductions = GetPlanProductionsByProduct(products)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ namespace FactoryContracts.BusinessLogicsContracts
|
||||
{
|
||||
List<ProductPlanProductionReportViewModel> GetPlanProductionsByProduct(List<ProductSearchModel> products);
|
||||
List<MachinePeriodReportViewModel> GetMachines(ClientSearchModel client, ReportBindingModel model);
|
||||
void SavePlanProductionsToWordFile(ReportBindingModel model);
|
||||
void SavePlanProductionsToExcelFile(ReportBindingModel model);
|
||||
void SaveMachinesToPdfFile(ReportBindingModel model);
|
||||
void SavePlanProductionsToWordFile(ReportBindingModel model, List<ProductSearchModel> products);
|
||||
void SavePlanProductionsToExcelFile(ReportBindingModel model, List<ProductSearchModel> products);
|
||||
void SaveMachinesToPdfFile(ClientSearchModel client, ReportBindingModel model);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user