From 31a6895951f11f531289b1e97f50260402980633 Mon Sep 17 00:00:00 2001 From: Oleg Shabunov Date: Thu, 30 May 2024 00:16:38 +0400 Subject: [PATCH] ComponentShipments report fix --- .../BusinessLogics/ReportGuarantorLogic.cs | 4 ++-- ComputerShopDatabaseImplement/Implements/ComponentStorage.cs | 3 ++- ComputerShopGuarantorApp/Controllers/HomeController.cs | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ComputerShopBusinessLogic/BusinessLogics/ReportGuarantorLogic.cs b/ComputerShopBusinessLogic/BusinessLogics/ReportGuarantorLogic.cs index f4fbb42..eb98e2c 100644 --- a/ComputerShopBusinessLogic/BusinessLogics/ReportGuarantorLogic.cs +++ b/ComputerShopBusinessLogic/BusinessLogics/ReportGuarantorLogic.cs @@ -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) diff --git a/ComputerShopDatabaseImplement/Implements/ComponentStorage.cs b/ComputerShopDatabaseImplement/Implements/ComponentStorage.cs index 72b9c2f..ae83a8b 100644 --- a/ComputerShopDatabaseImplement/Implements/ComponentStorage.cs +++ b/ComputerShopDatabaseImplement/Implements/ComponentStorage.cs @@ -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(), }) diff --git a/ComputerShopGuarantorApp/Controllers/HomeController.cs b/ComputerShopGuarantorApp/Controllers/HomeController.cs index c812877..b2d1206 100644 --- a/ComputerShopGuarantorApp/Controllers/HomeController.cs +++ b/ComputerShopGuarantorApp/Controllers/HomeController.cs @@ -202,7 +202,7 @@ namespace ComputerShopGuarantorApp.Controllers throw new Exception("Вход только авторизованным"); ViewBag.Components = ApiUser.GetRequest>($"api/component/getcomponents?userId={ApiUser.User.Id}"); - ViewBag.Shipments = ApiUser.GetRequest>($"api/shipment/getshipments?userId={ApiUser.User.Id}"); + ViewBag.Shipments = ApiUser.GetRequest>($"api/shipment/getshipments?userId=-1"); return View("Product"); } @@ -231,7 +231,7 @@ namespace ComputerShopGuarantorApp.Controllers return Redirect("~/Home/Enter"); ViewBag.Components = ApiUser.GetRequest>($"api/component/getcomponents?userId={ApiUser.User.Id}"); - ViewBag.Shipments = ApiUser.GetRequest>($"api/shipment/getshipments?userId={ApiUser.User.Id}"); + ViewBag.Shipments = ApiUser.GetRequest>($"api/shipment/getshipments?userId=-1"); return View("Product", ApiUser.GetRequest($"api/product/getproduct?id={Id}")); }