Осцилляция

This commit is contained in:
Olga Nemt 2024-06-29 21:26:43 +05:00
parent 9fac4edaf6
commit 04fd517ab1
13 changed files with 173 additions and 160 deletions

View File

@ -5,7 +5,7 @@ namespace AsbCloudApp.Data.ProcessMaps;
/// <summary>
/// РТК план осцилляция
/// </summary>
public class ProcessMapPlanFunctionsOscillationDto : ProcessMapPlanBaseDto
public class ProcessMapPlanOscillationDto : ProcessMapPlanBaseDto
{
/// <summary>
/// Оптимальный угол осцилляции, градусы
@ -17,31 +17,31 @@ public class ProcessMapPlanFunctionsOscillationDto : ProcessMapPlanBaseDto
/// Скорость вправо, об/мин
/// </summary>
[Range(0.0, 270.0, ErrorMessage = "Скорость вправо, об/мин, должно быть в пределах от 0 до 270")]
public double RPMRight { get; set; }
public double RpmRight { get; set; }
/// <summary>
/// Скорость влево, об/мин
/// </summary>
[Range(0.0, 270.0, ErrorMessage = "Скорость влево, об/мин, должно быть в пределах от 0 до 270")]
public double RPMLeft { get; set; }
public double RpmLeft { get; set; }
/// <summary>
/// Ограничение момента вправо, кН*м
/// </summary>
[Range(0.0, 35.0, ErrorMessage = "Ограничение момента вправо, кН*м., должно быть в пределах от 0 до 35")]
public double TorqueLimitRight { get; set; }
public double TorqueMaxRight { get; set; }
/// <summary>
/// Ограничение момента влево, кН*м
/// </summary>
[Range(0.0, 35.0, ErrorMessage = "Ограничение момента влево, кН*м., должно быть в пределах от 0 до 35")]
public double TorqueLimitLeft { get; set; }
public double TorqueMaxLeft { get; set; }
/// <summary>
/// Режим Авто/Руч
/// </summary>
[Required]
public bool Mode { get; set; }
[Range(0, 1, ErrorMessage = "Режим Авто/Руч, должен быть либо 0, либо 1")]
public int Mode { get; set; }
/// <summary>
/// Примечание

View File

@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data.ProcessMaps;
/// <summary>
/// РТК план обновление холостого хода
/// </summary>
public class ProcessMapPlanUpdatingNoloadParametersDto : ProcessMapPlanBaseDto
{
/// <summary>
/// СПУСК ОК Да/Нет
/// </summary>
public bool IdDeclineSocketColumn { get; set; }
/// <summary>
/// Примечание
/// </summary>
[StringLength(1024, ErrorMessage = "Примечание, должно быть не более 1024 символов")]
public string Note { get; set; } = string.Empty;
}

View File

@ -37,7 +37,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<ProcessMapPlanFunctionsAutoHold> ProcessMapPlanFunctionsAutoHold => Set<ProcessMapPlanFunctionsAutoHold>();
public virtual DbSet<ProcessMapPlanFunctionsJarrDrillTool> ProcessMapPlanFunctionsJarrDrillTool => Set<ProcessMapPlanFunctionsJarrDrillTool>();
public virtual DbSet<ProcessMapPlanUpdatingNoloadParameters> ProcessMapPlanFunctionsUpgradeNoload => Set<ProcessMapPlanUpdatingNoloadParameters>();
public virtual DbSet<ProcessMapPlanFunctionsOscillation> ProcessMapPlanFunctionsOscillation => Set<ProcessMapPlanFunctionsOscillation>();
public virtual DbSet<ProcessMapPlanOscillation> ProcessMapPlanFunctionsOscillation => Set<ProcessMapPlanOscillation>();
public virtual DbSet<ProcessMapPlanAntiCrashRotation> ProcessMapPlanFunctionsAnticrashRotation => Set<ProcessMapPlanAntiCrashRotation>();
public virtual DbSet<ProcessMapPlanFunctionsStaticMeasure> ProcessMapPlanFunctionsStaticMeasure => Set<ProcessMapPlanFunctionsStaticMeasure>();
@ -548,7 +548,7 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanFunctionsOscillation>()
modelBuilder.Entity<ProcessMapPlanOscillation>()
.HasOne(p => p.Author)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
@ -648,7 +648,7 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanFunctionsOscillation>()
modelBuilder.Entity<ProcessMapPlanOscillation>()
.HasOne(p => p.Editor)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);

View File

@ -98,7 +98,7 @@ namespace AsbCloudDb.Model
DbSet<ProcessMapPlanFunctionsAutoHold> ProcessMapPlanFunctionsAutoHold { get; }
DbSet<ProcessMapPlanFunctionsJarrDrillTool> ProcessMapPlanFunctionsJarrDrillTool { get; }
DbSet<ProcessMapPlanUpdatingNoloadParameters> ProcessMapPlanFunctionsUpgradeNoload { get; }
DbSet<ProcessMapPlanFunctionsOscillation> ProcessMapPlanFunctionsOscillation { get; }
DbSet<ProcessMapPlanOscillation> ProcessMapPlanFunctionsOscillation { get; }
DbSet<ProcessMapPlanAntiCrashRotation> ProcessMapPlanFunctionsAnticrashRotation { get; }
DbSet<ProcessMapPlanFunctionsStaticMeasure> ProcessMapPlanFunctionsStaticMeasure { get; }

View File

@ -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 RPMRight { get; set; }
[Column("RPM_left"), Comment("Скорость влево, об/мин")]
[Range(0.0, 270.0)]
[Required]
public double RPMLeft { 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; }
}

View File

@ -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; }
}

View File

@ -251,11 +251,11 @@ namespace AsbCloudInfrastructure
Item = src.Adapt<ProcessMapPlanUpdatingNoloadParametersDto>()
});
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanFunctionsOscillationDto>>.NewConfig()
.Include<ProcessMapPlanFunctionsOscillation, ChangeLogDto<ProcessMapPlanFunctionsOscillationDto>>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanFunctionsOscillationDto>()
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanOscillationDto>>.NewConfig()
.Include<ProcessMapPlanOscillation, ChangeLogDto<ProcessMapPlanOscillationDto>>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanOscillationDto>()
{
Item = src.Adapt<ProcessMapPlanFunctionsOscillationDto>()
Item = src.Adapt<ProcessMapPlanOscillationDto>()
});
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanAntiCrashRotationDto>>.NewConfig()
@ -444,7 +444,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanFunctionsAutoHoldParser>();
services.AddTransient<ProcessMapPlanFunctionsJarrDrillToolParser>();
services.AddTransient<ProcessMapPlanUpdatingNoloadParametersParser>();
services.AddTransient<ProcessMapPlanFunctionsOscillationParser>();
services.AddTransient<ProcessMapPlanOscillationParser>();
services.AddTransient<ProcessMapPlanAntiCrashRotationParser>();
services.AddTransient<ProcessMapPlanFunctionsStaticMeasureParser>();
@ -470,7 +470,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanFunctionsAutoHoldExportService>();
services.AddTransient<ProcessMapPlanFunctionsJarrDrillToolExportService>();
services.AddTransient<ProcessMapPlanUpdatingNoloadParametersExportService>();
services.AddTransient<ProcessMapPlanFunctionsOscillationExportService>();
services.AddTransient<ProcessMapPlanOscillationExportService>();
services.AddTransient<ProcessMapPlanAntiCrashRotationExportService>();
services.AddTransient<ProcessMapPlanFunctionsStaticMeasureExportService>();
@ -555,8 +555,8 @@ namespace AsbCloudInfrastructure
ProcessMapPlanBaseRepository<ProcessMapPlanUpdatingNoloadParameters, ProcessMapPlanUpdatingNoloadParametersDto>>();
services.AddTransient<
IChangeLogRepository<ProcessMapPlanFunctionsOscillationDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanFunctionsOscillation, ProcessMapPlanFunctionsOscillationDto>>();
IChangeLogRepository<ProcessMapPlanOscillationDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanOscillation, ProcessMapPlanOscillationDto>>();
services.AddTransient<
IChangeLogRepository<ProcessMapPlanAntiCrashRotationDto, ProcessMapPlanBaseRequestWithWell>,
@ -583,7 +583,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsAutoHoldDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsJarrDrillToolDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanUpdatingNoloadParametersDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsOscillationDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOscillationDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanAntiCrashRotationDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsStaticMeasureDto>>();

View File

@ -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<string, Cell> Cells => new Dictionary<string, Cell>
{

View File

@ -10,16 +10,16 @@ using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Export;
public class ProcessMapPlanFunctionsOscillationExportService : ProcessMapPlanExportService<ProcessMapPlanFunctionsOscillationDto>
public class ProcessMapPlanOscillationExportService : ProcessMapPlanExportService<ProcessMapPlanOscillationDto>
{
public ProcessMapPlanFunctionsOscillationExportService(
IChangeLogRepository<ProcessMapPlanFunctionsOscillationDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
public ProcessMapPlanOscillationExportService(
IChangeLogRepository<ProcessMapPlanOscillationDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
IWellService wellService)
: base(processMapPlanRepository, wellService)
{
}
protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanFunctionsOscillationTemplate();
protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanOscillationTemplate();
protected override async Task<string> BuildFileNameAsync(WellRelatedExportRequest options, CancellationToken token)
{

View File

@ -9,16 +9,16 @@ using AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemp
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Parser;
public class ProcessMapPlanFunctionsOscillationParser : ProcessMapPlanParser<ProcessMapPlanFunctionsOscillationDto>
public class ProcessMapPlanOscillationParser : ProcessMapPlanParser<ProcessMapPlanOscillationDto>
{
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<string, object?> row, int rowNumber)
protected override ProcessMapPlanOscillationDto BuildDto(IDictionary<string, object?> row, int rowNumber)
{
var dto = base.BuildDto(row, rowNumber);

View File

@ -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;
/// <summary>
/// РТК план осцилляция
/// </summary>
public class ProcessMapPlanFunctionsOscillationControllerTest :
ProcessMapPlanBaseControllerTest<ProcessMapPlanFunctionsOscillation, ProcessMapPlanFunctionsOscillationDto>
{
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<ProcessMapPlanFunctionsOscillation> dbSet, ProcessMapPlanFunctionsOscillationDto dto)
{
throw new NotImplementedException();
}
protected override ProcessMapPlanFunctionsOscillationDto GetByNote(IEnumerable<ProcessMapPlanFunctionsOscillationDto> dtos, ProcessMapPlanFunctionsOscillationDto dto)
{
throw new NotImplementedException();
}
protected override ProcessMapPlanFunctionsOscillation? GetByWellId()
{
throw new NotImplementedException();
}
}

View File

@ -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;
/// <summary>
/// РТК план осцилляция
/// </summary>
public class ProcessMapPlanOscillationControllerTest :
ProcessMapPlanBaseControllerTest<ProcessMapPlanOscillation, ProcessMapPlanOscillationDto>
{
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<ProcessMapPlanOscillation> dbSet, ProcessMapPlanOscillationDto dto)
{
throw new NotImplementedException();
}
protected override ProcessMapPlanOscillationDto GetByNote(IEnumerable<ProcessMapPlanOscillationDto> dtos, ProcessMapPlanOscillationDto dto)
{
throw new NotImplementedException();
}
protected override ProcessMapPlanOscillation? GetByWellId()
{
throw new NotImplementedException();
}
}

View File

@ -11,15 +11,15 @@ namespace AsbCloudWebApi.Controllers.ProcessMaps;
/// <summary>
/// РТК план осцилляция
/// </summary>
public class ProcessMapPlanFunctionsOscillationController :
ProcessMapPlanBaseController<ProcessMapPlanFunctionsOscillation, ProcessMapPlanFunctionsOscillationDto>
public class ProcessMapPlanOscillationController :
ProcessMapPlanBaseController<ProcessMapPlanOscillation, ProcessMapPlanOscillationDto>
{
public ProcessMapPlanFunctionsOscillationController(
IChangeLogRepository<ProcessMapPlanFunctionsOscillationDto, ProcessMapPlanBaseRequestWithWell> repository,
public ProcessMapPlanOscillationController(
IChangeLogRepository<ProcessMapPlanOscillationDto, ProcessMapPlanBaseRequestWithWell> repository,
IWellService wellService,
ProcessMapPlanFunctionsOscillationParser parserService,
ProcessMapPlanOscillationParser parserService,
ITelemetryService telemetryService,
ProcessMapPlanFunctionsOscillationExportService processMapPlanExportService)
ProcessMapPlanOscillationExportService processMapPlanExportService)
: base(repository, wellService, parserService, processMapPlanExportService, telemetryService)
{
}