diff --git a/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOperationLoadCapacityDto.cs b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOperationLoadCapacityDto.cs new file mode 100644 index 00000000..adf38aae --- /dev/null +++ b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOperationLoadCapacityDto.cs @@ -0,0 +1,36 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace AsbCloudApp.Data.ProcessMaps; + +/// +/// РТК план выработка нагрузки +/// +public class ProcessMapPlanOperationLoadCapacityDto : ProcessMapPlanBaseDto +{ + /// + /// Время выработки минимальное, сек + /// + [Range(0.0, 800.0)] + public double TimeLoadCapacityMin { get; set; } + + /// + /// Перепад давления минимальный, атм + /// + [Range(0.1, 400.0)] + public double DifferentialPressureMin { get; set; } + + /// + /// Нагрузка минимальная, т + /// + [Range(0.1, 99.0)] + public double WeightOnBitMin { get; set; } + + /// + /// Примечание + /// + [StringLength(1024)] + public string Note { get; set; } = string.Empty; + + +} \ No newline at end of file diff --git a/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOperationPositioningOffTheBottomDto.cs b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOperationPositioningOffTheBottomDto.cs new file mode 100644 index 00000000..bad705c6 --- /dev/null +++ b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOperationPositioningOffTheBottomDto.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace AsbCloudApp.Data.ProcessMaps; + +/// +/// РТК план позиционирования над забоем +/// +public class ProcessMapPlanOperationPositioningOffTheBottomDto : ProcessMapPlanBaseDto +{ + /// + /// Остановка над забоем, м + /// + [Range(0.0, 30.0)] + public double StopOffTheBottom { get; set; } +} \ No newline at end of file diff --git a/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOperationReamingSlideDto.cs b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOperationReamingSlideDto.cs new file mode 100644 index 00000000..5f8289ca --- /dev/null +++ b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOperationReamingSlideDto.cs @@ -0,0 +1,210 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace AsbCloudApp.Data.ProcessMaps; + +/// +/// РТК план проработка для слайда +/// +public class ProcessMapPlanOperationReamingSlideDto : 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/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanSurveyDto.cs b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanSurveyDto.cs new file mode 100644 index 00000000..4d8e6766 --- /dev/null +++ b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanSurveyDto.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace AsbCloudApp.Data.ProcessMaps; + +/// +/// РТК план записи статического замера +/// +public class ProcessMapPlanSurveyDto : ProcessMapPlanBaseDto +{ + /// + /// Время записи замера, сек + /// + [Range(0.0, 1800.0)] + public double MeasurementRecordingTime { get; set; } +} \ No newline at end of file diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs index e94555c0..4c0cc80d 100644 --- a/AsbCloudDb/Model/AsbCloudDbContext.cs +++ b/AsbCloudDb/Model/AsbCloudDbContext.cs @@ -26,6 +26,7 @@ namespace AsbCloudDb.Model public virtual DbSet ProcessMapPlanOperationReamingSlide => Set(); public virtual DbSet ProcessMapPlanOperationLoadCapacity => Set(); public virtual DbSet ProcessMapPlanSurvey => Set(); + public virtual DbSet ProcessMapPlanOperationPositioningOffTheBottom => Set(); public virtual DbSet DrillingProgramParts => Set(); public virtual DbSet FileCategories => Set(); public virtual DbSet Files => Set(); @@ -477,6 +478,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() @@ -507,6 +513,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 2686fa3d..28bc88f7 100644 --- a/AsbCloudDb/Model/IAsbCloudDbContext.cs +++ b/AsbCloudDb/Model/IAsbCloudDbContext.cs @@ -87,6 +87,7 @@ namespace AsbCloudDb.Model DbSet ProcessMapPlanOperationReamingSlide { get; } DbSet ProcessMapPlanOperationLoadCapacity { get; } DbSet ProcessMapPlanSurvey { get; } + DbSet ProcessMapPlanOperationPositioningOffTheBottom { get; } Task RefreshMaterializedViewAsync(string mwName, CancellationToken token); Task RefreshMaterializedViewAsync(CancellationToken token) where TEntity : class; diff --git a/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOperationPositioningOffTheBottom.cs b/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOperationPositioningOffTheBottom.cs new file mode 100644 index 00000000..424cac69 --- /dev/null +++ b/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOperationPositioningOffTheBottom.cs @@ -0,0 +1,18 @@ +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_positioning_off_the_bottom"), Comment("Позиционирование над забоем")] +public class ProcessMapPlanOperationPositioningOffTheBottom : ProcessMapPlanBase +{ + [Column("stop_off_the_bottom"), Comment("Остановка над забоем, м")] + [Range(0.0, 30.0)] + [Required] + public double StopOffTheBottom { get; set; } + + [ForeignKey(nameof(IdPrevious))] + public virtual ProcessMapPlanOperationPositioningOffTheBottom? Previous { get; set; } +} \ No newline at end of file diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs index 60f5fc21..5482af4e 100644 --- a/AsbCloudInfrastructure/DependencyInjection.cs +++ b/AsbCloudInfrastructure/DependencyInjection.cs @@ -173,6 +173,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) @@ -258,6 +265,10 @@ namespace AsbCloudInfrastructure IChangeLogRepository, ProcessMapPlanBaseRepository>(); + services.AddTransient< + IChangeLogRepository, + ProcessMapPlanBaseRepository>(); + services.AddTransient(); services.AddTransient(); @@ -309,6 +320,7 @@ namespace AsbCloudInfrastructure services.AddTransient>(); services.AddTransient>(); services.AddTransient>(); + services.AddTransient>(); services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -369,6 +381,7 @@ namespace AsbCloudInfrastructure services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -381,6 +394,7 @@ namespace AsbCloudInfrastructure services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanOperationPositioningOffTheBottomTemplate.cs b/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanOperationPositioningOffTheBottomTemplate.cs new file mode 100644 index 00000000..3cb9aadf --- /dev/null +++ b/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanOperationPositioningOffTheBottomTemplate.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates; + +public class ProcessMapPlanOperationPositioningOffTheBottomTemplate : ITemplateParameters +{ + public string SheetName => "Позиционирование над забоем"; + + public int HeaderRowsCount => 2; + + public string FileName => "ProcessMapPlanOperationPositioningOffTheBottomTemplate.xlsx"; + + public IDictionary Cells => new Dictionary + { + + }; +} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanOperationPositioningOffTheBottomExportService.cs b/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanOperationPositioningOffTheBottomExportService.cs new file mode 100644 index 00000000..d1049e01 --- /dev/null +++ b/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanOperationPositioningOffTheBottomExportService.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 ProcessMapPlanOperationPositioningOffTheBottomExportService : ProcessMapPlanExportService +{ + public ProcessMapPlanOperationPositioningOffTheBottomExportService( + IChangeLogRepository processMapPlanRepository, + IWellService wellService) + : base(processMapPlanRepository, wellService) + { + } + + protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanOperationPositioningOffTheBottomTemplate(); + + 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/ProcessMapPlanOperationPositioningOffTheBottomParser.cs b/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanOperationPositioningOffTheBottomParser.cs new file mode 100644 index 00000000..a921e0eb --- /dev/null +++ b/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanOperationPositioningOffTheBottomParser.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 ProcessMapPlanOperationPositioningOffTheBottomParser : ProcessMapPlanParser +{ + public ProcessMapPlanOperationPositioningOffTheBottomParser(IWellOperationRepository wellOperationRepository) + : base(wellOperationRepository) + { + } + + protected override ITemplateParameters TemplateParameters => new ProcessMapPlanOperationPositioningOffTheBottomTemplate(); + + protected override ProcessMapPlanOperationPositioningOffTheBottomDto 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/ProcessMapPlanOperationPositioningOffTheBottomController.cs b/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanOperationPositioningOffTheBottomController.cs new file mode 100644 index 00000000..ba4c9e91 --- /dev/null +++ b/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanOperationPositioningOffTheBottomController.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 ProcessMapPlanOperationPositioningOffTheBottomController : + ProcessMapPlanBaseController +{ + public ProcessMapPlanOperationPositioningOffTheBottomController( + IChangeLogRepository repository, + IWellService wellService, + ProcessMapPlanOperationPositioningOffTheBottomParser parserService, + ITelemetryService telemetryService, + ProcessMapPlanOperationPositioningOffTheBottomExportService processMapPlanExportService) + : base(repository, wellService, parserService, processMapPlanExportService, telemetryService) + { + } + + protected override string TemplateFileName => "ЕЦП_шаблон_файла_РТК_план_позиционирование_над_забоем.xlsx"; +} \ No newline at end of file