From b662f138197699cea8ffec79b7c3000c7b978b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Thu, 14 Mar 2024 09:05:58 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=D1=8B=20=D1=8D=D0=BA?= =?UTF-8?q?=D1=81=D0=BF=D0=BE=D1=80=D1=82=D0=B0=20=D0=B8=20=D0=B8=D0=BC?= =?UTF-8?q?=D0=BF=D0=BE=D1=80=D1=82=D0=B0=20=D0=A0=D0=A2=D0=9A-=D0=9F?= =?UTF-8?q?=D0=BB=D0=B0=D0=BD=20=D0=B1=D1=83=D1=80=D0=B5=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProcessMaps/ProcessMapPlanDrillingDto.cs | 12 +++-------- .../ProcessMapPlanDrillingExportService.cs | 21 +++++++++++++++++++ .../Export/ProcessMapPlanExportService.cs | 11 ++++++++-- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanDrillingDto.cs b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanDrillingDto.cs index 78567c2d..ea2555a8 100644 --- a/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanDrillingDto.cs +++ b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanDrillingDto.cs @@ -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 /// /// Название режима бурения /// - public string Mode => IdMode switch - { - 1 => "Ротор", - 2 => "Слайд", - _ => throw new ArgumentOutOfRangeException() - }; - + public string? Mode { get; set; } + /// /// Осевая нагрузка, т план /// diff --git a/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanDrillingExportService.cs b/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanDrillingExportService.cs index 671a34ee..18778ca1 100644 --- a/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanDrillingExportService.cs +++ b/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanDrillingExportService.cs @@ -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

> 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; + } } \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanExportService.cs b/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanExportService.cs index 60491ca8..6d684946 100644 --- a/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanExportService.cs +++ b/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanExportService.cs @@ -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 : ExportExcelService 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 : ExportExcelService BuildFileNameAsync(int idWell, CancellationToken token); + + protected virtual async Task> GetProcessMapPlanAsync(int idWell, CancellationToken token) + { + var request = new ProcessMapPlanBaseRequestWithWell(idWell); + var dtos = await processMapPlanRepository.Get(request, token); + return dtos; + } } \ No newline at end of file