аааааааа

This commit is contained in:
sardq 2024-05-29 21:14:27 +04:00
parent 4b5d089fe1
commit 49a6924def
8 changed files with 29 additions and 55 deletions

View File

@ -94,43 +94,41 @@ namespace FactoryBusinessLogic.OfficePackage
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
CreateTable(new List<string> { "3cm", "5cm", "5cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Название изделия", "Этапы выполнения", "Станки" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var workpiece in info.Workpieces)
CreateTable(new List<string> { "3cm", "5cm" });
foreach (var report in info.Workpieces)
{
CreateRow(new PdfRowParameters
{
Texts = new List<string>
{
workpiece.WorkpieceName,
string.Empty,
string.Empty,
},
Texts = new List<string> { "Заготовка", "Станок" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
CreateRow(new PdfRowParameters
{
Texts = new List<string> { 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>
{
string.Empty,
tuple.Item1,
tuple.Item2,
},
Texts = new List<string> { "", machinee },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "", "Этап выполнения" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var phase in report.ExecutionPhases)
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "", phase },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});
}
}
SaveWorkerPdf(info);
}

View File

@ -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; }
}
}

View File

@ -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<MachineViewModel> 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

View File

@ -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]

View File

@ -55,6 +55,7 @@ app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseSession();
app.UseAuthorization();

View File

@ -6,6 +6,6 @@
<h1 class="display-4">Выберите тип отчета</h1>
<div class="list-group">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="GetByPlans">Отчет изделий по производствам</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="WorkpieceDateReport">Отчет по заготовкам по датам</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="WorkpieceTimeChoose">Отчет по заготовкам по датам</a>
</div>
</div>

View File

@ -114,28 +114,5 @@ namespace FactoryWorkerApp
{
return _productLogic.ReadList(null);
}
public List<WorkpieceTimeReportViewModel>? GetWorkpieceTime(DateTime? startDate, DateTime? endDate, int ClientId)
{
var workpieces = _workpieceLogic.ReadList(new() { DateFrom = startDate, DateTo = endDate, ClientId = ClientId });
if (workpieces == null)
return new();
List<WorkpieceTimeReportViewModel> detailTimeReports = new List<WorkpieceTimeReportViewModel>();
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;
}
}
}