MachineByPeriod implementation
This commit is contained in:
parent
8d3a39c256
commit
396f923de4
@ -129,7 +129,10 @@ namespace FactoryDatabaseImplement.Implements
|
||||
using var context = new FactoryDatabase();
|
||||
return context.Machines
|
||||
.Include(x => x.Client)
|
||||
// not sure if its true
|
||||
.Include(x => x.PlanProductions)
|
||||
.ThenInclude(x => x.PlanProduction)
|
||||
.Include(x => x.Products)
|
||||
.ThenInclude(x => x.Product)
|
||||
.Where(x => x.ClientId == client.Id && x.ExploitationStartDate >= model.DateFrom && x.ExploitationStartDate <= model.DateTo)
|
||||
.Select(x => new MachinePeriodReportViewModel()
|
||||
{
|
||||
|
@ -18,10 +18,14 @@ namespace FactoryStorekeeperApp.Controllers
|
||||
private readonly IRequirementLogic requirementLogic;
|
||||
private readonly IProductLogic productLogic;
|
||||
private readonly IPlanProductionLogic planProductionLogic;
|
||||
private readonly IStorekeeperReportLogic storekeeperReportLogic;
|
||||
|
||||
private static bool IsLoggedIn { get { return Client.client != null; } }
|
||||
|
||||
public HomeController(ILogger<HomeController> logger, IClientLogic clientLogic, IRequirementLogic requirementLogic, IProductLogic productLogic, IMachineLogic machineLogic, IPlanProductionLogic planProductionLogic)
|
||||
public HomeController(ILogger<HomeController> logger, IClientLogic clientLogic,
|
||||
IRequirementLogic requirementLogic, IProductLogic productLogic,
|
||||
IMachineLogic machineLogic, IPlanProductionLogic planProductionLogic,
|
||||
IStorekeeperReportLogic storekeeperReportLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
this.clientLogic = clientLogic;
|
||||
@ -29,6 +33,7 @@ namespace FactoryStorekeeperApp.Controllers
|
||||
this.productLogic = productLogic;
|
||||
this.machineLogic = machineLogic;
|
||||
this.planProductionLogic = planProductionLogic;
|
||||
this.storekeeperReportLogic = storekeeperReportLogic;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
@ -393,28 +398,33 @@ namespace FactoryStorekeeperApp.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult GetByPeriod()
|
||||
{
|
||||
if (!IsLoggedIn)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult MachinePeriodReport()
|
||||
public IActionResult MachinePeriodReport(DateTime datefrom, DateTime dateto)
|
||||
{
|
||||
if (!IsLoggedIn)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
List<MachinePeriodReportViewModel> reports = new List<MachinePeriodReportViewModel>
|
||||
{
|
||||
new MachinePeriodReportViewModel
|
||||
{
|
||||
MachineName = "Станок А",
|
||||
PlanProductions = new(),
|
||||
Products = new()
|
||||
},
|
||||
new MachinePeriodReportViewModel
|
||||
{
|
||||
MachineName = "Станок B",
|
||||
PlanProductions = new(),
|
||||
Products = new()
|
||||
}
|
||||
};
|
||||
var reports = storekeeperReportLogic.GetMachines(
|
||||
new ClientSearchModel
|
||||
{
|
||||
Id = Client.client.Id
|
||||
},
|
||||
new ReportBindingModel
|
||||
{
|
||||
DateFrom = datefrom,
|
||||
DateTo = dateto,
|
||||
});
|
||||
return View(reports);
|
||||
}
|
||||
|
||||
|
24
Factory/FactoryStorekeeperApp/Views/Home/GetByPeriod.cshtml
Normal file
24
Factory/FactoryStorekeeperApp/Views/Home/GetByPeriod.cshtml
Normal file
@ -0,0 +1,24 @@
|
||||
@using FactoryContracts.ViewModels
|
||||
|
||||
@model List<MachinePeriodReportViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Подготовка к созданию отчета за период";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Список станков за период</h1>
|
||||
</div>
|
||||
|
||||
<form asp-controller="Home" asp-action="MachinePeriodReport" method="get">
|
||||
<div class="row">Выберите период</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Дата начала:</div>
|
||||
<div class="col-8"><input type="date" name="datefrom" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Дата конца:</div>
|
||||
<div class="col-8"><input type="date" name="dateto" /></div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Создать отчёт</button>
|
||||
</form>
|
@ -3,7 +3,7 @@
|
||||
@model List<MachinePeriodReportViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Очет станков за период";
|
||||
ViewData["Title"] = "Отчет станков за период";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
@ -32,7 +32,7 @@
|
||||
<ul>
|
||||
@foreach (var product in machine.Products)
|
||||
{
|
||||
<li>@product</li>
|
||||
<li>@product.ProductName</li>
|
||||
}
|
||||
</ul>
|
||||
</td>
|
||||
@ -40,7 +40,7 @@
|
||||
<ul>
|
||||
@foreach (var planProduction in machine.PlanProductions)
|
||||
{
|
||||
<li>@planProduction</li>
|
||||
<li>@planProduction.ProductionName</li>
|
||||
}
|
||||
</ul>
|
||||
</td>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Выберите тип отчета</h1>
|
||||
<div class="list-group">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="PlanProductionByProductReport">Отчет планов производства по изделиям</a>
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="MachinePeriodReport">Отчет по станкам за период</a>
|
||||
<a class="nav-link text-dark" asp-controller="Home" asp-action="PlanProductionByProductReport">Отчет планов производства по изделиям</a>
|
||||
<a class="nav-link text-dark" asp-controller="Home" asp-action="GetByPeriod">Отчет по станкам за период</a>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user