add pages and viewmodels for reports

This commit is contained in:
DavidMakarov 2024-05-01 16:58:49 +04:00
parent 739cb558c4
commit 06f3d0a153
9 changed files with 176 additions and 10 deletions

View File

@ -0,0 +1,9 @@
namespace FactoryContracts.ViewModels
{
public class MachinePeriodReportViewModel
{
public string MachineName { get; set; } = string.Empty;
public List<string> Products { get; set; } = new();
public List<string> PlanProductions { get; set; } = new();
}
}

View File

@ -0,0 +1,8 @@
namespace FactoryContracts.ViewModels
{
public class PlanProductionProductReportViewModel
{
public string ProductionName { get; set; } = string.Empty;
public List<string> Products { get; set; } = new();
}
}

View File

@ -1,5 +1,3 @@
using FactoryStorekeeperApp;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.

View File

@ -25,7 +25,7 @@
<a asp-action="Requirements">Требования к изделиям</a>
</p>
<p>
<a asp-action="MachinePlanProductions">Привязка станков к планам производства</a>
<a asp-action="MachinePlanProductions">Привязка станка к планам производства</a>
</p>
<p>
<a asp-action="Reports">Отчеты</a>

View File

@ -0,0 +1,50 @@
@using FactoryContracts.ViewModels
@model List<MachinePeriodReportViewModel>
@{
ViewData["Title"] = "Очет станков за период";
}
<div class="text-center">
<h1 class="display-4">Список станков за период</h1>
</div>
<form asp-controller="Report" method="post">
<button type="submit" class="btn btn-primary">Отправить отчет на почту</button>
</form>
<table class="table">
<thead>
<tr>
<th>Станок</th>
<th>Изделия</th>
<th>Планы производства</th>
</tr>
</thead>
<tbody>
@foreach (var machine in Model)
{
<tr>
<td>@machine.MachineName</td>
<td>
<ul>
@foreach (var product in machine.Products)
{
<li>@product</li>
}
</ul>
</td>
<td>
<ul>
@foreach (var planProduction in machine.PlanProductions)
{
<li>@planProduction</li>
}
</ul>
</td>
</tr>
}
</tbody>
</table>

View File

@ -1,5 +1,49 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@using FactoryContracts.ViewModels
@model List<PlanProductionViewModel>
@{
ViewData["Title"] = "Привязка станка к планам производства";
}
<div class="text-center">
<h3 class="display-4">Привязка станка к планам производства</h3>
</div>
<form method="post">
<div class="row">
<div class="col-4">Станок:</div>
<div class="col-8">
<select id="machine" name="machine" class="form-control"></select>
</div>
</div>
<h3>Список планов производства</h3>
<div class="container">
<div>Заготовки</div>
<div class="table-responsive-lg">
<table id="detailsTable" class="display">
<thead>
<tr>
<th>Выбор </th>
<th>Название </th>
<th>Количество</th>
</tr>
</thead>
<tbody>
@foreach (var planProduction in Model)
{
<tr>
<td>
<input type="checkbox" name="planproductions" value="@planProduction.Id" />
</td>
<td>@planProduction.ProductionName</td>
<td>
<input type="number" name="count" value="0" min="0" class="form-control" />
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -0,0 +1,42 @@
@using FactoryContracts.ViewModels
@model List<PlanProductionProductReportViewModel>
@{
ViewData["Title"] = "Отчет планов производства по изделиям";
}
<div class="text-center">
<h1 class="display-4">Список планов производств по изделиям</h1>
</div>
<form asp-controller="Report" method="post">
<button type="submit" class="btn btn-primary">Сгенерировать отчет в Word</button>
</form>
<form asp-controller="Report" method="post">
<button type="submit" class="btn btn-primary">Сгенерировать отчет в Excel</button>
</form>
<table class="table">
<thead>
<tr>
<th>План производства</th>
<th>Изделие</th>
</tr>
</thead>
<tbody>
@foreach (var planProduction in Model)
{
<tr>
<td>@planProduction.ProductionName</td>
<td>
<ul>
@foreach (var plan in planProduction.Products)
{
<li>@plan</li>
}
</ul>
</td>
</tr>
}
</tbody>
</table>

View File

@ -0,0 +1,11 @@
@{
ViewData["Title"] = "Отчеты";
}
<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>
</div>
</div>

View File

@ -19,10 +19,14 @@
</button>
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item d-flex">
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Главная</a>
<a class="nav-link text-dark" asp-area="" asp-page="/Enter">Вход</a>
<a class="nav-link text-dark" asp-area="" asp-page="/Register">Регистрация</a>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Главная</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Enter">Вход</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
</li>
</ul>
</div>