diff --git a/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanFunctionsOscillationDto.cs b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOscillationDto.cs similarity index 82% rename from AsbCloudApp/Data/ProcessMaps/ProcessMapPlanFunctionsOscillationDto.cs rename to AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOscillationDto.cs index 733c1bee..51ca2027 100644 --- a/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanFunctionsOscillationDto.cs +++ b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanOscillationDto.cs @@ -5,7 +5,7 @@ namespace AsbCloudApp.Data.ProcessMaps; /// /// РТК план осцилляция /// -public class ProcessMapPlanFunctionsOscillationDto : ProcessMapPlanBaseDto +public class ProcessMapPlanOscillationDto : ProcessMapPlanBaseDto { /// /// Оптимальный угол осцилляции, градусы @@ -17,31 +17,31 @@ public class ProcessMapPlanFunctionsOscillationDto : ProcessMapPlanBaseDto /// Скорость вправо, об/мин /// [Range(0.0, 270.0, ErrorMessage = "Скорость вправо, об/мин, должно быть в пределах от 0 до 270")] - public double RPM​Right { get; set; } + public double RpmRight { get; set; } /// /// Скорость влево, об/мин /// [Range(0.0, 270.0, ErrorMessage = "Скорость влево, об/мин, должно быть в пределах от 0 до 270")] - public double RPM​Left { get; set; } + public double RpmLeft { get; set; } /// /// Ограничение момента вправо, кН*м /// [Range(0.0, 35.0, ErrorMessage = "Ограничение момента вправо, кН*м., должно быть в пределах от 0 до 35")] - public double TorqueLimitRight { get; set; } + public double TorqueMaxRight { get; set; } /// /// Ограничение момента влево, кН*м /// [Range(0.0, 35.0, ErrorMessage = "Ограничение момента влево, кН*м., должно быть в пределах от 0 до 35")] - public double TorqueLimitLeft { get; set; } + public double TorqueMaxLeft { get; set; } /// /// Режим Авто/Руч /// - [Required] - public bool Mode { get; set; } + [Range(0, 1, ErrorMessage = "Режим Авто/Руч, должен быть либо 0, либо 1")] + public int Mode { get; set; } /// /// Примечание diff --git a/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanUpdatingNoloadParametersDto.cs b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanUpdatingNoloadParametersDto.cs new file mode 100644 index 00000000..5d05f594 --- /dev/null +++ b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanUpdatingNoloadParametersDto.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations; + +namespace AsbCloudApp.Data.ProcessMaps; + +/// +/// РТК план обновление холостого хода +/// +public class ProcessMapPlanUpdatingNoloadParametersDto : ProcessMapPlanBaseDto +{ + /// + /// СПУСК ОК Да/Нет + /// + public bool IdDeclineSocketColumn { get; set; } + + /// + /// Примечание + /// + [StringLength(1024, ErrorMessage = "Примечание, должно быть не более 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 95d51216..94395a4d 100644 --- a/AsbCloudDb/Model/AsbCloudDbContext.cs +++ b/AsbCloudDb/Model/AsbCloudDbContext.cs @@ -37,7 +37,7 @@ namespace AsbCloudDb.Model public virtual DbSet ProcessMapPlanFunctionsAutoHold => Set(); public virtual DbSet ProcessMapPlanFunctionsJarrDrillTool => Set(); public virtual DbSet ProcessMapPlanFunctionsUpgradeNoload => Set(); - public virtual DbSet ProcessMapPlanFunctionsOscillation => Set(); + public virtual DbSet ProcessMapPlanFunctionsOscillation => Set(); public virtual DbSet ProcessMapPlanFunctionsAnticrashRotation => Set(); public virtual DbSet ProcessMapPlanFunctionsStaticMeasure => Set(); @@ -548,7 +548,7 @@ namespace AsbCloudDb.Model .WithMany() .OnDelete(DeleteBehavior.Restrict); - modelBuilder.Entity() + modelBuilder.Entity() .HasOne(p => p.Author) .WithMany() .OnDelete(DeleteBehavior.Restrict); @@ -648,7 +648,7 @@ namespace AsbCloudDb.Model .WithMany() .OnDelete(DeleteBehavior.Restrict); - modelBuilder.Entity() + modelBuilder.Entity() .HasOne(p => p.Editor) .WithMany() .OnDelete(DeleteBehavior.Restrict); diff --git a/AsbCloudDb/Model/IAsbCloudDbContext.cs b/AsbCloudDb/Model/IAsbCloudDbContext.cs index 5a764be3..4ebae966 100644 --- a/AsbCloudDb/Model/IAsbCloudDbContext.cs +++ b/AsbCloudDb/Model/IAsbCloudDbContext.cs @@ -98,7 +98,7 @@ namespace AsbCloudDb.Model DbSet ProcessMapPlanFunctionsAutoHold { get; } DbSet ProcessMapPlanFunctionsJarrDrillTool { get; } DbSet ProcessMapPlanFunctionsUpgradeNoload { get; } - DbSet ProcessMapPlanFunctionsOscillation { get; } + DbSet ProcessMapPlanFunctionsOscillation { get; } DbSet ProcessMapPlanFunctionsAnticrashRotation { get; } DbSet ProcessMapPlanFunctionsStaticMeasure { get; } diff --git a/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanFunctionsOscillation.cs b/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanFunctionsOscillation.cs deleted file mode 100644 index 8836a451..00000000 --- a/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanFunctionsOscillation.cs +++ /dev/null @@ -1,45 +0,0 @@ -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_functions_oscillation"), Comment("Осцилляция")] -public class ProcessMapPlanFunctionsOscillation : ProcessMapPlanBase -{ - [Column("optimal_oscillation_angle"), Comment("Оптимальный угол осцилляции, градусы")] - [Range(0.0, 6000.0)] - [Required] - public double OptimalOscillationAngle { get; set; } - - [Column("RPM​_right"), Comment("Скорость вправо, об/мин")] - [Range(0.0, 270.0)] - [Required] - public double RPM​Right { get; set; } - - [Column("RPM​_left"), Comment("Скорость влево, об/мин")] - [Range(0.0, 270.0)] - [Required] - public double RPM​Left { get; set; } - - [Column("torque_limit_right"), Comment("Ограничение момента вправо, кН*м")] - [Range(0.0, 35.0)] - [Required] - public double TorqueLimitRight { get; set; } - - [Column("torque_limit_left"), Comment("Ограничение момента влево, кН*м")] - [Range(0.0, 35.0)] - [Required] - public double TorqueLimitLeft { get; set; } - - [Column("id_mode"), Comment("Режим Авто/Руч")] - [Required] - public bool Mode { get; set; } - - [Column("note"), Comment("Примечание"), StringLength(1024)] - public string Note { get; set; } = string.Empty; - - [ForeignKey(nameof(IdPrevious))] - public virtual ProcessMapPlanFunctionsOscillation? Previous { get; set; } -} \ No newline at end of file diff --git a/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOscillation.cs b/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOscillation.cs new file mode 100644 index 00000000..f11a11f3 --- /dev/null +++ b/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanOscillation.cs @@ -0,0 +1,46 @@ +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_oscillation"), Comment("Осцилляция")] +public class ProcessMapPlanOscillation : ProcessMapPlanBase +{ + [Column("optimal_oscillation_angle"), Comment("Оптимальный угол осцилляции, градусы")] + [Range(0.0, 6000.0)] + [Required] + public double OptimalOscillationAngle { get; set; } + + [Column("Rpm​_right"), Comment("Скорость вправо, об/мин")] + [Range(0.0, 270.0)] + [Required] + public double RpmRight { get; set; } + + [Column("Rpm_left"), Comment("Скорость влево, об/мин")] + [Range(0.0, 270.0)] + [Required] + public double RpmLeft { get; set; } + + [Column("torque_max_right"), Comment("Ограничение момента вправо, кН*м")] + [Range(0.0, 35.0)] + [Required] + public double TorqueMaxRight { get; set; } + + [Column("torque_max_left"), Comment("Ограничение момента влево, кН*м")] + [Range(0.0, 35.0)] + [Required] + public double TorqueMaxLeft { get; set; } + + [Column("mode"), Comment("Режим Авто/Руч")] + [Range(0, 1)] + [Required] + public int Mode { get; set; } + + [Column("note"), Comment("Примечание"), StringLength(1024)] + public string Note { get; set; } = string.Empty; + + [ForeignKey(nameof(IdPrevious))] + public virtual ProcessMapPlanOscillation? Previous { get; set; } +} \ No newline at end of file diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs index 216354c3..950fb2a8 100644 --- a/AsbCloudInfrastructure/DependencyInjection.cs +++ b/AsbCloudInfrastructure/DependencyInjection.cs @@ -251,11 +251,11 @@ namespace AsbCloudInfrastructure Item = src.Adapt() }); - TypeAdapterConfig>.NewConfig() - .Include>() - .Map(dest => dest, src => new ChangeLogDto() + TypeAdapterConfig>.NewConfig() + .Include>() + .Map(dest => dest, src => new ChangeLogDto() { - Item = src.Adapt() + Item = src.Adapt() }); TypeAdapterConfig>.NewConfig() @@ -444,7 +444,7 @@ namespace AsbCloudInfrastructure services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -470,7 +470,7 @@ namespace AsbCloudInfrastructure services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -555,8 +555,8 @@ namespace AsbCloudInfrastructure ProcessMapPlanBaseRepository>(); services.AddTransient< - IChangeLogRepository, - ProcessMapPlanBaseRepository>(); + IChangeLogRepository, + ProcessMapPlanBaseRepository>(); services.AddTransient< IChangeLogRepository, @@ -583,7 +583,7 @@ namespace AsbCloudInfrastructure services.AddTransient>(); services.AddTransient>(); services.AddTransient>(); - services.AddTransient>(); + services.AddTransient>(); services.AddTransient>(); services.AddTransient>(); diff --git a/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanFunctionsOscillationTemplate.cs b/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanOscillationTemplate.cs similarity index 66% rename from AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanFunctionsOscillationTemplate.cs rename to AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanOscillationTemplate.cs index 65dfdd9f..6990aa1a 100644 --- a/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanFunctionsOscillationTemplate.cs +++ b/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanOscillationTemplate.cs @@ -2,13 +2,13 @@ using System.Collections.Generic; namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates; -public class ProcessMapPlanFunctionsOscillationTemplate : ITemplateParameters +public class ProcessMapPlanOscillationTemplate : ITemplateParameters { public string SheetName => "Осцилляция"; public int HeaderRowsCount => 2; - public string FileName => "ProcessMapPlanFunctionsOscillationTemplate.xlsx"; + public string FileName => "ProcessMapPlanOscillationTemplate.xlsx"; public IDictionary Cells => new Dictionary { diff --git a/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanFunctionsOscillationExportService.cs b/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanOscillationExportService.cs similarity index 70% rename from AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanFunctionsOscillationExportService.cs rename to AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanOscillationExportService.cs index da8631c1..5e6f4ce4 100644 --- a/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanFunctionsOscillationExportService.cs +++ b/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanOscillationExportService.cs @@ -10,16 +10,16 @@ using System.Threading.Tasks; namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Export; -public class ProcessMapPlanFunctionsOscillationExportService : ProcessMapPlanExportService +public class ProcessMapPlanOscillationExportService : ProcessMapPlanExportService { - public ProcessMapPlanFunctionsOscillationExportService( - IChangeLogRepository processMapPlanRepository, + public ProcessMapPlanOscillationExportService( + IChangeLogRepository processMapPlanRepository, IWellService wellService) : base(processMapPlanRepository, wellService) { } - protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanFunctionsOscillationTemplate(); + protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanOscillationTemplate(); protected override async Task BuildFileNameAsync(WellRelatedExportRequest options, CancellationToken token) { diff --git a/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanFunctionsOscillationParser.cs b/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanOscillationParser.cs similarity index 73% rename from AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanFunctionsOscillationParser.cs rename to AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanOscillationParser.cs index b7966539..f243053f 100644 --- a/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanFunctionsOscillationParser.cs +++ b/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanOscillationParser.cs @@ -9,16 +9,16 @@ using AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemp namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Parser; -public class ProcessMapPlanFunctionsOscillationParser : ProcessMapPlanParser +public class ProcessMapPlanOscillationParser : ProcessMapPlanParser { - public ProcessMapPlanFunctionsOscillationParser(IWellOperationRepository wellOperationRepository) + public ProcessMapPlanOscillationParser(IWellOperationRepository wellOperationRepository) : base(wellOperationRepository) { } - protected override ITemplateParameters TemplateParameters => new ProcessMapPlanFunctionsOscillationTemplate(); + protected override ITemplateParameters TemplateParameters => new ProcessMapPlanOscillationTemplate(); - protected override ProcessMapPlanFunctionsOscillationDto BuildDto(IDictionary row, int rowNumber) + protected override ProcessMapPlanOscillationDto BuildDto(IDictionary row, int rowNumber) { var dto = base.BuildDto(row, rowNumber); diff --git a/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlan/ProcessMapPlanFunctionsOscillationControllerTest.cs b/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlan/ProcessMapPlanFunctionsOscillationControllerTest.cs deleted file mode 100644 index e195ca41..00000000 --- a/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlan/ProcessMapPlanFunctionsOscillationControllerTest.cs +++ /dev/null @@ -1,79 +0,0 @@ -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; -using AsbCloudWebApi.IntegrationTests.Controllers.ProcessMapPlan; -using AsbCloudWebApi.IntegrationTests; -using Microsoft.EntityFrameworkCore; -using Xunit; - -namespace AsbCloudWebApi.Controllers.ProcessMaps; - -/// -/// РТК план осцилляция -/// -public class ProcessMapPlanFunctionsOscillationControllerTest : - ProcessMapPlanBaseControllerTest -{ - public ProcessMapPlanFunctionsOscillationControllerTest(WebAppFactoryFixture factory) : base(factory, "ProcessMapPlanFunctionsOscillation") - { - } - private readonly ProcessMapPlanFunctionsOscillationDto dto = new ProcessMapPlanFunctionsOscillationDto() - { - IdWell = 1, - DepthStart = 1, - DepthEnd = 2, - Id = 0, - IdWellSectionType = 1, - Mode = true, - Note = "1", - OptimalOscillationAngle = 1, - RPMLeft = 2, - RPMRight = 3, - TorqueLimitLeft = 4, - TorqueLimitRight = 5 - }; - - private readonly ProcessMapPlanFunctionsOscillation entity = new ProcessMapPlanFunctionsOscillation() - { - IdWell = 1, - DepthEnd = 10, - DepthStart = 2, - Id = 0, - IdWellSectionType = 1, - IdAuthor = 1, - IdEditor = 1, - Creation = DateTimeOffset.UtcNow, - Mode = true, - Note = "1", - OptimalOscillationAngle = 1, - RPMLeft = 2, - RPMRight = 3, - TorqueLimitLeft = 4, - TorqueLimitRight = 5 - }; - - [Fact] - public async Task Get_actual_returns_success() - { - await Get(entity, dto); - } - - protected override ProcessMapPlanFunctionsOscillation GetByNote(DbSet dbSet, ProcessMapPlanFunctionsOscillationDto dto) - { - throw new NotImplementedException(); - } - - protected override ProcessMapPlanFunctionsOscillationDto GetByNote(IEnumerable dtos, ProcessMapPlanFunctionsOscillationDto dto) - { - throw new NotImplementedException(); - } - - protected override ProcessMapPlanFunctionsOscillation? GetByWellId() - { - throw new NotImplementedException(); - } -} \ No newline at end of file diff --git a/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlan/ProcessMapPlanOscillationControllerTest.cs b/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlan/ProcessMapPlanOscillationControllerTest.cs new file mode 100644 index 00000000..d9413b12 --- /dev/null +++ b/AsbCloudWebApi.IntegrationTests/Controllers/ProcessMapPlan/ProcessMapPlanOscillationControllerTest.cs @@ -0,0 +1,71 @@ +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; +using AsbCloudWebApi.IntegrationTests.Controllers.ProcessMapPlan; +using AsbCloudWebApi.IntegrationTests; +using Microsoft.EntityFrameworkCore; +using Xunit; + +namespace AsbCloudWebApi.Controllers.ProcessMaps; + +/// +/// РТК план осцилляция +/// +public class ProcessMapPlanOscillationControllerTest : + ProcessMapPlanBaseControllerTest +{ + public ProcessMapPlanOscillationControllerTest(WebAppFactoryFixture factory) : base(factory, "ProcessMapPlanFunctionsOscillation") + { + } + private readonly ProcessMapPlanOscillationDto dto = new ProcessMapPlanOscillationDto() + { + IdWell = 1, + DepthStart = 1, + DepthEnd = 2, + Id = 0, + IdWellSectionType = 1, + Mode = 1, + Note = "1", + OptimalOscillationAngle = 1 + }; + + private readonly ProcessMapPlanOscillation entity = new ProcessMapPlanOscillation() + { + IdWell = 1, + DepthEnd = 10, + DepthStart = 2, + Id = 0, + IdWellSectionType = 1, + IdAuthor = 1, + IdEditor = 1, + Creation = DateTimeOffset.UtcNow, + Mode = 1, + Note = "1", + OptimalOscillationAngle = 1 + }; + + [Fact] + public async Task Get_actual_returns_success() + { + await Get(entity, dto); + } + + protected override ProcessMapPlanOscillation GetByNote(DbSet dbSet, ProcessMapPlanOscillationDto dto) + { + throw new NotImplementedException(); + } + + protected override ProcessMapPlanOscillationDto GetByNote(IEnumerable dtos, ProcessMapPlanOscillationDto dto) + { + throw new NotImplementedException(); + } + + protected override ProcessMapPlanOscillation? GetByWellId() + { + throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanFunctionsOscillationController.cs b/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanOscillationController.cs similarity index 59% rename from AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanFunctionsOscillationController.cs rename to AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanOscillationController.cs index a8d1f155..6c585d33 100644 --- a/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanFunctionsOscillationController.cs +++ b/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanOscillationController.cs @@ -11,15 +11,15 @@ namespace AsbCloudWebApi.Controllers.ProcessMaps; /// /// РТК план осцилляция /// -public class ProcessMapPlanFunctionsOscillationController : - ProcessMapPlanBaseController +public class ProcessMapPlanOscillationController : + ProcessMapPlanBaseController { - public ProcessMapPlanFunctionsOscillationController( - IChangeLogRepository repository, + public ProcessMapPlanOscillationController( + IChangeLogRepository repository, IWellService wellService, - ProcessMapPlanFunctionsOscillationParser parserService, + ProcessMapPlanOscillationParser parserService, ITelemetryService telemetryService, - ProcessMapPlanFunctionsOscillationExportService processMapPlanExportService) + ProcessMapPlanOscillationExportService processMapPlanExportService) : base(repository, wellService, parserService, processMapPlanExportService, telemetryService) { }