From d38144af208f00c10b3ab76fb6144ea2b86a7049 Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Sat, 18 Mar 2023 22:15:22 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=BC=D0=B5=D0=B6=D1=83?= =?UTF-8?q?=D1=82=D0=BE=D1=87=D0=BD=D0=BE=D0=B5=20=D1=81=D0=BE=D1=85=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormReportManufactureWorkPieces.cs | 2 +- .../BlacksmithWorkshop/ReportOrders.rdlc | 1 + .../BusinessLogic/ReportLogic.cs | 16 ++++++---------- .../OfficePackage/AbstractSaveToExcel.cs | 2 +- .../OfficePackage/AbstractSaveToPdf.cs | 2 +- .../ReportManufactureWorkPieceViewModel.cs | 4 ++-- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.cs index e615b34..598437d 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.cs @@ -39,7 +39,7 @@ namespace BlacksmithWorkshop foreach (var elem in dict) { - dataGridView.Rows.Add(new object[] { elem.WorkPieceName, "", "" }); + dataGridView.Rows.Add(new object[] { elem.ManufactureName, "", "" }); foreach (var listElem in elem.Manufactures) { diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/ReportOrders.rdlc b/BlacksmithWorkshop/BlacksmithWorkshop/ReportOrders.rdlc index 115c61a..15919c2 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshop/ReportOrders.rdlc +++ b/BlacksmithWorkshop/BlacksmithWorkshop/ReportOrders.rdlc @@ -466,6 +466,7 @@ + diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ReportLogic.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ReportLogic.cs index bffebd2..60826dc 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ReportLogic.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/BusinessLogic/ReportLogic.cs @@ -44,27 +44,23 @@ namespace BlacksmithWorkshopBusinessLogic.BusinessLogic //Получение списка компонент с указанием, в каких изделиях используются public List GetManufactureWorkPiece() { - var workPieces = _workPieceStorage.GetFullList(); var manufactures = _manufactureStorage.GetFullList(); var list = new List(); - foreach (var workPiece in workPieces) + foreach (var manufacture in manufactures) { var record = new ReportManufactureWorkPieceViewModel { - WorkPieceName = workPiece.WorkPieceName, - Manufactures = new List<(string, int)>(), + ManufactureName = manufacture.ManufactureName, + WorkPieces = new List<(string, int)>(), TotalCount = 0 }; - foreach (var manufacture in manufactures) + foreach (var workPieces in manufacture.ManufactureWorkPieces) { - if (manufacture.ManufactureWorkPieces.ContainsKey(workPiece.Id)) - { - record.Manufactures.Add(new (manufacture.ManufactureName, manufacture.ManufactureWorkPieces[workPiece.Id].Item2)); - record.TotalCount += manufacture.ManufactureWorkPieces[workPiece.Id].Item2; - } + record.WorkPieces.Add(new (workPieces.Value.Item1.WorkPieceName, workPieces.Value.Item2)); + record.TotalCount += workPieces.Value.Item2; } list.Add(record); diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/OfficePackage/AbstractSaveToExcel.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/OfficePackage/AbstractSaveToExcel.cs index cc0054c..6073116 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/OfficePackage/AbstractSaveToExcel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/OfficePackage/AbstractSaveToExcel.cs @@ -37,7 +37,7 @@ namespace BlacksmithWorkshopBusinessLogic.OfficePackage { ColumnName = "A", RowIndex = rowIndex, - Text = mwp.WorkPieceName, + Text = mwp.ManufactureName, StyleInfo = ExcelStyleInfoType.Text }); diff --git a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs index 2bdb97d..6647794 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopBusinessLogic/OfficePackage/AbstractSaveToPdf.cs @@ -24,7 +24,7 @@ namespace BlacksmithWorkshopBusinessLogic.OfficePackage CreateParagraph(new PdfParagraph { - Text = $"с{ info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }", + Text = $"с { info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center }); diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ReportManufactureWorkPieceViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ReportManufactureWorkPieceViewModel.cs index de3b0fe..263b24b 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ReportManufactureWorkPieceViewModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ReportManufactureWorkPieceViewModel.cs @@ -8,11 +8,11 @@ namespace BlacksmithWorkshopContracts.ViewModels { public class ReportManufactureWorkPieceViewModel { - public string WorkPieceName { get; set; } = string.Empty; + public string ManufactureName { get; set; } = string.Empty; public int TotalCount { get; set; } //список кортежей - public List<(string Manufacure, int Count)> Manufactures { get; set; } = new(); + public List<(string Manufacure, int Count)> WorkPieces { get; set; } = new(); } }