аааааааа

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", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Center ParagraphAlignment = PdfParagraphAlignmentType.Center
}); });
CreateTable(new List<string> { "3cm", "5cm", "5cm" }); CreateTable(new List<string> { "3cm", "5cm" });
CreateRow(new PdfRowParameters foreach (var report in info.Workpieces)
{
Texts = new List<string> { "Название изделия", "Этапы выполнения", "Станки" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
foreach (var workpiece in info.Workpieces)
{ {
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
{ {
Texts = new List<string> Texts = new List<string> { "Заготовка", "Станок" },
{ Style = "NormalTitle",
workpiece.WorkpieceName, ParagraphAlignment = PdfParagraphAlignmentType.Center
string.Empty, });
string.Empty, CreateRow(new PdfRowParameters
}, {
Texts = new List<string> { report.WorkpieceName, "" },
Style = "Normal", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left ParagraphAlignment = PdfParagraphAlignmentType.Left
}); });
foreach (var machinee in report.Machines)
var tupleList = machineNames.Zip(phaseNames, Tuple.Create);
foreach (var tuple in tupleList)
{
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
{ {
Texts = new List<string> Texts = new List<string> { "", machinee },
{ Style = "Normal",
string.Empty, ParagraphAlignment = PdfParagraphAlignmentType.Left
tuple.Item1, });
tuple.Item2, 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", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left ParagraphAlignment = PdfParagraphAlignmentType.Left
}); });
}
} }
SaveWorkerPdf(info); SaveWorkerPdf(info);
} }

View File

@ -4,7 +4,7 @@
{ {
public int? Id { get; set; } public int? Id { get; set; }
public string? MachineName { get; set; } public string? MachineName { get; set; }
public int WorkpieceId { get; set; } public int? WorkpieceId { get; set; }
public int ClientId { get; set; } public int ClientId { get; set; }
} }
} }

View File

@ -4,6 +4,7 @@ using FactoryContracts.StoragesContracts;
using FactoryContracts.ViewModels; using FactoryContracts.ViewModels;
using FactoryDatabaseImplement.Models; using FactoryDatabaseImplement.Models;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using System.Runtime.CompilerServices;
namespace FactoryDatabaseImplement.Implements namespace FactoryDatabaseImplement.Implements
{ {
@ -23,9 +24,6 @@ namespace FactoryDatabaseImplement.Implements
public List<MachineViewModel> GetFilteredList(MachineSearchModel model) public List<MachineViewModel> GetFilteredList(MachineSearchModel model)
{ {
using var context = new FactoryDatabase(); 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)) if (!string.IsNullOrEmpty(model.MachineName))
{ {
return context.Machines return context.Machines

View File

@ -277,7 +277,7 @@ namespace FactoryWorkerApp.Controllers
HttpContext.Session.SetString("StartDate", startDate.ToString()); HttpContext.Session.SetString("StartDate", startDate.ToString());
HttpContext.Session.SetString("EndDate", endDate.ToString()); HttpContext.Session.SetString("EndDate", endDate.ToString());
return RedirectToAction("WorkpieceTimeReport"); return RedirectToAction("WorkpieceDateReport");
} }
[HttpGet] [HttpGet]

View File

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

View File

@ -6,6 +6,6 @@
<h1 class="display-4">Выберите тип отчета</h1> <h1 class="display-4">Выберите тип отчета</h1>
<div class="list-group"> <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="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>
</div> </div>

View File

@ -114,28 +114,5 @@ namespace FactoryWorkerApp
{ {
return _productLogic.ReadList(null); 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;
}
} }
} }