2024-03-14 11:05:58 +05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2024-03-14 10:30:25 +05:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using AsbCloudApp.Data.ProcessMaps;
|
|
|
|
|
using AsbCloudApp.Repositories;
|
|
|
|
|
using AsbCloudApp.Requests;
|
2024-03-14 15:18:02 +05:00
|
|
|
|
using AsbCloudApp.Requests.ExportOptions;
|
2024-03-14 10:30:25 +05:00
|
|
|
|
using AsbCloudApp.Services;
|
|
|
|
|
using AsbCloudInfrastructure.Services.ExcelServices.Templates;
|
|
|
|
|
using AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
|
|
|
|
|
|
|
|
|
|
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Export;
|
|
|
|
|
|
|
|
|
|
public class ProcessMapPlanDrillingExportService : ProcessMapPlanExportService<ProcessMapPlanDrillingDto>
|
|
|
|
|
{
|
|
|
|
|
public ProcessMapPlanDrillingExportService(
|
|
|
|
|
IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
|
|
|
|
|
IWellService wellService)
|
|
|
|
|
: base(processMapPlanRepository, wellService)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanDrillingTemplate();
|
|
|
|
|
|
2024-03-14 15:18:02 +05:00
|
|
|
|
protected override async Task<string> BuildFileNameAsync(WellRelatedExportRequest options, CancellationToken token)
|
2024-03-14 10:30:25 +05:00
|
|
|
|
{
|
2024-03-14 15:18:02 +05:00
|
|
|
|
var caption = await wellService.GetWellCaptionByIdAsync(options.IdWell, token);
|
2024-03-14 10:30:25 +05:00
|
|
|
|
|
|
|
|
|
return $"{caption}_РТК_План_бурение.xlsx";
|
|
|
|
|
}
|
2024-03-14 11:05:58 +05:00
|
|
|
|
|
2024-03-14 15:18:02 +05:00
|
|
|
|
protected override async Task<IEnumerable<ProcessMapPlanDrillingDto>> GetDtosAsync(WellRelatedExportRequest options,
|
|
|
|
|
CancellationToken token)
|
2024-03-14 11:05:58 +05:00
|
|
|
|
{
|
2024-03-14 15:18:02 +05:00
|
|
|
|
var dtos = await base.GetDtosAsync(options, token);
|
2024-03-14 11:05:58 +05:00
|
|
|
|
var dtosWithMode = dtos.Select(dto =>
|
|
|
|
|
{
|
|
|
|
|
dto.Mode = dto.IdMode switch
|
|
|
|
|
{
|
|
|
|
|
1 => "Ротор",
|
|
|
|
|
2 => "Слайд",
|
|
|
|
|
_ => throw new ArgumentOutOfRangeException()
|
|
|
|
|
};
|
2024-03-14 15:18:02 +05:00
|
|
|
|
|
2024-03-14 11:05:58 +05:00
|
|
|
|
return dto;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return dtosWithMode;
|
|
|
|
|
}
|
2024-03-14 10:30:25 +05:00
|
|
|
|
}
|