продолжение интерфейсов работника
This commit is contained in:
parent
dac37e96b5
commit
a1ddbe8312
@ -17,38 +17,13 @@ namespace FactoryWorkerApp.Controllers
|
|||||||
|
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
if (APIClient.Client == null)
|
//if (APIClient.Client == null)
|
||||||
{
|
//{
|
||||||
return Redirect("~/Home/Enter");
|
// return Redirect("~/Home/Enter");
|
||||||
}
|
//}
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
public void Privacy(string email, string password, string login)
|
|
||||||
{
|
|
||||||
if (APIClient.Client == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
|
|
||||||
{
|
|
||||||
throw new Exception("Введите логин, пароль и ФИО");
|
|
||||||
}
|
|
||||||
APIClient.PostRequest("api/client/updatedata", new ClientBindingModel
|
|
||||||
{
|
|
||||||
Id = APIClient.Client.Id,
|
|
||||||
Login = login,
|
|
||||||
Email = email,
|
|
||||||
Password = password
|
|
||||||
});
|
|
||||||
|
|
||||||
APIClient.Client.Login = login;
|
|
||||||
APIClient.Client.Email = email;
|
|
||||||
APIClient.Client.Password = password;
|
|
||||||
Response.Redirect("Index");
|
|
||||||
}
|
|
||||||
|
|
||||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
public IActionResult Error()
|
public IActionResult Error()
|
||||||
{
|
{
|
||||||
@ -61,44 +36,12 @@ namespace FactoryWorkerApp.Controllers
|
|||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
public void Enter(string login, string password)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
|
|
||||||
{
|
|
||||||
throw new Exception("Введите логин и пароль");
|
|
||||||
}
|
|
||||||
APIClient.Client = APIClient.GetRequest<ClientViewModel>($"api/client/login?login={login}&password={password}");
|
|
||||||
if (APIClient.Client == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Неверный логин/пароль");
|
|
||||||
}
|
|
||||||
Response.Redirect("Index");
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult Register()
|
public IActionResult Register()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
public void Register(string email, string password, string login)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
|
|
||||||
{
|
|
||||||
throw new Exception("Введите логин, пароль и ФИО");
|
|
||||||
}
|
|
||||||
APIClient.PostRequest("api/client/register", new ClientBindingModel
|
|
||||||
{
|
|
||||||
Login = login,
|
|
||||||
Email = email,
|
|
||||||
Password = password
|
|
||||||
});
|
|
||||||
Response.Redirect("Enter");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
@ -106,26 +49,35 @@ namespace FactoryWorkerApp.Controllers
|
|||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpGet]
|
||||||
public void Create(string name, double cost, string material)
|
public IActionResult Workpieces()
|
||||||
{
|
{
|
||||||
if (APIClient.Client == null)
|
return View(new List<WorkpieceViewModel>());
|
||||||
{
|
|
||||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
|
||||||
}
|
}
|
||||||
if (cost<= 0)
|
[HttpGet]
|
||||||
|
public IActionResult Workpiece()
|
||||||
{
|
{
|
||||||
throw new Exception("Количество и сумма должны быть больше 0");
|
return View();
|
||||||
}
|
}
|
||||||
APIClient.PostRequest("api/main/createorder", new WorkpieceBindingModel
|
[HttpGet]
|
||||||
|
public IActionResult PlanProductions()
|
||||||
{
|
{
|
||||||
ClientId = APIClient.Client.Id,
|
return View(new List<PlanProductionViewModel>());
|
||||||
Material = material,
|
}
|
||||||
Cost = cost,
|
[HttpGet]
|
||||||
WorkpieceName = name,
|
public IActionResult PlanProduction()
|
||||||
|
{
|
||||||
});
|
return View();
|
||||||
Response.Redirect("Index");
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult ExecutionPhases()
|
||||||
|
{
|
||||||
|
return View(new List<ExecutionPhaseViewModel>());
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult ExecutionPhase()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
26
Factory/FactoryWorkerApp/Views/Home/ExecutionPhase.cshtml
Normal file
26
Factory/FactoryWorkerApp/Views/Home/ExecutionPhase.cshtml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Workpiece";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4">Заготовка</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">План производства:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="planproduction" name="planproduction" class="form-control" asp-items="@(new SelectList(@ViewBag.PlanProduction,"Id", "ProductionName"))"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Название:</div>
|
||||||
|
<div class="col-8"><input type="text" name="name" id="name" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Статус:</div>
|
||||||
|
<div class="col-8"><input type="text" id="status" name="status" readonly /></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>
|
63
Factory/FactoryWorkerApp/Views/Home/ExecutionPhases.cshtml
Normal file
63
Factory/FactoryWorkerApp/Views/Home/ExecutionPhases.cshtml
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
@using FactoryContracts.ViewModels
|
||||||
|
@model List<ExecutionPhaseViewModel>
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Execution Phases";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h1 class="display-4">Этапы выполнения</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
@{
|
||||||
|
//if (Model == null)
|
||||||
|
//{
|
||||||
|
// <h3 class="display-4">Авторизируйтесь</h3>
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a asp-action="ExecutionPhase">Создать</a>
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Название
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Логин клиента
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
ФИО исполнителя
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Статус
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in Model)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.ExecutionPhaseName)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.ClientLogin)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.ImplementerFIO)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Status)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
}
|
||||||
|
</div>
|
@ -12,17 +12,25 @@
|
|||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
@{
|
@{
|
||||||
if (Model == null)
|
//if (Model == null)
|
||||||
{
|
//{
|
||||||
<h3 class="display-4">Авторизируйтесь</h3>
|
// <h3 class="display-4">Авторизируйтесь</h3>
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="Workpieces">Заготовки</a>
|
<a asp-action="Workpieces">Заготовки</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
<a asp-action="PlanProductions">Планы производства</a>
|
<a asp-action="PlanProductions">Планы производства</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
<a asp-action="PlanProdctionExecutionPhase">Привзяка планов производства к заготовкам</a>
|
<a asp-action="PlanProdctionExecutionPhase">Привзяка планов производства к заготовкам</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
<a asp-action="ExecutionPhases">Этапы выполнения</a>
|
<a asp-action="ExecutionPhases">Этапы выполнения</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
<a asp-action="Reports">Получение списка</a>
|
<a asp-action="Reports">Получение списка</a>
|
||||||
</p>
|
</p>
|
||||||
}
|
}
|
||||||
|
24
Factory/FactoryWorkerApp/Views/Home/PlanProduction.cshtml
Normal file
24
Factory/FactoryWorkerApp/Views/Home/PlanProduction.cshtml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Plan Production";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4">План производства</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Название:</div>
|
||||||
|
<div class="col-8"><input type="text" name="productionname" id="productionname" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Количество:</div>
|
||||||
|
<div class="col-8"><input type="text" id="count" name="count" readonly /></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Срок выполнения:</div>
|
||||||
|
<div class="col-8"><input type="text" id="deadline" name="deadline" readonly /></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>
|
69
Factory/FactoryWorkerApp/Views/Home/PlanProductions.cshtml
Normal file
69
Factory/FactoryWorkerApp/Views/Home/PlanProductions.cshtml
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
@using FactoryContracts.ViewModels
|
||||||
|
@model List<PlanProductionViewModel>
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "Plan Productions";
|
||||||
|
}
|
||||||
|
<div class="text-center">
|
||||||
|
<h1 class="display-4">Планы производства</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
@{
|
||||||
|
if (Model == null)
|
||||||
|
{
|
||||||
|
<h3 class="display-4">Авторизируйтесь</h3>
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a asp-action="PlanProduction">Создать</a>
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Название
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Логин клиента
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Количество
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Этап выполнения
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Срок выполнения
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var item in Model)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.ProductionName)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.ClientLogin)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Count)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.ExecutionPhaseName)
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Deadline)
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
}
|
||||||
|
</div>
|
@ -1,4 +1,5 @@
|
|||||||
@{
|
@using FactoryContracts.ViewModels
|
||||||
|
@{
|
||||||
ViewData["Title"] = "Workpiece";
|
ViewData["Title"] = "Workpiece";
|
||||||
}
|
}
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
@ -8,12 +9,16 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Изделие:</div>
|
<div class="col-4">Изделие:</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<select id="product" name="product" class="form-control" asp-items="@(new SelectList(@ViewBag.Products,"Id", "ProductName"))"></select>
|
<select id="product" name="product" class="form-control"></select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Название:</div>
|
||||||
|
<div class="col-8"><input type="text" name="workpiecename" id="workpiecename" /></div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Материал:</div>
|
<div class="col-4">Материал:</div>
|
||||||
<div class="col-8"><input type="text" name="material" id="count" /></div>
|
<div class="col-8"><input type="text" name="material" id="material" /></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Цена:</div>
|
<div class="col-4">Цена:</div>
|
||||||
|
@ -11,11 +11,11 @@
|
|||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
@{
|
@{
|
||||||
if (Model == null)
|
//if (Model == null)
|
||||||
{
|
//{
|
||||||
<h3 class="display-4">Авторизируйтесь</h3>
|
// <h3 class="display-4">Авторизируйтесь</h3>
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="Workpiece">Создать заказ</a>
|
<a asp-action="Workpiece">Создать заказ</a>
|
||||||
|
@ -20,10 +20,7 @@
|
|||||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||||
<ul class="navbar-nav flex-grow-1">
|
<ul class="navbar-nav flex-grow-1">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
|
<a class="nav-link text-dark" asp-area="" asp-action="Index">Главная</a>
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Privacy</a>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user