diff --git a/Factory/FactoryBuisinessLogic/OfficePackage/AbstractSaveToPdf.cs b/Factory/FactoryBuisinessLogic/OfficePackage/AbstractSaveToPdf.cs index f284f55..3c46ad1 100644 --- a/Factory/FactoryBuisinessLogic/OfficePackage/AbstractSaveToPdf.cs +++ b/Factory/FactoryBuisinessLogic/OfficePackage/AbstractSaveToPdf.cs @@ -94,43 +94,41 @@ namespace FactoryBusinessLogic.OfficePackage Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center }); - CreateTable(new List { "3cm", "5cm", "5cm" }); - CreateRow(new PdfRowParameters - { - Texts = new List { "Название изделия", "Этапы выполнения", "Станки" }, - Style = "NormalTitle", - ParagraphAlignment = PdfParagraphAlignmentType.Center - }); - foreach (var workpiece in info.Workpieces) + CreateTable(new List { "3cm", "5cm" }); + foreach (var report in info.Workpieces) { CreateRow(new PdfRowParameters { - Texts = new List - { - workpiece.WorkpieceName, - string.Empty, - string.Empty, - }, + Texts = new List { "Заготовка", "Станок" }, + Style = "NormalTitle", + ParagraphAlignment = PdfParagraphAlignmentType.Center + }); + CreateRow(new PdfRowParameters + { + Texts = new List { report.WorkpieceName, "" }, Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Left }); - - - var tupleList = machineNames.Zip(phaseNames, Tuple.Create); - foreach (var tuple in tupleList) - { + foreach (var machinee in report.Machines) CreateRow(new PdfRowParameters { - Texts = new List - { - string.Empty, - tuple.Item1, - tuple.Item2, - }, + Texts = new List { "", machinee }, + Style = "Normal", + ParagraphAlignment = PdfParagraphAlignmentType.Left + }); + CreateRow(new PdfRowParameters + { + Texts = new List { "", "Этап выполнения" }, + Style = "NormalTitle", + ParagraphAlignment = PdfParagraphAlignmentType.Center + }); + foreach (var phase in report.ExecutionPhases) + CreateRow(new PdfRowParameters + { + Texts = new List { "", phase }, Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Left }); - } } SaveWorkerPdf(info); } diff --git a/Factory/FactoryContracts/SearchModels/MachineSearchModel.cs b/Factory/FactoryContracts/SearchModels/MachineSearchModel.cs index 62b976f..0247124 100644 --- a/Factory/FactoryContracts/SearchModels/MachineSearchModel.cs +++ b/Factory/FactoryContracts/SearchModels/MachineSearchModel.cs @@ -4,7 +4,7 @@ { public int? Id { get; set; } public string? MachineName { get; set; } - public int WorkpieceId { get; set; } + public int? WorkpieceId { get; set; } public int ClientId { get; set; } } } diff --git a/Factory/FactoryDatabaseImplement/Implements/MachineStorage.cs b/Factory/FactoryDatabaseImplement/Implements/MachineStorage.cs index b930383..ab6c9e1 100644 --- a/Factory/FactoryDatabaseImplement/Implements/MachineStorage.cs +++ b/Factory/FactoryDatabaseImplement/Implements/MachineStorage.cs @@ -4,6 +4,7 @@ using FactoryContracts.StoragesContracts; using FactoryContracts.ViewModels; using FactoryDatabaseImplement.Models; using Microsoft.EntityFrameworkCore; +using System.Runtime.CompilerServices; namespace FactoryDatabaseImplement.Implements { @@ -23,9 +24,6 @@ namespace FactoryDatabaseImplement.Implements public List GetFilteredList(MachineSearchModel model) { using var context = new FactoryDatabase(); - if (model.WorkpieceId.HasValue) - return context.Machines.Include(x => x.PlanProductions).Where(x => x.PlanProduction.Workpieces.FirstOrDefault(y => y.WorkpieceId == model.WorkpieceId) != null).Select(x => x.GetViewModel).ToList(); - if (!string.IsNullOrEmpty(model.MachineName)) { return context.Machines diff --git a/Factory/FactoryWorkerApp/Controllers/HomeController.cs b/Factory/FactoryWorkerApp/Controllers/HomeController.cs index 60dc10d..5efce59 100644 --- a/Factory/FactoryWorkerApp/Controllers/HomeController.cs +++ b/Factory/FactoryWorkerApp/Controllers/HomeController.cs @@ -277,7 +277,7 @@ namespace FactoryWorkerApp.Controllers HttpContext.Session.SetString("StartDate", startDate.ToString()); HttpContext.Session.SetString("EndDate", endDate.ToString()); - return RedirectToAction("WorkpieceTimeReport"); + return RedirectToAction("WorkpieceDateReport"); } [HttpGet] diff --git a/Factory/FactoryWorkerApp/Program.cs b/Factory/FactoryWorkerApp/Program.cs index 6e157f2..dbfcc84 100644 --- a/Factory/FactoryWorkerApp/Program.cs +++ b/Factory/FactoryWorkerApp/Program.cs @@ -55,6 +55,7 @@ app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); +app.UseSession(); app.UseAuthorization(); diff --git a/Factory/FactoryWorkerApp/Views/Home/Reports.cshtml b/Factory/FactoryWorkerApp/Views/Home/Reports.cshtml index ab5af27..a8ef7c4 100644 --- a/Factory/FactoryWorkerApp/Views/Home/Reports.cshtml +++ b/Factory/FactoryWorkerApp/Views/Home/Reports.cshtml @@ -6,6 +6,6 @@

Выберите тип отчета

\ No newline at end of file diff --git a/Factory/FactoryWorkerApp/Views/Home/WorkpiecesTimeChoose.cshtml b/Factory/FactoryWorkerApp/Views/Home/WorkpieceTimeChoose.cshtml similarity index 100% rename from Factory/FactoryWorkerApp/Views/Home/WorkpiecesTimeChoose.cshtml rename to Factory/FactoryWorkerApp/Views/Home/WorkpieceTimeChoose.cshtml diff --git a/Factory/FactoryWorkerApp/WorkerLogic.cs b/Factory/FactoryWorkerApp/WorkerLogic.cs index 401661b..1a16091 100644 --- a/Factory/FactoryWorkerApp/WorkerLogic.cs +++ b/Factory/FactoryWorkerApp/WorkerLogic.cs @@ -114,28 +114,5 @@ namespace FactoryWorkerApp { return _productLogic.ReadList(null); } - public List? GetWorkpieceTime(DateTime? startDate, DateTime? endDate, int ClientId) - { - var workpieces = _workpieceLogic.ReadList(new() { DateFrom = startDate, DateTo = endDate, ClientId = ClientId }); - if (workpieces == null) - return new(); - List detailTimeReports = new List(); - foreach (var i in workpieces) - { - WorkpieceTimeReportViewModel report = new(); - var workpiece = _workpieceLogic.ReadElement(new() { Id = i.Id }); - report.WorkpieceName = workpiece!.WorkpieceName; - var phases = _executionPhaseLogic.ReadList(new() { WorkpieceId = i.Id }); - if (phases != null) - report.ExecutionPhases = phases.Select(w => w.ExecutionPhaseName).ToList(); - var machines = _machineLogic.ReadList(new() { WorkpieceId = i.Id }); - if (machines != null) - report.Machines = machines.Select(w => w.MachineName).ToList(); - detailTimeReports.Add(report); - } - return detailTimeReports; - } - - } }