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