доработал отчеты до конца, осталась почта

This commit is contained in:
Максим Яковлев 2024-05-28 17:49:22 +04:00
parent cdf1ca5e9f
commit df55a3ea40

View File

@ -100,9 +100,9 @@ namespace ServiceStationBusinessLogic.BusinessLogics
});
List<DefectViewModel> defectList = _defectStorage.GetFullList();
List<(DefectViewModel, int)> defects = new();
foreach(var techWork in techWorkList)
foreach (var techWork in techWorkList)
{
foreach(var car in techWork.TechnicalWorkCars.Values)
{
@ -114,30 +114,45 @@ namespace ServiceStationBusinessLogic.BusinessLogics
TechnicalWorkDate = techWork.DateStartWork,
TechnicalWorkPrice = techWork.WorkPrice,
});
List<DefectViewModel> defects = new();
foreach (var defect in defectList)
{
if (defect.DefectCars.ContainsKey(car.Id))
{
defects.Add(defect);
int contains = 0;
foreach (var defectt in defects)
{
if (defectt.Item2 == car.Id && defect.DefectType == defectt.Item1.DefectType)
{
contains++;
}
}
if(contains == 0)
{
defects.Add(new(defect, car.Id));
}
}
}
foreach(var defect in defects)
{
//if (defect.RepairId.HasValue)
//{
var repair = _repairStorage.GetElement(new RepairSearchModel { Id = 1 });
allList.Add(new ReportCarsViewModel
{
RepairName = repair.RepairName,
RepairStartDate = repair.RepairStartDate,
RepairPrice = repair.RepairPrice,
});
//}
}
}
}
foreach (var defect in defects)
{
//if (defect.RepairId.HasValue)
//{
var repair = _repairStorage.GetElement(new RepairSearchModel { Id = 1 });
var car = _carStorage.GetElement(new CarSearchModel { Id = defect.Item2 });
allList.Add(new ReportCarsViewModel
{
CarNumber = car.CarNumber,
CarBrand = car.CarBrand,
RepairName = repair.RepairName,
RepairStartDate = repair.RepairStartDate,
RepairPrice = repair.RepairPrice,
});
//}
}
return allList;
}