LabWork04_Base: Фиксы
This commit is contained in:
parent
f77d3f66cc
commit
fc5a9b69c5
@ -33,7 +33,6 @@ namespace AutomobilePlantBusinessLogic.BusinessLogics
|
|||||||
/// Получение списка компонент с указанием, в каких изделиях используются
|
/// Получение списка компонент с указанием, в каких изделиях используются
|
||||||
public List<ReportCarComponentViewModel> GetCarComponents()
|
public List<ReportCarComponentViewModel> GetCarComponents()
|
||||||
{
|
{
|
||||||
var components = _componentStorage.GetFullList();
|
|
||||||
var cars = _carStorage.GetFullList();
|
var cars = _carStorage.GetFullList();
|
||||||
var list = new List<ReportCarComponentViewModel>();
|
var list = new List<ReportCarComponentViewModel>();
|
||||||
foreach (var car in cars)
|
foreach (var car in cars)
|
||||||
@ -44,13 +43,10 @@ namespace AutomobilePlantBusinessLogic.BusinessLogics
|
|||||||
Components = new List<(string Component, int Count)>(),
|
Components = new List<(string Component, int Count)>(),
|
||||||
TotalCount = 0
|
TotalCount = 0
|
||||||
};
|
};
|
||||||
foreach (var component in components)
|
foreach (var component in car.CarComponents.Values)
|
||||||
{
|
{
|
||||||
if (car.CarComponents.ContainsKey(component.Id))
|
record.Components.Add((component.Item1.ComponentName, component.Item2));
|
||||||
{
|
record.TotalCount += component.Item2;
|
||||||
record.Components.Add(new(component.ComponentName, car.CarComponents[component.Id].Item2));
|
|
||||||
record.TotalCount += car.CarComponents[component.Id].Item2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
list.Add(record);
|
list.Add(record);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user