Compare commits

..

No commits in common. "5e84b0154bb1bdfa042db87f3480225a523804d2" and "99a55d76222f151435e6ede5ad68e38594ce7407" have entirely different histories.

View File

@ -35,6 +35,7 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
/// <returns></returns>
public List<ReportManufactureComponentViewModel> GetManufactureComponent()
{
var components = _componentStorage.GetFullList();
var manufactures = _manufactureStorage.GetFullList();
var list = new List<ReportManufactureComponentViewModel>();
foreach (var manufacture in manufactures)
@ -46,12 +47,14 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
TotalCount = 0,
TotalSum = 0
};
foreach (var component in manufacture.ManufactureComponents)
foreach (var component in components)
{
double componentCost = _componentStorage.GetElement(new() { Id = component.Key })?.Cost ?? 0;
record.Components.Add(new(component.Value.Item1.ComponentName, component.Value.Item2, componentCost));
record.TotalCount += component.Value.Item2;
record.TotalSum += component.Value.Item2 * componentCost;
if (manufacture.ManufactureComponents.ContainsKey(component.Id))
{
record.Components.Add((component.ComponentName, manufacture.ManufactureComponents[component.Id].Item2, component.Cost * manufacture.ManufactureComponents[component.Id].Item2));
record.TotalCount += manufacture.ManufactureComponents[component.Id].Item2;
record.TotalSum += component.Cost * manufacture.ManufactureComponents[component.Id].Item2;
}
}
list.Add(record);
}