ProcessMapReportDataSaubStatExportService nit

This commit is contained in:
ngfrolov 2024-02-16 16:22:06 +05:00
parent 8f271eac0a
commit 11873c6764
Signed by untrusted user who does not match committer: ng.frolov
GPG Key ID: E99907A0357B29A7
2 changed files with 237 additions and 238 deletions

View File

@ -10,18 +10,18 @@ using System.Reflection;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Services.ProcessMaps.Report namespace AsbCloudInfrastructure.Services.ProcessMaps.Report;
{
public class ProcessMapReportDataSaubStatExportService : IProcessMapReportDataSaubStatExportService public class ProcessMapReportDataSaubStatExportService : IProcessMapReportDataSaubStatExportService
{ {
const int firstColumn = 2; private const int firstColumn = 2;
const int lastColumn = 35; private const int lastColumn = 35;
private const int headerRowsCount = 5;
const int headerRowsCount = 5; private const string TemplateName = "ProcessMapReportDataSaubStatTemplate.xlsx";
private const string sheetName = "Отчёт";
private readonly IWellService wellService; private readonly IWellService wellService;
private readonly IProcessMapReportDataSaubStatService processMapReportDataSaubStatService; private readonly IProcessMapReportDataSaubStatService processMapReportDataSaubStatService;
private readonly string TemplateName = "ProcessMapReportDataSaubStatTemplate.xlsx";
public ProcessMapReportDataSaubStatExportService(IWellService wellService, public ProcessMapReportDataSaubStatExportService(IWellService wellService,
IProcessMapReportDataSaubStatService processMapReportDataSaubStatService) IProcessMapReportDataSaubStatService processMapReportDataSaubStatService)
@ -53,11 +53,8 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report
return (name, memoryStream); return (name, memoryStream);
} }
private static void FillProcessMapToWorkbook(XLWorkbook workbook, private static void FillProcessMapToWorkbook(XLWorkbook workbook, IEnumerable<ProcessMapReportDataSaubStatDto> data)
IEnumerable<ProcessMapReportDataSaubStatDto> data)
{ {
const string sheetName = "Отчёт";
var sheet = workbook.GetWorksheet(sheetName); var sheet = workbook.GetWorksheet(sheetName);
var startRow = headerRowsCount + 1; var startRow = headerRowsCount + 1;
@ -68,8 +65,7 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report
} }
private static int FillRow(IXLWorksheet sheet, ProcessMapReportDataSaubStatDto item, private static int FillRow(IXLWorksheet sheet, ProcessMapReportDataSaubStatDto item, int startRow)
int startRow)
{ {
var endRow = FillIntervalData(sheet, item, startRow); var endRow = FillIntervalData(sheet, item, startRow);
@ -256,4 +252,3 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report
style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
} }
} }
}

View File

@ -11,6 +11,7 @@ using AsbCloudWebApi.SignalR.Clients;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.IO; using System.IO;
@ -91,6 +92,7 @@ public class ProcessMapWellDrillingController : ProcessMapBaseController<Process
/// <param name="file"></param> /// <param name="file"></param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[Obsolete]
[HttpPost("import/{options}")] [HttpPost("import/{options}")]
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
public async Task<IActionResult> ImportAsync(int idWell, public async Task<IActionResult> ImportAsync(int idWell,
@ -129,6 +131,7 @@ public class ProcessMapWellDrillingController : ProcessMapBaseController<Process
/// <param name="idWell">Id скважины</param> /// <param name="idWell">Id скважины</param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[Obsolete]
[HttpGet("export")] [HttpGet("export")]
[ProducesResponseType(typeof(PhysicalFileResult), StatusCodes.Status200OK, "application/octet-stream")] [ProducesResponseType(typeof(PhysicalFileResult), StatusCodes.Status200OK, "application/octet-stream")]
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
@ -143,6 +146,7 @@ public class ProcessMapWellDrillingController : ProcessMapBaseController<Process
/// Возвращает шаблон файла для импорта /// Возвращает шаблон файла для импорта
/// </summary> /// </summary>
/// <returns>Запрашиваемый файл</returns> /// <returns>Запрашиваемый файл</returns>
[Obsolete]
[HttpGet("template")] [HttpGet("template")]
[ProducesResponseType(typeof(PhysicalFileResult), StatusCodes.Status200OK, "application/octet-stream")] [ProducesResponseType(typeof(PhysicalFileResult), StatusCodes.Status200OK, "application/octet-stream")]
public async Task<IActionResult> GetTemplateAsync(CancellationToken cancellationToken) public async Task<IActionResult> GetTemplateAsync(CancellationToken cancellationToken)