From 814515d8ac69546d45fe52535fc9c4b3db8ddfcc Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 24 Jun 2024 15:06:50 +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=BF=D1=80=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA=D0=B0?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20=D1=80=D0=BE=D1=82=D0=BE=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProcessMapPlanOperationReamingRotorDto.cs | 210 ++++++++++++++++++ AsbCloudDb/Model/AsbCloudDbContext.cs | 1 + AsbCloudDb/Model/IAsbCloudDbContext.cs | 1 + .../ProcessMapPlanOperationReamingRotor.cs | 158 +++++++++++++ AsbCloudInfrastructure/DependencyInjection.cs | 7 + ...essMapPlanOperationReamingRotorTemplate.cs | 18 ++ ...pPlanOperationReamingRotorExportService.cs | 30 +++ ...ocessMapPlanOperationReamingRotorParser.cs | 42 ++++ ...sMapPlanOperationReamingRotorController.cs | 28 +++ 9 files changed, 495 insertions(+) create mode 100644 AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOperationReamingRotorDto.cs create mode 100644 AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOperationReamingRotor.cs create mode 100644 AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanOperationReamingRotorTemplate.cs create mode 100644 AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanOperationReamingRotorExportService.cs create mode 100644 AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanOperationReamingRotorParser.cs create mode 100644 AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanOperationReamingRotorController.cs diff --git a/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOperationReamingRotorDto.cs b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOperationReamingRotorDto.cs new file mode 100644 index 00000000..a29892da --- /dev/null +++ b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOperationReamingRotorDto.cs @@ -0,0 +1,210 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace AsbCloudApp.Data.ProcessMaps; + +/// +/// РТК план проработка для ротора +/// +public class ProcessMapPlanOperationReamingRotorDto : ProcessMapPlanBaseDto +{ + /// + /// Максимальное давление, атм + /// + [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, 270.0)] + public double Reaming1RPMUp { get; set; } + + /// + /// Проработка 1, Обороты, об/мин., Вниз + /// + [Range(0.0, 270.0)] + public double Reaming1RPMDown { 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; } + + /// + /// Проработка 2, Количество повторений, шт. + /// + [Range(0.0, 99.0)] + public double Reaming2NumberOfRepetitions { get; set; } + + /// + /// Проработка 2, Скорость, м/ч., Вверх + /// + [Range(0.0, 999.0)] + public double Reaming2ROPUp { get; set; } + + /// + /// Проработка 2, Скорость, м/ч., Вниз + /// + [Range(0.0, 999.0)] + public double Reaming2ROPDown { get; set; } + + /// + /// Проработка 2, Обороты, об/мин., Вверх + /// + [Range(0.0, 270.0)] + public double Reaming2RPMUp { get; set; } + + /// + /// Проработка 2, Обороты, об/мин., Вниз + /// + [Range(0.0, 270.0)] + public double Reaming2RPMDown { get; set; } + + /// + /// Проработка 2, Расход, л/с., Вверх + /// + [Range(0.0, 100.0)] + public double Reaming2FlowRateUp { get; set; } + + /// + /// Проработка 2, Расход, л/с., Вниз + /// + [Range(0.0, 100.0)] + public double Reaming2FlowRateDown { get; set; } + + /// + /// Проработка 2, Интервал проработки, м. + /// + [Range(0.0, 30.0)] + public double Reaming2Interval { get; set; } + + /// + /// Остановка над забоем, м. + /// + [Range(0.0, 10.0)] + public double Reaming2StopPointOffBottom { get; set; } + + /// + /// Проработка 3, Количество повторений, шт. + /// + [Range(0.0, 99.0)] + public double Reaming3NumberOfRepetitions { get; set; } + + /// + /// Проработка 3, Скорость, м/ч., Вверх + /// + [Range(0.0, 999.0)] + public double Reaming3ROPUp { get; set; } + + /// + /// Проработка 3, Скорость, м/ч., Вниз + /// + [Range(0.0, 999.0)] + public double Reaming3ROPDown { get; set; } + + /// + /// Проработка 3, Обороты, об/мин., Вверх + /// + [Range(0.0, 270.0)] + public double Reaming3RPMUp { get; set; } + + /// + /// Проработка 3, Обороты, об/мин., Вниз + /// + [Range(0.0, 270.0)] + public double Reaming3RPMDown { get; set; } + + /// + /// Проработка 3, Расход, л/с., Вверх + /// + [Range(0.0, 100.0)] + public double Reaming3FlowRateUp { get; set; } + + /// + /// Проработка 3, Расход, л/с., Вниз + /// + [Range(0.0, 100.0)] + public double Reaming3FlowRateDown { get; set; } + + /// + /// Проработка 3, Интервал проработки, м. + /// + [Range(0.0, 30.0)] + public double Reaming3Interval { get; set; } + + /// + /// Остановка над забоем, м. + /// + [Range(0.0, 10.0)] + public double Reaming3StopPointOffBottom { get; set; } + + /// + /// Примечание + /// + [StringLength(1024)] + public string Note { get; set; } = string.Empty; + + +} \ No newline at end of file diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs index 19f46c52..87438528 100644 --- a/AsbCloudDb/Model/AsbCloudDbContext.cs +++ b/AsbCloudDb/Model/AsbCloudDbContext.cs @@ -22,6 +22,7 @@ namespace AsbCloudDb.Model public virtual DbSet ProcessMapPlanRotor => Set(); public virtual DbSet ProcessMapPlanSlide => Set(); public virtual DbSet ProcessMapPlanReams => Set(); + public virtual DbSet ProcessMapPlanOperationReamingRotor => Set(); public virtual DbSet DrillingProgramParts => Set(); public virtual DbSet FileCategories => Set(); public virtual DbSet Files => Set(); diff --git a/AsbCloudDb/Model/IAsbCloudDbContext.cs b/AsbCloudDb/Model/IAsbCloudDbContext.cs index f21f8173..b34be878 100644 --- a/AsbCloudDb/Model/IAsbCloudDbContext.cs +++ b/AsbCloudDb/Model/IAsbCloudDbContext.cs @@ -81,6 +81,7 @@ namespace AsbCloudDb.Model DbSet DataSaubStat { get; } DatabaseFacade Database { get; } DbSet ProcessMapPlanReams { get; } + DbSet ProcessMapPlanOperationReamingRotor { 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 new file mode 100644 index 00000000..21d97567 --- /dev/null +++ b/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOperationReamingRotor.cs @@ -0,0 +1,158 @@ +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_reaming_rotor"), Comment("РТК проработка ротор")] +public class ProcessMapPlanOperationReamingRotor : ProcessMapPlanBase +{ + [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_rpm_up"), Comment("Проработка 1, Обороты, об/мин., Вверх")] + [Range(0.0, 270.0)] + [Required] + public double Reaming1RPMUp { get; set; } + + [Column("reaming1_rpm_down"), Comment("Проработка 1, Обороты, об/мин., Вниз")] + [Range(0.0, 270.0)] + [Required] + public double Reaming1RPMDown { 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; } + + [Column("reaming2_number_of_ repetitions"), Comment("Проработка 2, Количество повторений, шт.")] + [Range(0.0, 99.0)] + public double Reaming2NumberOfRepetitions { get; set; } + + [Column("reaming2_rop_up"), Comment("Проработка 2, Скорость, м/ч., Вверх")] + [Range(0.0, 999.0)] + public double Reaming2ROPUp { get; set; } + + [Column("reaming2_rop_down"), Comment("Проработка 2, Скорость, м/ч., Вниз")] + [Range(0.0, 999.0)] + public double Reaming2ROPDown { get; set; } + + [Column("reaming2_rpm_up"), Comment("Проработка 2, Обороты, об/мин., Вверх")] + [Range(0.0, 270.0)] + public double Reaming2RPMUp { get; set; } + + [Column("reaming2_rpm_down"), Comment("Проработка 2, Обороты, об/мин., Вниз")] + [Range(0.0, 270.0)] + public double Reaming2RPMDown { get; set; } + + [Column("reaming2_flow_rate_up"), Comment("Проработка 2, Расход, л/с., Вверх")] + [Range(0.0, 100.0)] + public double Reaming2FlowRateUp { get; set; } + + [Column("reaming2_flow_rate_down"), Comment("Проработка 2, Расход, л/с., Вниз")] + [Range(0.0, 100.0)] + public double Reaming2FlowRateDown { get; set; } + + [Column("reaming2_interval"), Comment("Проработка 2, Интервал проработки, м.")] + [Range(0.0, 30.0)] + public double Reaming2Interval { get; set; } + + [Column("reaming2_stop_point_off_bottom"), Comment("Остановка над забоем, м.")] + [Range(0.0, 10.0)] + public double Reaming2StopPointOffBottom { get; set; } + + [Column("reaming3_number_of_ repetitions"), Comment("Проработка 3, Количество повторений, шт.")] + [Range(0.0, 99.0)] + public double Reaming3NumberOfRepetitions { get; set; } + + [Column("reaming3_rop_up"), Comment("Проработка 3, Скорость, м/ч., Вверх")] + [Range(0.0, 999.0)] + public double Reaming3ROPUp { get; set; } + + [Column("reaming3_rop_down"), Comment("Проработка 3, Скорость, м/ч., Вниз")] + [Range(0.0, 999.0)] + public double Reaming3ROPDown { get; set; } + + [Column("reaming3_rpm_up"), Comment("Проработка 3, Обороты, об/мин., Вверх")] + [Range(0.0, 270.0)] + public double Reaming3RPMUp { get; set; } + + [Column("reaming3_rpm_down"), Comment("Проработка 3, Обороты, об/мин., Вниз")] + [Range(0.0, 270.0)] + public double Reaming3RPMDown { get; set; } + + [Column("reaming3_flow_rate_up"), Comment("Проработка 3, Расход, л/с., Вверх")] + [Range(0.0, 100.0)] + public double Reaming3FlowRateUp { get; set; } + + [Column("reaming3_flow_rate_down"), Comment("Проработка 3, Расход, л/с., Вниз")] + [Range(0.0, 100.0)] + public double Reaming3FlowRateDown { get; set; } + + [Column("reaming3_interval"), Comment("Проработка 3, Интервал проработки, м.")] + [Range(0.0, 30.0)] + public double Reaming3Interval { get; set; } + + [Column("reaming3_stop_point_off_bottom"), Comment("Остановка над забоем, м.")] + [Range(0.0, 10.0)] + public double Reaming3StopPointOffBottom { get; set; } + + [Column("note"), Comment("Примечание"), StringLength(1024)] + public string Note { get; set; } = string.Empty; + + [ForeignKey(nameof(IdPrevious))] + public virtual ProcessMapPlanOperationReamingRotor? Previous { get; set; } +} \ No newline at end of file diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs index 86ec923b..64d800b2 100644 --- a/AsbCloudInfrastructure/DependencyInjection.cs +++ b/AsbCloudInfrastructure/DependencyInjection.cs @@ -214,6 +214,10 @@ namespace AsbCloudInfrastructure IChangeLogRepository, ProcessMapPlanBaseRepository>(); + services.AddTransient< + IChangeLogRepository, + ProcessMapPlanBaseRepository>(); + services.AddTransient(); services.AddTransient(); @@ -261,6 +265,7 @@ namespace AsbCloudInfrastructure services.AddTransient(); services.AddTransient>(); services.AddTransient>(); + services.AddTransient>(); services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -317,6 +322,7 @@ namespace AsbCloudInfrastructure services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -325,6 +331,7 @@ namespace AsbCloudInfrastructure services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanOperationReamingRotorTemplate.cs b/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanOperationReamingRotorTemplate.cs new file mode 100644 index 00000000..319e9fa8 --- /dev/null +++ b/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanOperationReamingRotorTemplate.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using AsbCloudApp.Data.ProcessMaps; + +namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates; + +public class ProcessMapPlanOperationReamingRotorTemplate : ITemplateParameters +{ + public string SheetName => "Проработка ротор"; + + public int HeaderRowsCount => 2; + + public string FileName => "ProcessMapPlanOperationReamingRotorTemplate.xlsx"; + + public IDictionary Cells => new Dictionary + { + + }; +} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanOperationReamingRotorExportService.cs b/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanOperationReamingRotorExportService.cs new file mode 100644 index 00000000..1131e015 --- /dev/null +++ b/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanOperationReamingRotorExportService.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 ProcessMapPlanOperationReamingRotorExportService : ProcessMapPlanExportService +{ + public ProcessMapPlanOperationReamingRotorExportService( + IChangeLogRepository processMapPlanRepository, + IWellService wellService) + : base(processMapPlanRepository, wellService) + { + } + + protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanOperationReamingRotorTemplate(); + + 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/ProcessMapPlanOperationReamingRotorParser.cs b/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanOperationReamingRotorParser.cs new file mode 100644 index 00000000..2f028b3b --- /dev/null +++ b/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanOperationReamingRotorParser.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 ProcessMapPlanOperationReamingRotorParser : ProcessMapPlanParser +{ + public ProcessMapPlanOperationReamingRotorParser(IWellOperationRepository wellOperationRepository) + : base(wellOperationRepository) + { + } + + protected override ITemplateParameters TemplateParameters => new ProcessMapPlanOperationReamingRotorTemplate(); + + protected override ProcessMapPlanOperationReamingRotorDto 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/ProcessMapPlanOperationReamingRotorController.cs b/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanOperationReamingRotorController.cs new file mode 100644 index 00000000..01b6eebc --- /dev/null +++ b/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanOperationReamingRotorController.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 ProcessMapPlanOperationReamingRotorController : + ProcessMapPlanBaseController +{ + public ProcessMapPlanOperationReamingRotorController( + IChangeLogRepository repository, + IWellService wellService, + ProcessMapPlanOperationReamingRotorParser parserService, + ITelemetryService telemetryService, + ProcessMapPlanOperationReamingRotorExportService processMapPlanExportService) + : base(repository, wellService, parserService, processMapPlanExportService, telemetryService) + { + } + + protected override string TemplateFileName => "ЕЦП_шаблон_файла_РТК_план_проработка_ротор.xlsx"; +} \ No newline at end of file