Фиксы экспорта и импорта РТК-План бурение.

This commit is contained in:
Степанов Дмитрий 2024-03-14 09:05:58 +03:00
parent cba6654a25
commit b662f13819
3 changed files with 33 additions and 11 deletions

View File

@ -1,5 +1,4 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data.ProcessMaps;
@ -17,13 +16,8 @@ public class ProcessMapPlanDrillingDto : ProcessMapPlanBaseDto
/// <summary>
/// Название режима бурения
/// </summary>
public string Mode => IdMode switch
{
1 => "Ротор",
2 => "Слайд",
_ => throw new ArgumentOutOfRangeException()
};
public string? Mode { get; set; }
/// <summary>
/// Осевая нагрузка, т план
/// </summary>

View File

@ -1,3 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Data.ProcessMaps;
@ -26,4 +29,22 @@ public class ProcessMapPlanDrillingExportService : ProcessMapPlanExportService<P
return $"{caption}_РТК_План_бурение.xlsx";
}
protected override async Task<IEnumerable<ProcessMapPlanDrillingDto>> GetProcessMapPlanAsync(int idWell, CancellationToken token)
{
var dtos = await base.GetProcessMapPlanAsync(idWell, token);
var dtosWithMode = dtos.Select(dto =>
{
dto.Mode = dto.IdMode switch
{
1 => "Ротор",
2 => "Слайд",
_ => throw new ArgumentOutOfRangeException()
};
return dto;
});
return dtosWithMode;
}
}

View File

@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
@ -26,8 +27,7 @@ public abstract class ProcessMapPlanExportService<TDto> : ExportExcelService<TDt
public async Task<(string FileName, Stream File)> ExportAsync(int idWell, CancellationToken token)
{
var request = new ProcessMapPlanBaseRequestWithWell(idWell);
var dtos = await processMapPlanRepository.Get(request, token);
var dtos = await GetProcessMapPlanAsync(idWell, token);
var fileName = await BuildFileNameAsync(idWell, token);
var file = Export(dtos);
@ -35,4 +35,11 @@ public abstract class ProcessMapPlanExportService<TDto> : ExportExcelService<TDt
}
protected abstract Task<string> BuildFileNameAsync(int idWell, CancellationToken token);
protected virtual async Task<IEnumerable<TDto>> GetProcessMapPlanAsync(int idWell, CancellationToken token)
{
var request = new ProcessMapPlanBaseRequestWithWell(idWell);
var dtos = await processMapPlanRepository.Get(request, token);
return dtos;
}
}