MachineByPeriod implementation
This commit is contained in:
parent
8d3a39c256
commit
396f923de4
@ -129,7 +129,10 @@ namespace FactoryDatabaseImplement.Implements
|
|||||||
using var context = new FactoryDatabase();
|
using var context = new FactoryDatabase();
|
||||||
return context.Machines
|
return context.Machines
|
||||||
.Include(x => x.Client)
|
.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)
|
.Where(x => x.ClientId == client.Id && x.ExploitationStartDate >= model.DateFrom && x.ExploitationStartDate <= model.DateTo)
|
||||||
.Select(x => new MachinePeriodReportViewModel()
|
.Select(x => new MachinePeriodReportViewModel()
|
||||||
{
|
{
|
||||||
|
@ -18,10 +18,14 @@ namespace FactoryStorekeeperApp.Controllers
|
|||||||
private readonly IRequirementLogic requirementLogic;
|
private readonly IRequirementLogic requirementLogic;
|
||||||
private readonly IProductLogic productLogic;
|
private readonly IProductLogic productLogic;
|
||||||
private readonly IPlanProductionLogic planProductionLogic;
|
private readonly IPlanProductionLogic planProductionLogic;
|
||||||
|
private readonly IStorekeeperReportLogic storekeeperReportLogic;
|
||||||
|
|
||||||
private static bool IsLoggedIn { get { return Client.client != null; } }
|
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;
|
_logger = logger;
|
||||||
this.clientLogic = clientLogic;
|
this.clientLogic = clientLogic;
|
||||||
@ -29,6 +33,7 @@ namespace FactoryStorekeeperApp.Controllers
|
|||||||
this.productLogic = productLogic;
|
this.productLogic = productLogic;
|
||||||
this.machineLogic = machineLogic;
|
this.machineLogic = machineLogic;
|
||||||
this.planProductionLogic = planProductionLogic;
|
this.planProductionLogic = planProductionLogic;
|
||||||
|
this.storekeeperReportLogic = storekeeperReportLogic;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
@ -393,28 +398,33 @@ namespace FactoryStorekeeperApp.Controllers
|
|||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult GetByPeriod()
|
||||||
|
{
|
||||||
|
if (!IsLoggedIn)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult MachinePeriodReport()
|
public IActionResult MachinePeriodReport(DateTime datefrom, DateTime dateto)
|
||||||
{
|
{
|
||||||
if (!IsLoggedIn)
|
if (!IsLoggedIn)
|
||||||
{
|
{
|
||||||
return Redirect("~/Home/Enter");
|
return Redirect("~/Home/Enter");
|
||||||
}
|
}
|
||||||
List<MachinePeriodReportViewModel> reports = new List<MachinePeriodReportViewModel>
|
var reports = storekeeperReportLogic.GetMachines(
|
||||||
{
|
new ClientSearchModel
|
||||||
new MachinePeriodReportViewModel
|
{
|
||||||
{
|
Id = Client.client.Id
|
||||||
MachineName = "Станок А",
|
},
|
||||||
PlanProductions = new(),
|
new ReportBindingModel
|
||||||
Products = new()
|
{
|
||||||
},
|
DateFrom = datefrom,
|
||||||
new MachinePeriodReportViewModel
|
DateTo = dateto,
|
||||||
{
|
});
|
||||||
MachineName = "Станок B",
|
|
||||||
PlanProductions = new(),
|
|
||||||
Products = new()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return View(reports);
|
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>
|
@model List<MachinePeriodReportViewModel>
|
||||||
|
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Очет станков за период";
|
ViewData["Title"] = "Отчет станков за период";
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
@ -32,7 +32,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
@foreach (var product in machine.Products)
|
@foreach (var product in machine.Products)
|
||||||
{
|
{
|
||||||
<li>@product</li>
|
<li>@product.ProductName</li>
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
@ -40,7 +40,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
@foreach (var planProduction in machine.PlanProductions)
|
@foreach (var planProduction in machine.PlanProductions)
|
||||||
{
|
{
|
||||||
<li>@planProduction</li>
|
<li>@planProduction.ProductionName</li>
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<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="PlanProductionByProductReport">Отчет планов производства по изделиям</a>
|
<a class="nav-link text-dark" 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="GetByPeriod">Отчет по станкам за период</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
Loading…
Reference in New Issue
Block a user