forked from ddrilling/AsbCloudServer
Фиксы экспорта и импорта РТК-План бурение.
This commit is contained in:
parent
cba6654a25
commit
b662f13819
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace AsbCloudApp.Data.ProcessMaps;
|
namespace AsbCloudApp.Data.ProcessMaps;
|
||||||
|
|
||||||
@ -17,12 +16,7 @@ public class ProcessMapPlanDrillingDto : ProcessMapPlanBaseDto
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Название режима бурения
|
/// Название режима бурения
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Mode => IdMode switch
|
public string? Mode { get; set; }
|
||||||
{
|
|
||||||
1 => "Ротор",
|
|
||||||
2 => "Слайд",
|
|
||||||
_ => throw new ArgumentOutOfRangeException()
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Осевая нагрузка, т план
|
/// Осевая нагрузка, т план
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using AsbCloudApp.Data.ProcessMaps;
|
using AsbCloudApp.Data.ProcessMaps;
|
||||||
@ -26,4 +29,22 @@ public class ProcessMapPlanDrillingExportService : ProcessMapPlanExportService<P
|
|||||||
|
|
||||||
return $"{caption}_РТК_План_бурение.xlsx";
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
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)
|
public async Task<(string FileName, Stream File)> ExportAsync(int idWell, CancellationToken token)
|
||||||
{
|
{
|
||||||
var request = new ProcessMapPlanBaseRequestWithWell(idWell);
|
var dtos = await GetProcessMapPlanAsync(idWell, token);
|
||||||
var dtos = await processMapPlanRepository.Get(request, token);
|
|
||||||
|
|
||||||
var fileName = await BuildFileNameAsync(idWell, token);
|
var fileName = await BuildFileNameAsync(idWell, token);
|
||||||
var file = Export(dtos);
|
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 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;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user