подправил отчеты, убрал кнопку добавления машин к неисрпавностям, допилил логкику, отсалось ТО
This commit is contained in:
parent
e80ba13485
commit
4c12ecf513
@ -100,13 +100,11 @@ namespace ServiceStationBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
_logger.LogInformation("AddCarToDefect find. Id:{Id}", element.Id);
|
_logger.LogInformation("AddCarToDefect find. Id:{Id}", element.Id);
|
||||||
|
|
||||||
|
element.DefectCars.Clear();
|
||||||
foreach(int car in cars)
|
foreach(int car in cars)
|
||||||
{
|
|
||||||
if (!element.DefectCars.Keys.Contains(car))
|
|
||||||
{
|
{
|
||||||
element.DefectCars.Add(car, new CarViewModel() { Id = car });
|
element.DefectCars.Add(car, new CarViewModel() { Id = car });
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_defectStorage.Update(new DefectBindingModel()
|
_defectStorage.Update(new DefectBindingModel()
|
||||||
{
|
{
|
||||||
|
@ -88,7 +88,7 @@ namespace ServiceStationBusinessLogic.BusinessLogics
|
|||||||
}
|
}
|
||||||
return allList;
|
return allList;
|
||||||
}
|
}
|
||||||
public List<ReportCarsViewModel> GetCars(ReportExecutorBindingModel model)
|
public List<ReportCarsViewModel> GetCars(PdfReportBindingModel model)
|
||||||
{
|
{
|
||||||
List<ReportCarsViewModel> allList = new List<ReportCarsViewModel>();
|
List<ReportCarsViewModel> allList = new List<ReportCarsViewModel>();
|
||||||
|
|
||||||
@ -122,7 +122,8 @@ namespace ServiceStationBusinessLogic.BusinessLogics
|
|||||||
int contains = 0;
|
int contains = 0;
|
||||||
foreach (var defectt in defects)
|
foreach (var defectt in defects)
|
||||||
{
|
{
|
||||||
if (defectt.Item2 == car.Id && defect.DefectType == defectt.Item1.DefectType)
|
var carr = _carStorage.GetElement(new CarSearchModel { Id = defectt.Item2 });
|
||||||
|
if (defectt.Item2 == car.Id && defectt.Item1.DefectType == defect.DefectType)
|
||||||
{
|
{
|
||||||
contains++;
|
contains++;
|
||||||
}
|
}
|
||||||
@ -161,13 +162,13 @@ namespace ServiceStationBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
_saveToWord.CreateDoc(new WordInfoExecutor
|
_saveToWord.CreateDoc(new WordInfoExecutor
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileStream = model.FileStream,
|
||||||
Title = "Список работ",
|
Title = "Список работ",
|
||||||
WorksByCar = GetWorks(model.Ids!)
|
WorksByCar = GetWorks(model.Ids!)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveTechWorkAndRepairsByCarsToPdfFile(ReportExecutorBindingModel model)
|
public void SaveTechWorkAndRepairsByCarsToPdfFile(PdfReportBindingModel model)
|
||||||
{
|
{
|
||||||
if(model.DateFrom == null)
|
if(model.DateFrom == null)
|
||||||
{
|
{
|
||||||
@ -192,7 +193,7 @@ namespace ServiceStationBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
_saveToExcel.CreateReport(new ExcelInfoExecutor
|
_saveToExcel.CreateReport(new ExcelInfoExecutor
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileStream = model.FileStream,
|
||||||
Title = "Список работ",
|
Title = "Список работ",
|
||||||
WorksByCar = GetWorks(model.Ids!)
|
WorksByCar = GetWorks(model.Ids!)
|
||||||
});
|
});
|
||||||
|
@ -10,6 +10,7 @@ namespace ServiceStationBusinessLogic.OfficePackage.HelperModels
|
|||||||
public class ExcelInfoExecutor
|
public class ExcelInfoExecutor
|
||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
public Stream FileStream { get; set; } = new MemoryStream();
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
public List<ReportWorksViewModel> WorksByCar { get; set; } = new();
|
public List<ReportWorksViewModel> WorksByCar { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ namespace ServiceStationBusinessLogic.OfficePackage.HelperModels
|
|||||||
public class WordInfoExecutor
|
public class WordInfoExecutor
|
||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
public Stream FileStream { get; set; } = new MemoryStream();
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
public List<ReportWorksViewModel> WorksByCar { get; set; } = new();
|
public List<ReportWorksViewModel> WorksByCar { get; set; } = new();
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ namespace ServiceStationBusinessLogic.OfficePackage.Implements
|
|||||||
|
|
||||||
protected override void CreateExcel(ExcelInfoExecutor info)
|
protected override void CreateExcel(ExcelInfoExecutor info)
|
||||||
{
|
{
|
||||||
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileName, SpreadsheetDocumentType.Workbook);
|
_spreadsheetDocument = SpreadsheetDocument.Create(info.FileStream, SpreadsheetDocumentType.Workbook);
|
||||||
var workbookpart = _spreadsheetDocument.AddWorkbookPart();
|
var workbookpart = _spreadsheetDocument.AddWorkbookPart();
|
||||||
workbookpart.Workbook = new Workbook();
|
workbookpart.Workbook = new Workbook();
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ namespace ServiceStationBusinessLogic.OfficePackage.Implements
|
|||||||
|
|
||||||
protected override void CreateWord(WordInfoExecutor info)
|
protected override void CreateWord(WordInfoExecutor info)
|
||||||
{
|
{
|
||||||
_wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document);
|
_wordDocument = WordprocessingDocument.Create(info.FileStream, WordprocessingDocumentType.Document);
|
||||||
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
|
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
|
||||||
mainPart.Document = new Document();
|
mainPart.Document = new Document();
|
||||||
_docBody = mainPart.Document.AppendChild(new Body());
|
_docBody = mainPart.Document.AppendChild(new Body());
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ServiceStationContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class PdfReportBindingModel
|
||||||
|
{
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int ExecutorId { get; set; }
|
||||||
|
|
||||||
|
public DateTime? DateFrom { get; set; }
|
||||||
|
|
||||||
|
public DateTime? DateTo { get; set; }
|
||||||
|
|
||||||
|
public List<int>? Ids { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -2,13 +2,14 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ServiceStationContracts.BindingModels
|
namespace ServiceStationContracts.BindingModels
|
||||||
{
|
{
|
||||||
public class ReportExecutorBindingModel
|
public class ReportExecutorBindingModel
|
||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public Stream FileStream { get; set; } = new MemoryStream();
|
||||||
|
|
||||||
public int ExecutorId { get; set; }
|
public int ExecutorId { get; set; }
|
||||||
|
|
||||||
|
@ -11,12 +11,12 @@ namespace ServiceStationContracts.BusinessLogicsContracts
|
|||||||
public interface IExecutorReportLogic
|
public interface IExecutorReportLogic
|
||||||
{
|
{
|
||||||
List<ReportWorksViewModel> GetWorks(List<int> Ids);
|
List<ReportWorksViewModel> GetWorks(List<int> Ids);
|
||||||
List<ReportCarsViewModel> GetCars(ReportExecutorBindingModel model);
|
List<ReportCarsViewModel> GetCars(PdfReportBindingModel model);
|
||||||
|
|
||||||
void SaveWorkByCarsWordFile(ReportExecutorBindingModel model);
|
void SaveWorkByCarsWordFile(ReportExecutorBindingModel model);
|
||||||
|
|
||||||
void SaveWorkByCarsToExcelFile(ReportExecutorBindingModel model);
|
void SaveWorkByCarsToExcelFile(ReportExecutorBindingModel model);
|
||||||
|
|
||||||
void SaveTechWorkAndRepairsByCarsToPdfFile(ReportExecutorBindingModel model);
|
void SaveTechWorkAndRepairsByCarsToPdfFile(PdfReportBindingModel model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,15 +18,15 @@ namespace ServiceStationDatabaseImplement.Implements
|
|||||||
public List<DefectViewModel> GetFullList()
|
public List<DefectViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
using var context = new ServiceStationDatabase();
|
using var context = new ServiceStationDatabase();
|
||||||
return context.Defects
|
var defects = context.Defects
|
||||||
.Include(x => x.Cars)
|
.Include(x => x.Cars)
|
||||||
.ThenInclude(x => x.Car)
|
.ThenInclude(x => x.Car)
|
||||||
.ThenInclude(x => x.CarTechnicalWorks)
|
.ThenInclude(x => x.CarTechnicalWorks)
|
||||||
.ThenInclude(x => x.TechnicalWork)
|
.ThenInclude(x => x.TechnicalWork)
|
||||||
.Include(x => x.Repair)
|
|
||||||
.Include(x => x.Executor)
|
.Include(x => x.Executor)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
return defects;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DefectViewModel> GetFilteredList(DefectSearchModel model)
|
public List<DefectViewModel> GetFilteredList(DefectSearchModel model)
|
||||||
|
@ -81,7 +81,8 @@ namespace ServiceStationDatabaseImplement.Models
|
|||||||
DefectType = DefectType,
|
DefectType = DefectType,
|
||||||
DefectPrice = DefectPrice,
|
DefectPrice = DefectPrice,
|
||||||
ExecutorId = ExecutorId,
|
ExecutorId = ExecutorId,
|
||||||
DefectCars = DefectCars
|
DefectCars = DefectCars,
|
||||||
|
RepairId = RepairId
|
||||||
};
|
};
|
||||||
|
|
||||||
public void UpdateCars(ServiceStationDatabase context, DefectBindingModel model)
|
public void UpdateCars(ServiceStationDatabase context, DefectBindingModel model)
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using DocumentFormat.OpenXml.Wordprocessing;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using ServiceStationContracts.BindingModels;
|
using ServiceStationContracts.BindingModels;
|
||||||
using ServiceStationContracts.BusinessLogicsContracts;
|
using ServiceStationContracts.BusinessLogicsContracts;
|
||||||
using ServiceStationContracts.SearchModels;
|
using ServiceStationContracts.SearchModels;
|
||||||
using ServiceStationContracts.ViewModels;
|
using ServiceStationContracts.ViewModels;
|
||||||
|
using ServiceStationDatabaseImplement.Models;
|
||||||
using ServiceStationExecutorApp.Models;
|
using ServiceStationExecutorApp.Models;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@ -137,6 +139,7 @@ namespace ServiceStationExecutorApp.Controllers
|
|||||||
table += $"<td>{carBrand}</td>";
|
table += $"<td>{carBrand}</td>";
|
||||||
table += "</tr>";
|
table += "</tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
return Tuple.Create(result.Item1, table);
|
return Tuple.Create(result.Item1, table);
|
||||||
}
|
}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@ -260,10 +263,10 @@ namespace ServiceStationExecutorApp.Controllers
|
|||||||
return RedirectToAction("Enter");
|
return RedirectToAction("Enter");
|
||||||
}
|
}
|
||||||
ViewBag.Defects = APIExecutor.GetRequest<List<DefectViewModel>>($"api/main/getdefectlist?executorId={APIExecutor.Executor.Id}");
|
ViewBag.Defects = APIExecutor.GetRequest<List<DefectViewModel>>($"api/main/getdefectlist?executorId={APIExecutor.Executor.Id}");
|
||||||
return View();
|
return View(APIExecutor.GetRequest<List<CarViewModel>>($"api/main/getcarlist?executorId={APIExecutor.Executor.Id}"));
|
||||||
}
|
}
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void UpdateDefect(int defect, string DefectType, double DefectPrice)
|
public void UpdateDefect(int defect, string DefectType, double DefectPrice, int[] car)
|
||||||
{
|
{
|
||||||
if (APIExecutor.Executor == null)
|
if (APIExecutor.Executor == null)
|
||||||
{
|
{
|
||||||
@ -284,6 +287,10 @@ namespace ServiceStationExecutorApp.Controllers
|
|||||||
DefectType = DefectType,
|
DefectType = DefectType,
|
||||||
DefectPrice = DefectPrice
|
DefectPrice = DefectPrice
|
||||||
});
|
});
|
||||||
|
APIExecutor.PostRequest("api/main/addcartodefect", Tuple.Create(
|
||||||
|
new DefectSearchModel() { Id = defect },
|
||||||
|
car
|
||||||
|
));
|
||||||
Response.Redirect("ListDefects");
|
Response.Redirect("ListDefects");
|
||||||
}
|
}
|
||||||
public IActionResult UpdateTechnicalWork()
|
public IActionResult UpdateTechnicalWork()
|
||||||
@ -348,10 +355,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 CreateDefect(string defectType, double defectPrice)
|
public void CreateDefect(string defectType, double defectPrice, int[] car)
|
||||||
{
|
{
|
||||||
if (APIExecutor.Executor == null)
|
if (APIExecutor.Executor == null)
|
||||||
{
|
{
|
||||||
@ -363,6 +370,10 @@ namespace ServiceStationExecutorApp.Controllers
|
|||||||
DefectType = defectType,
|
DefectType = defectType,
|
||||||
DefectPrice = defectPrice
|
DefectPrice = defectPrice
|
||||||
});
|
});
|
||||||
|
APIExecutor.PostRequest("api/main/addcartodefect", Tuple.Create(
|
||||||
|
new DefectSearchModel() { DefectType = defectType },
|
||||||
|
car
|
||||||
|
));
|
||||||
Response.Redirect("ListDefects");
|
Response.Redirect("ListDefects");
|
||||||
}
|
}
|
||||||
public IActionResult CreateTechnicalWork()
|
public IActionResult CreateTechnicalWork()
|
||||||
@ -389,50 +400,6 @@ namespace ServiceStationExecutorApp.Controllers
|
|||||||
});
|
});
|
||||||
Response.Redirect("ListTechnicalWorks");
|
Response.Redirect("ListTechnicalWorks");
|
||||||
}
|
}
|
||||||
public IActionResult AddCarToDefect()
|
|
||||||
{
|
|
||||||
if (APIExecutor.Executor == null)
|
|
||||||
{
|
|
||||||
return RedirectToAction("Enter");
|
|
||||||
}
|
|
||||||
return View(Tuple.Create(APIExecutor.GetRequest<List<DefectViewModel>>($"api/main/getdefectlist?executorId={APIExecutor.Executor.Id}"),
|
|
||||||
APIExecutor.GetRequest<List<CarViewModel>>($"api/main/getcarlist?executorId={APIExecutor.Executor.Id}")));
|
|
||||||
}
|
|
||||||
[HttpPost]
|
|
||||||
public void AddCarToDefect(int defect, int[] car)
|
|
||||||
{
|
|
||||||
if(APIExecutor.Executor == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Авторизироваться не забыли?");
|
|
||||||
}
|
|
||||||
APIExecutor.PostRequest("api/main/addcartodefect", Tuple.Create(
|
|
||||||
new DefectSearchModel() { Id = defect },
|
|
||||||
car
|
|
||||||
));
|
|
||||||
Response.Redirect("ListDefects");
|
|
||||||
}
|
|
||||||
public IActionResult AddCarToTechnicalWork()
|
|
||||||
{
|
|
||||||
if (APIExecutor.Executor == null)
|
|
||||||
{
|
|
||||||
return RedirectToAction("Enter");
|
|
||||||
}
|
|
||||||
return View(Tuple.Create(APIExecutor.GetRequest<List<TechnicalWorkViewModel>>($"api/main/gettechnicalworklist?executorId={APIExecutor.Executor.Id}"),
|
|
||||||
APIExecutor.GetRequest<List<CarViewModel>>($"api/main/getcarlist?executorId={APIExecutor.Executor.Id}")));
|
|
||||||
}
|
|
||||||
[HttpPost]
|
|
||||||
public void AddCarToTechnicalWork(int technicalWork, int[] car)
|
|
||||||
{
|
|
||||||
if (APIExecutor.Executor == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Авторизироваться не забыли?");
|
|
||||||
}
|
|
||||||
APIExecutor.PostRequest("api/main/addcartotechnicalwork", Tuple.Create(
|
|
||||||
new TechnicalWorkSearchModel() { Id = technicalWork },
|
|
||||||
car
|
|
||||||
));
|
|
||||||
Response.Redirect("ListTechnicalWorks");
|
|
||||||
}
|
|
||||||
public IActionResult BindingTechnicalWorkToWork()
|
public IActionResult BindingTechnicalWorkToWork()
|
||||||
{
|
{
|
||||||
if (APIExecutor.Executor == null)
|
if (APIExecutor.Executor == null)
|
||||||
@ -464,8 +431,9 @@ namespace ServiceStationExecutorApp.Controllers
|
|||||||
}
|
}
|
||||||
return View(APIExecutor.GetRequest<List<CarViewModel>>($"api/main/getcarlist?executorId={APIExecutor.Executor.Id}"));
|
return View(APIExecutor.GetRequest<List<CarViewModel>>($"api/main/getcarlist?executorId={APIExecutor.Executor.Id}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void ListWorkToFile(int[] Ids, string type)
|
public IActionResult ListWorkToFile(int[] Ids, string type)
|
||||||
{
|
{
|
||||||
if (APIExecutor.Executor == null)
|
if (APIExecutor.Executor == null)
|
||||||
{
|
{
|
||||||
@ -489,35 +457,31 @@ namespace ServiceStationExecutorApp.Controllers
|
|||||||
|
|
||||||
if (type == "docx")
|
if (type == "docx")
|
||||||
{
|
{
|
||||||
APIExecutor.PostRequest("api/report/createexecutorreporttoword", new ReportExecutorBindingModel
|
using (var stream = new MemoryStream())
|
||||||
{
|
{
|
||||||
Ids = res,
|
_report.SaveWorkByCarsWordFile(new ReportExecutorBindingModel
|
||||||
FileName = Directory.GetCurrentDirectory() + "\\Reports\\wordfile.docx"
|
{
|
||||||
|
FileStream = stream,
|
||||||
|
Ids = res
|
||||||
});
|
});
|
||||||
Response.Redirect("GetWordFile");
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
|
return File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "wordfile.docx");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
APIExecutor.PostRequest("api/report/createexecutorreporttoexcel", new ReportExecutorBindingModel
|
using (var stream = new MemoryStream())
|
||||||
{
|
{
|
||||||
Ids = res,
|
_report.SaveWorkByCarsToExcelFile(new ReportExecutorBindingModel
|
||||||
FileName = Directory.GetCurrentDirectory() + "\\Reports\\excelfile.xlsx"
|
{
|
||||||
|
FileStream = stream,
|
||||||
|
Ids = res
|
||||||
});
|
});
|
||||||
Response.Redirect("GetExcelFile");
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
|
return File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "excelfile.xlsx");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public IActionResult GetWordFile()
|
|
||||||
{
|
|
||||||
return new PhysicalFileResult(Directory.GetCurrentDirectory() + "\\Reports\\wordfile.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
|
||||||
}
|
}
|
||||||
public IActionResult GetExcelFile()
|
|
||||||
{
|
|
||||||
return new PhysicalFileResult(Directory.GetCurrentDirectory() + "\\Reports\\excelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
||||||
}
|
|
||||||
//public IActionResult GetPdfFile()
|
|
||||||
//{
|
|
||||||
// return new PhysicalFileResult(Directory.GetCurrentDirectory() + "\\Reports\\pdffile.pdf", "application/pdf");
|
|
||||||
//}
|
|
||||||
public IActionResult ListCarsToPdf()
|
public IActionResult ListCarsToPdf()
|
||||||
{
|
{
|
||||||
if (APIExecutor.Executor == null)
|
if (APIExecutor.Executor == null)
|
||||||
@ -537,7 +501,7 @@ namespace ServiceStationExecutorApp.Controllers
|
|||||||
{
|
{
|
||||||
throw new Exception("Email пуст");
|
throw new Exception("Email пуст");
|
||||||
}
|
}
|
||||||
APIExecutor.PostRequest("api/report/createexecutorreporttopdf", new ReportExecutorBindingModel
|
APIExecutor.PostRequest("api/report/createexecutorreporttopdf", new PdfReportBindingModel
|
||||||
{
|
{
|
||||||
FileName = Directory.GetCurrentDirectory() + "\\Reports\\pdffile.pdf",
|
FileName = Directory.GetCurrentDirectory() + "\\Reports\\pdffile.pdf",
|
||||||
DateFrom = dateFrom,
|
DateFrom = dateFrom,
|
||||||
@ -563,7 +527,7 @@ namespace ServiceStationExecutorApp.Controllers
|
|||||||
List<ReportCarsViewModel> cars;
|
List<ReportCarsViewModel> cars;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
cars = _report.GetCars(new ReportExecutorBindingModel
|
cars = _report.GetCars(new PdfReportBindingModel
|
||||||
{
|
{
|
||||||
ExecutorId = APIExecutor.Executor.Id,
|
ExecutorId = APIExecutor.Executor.Id,
|
||||||
DateFrom = dateFrom,
|
DateFrom = dateFrom,
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
@using ServiceStationContracts.ViewModels;
|
|
||||||
@using ServiceStationDataModels.Models;
|
|
||||||
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "AddCarToDefect";
|
|
||||||
}
|
|
||||||
|
|
||||||
@model Tuple<List<DefectViewModel>, List<CarViewModel>>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<h2>Добавление машин к неисправностям:</h2>
|
|
||||||
<form method="post">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="defect">Выберите неисправность</label>
|
|
||||||
<select id="defect" name="defect" class="form-control">
|
|
||||||
@foreach (var defect in Model.Item1)
|
|
||||||
{
|
|
||||||
<option value="@defect.Id">@Html.DisplayFor(modelItem => defect.DefectType)</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="car">Выберите машины</label>
|
|
||||||
<table class="table mb-0">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th scope="col"></th>
|
|
||||||
<th scope="col">Номер</th>
|
|
||||||
<th scope="col">Марка</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach (var car in Model.Item2)
|
|
||||||
{
|
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
<br>
|
|
||||||
<div>
|
|
||||||
<input type="submit" value="Добавить" class="btn btn-secondary" />
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
@ -1,9 +1,11 @@
|
|||||||
@*
|
@using ServiceStationContracts.ViewModels
|
||||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
|
||||||
*@
|
|
||||||
@{
|
@{
|
||||||
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">
|
||||||
<div class="form-group py-2">
|
<div class="form-group py-2">
|
||||||
@ -14,6 +16,29 @@
|
|||||||
<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>
|
||||||
|
<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" />
|
||||||
|
@ -42,8 +42,6 @@
|
|||||||
|
|
||||||
<a asp-controller="Home" asp-action="UpdateDefect" class="btn btn-secondary text-center col-2">Изменить</a>
|
<a asp-controller="Home" asp-action="UpdateDefect" class="btn btn-secondary text-center col-2">Изменить</a>
|
||||||
|
|
||||||
<a asp-controller="Home" asp-action="AddCarToDefect" class="btn btn-secondary text-center col-2">Добавить машину</a>
|
|
||||||
|
|
||||||
<a asp-controller="Home" asp-action="DeleteDefect" class="btn btn-secondary text-center col-2">Удалить</a>
|
<a asp-controller="Home" asp-action="DeleteDefect" class="btn btn-secondary text-center col-2">Удалить</a>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
@ -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"] = "UpdateDefect";
|
ViewData["Title"] = "UpdateDefect";
|
||||||
}
|
}
|
||||||
@ -19,6 +19,7 @@
|
|||||||
<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>
|
||||||
<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,6 @@
|
|||||||
url: "/Home/GetDefect",
|
url: "/Home/GetDefect",
|
||||||
data: { defectId: defect },
|
data: { defectId: defect },
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
$('#defectType').val(result.item1.defectType);
|
|
||||||
$('#table-elements').html(result.item2);
|
$('#table-elements').html(result.item2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using ServiceStationContracts.BindingModels;
|
using ServiceStationContracts.BindingModels;
|
||||||
using ServiceStationContracts.BusinessLogicsContracts;
|
using ServiceStationContracts.BusinessLogicsContracts;
|
||||||
using ServiceStationContracts.SearchModels;
|
using ServiceStationContracts.SearchModels;
|
||||||
|
@ -21,39 +21,12 @@ namespace ServiceStationRestApi.Controllers
|
|||||||
_mailWorker = abstractMailWorker;
|
_mailWorker = abstractMailWorker;
|
||||||
_guarantorReportLogic = guarantorReportLogic;
|
_guarantorReportLogic = guarantorReportLogic;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void CreateExecutorReportToWord(ReportExecutorBindingModel model)
|
public void CreateExecutorReportToPdf(PdfReportBindingModel model)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_executorReportLogic.SaveWorkByCarsWordFile(model);
|
_executorReportLogic.SaveTechWorkAndRepairsByCarsToPdfFile(new PdfReportBindingModel
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка создания отчета");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
[HttpPost]
|
|
||||||
public void CreateExecutorReportToExcel(ReportExecutorBindingModel model)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_executorReportLogic.SaveWorkByCarsToExcelFile(model);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка создания отчета");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
[HttpPost]
|
|
||||||
public void CreateExecutorReportToPdf(ReportExecutorBindingModel model)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_executorReportLogic.SaveTechWorkAndRepairsByCarsToPdfFile(new ReportExecutorBindingModel
|
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
DateFrom = model.DateFrom,
|
DateFrom = model.DateFrom,
|
||||||
|
Loading…
Reference in New Issue
Block a user