ComponentShipments report fix

This commit is contained in:
ShabOl 2024-05-30 00:16:38 +04:00
parent 05d5ba207e
commit 31a6895951
3 changed files with 6 additions and 5 deletions

View File

@ -45,9 +45,9 @@ namespace ComputerShopBusinessLogic.BusinessLogics
_saveToWord.CreateDoc(new WordInfoGuarantor
{
Filename = Model.FileName,
Title = "Список сборок по выбранным заказам",
Title = "Список партий товаров по выбранным компонентам",
ShipmentComponents = GetReportComponentsWithShipments(Model.Ids!)
}); ;
});
}
public void SaveReportToExcelFile(ReportBindingModel Model)

View File

@ -98,7 +98,7 @@ namespace ComputerShopDatabaseImplement.Implements
.ThenInclude(x => x.Shipment)
.Where(x =>
ComponentIds.Contains(x.Id) // Компонент, указанный пользователем,
&& x.ProductComponents.Any(y => y.Product.Shipment != null)) // который содержится в товаре, имеющем партию товаров
)//&& x.ProductComponents.Any(y => y.Product.Shipment != null)) // который содержится в товаре, имеющем партию товаров
.ToList()
.Select(x => new ReportComponentWithShipmentViewModel
{
@ -106,6 +106,7 @@ namespace ComputerShopDatabaseImplement.Implements
ComponentName = x.ComponentName,
ComponentCost = x.Cost,
Shipments = x.ProductComponents
.Where(y => y.Product.Shipment != null)
.Select(y => (y.Product.ProductName, y.Product.Price, y.Product.Shipment!.ProviderName, y.Product.Shipment.DateShipment))
.ToList(),
})

View File

@ -202,7 +202,7 @@ namespace ComputerShopGuarantorApp.Controllers
throw new Exception("Вход только авторизованным");
ViewBag.Components = ApiUser.GetRequest<List<ComponentViewModel>>($"api/component/getcomponents?userId={ApiUser.User.Id}");
ViewBag.Shipments = ApiUser.GetRequest<List<ShipmentViewModel>>($"api/shipment/getshipments?userId={ApiUser.User.Id}");
ViewBag.Shipments = ApiUser.GetRequest<List<ShipmentViewModel>>($"api/shipment/getshipments?userId=-1");
return View("Product");
}
@ -231,7 +231,7 @@ namespace ComputerShopGuarantorApp.Controllers
return Redirect("~/Home/Enter");
ViewBag.Components = ApiUser.GetRequest<List<ComponentViewModel>>($"api/component/getcomponents?userId={ApiUser.User.Id}");
ViewBag.Shipments = ApiUser.GetRequest<List<ShipmentViewModel>>($"api/shipment/getshipments?userId={ApiUser.User.Id}");
ViewBag.Shipments = ApiUser.GetRequest<List<ShipmentViewModel>>($"api/shipment/getshipments?userId=-1");
return View("Product", ApiUser.GetRequest<ProductViewModel>($"api/product/getproduct?id={Id}"));
}