From 0c8632b6f34b3ceef7d436c6b69105e835aede3e Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Tue, 25 Jun 2024 15:22:32 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=A2=D0=9A=20=D0=BF=D0=BB=D0=B0=D0=BD?= =?UTF-8?q?=20=D0=B2=D1=8B=D1=81=D1=82=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ProcessMapPlanOperationTFOrientationDto.cs | 94 +++++++++++++++++++ AsbCloudDb/Model/AsbCloudDbContext.cs | 11 +++ AsbCloudDb/Model/IAsbCloudDbContext.cs | 1 + .../ProcessMapPlanOperationReamingRotor.cs | 2 +- .../ProcessMapPlanOperationReamingSlide.cs | 2 +- .../ProcessMapPlanOperationTFOrientation.cs | 83 ++++++++++++++++ AsbCloudInfrastructure/DependencyInjection.cs | 14 +++ ...ssMapPlanOperationTFOrientationTemplate.cs | 17 ++++ ...PlanOperationTFOrientationExportService.cs | 30 ++++++ ...cessMapPlanOperationTFOrientationParser.cs | 42 +++++++++ ...MapPlanOperationTFOrientationController.cs | 28 ++++++ 11 files changed, 322 insertions(+), 2 deletions(-) create mode 100644 AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOperationTFOrientationDto.cs create mode 100644 AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOperationTFOrientation.cs create mode 100644 AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanOperationTFOrientationTemplate.cs create mode 100644 AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanOperationTFOrientationExportService.cs create mode 100644 AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanOperationTFOrientationParser.cs create mode 100644 AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanOperationTFOrientationController.cs diff --git a/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOperationTFOrientationDto.cs b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOperationTFOrientationDto.cs new file mode 100644 index 00000000..a40f5c2f --- /dev/null +++ b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOperationTFOrientationDto.cs @@ -0,0 +1,94 @@ +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; + +namespace AsbCloudApp.Data.ProcessMaps; + +/// +/// РТК план выставление +/// +public class ProcessMapPlanOperationTFOrientationDto : ProcessMapPlanBaseDto +{ + /// + /// План TF, град + /// + [Range(0.0, 360.0)] + public double planTF { get; set; } + + /// + /// Пружина, град + /// + [Range(0.0, 10000.0)] + public double Spring { get; set; } + + /// + /// Максимальное давление, атм + /// + [Range(0.0, 400.0)] + public double MaxPressure { get; set; } + + /// + /// Перепад давления, атм. + /// + [Range(0.0, 60.0)] + public double DifferentialPressure { get; set; } + + /// + /// Уставки, т., затяжка + /// + [Range(0.0, 20.0)] + public double SetpointsTight { get; set; } + + /// + /// Уставки, т., посадка + /// + [Range(0.0, 20.0)] + public double SetpointsSlackingOff { get; set; } + + /// + /// Максимально допустимый момент, кН*м. + /// + [Range(0.0, 35.0)] + public double MaxTorque { get; set; } + + /// + /// Проработка 1, Количество расхаживаний, шт + /// + [Range(0.0, 99.0)] + public double Reaming1NumberOfRepetitions { get; set; } + + /// + /// Проработка 1, Скорость, м/ч., Вверх + /// + [Range(0.0, 999.0)] + public double Reaming1ROPUp { get; set; } + + /// + /// Проработка 1, Скорость, м/ч., Вниз + /// + [Range(0.0, 999.0)] + public double Reaming1ROPDown { get; set; } + + /// + /// Проработка 1, Расход, л/с., Вверх + /// + [Range(0.0, 100.0)] + public double Reaming1FlowRateUp { get; set; } + + /// + /// Проработка 1, Расход, л/с., Вниз + /// + [Range(0.0, 100.0)] + public double Reaming1FlowRateDown { get; set; } + + /// + /// Проработка 1, Интервал расхаживания, м. + /// + [Range(0.0, 30.0)] + public double Reaming1Interval { get; set; } + + /// + /// Остановка над забоем, м. + /// + [Range(0.0, 10.0)] + public double Reaming1StopPointOffBottom { get; set; } +} \ No newline at end of file diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs index 6deaa5c5..5726b219 100644 --- a/AsbCloudDb/Model/AsbCloudDbContext.cs +++ b/AsbCloudDb/Model/AsbCloudDbContext.cs @@ -28,6 +28,7 @@ namespace AsbCloudDb.Model public virtual DbSet ProcessMapPlanSurvey => Set(); public virtual DbSet ProcessMapPlanOperationPositioningOffTheBottom => Set(); public virtual DbSet ProcessMapPlanOperationDeterminationOfOscillationAngles => Set(); + public virtual DbSet ProcessMapPlanOperationTFOrientation => Set(); public virtual DbSet DrillingProgramParts => Set(); public virtual DbSet FileCategories => Set(); public virtual DbSet Files => Set(); @@ -489,6 +490,11 @@ namespace AsbCloudDb.Model .WithMany() .OnDelete(DeleteBehavior.Restrict); + modelBuilder.Entity() + .HasOne(p => p.Author) + .WithMany() + .OnDelete(DeleteBehavior.Restrict); + modelBuilder.Entity() .HasOne(p => p.Editor) .WithMany() @@ -529,6 +535,11 @@ namespace AsbCloudDb.Model .WithMany() .OnDelete(DeleteBehavior.Restrict); + modelBuilder.Entity() + .HasOne(p => p.Editor) + .WithMany() + .OnDelete(DeleteBehavior.Restrict); + DefaultData.DefaultContextData.Fill(modelBuilder); } diff --git a/AsbCloudDb/Model/IAsbCloudDbContext.cs b/AsbCloudDb/Model/IAsbCloudDbContext.cs index c7f8e455..9479d8f8 100644 --- a/AsbCloudDb/Model/IAsbCloudDbContext.cs +++ b/AsbCloudDb/Model/IAsbCloudDbContext.cs @@ -89,6 +89,7 @@ namespace AsbCloudDb.Model DbSet ProcessMapPlanSurvey { get; } DbSet ProcessMapPlanOperationPositioningOffTheBottom { get; } DbSet ProcessMapPlanOperationDeterminationOfOscillationAngles { get; } + DbSet ProcessMapPlanOperationTFOrientation { get; } Task RefreshMaterializedViewAsync(string mwName, CancellationToken token); Task RefreshMaterializedViewAsync(CancellationToken token) where TEntity : class; diff --git a/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOperationReamingRotor.cs b/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOperationReamingRotor.cs index 21d97567..44f8c1e8 100644 --- a/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOperationReamingRotor.cs +++ b/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOperationReamingRotor.cs @@ -78,7 +78,7 @@ public class ProcessMapPlanOperationReamingRotor : ProcessMapPlanBase [Required] public double Reaming1StopPointOffBottom { get; set; } - [Column("reaming2_number_of_ repetitions"), Comment("Проработка 2, Количество повторений, шт.")] + [Column("reaming2_number_of_repetitions"), Comment("Проработка 2, Количество повторений, шт.")] [Range(0.0, 99.0)] public double Reaming2NumberOfRepetitions { get; set; } diff --git a/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOperationReamingSlide.cs b/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOperationReamingSlide.cs index c2038304..a2b38354 100644 --- a/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOperationReamingSlide.cs +++ b/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOperationReamingSlide.cs @@ -33,7 +33,7 @@ public class ProcessMapPlanOperationReamingSlide : ProcessMapPlanBase [Required] public double MaxTorque { get; set; } - [Column("reaming1_number_of_ repetitions"), Comment("Проработка 1, Количество повторений, шт.")] + [Column("reaming1_number_of_repetitions"), Comment("Проработка 1, Количество повторений, шт.")] [Range(0.0, 99.0)] [Required] public double Reaming1NumberOfRepetitions { get; set; } diff --git a/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOperationTFOrientation.cs b/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOperationTFOrientation.cs new file mode 100644 index 00000000..0aa4adbf --- /dev/null +++ b/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOperationTFOrientation.cs @@ -0,0 +1,83 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using AsbCloudDb.Model.ProcessMapPlan; +using Microsoft.EntityFrameworkCore; + +namespace AsbCloudDb.Model.ProcessMaps; + +[Table("t_process_map_plan_operation_tf_orientation"), Comment("Выставление")] +public class ProcessMapPlanOperationTFOrientation : ProcessMapPlanBase +{ + [Column("plan_tf"), Comment("План TF, град")] + [Range(0.0, 360.0)] + [Required] + public double planTF { get; set; } + + [Column("spring"), Comment("Пружина, град ")] + [Range(0.0, 10000.0)] + [Required] + public double Spring { get; set; } + + [Column("max_pressure"), Comment("Максимальное давление, атм")] + [Range(0.0, 400.0)] + [Required] + public double MaxPressure { get; set; } + + [Column("differential_pressure"), Comment("Перепад давления, атм.")] + [Range(0.0, 60.0)] + [Required] + public double DifferentialPressure { get; set; } + + [Column("setpoints_tight"), Comment("Уставки, т., затяжка")] + [Range(0.0, 20.0)] + [Required] + public double SetpointsTight { get; set; } + + [Column("setpoints_slacking_off"), Comment("Уставки, т., посадка")] + [Range(0.0, 20.0)] + [Required] + public double SetpointsSlackingOff { get; set; } + + [Column("max_torque"), Comment("Максимально допустимый момент, кН*м.")] + [Range(0.0, 35.0)] + [Required] + public double MaxTorque { get; set; } + + [Column("reaming1_number_of_repetitions"), Comment("Проработка 1, Количество расхаживаний, шт")] + [Range(0.0, 99.0)] + [Required] + public double Reaming1NumberOfRepetitions { get; set; } + + [Column("reaming1_rop_up"), Comment("Проработка 1, Скорость, м/ч., Вверх")] + [Range(0.0, 999.0)] + [Required] + public double Reaming1ROPUp { get; set; } + + [Column("reaming1_rop_down"), Comment("Проработка 1, Скорость, м/ч., Вниз")] + [Range(0.0, 999.0)] + [Required] + public double Reaming1ROPDown { get; set; } + + [Column("reaming1_flow_rate_up"), Comment("Проработка 1, Расход, л/с., Вверх")] + [Range(0.0, 100.0)] + [Required] + public double Reaming1FlowRateUp { get; set; } + + [Column("reaming1_flow_rate_down"), Comment("Проработка 1, Расход, л/с., Вниз")] + [Range(0.0, 100.0)] + [Required] + public double Reaming1FlowRateDown { get; set; } + + [Column("reaming1_interval"), Comment("Проработка 1, Интервал расхаживания, м.")] + [Range(0.0, 30.0)] + [Required] + public double Reaming1Interval { get; set; } + + [Column("reaming1_stop_point_off_bottom"), Comment("Остановка над забоем, м.")] + [Range(0.0, 10.0)] + [Required] + public double Reaming1StopPointOffBottom { get; set; } + + [ForeignKey(nameof(IdPrevious))] + public virtual ProcessMapPlanOperationTFOrientation? Previous { get; set; } +} \ No newline at end of file diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs index 14356f82..f23b5d61 100644 --- a/AsbCloudInfrastructure/DependencyInjection.cs +++ b/AsbCloudInfrastructure/DependencyInjection.cs @@ -187,6 +187,13 @@ namespace AsbCloudInfrastructure { Item = src.Adapt() }); + + TypeAdapterConfig>.NewConfig() + .Include>() + .Map(dest => dest, src => new ChangeLogDto() + { + Item = src.Adapt() + }); } public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration) @@ -280,6 +287,10 @@ namespace AsbCloudInfrastructure IChangeLogRepository, ProcessMapPlanBaseRepository>(); + services.AddTransient< + IChangeLogRepository, + ProcessMapPlanBaseRepository>(); + services.AddTransient(); services.AddTransient(); @@ -333,6 +344,7 @@ namespace AsbCloudInfrastructure services.AddTransient>(); services.AddTransient>(); services.AddTransient>(); + services.AddTransient>(); services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -395,6 +407,7 @@ namespace AsbCloudInfrastructure services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -409,6 +422,7 @@ namespace AsbCloudInfrastructure services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanOperationTFOrientationTemplate.cs b/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanOperationTFOrientationTemplate.cs new file mode 100644 index 00000000..b44fc5df --- /dev/null +++ b/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanOperationTFOrientationTemplate.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates; + +public class ProcessMapPlanOperationTFOrientationTemplate : ITemplateParameters +{ + public string SheetName => "Определение выставление"; + + public int HeaderRowsCount => 2; + + public string FileName => "ProcessMapPlanOperationTFOrientationTemplate.xlsx"; + + public IDictionary Cells => new Dictionary + { + + }; +} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanOperationTFOrientationExportService.cs b/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanOperationTFOrientationExportService.cs new file mode 100644 index 00000000..e1c6ffa4 --- /dev/null +++ b/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanOperationTFOrientationExportService.cs @@ -0,0 +1,30 @@ +using AsbCloudApp.Data.ProcessMaps; +using AsbCloudApp.Repositories; +using AsbCloudApp.Requests; +using AsbCloudApp.Requests.ExportOptions; +using AsbCloudApp.Services; +using AsbCloudInfrastructure.Services.ExcelServices.Templates; +using AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates; +using System.Threading; +using System.Threading.Tasks; + +namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Export; + +public class ProcessMapPlanOperationTFOrientationExportService : ProcessMapPlanExportService +{ + public ProcessMapPlanOperationTFOrientationExportService( + IChangeLogRepository processMapPlanRepository, + IWellService wellService) + : base(processMapPlanRepository, wellService) + { + } + + protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanOperationTFOrientationTemplate(); + + protected override async Task BuildFileNameAsync(WellRelatedExportRequest options, CancellationToken token) + { + var caption = await wellService.GetWellCaptionByIdAsync(options.IdWell, token); + + return $"{caption}_РТК_План_выставление.xlsx"; + } +} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanOperationTFOrientationParser.cs b/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanOperationTFOrientationParser.cs new file mode 100644 index 00000000..620d4e99 --- /dev/null +++ b/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanOperationTFOrientationParser.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using AsbCloudApp.Data.ProcessMaps; +using AsbCloudApp.Repositories; +using AsbCloudInfrastructure.Services.ExcelServices.Templates; +using AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates; + +namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Parser; + +public class ProcessMapPlanOperationTFOrientationParser : ProcessMapPlanParser +{ + public ProcessMapPlanOperationTFOrientationParser(IWellOperationRepository wellOperationRepository) + : base(wellOperationRepository) + { + } + + protected override ITemplateParameters TemplateParameters => new ProcessMapPlanOperationTFOrientationTemplate(); + + protected override ProcessMapPlanOperationTFOrientationDto BuildDto(IDictionary row, int rowNumber) + { + var dto = base.BuildDto(row, rowNumber); + + var section = sections.FirstOrDefault(s => + string.Equals(s.Caption.Trim(), dto.Section?.Trim(), StringComparison.CurrentCultureIgnoreCase)); + + if (section is null) + { + var message = string.Format(XLExtentions.ProblemDetailsTemplate, + TemplateParameters.SheetName, + rowNumber, + TemplateParameters.Cells[nameof(ProcessMapPlanBaseDto.Section)], + "Указана некорректная секция"); + throw new FileFormatException(message); + } + + dto.IdWellSectionType = section.Id; + + return dto; + } +} \ No newline at end of file diff --git a/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanOperationTFOrientationController.cs b/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanOperationTFOrientationController.cs new file mode 100644 index 00000000..2df9de7e --- /dev/null +++ b/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanOperationTFOrientationController.cs @@ -0,0 +1,28 @@ +using AsbCloudApp.Data.ProcessMaps; +using AsbCloudApp.Repositories; +using AsbCloudApp.Requests; +using AsbCloudApp.Services; +using AsbCloudDb.Model.ProcessMaps; +using AsbCloudInfrastructure.Services.ProcessMapPlan.Export; +using AsbCloudInfrastructure.Services.ProcessMapPlan.Parser; + +namespace AsbCloudWebApi.Controllers.ProcessMaps; + +/// +/// РТК план выставление +/// +public class ProcessMapPlanOperationTFOrientationController : + ProcessMapPlanBaseController +{ + public ProcessMapPlanOperationTFOrientationController( + IChangeLogRepository repository, + IWellService wellService, + ProcessMapPlanOperationTFOrientationParser parserService, + ITelemetryService telemetryService, + ProcessMapPlanOperationTFOrientationExportService processMapPlanExportService) + : base(repository, wellService, parserService, processMapPlanExportService, telemetryService) + { + } + + protected override string TemplateFileName => "ЕЦП_шаблон_файла_РТК_план_выставление.xlsx"; +} \ No newline at end of file