вроде все ლ(ಥ益ಥლ)
This commit is contained in:
parent
766b50e33a
commit
816ff96982
@ -69,6 +69,8 @@ namespace ServiceStationBusinessLogic.BusinessLogics
|
||||
WorksInfo = new List<(string, double)>()
|
||||
};
|
||||
foreach(var work in works)
|
||||
{
|
||||
if (work.TechnicalWorkId.HasValue)
|
||||
{
|
||||
var techWork = _techWorkStorage.GetElement(new TechnicalWorkSearchModel
|
||||
{
|
||||
@ -83,6 +85,8 @@ namespace ServiceStationBusinessLogic.BusinessLogics
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
rec.FullPrice = price;
|
||||
allList.Add(rec);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using DocumentFormat.OpenXml.Drawing;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceStationContracts.BindingModels;
|
||||
using ServiceStationContracts.BusinessLogicsContracts;
|
||||
@ -121,6 +122,18 @@ namespace ServiceStationExecutorApp.Controllers
|
||||
return View(APIExecutor.GetRequest<List<TechnicalWorkViewModel>>($"api/main/gettechnicalworklist?executorId={APIExecutor.Executor.Id}"));
|
||||
}
|
||||
[HttpGet]
|
||||
public CarViewModel? GetCar(int carId)
|
||||
{
|
||||
if (APIExecutor.Executor == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
var result = APIExecutor.GetRequest<CarViewModel>($"api/main/getcar?carId={carId}");
|
||||
if (result == null) return null;
|
||||
|
||||
return result;
|
||||
}
|
||||
[HttpGet]
|
||||
public Tuple<DefectViewModel, string>? GetDefect(int defectId)
|
||||
{
|
||||
if(APIExecutor.Executor == null)
|
||||
@ -300,10 +313,10 @@ namespace ServiceStationExecutorApp.Controllers
|
||||
return RedirectToAction("Enter");
|
||||
}
|
||||
ViewBag.TechnicalWorks = APIExecutor.GetRequest<List<TechnicalWorkViewModel>>($"api/main/gettechnicalworklist?executorId={APIExecutor.Executor.Id}");
|
||||
return View();
|
||||
return View(APIExecutor.GetRequest<List<CarViewModel>>($"api/main/getcarlist?executorId={APIExecutor.Executor.Id}"));
|
||||
}
|
||||
[HttpPost]
|
||||
public void UpdateTechnicalWork(int technicalWork, string TechnicalWorkType, double TechnicalWorkPrice)
|
||||
public void UpdateTechnicalWork(int technicalWork, string TechnicalWorkType, double TechnicalWorkPrice, int[] car)
|
||||
{
|
||||
if (APIExecutor.Executor == null)
|
||||
{
|
||||
@ -324,6 +337,10 @@ namespace ServiceStationExecutorApp.Controllers
|
||||
ExecutorId = APIExecutor.Executor.Id,
|
||||
WorkPrice = TechnicalWorkPrice,
|
||||
});
|
||||
APIExecutor.PostRequest("api/main/addcartotechnicalwork", Tuple.Create(
|
||||
new TechnicalWorkSearchModel() { Id = technicalWork },
|
||||
car
|
||||
));
|
||||
Response.Redirect("ListTechnicalWorks");
|
||||
}
|
||||
public IActionResult CreateCar()
|
||||
@ -382,10 +399,10 @@ namespace ServiceStationExecutorApp.Controllers
|
||||
{
|
||||
return RedirectToAction("Enter");
|
||||
}
|
||||
return View();
|
||||
return View(APIExecutor.GetRequest<List<CarViewModel>>($"api/main/getcarlist?executorId={APIExecutor.Executor.Id}"));
|
||||
}
|
||||
[HttpPost]
|
||||
public void CreateTechnicalWork(string WorkType, double WorkPrice)
|
||||
public void CreateTechnicalWork(string WorkType, double WorkPrice, int[] car)
|
||||
{
|
||||
if (APIExecutor.Executor == null)
|
||||
{
|
||||
@ -398,6 +415,10 @@ namespace ServiceStationExecutorApp.Controllers
|
||||
WorkPrice = WorkPrice,
|
||||
DateStartWork = DateTime.Now
|
||||
});
|
||||
APIExecutor.PostRequest("api/main/addcartotechnicalwork", Tuple.Create(
|
||||
new TechnicalWorkSearchModel() { WorkType = WorkType },
|
||||
car
|
||||
));
|
||||
Response.Redirect("ListTechnicalWorks");
|
||||
}
|
||||
public IActionResult BindingTechnicalWorkToWork()
|
||||
@ -503,7 +524,7 @@ namespace ServiceStationExecutorApp.Controllers
|
||||
}
|
||||
APIExecutor.PostRequest("api/report/createexecutorreporttopdf", new PdfReportBindingModel
|
||||
{
|
||||
FileName = Directory.GetCurrentDirectory() + "\\Reports\\pdffile.pdf",
|
||||
FileName = Directory.GetCurrentDirectory().Replace("ServiceStationExecutorApp", "ServiceStationRestApi") + "\\Reports\\pdffile.pdf",
|
||||
DateFrom = dateFrom,
|
||||
DateTo = dateTo,
|
||||
ExecutorId = APIExecutor.Executor.Id,
|
||||
|
@ -1,10 +1,10 @@
|
||||
@using ServiceStationContracts.ViewModels
|
||||
|
||||
@model List<CarViewModel>
|
||||
@{
|
||||
ViewData["Title"] = "CreateDefect";
|
||||
}
|
||||
|
||||
@model List<CarViewModel>
|
||||
|
||||
|
||||
<form method="post">
|
||||
<div class="w-25 container justify-content-center align-items-center">
|
||||
|
@ -1,6 +1,5 @@
|
||||
@*
|
||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
*@
|
||||
@using ServiceStationContracts.ViewModels
|
||||
@model List<CarViewModel>
|
||||
@{
|
||||
ViewData["Title"] = "CreateTechnicalWork";
|
||||
}
|
||||
@ -14,6 +13,29 @@
|
||||
<label>Цена ТО</label>
|
||||
<input type="number" min="100" step="100" id="WorkPrice" placeholder="Введите цену" name="WorkPrice" class="form-control" />
|
||||
</div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">№</th>
|
||||
<th scope="col">Номер машины</th>
|
||||
<th scope="col">Марка машины</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var car in Model)
|
||||
{
|
||||
<tr>
|
||||
<td class="align-middle">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" name="car[]" value="@car.Id" id="@car.Id">
|
||||
</div>
|
||||
</td>
|
||||
<td class="align-middle">@Html.DisplayFor(modelItem => car.CarNumber)</td>
|
||||
<td class="align-middle">@Html.DisplayFor(modelItem => car.CarBrand)</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<div>
|
||||
<input type="submit" value="Сохранить" class="btn btn-secondary text-center" />
|
||||
|
@ -49,8 +49,6 @@
|
||||
|
||||
<a asp-controller="Home" asp-action="UpdateTechnicalWork" class="btn btn-secondary text-center col-2">Изменить</a>
|
||||
|
||||
<a asp-controller="Home" asp-action="AddCarToTechnicalWork" class="btn btn-secondary text-center col-2">Добавить машину</a>
|
||||
|
||||
<a asp-controller="Home" asp-action="DeleteTechnicalWork" class="btn btn-secondary text-center col-2">Удалить</a>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -26,3 +26,26 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@section Scripts
|
||||
{
|
||||
<script>
|
||||
function check() {
|
||||
var car = $('#car').val();
|
||||
if (car) {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/Home/GetCar",
|
||||
data: { carId: car },
|
||||
success: function (result) {
|
||||
$('#carNumber').val(result.carNumber);
|
||||
$('#carBrand').val(result.carBrand);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
check();
|
||||
$('#car').on('change', function () {
|
||||
check();
|
||||
});
|
||||
</script>
|
||||
}
|
@ -13,11 +13,11 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Тип неисравности</label>
|
||||
<input type="text" id="DefectType" placeholder="Введите тип неисправности" name="DefectType" class="form-control" />
|
||||
<input type="text" id="defectType" placeholder="Введите тип неисправности" name="defectType" class="form-control" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Цена починки</label>
|
||||
<input type="number" min="100" step="100" id="DefectPrice" placeholder="Введите цену" name="DefectPrice" class="form-control" />
|
||||
<input type="number" min="100" step="100" id="defectPrice" placeholder="Введите цену" name="defectPrice" class="form-control" />
|
||||
</div>
|
||||
<h5>Уже привязанные машины</h5>
|
||||
<table class="table">
|
||||
@ -74,6 +74,8 @@
|
||||
url: "/Home/GetDefect",
|
||||
data: { defectId: defect },
|
||||
success: function (result) {
|
||||
$('#defectType').val(result.item1.defectType);
|
||||
$('#defectPrice').val(result.item1.defectPrice);
|
||||
$('#table-elements').html(result.item2);
|
||||
}
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
@*
|
||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
*@
|
||||
@using ServiceStationContracts.ViewModels
|
||||
|
||||
@model List<CarViewModel>
|
||||
@{
|
||||
ViewData["Title"] = "UpdateTechnicalWork";
|
||||
}
|
||||
@ -13,12 +13,13 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Тип ТО</label>
|
||||
<input type="text" id="TechnicalWorkType" placeholder="Введите тип то" name="TechnicalWorkType" class="form-control" />
|
||||
<input type="text" id="worktype" placeholder="Введите тип то" name="worktype" class="form-control" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Цена</label>
|
||||
<input type="number" min="100" step="100" id="TechnicalWorkPrice" placeholder="Введите цену" name="TechnicalWorkPrice" class="form-control" />
|
||||
<input type="number" min="100" step="100" id="workPrice" placeholder="Введите цену" name="workPrice" class="form-control" />
|
||||
</div>
|
||||
<h5>Уже привязанные машины</h5>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -30,6 +31,30 @@
|
||||
@* полученные машины *@
|
||||
</tbody>
|
||||
</table>
|
||||
<h5>Изменить машины</h5>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"></th>
|
||||
<th scope="col">Номер машины</th>
|
||||
<th scope="col">Марка машины</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var car in Model)
|
||||
{
|
||||
<tr>
|
||||
<td class="align-middle">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" name="car[]" value="@car.Id" id="@car.Id">
|
||||
</div>
|
||||
</td>
|
||||
<td class="align-middle">@Html.DisplayFor(modelItem => car.CarNumber)</td>
|
||||
<td class="align-middle">@Html.DisplayFor(modelItem => car.CarBrand)</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<div>
|
||||
<input type="submit" value="Сохранить" class="btn btn-secondary text-center" />
|
||||
@ -49,7 +74,8 @@
|
||||
url: "/Home/GetTechnicalWork",
|
||||
data: { technicalWorkId: technicalWork },
|
||||
success: function (result) {
|
||||
$('#technicalWorkType').val(result.item1.WorkType);
|
||||
$('#worktype').val(result.item1.workType);
|
||||
$('#workPrice').val(result.item1.workPrice);
|
||||
$('#table-elements').html(result.item2);
|
||||
}
|
||||
});
|
||||
|
@ -238,6 +238,19 @@ namespace ServiceStationRestApi.Controllers
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public CarViewModel? GetCar(int carId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _clogic.ReadElement(new CarSearchModel { Id = carId });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения машины по id={Id}", carId);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public Tuple<DefectViewModel, List<Tuple<string, string>>>? GetDefect(int defectId)
|
||||
{
|
||||
try
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user