Определение углов осцилляции

This commit is contained in:
Olga Nemt 2024-06-25 11:05:18 +05:00
parent 4b155cb893
commit 52b1e6c043
9 changed files with 232 additions and 0 deletions

View File

@ -0,0 +1,46 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudApp.Data.ProcessMaps;
/// <summary>
/// РТК план определения углов осцилляции
/// </summary>
public class ProcessMapPlanOperationDeterminationOfOscillationAnglesDto : ProcessMapPlanBaseDto
{
/// <summary>
/// Максимальное давление, атм
/// </summary>
[Range(0.0, 400.0)]
public double MaxPressure { get; set; }
/// <summary>
/// Перепад давления, атм.
/// </summary>
[Range(0.0, 60.0)]
public double DifferentialPressure { get; set; }
/// <summary>
/// Уставки, т., затяжка
/// </summary>
[Range(0.0, 20.0)]
public double SetpointsTight { get; set; }
/// <summary>
/// Уставки, т., посадка
/// </summary>
[Range(0.0, 20.0)]
public double SetpointsSlackingOff { get; set; }
/// <summary>
/// Скорость, м/ч., Вверх
/// </summary>
[Range(0.0, 999.0)]
public double Reaming1ROPUp { get; set; }
/// <summary>
/// Скорость, м/ч., Вниз
/// </summary>
[Range(0.0, 999.0)]
public double Reaming1ROPDown { get; set; }
}

View File

@ -27,6 +27,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<ProcessMapPlanOperationLoadCapacity> ProcessMapPlanOperationLoadCapacity => Set<ProcessMapPlanOperationLoadCapacity>();
public virtual DbSet<ProcessMapPlanSurvey> ProcessMapPlanSurvey => Set<ProcessMapPlanSurvey>();
public virtual DbSet<ProcessMapPlanOperationPositioningOffTheBottom> ProcessMapPlanOperationPositioningOffTheBottom => Set<ProcessMapPlanOperationPositioningOffTheBottom>();
public virtual DbSet<ProcessMapPlanOperationDeterminationOfOscillationAngles> ProcessMapPlanOperationDeterminationOfOscillationAngles => Set<ProcessMapPlanOperationDeterminationOfOscillationAngles>();
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
public virtual DbSet<FileCategory> FileCategories => Set<FileCategory>();
public virtual DbSet<FileInfo> Files => Set<FileInfo>();
@ -483,6 +484,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanOperationDeterminationOfOscillationAngles>()
.HasOne(p => p.Author)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanRotor>()
.HasOne(p => p.Editor)
.WithMany()
@ -518,6 +524,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanOperationDeterminationOfOscillationAngles>()
.HasOne(p => p.Editor)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
DefaultData.DefaultContextData.Fill(modelBuilder);
}

View File

@ -88,6 +88,7 @@ namespace AsbCloudDb.Model
DbSet<ProcessMapPlanOperationLoadCapacity> ProcessMapPlanOperationLoadCapacity { get; }
DbSet<ProcessMapPlanSurvey> ProcessMapPlanSurvey { get; }
DbSet<ProcessMapPlanOperationPositioningOffTheBottom> ProcessMapPlanOperationPositioningOffTheBottom { get; }
DbSet<ProcessMapPlanOperationDeterminationOfOscillationAngles> ProcessMapPlanOperationDeterminationOfOscillationAngles { get; }
Task<int> RefreshMaterializedViewAsync(string mwName, CancellationToken token);
Task<int> RefreshMaterializedViewAsync<TEntity>(CancellationToken token) where TEntity : class;

View File

@ -0,0 +1,43 @@
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_oscillation_angels"), Comment("Определение углов осцилляции")]
public class ProcessMapPlanOperationDeterminationOfOscillationAngles : 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("reaming1_rop_up"), Comment("Скорость, м/ч., Вверх")]
[Range(0.0, 999.0)]
[Required]
public double Reaming1ROPUp { get; set; }
[Column("reaming1_rop_down"), Comment("Скорость, м/ч., Вниз")]
[Range(0.0, 999.0)]
[Required]
public double Reaming1ROPDown { get; set; }
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanOperationDeterminationOfOscillationAngles? Previous { get; set; }
}

View File

@ -180,6 +180,13 @@ namespace AsbCloudInfrastructure
{
Item = src.Adapt<ProcessMapPlanOperationPositioningOffTheBottomDto>()
});
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanOperationDeterminationOfOscillationAnglesDto>>.NewConfig()
.Include<ProcessMapPlanOperationDeterminationOfOscillationAngles, ChangeLogDto<ProcessMapPlanOperationDeterminationOfOscillationAnglesDto>>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanOperationDeterminationOfOscillationAnglesDto>()
{
Item = src.Adapt<ProcessMapPlanOperationDeterminationOfOscillationAnglesDto>()
});
}
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
@ -269,6 +276,10 @@ namespace AsbCloudInfrastructure
IChangeLogRepository<ProcessMapPlanOperationPositioningOffTheBottomDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanOperationPositioningOffTheBottom, ProcessMapPlanOperationPositioningOffTheBottomDto>>();
services.AddTransient<
IChangeLogRepository<ProcessMapPlanOperationDeterminationOfOscillationAnglesDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanOperationDeterminationOfOscillationAngles, ProcessMapPlanOperationDeterminationOfOscillationAnglesDto>>();
services.AddTransient<IProcessMapReportDrillingService, ProcessMapReportDrillingService>();
services.AddTransient<TrajectoryService>();
@ -321,6 +332,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationLoadCapacityDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanSurveyDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationPositioningOffTheBottomDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationDeterminationOfOscillationAnglesDto>>();
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
services.AddTransient<IUserRepository, UserRepository>();
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
@ -382,6 +394,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanOperationLoadCapacityParser>();
services.AddTransient<ProcessMapPlanSurveyParser>();
services.AddTransient<ProcessMapPlanOperationPositioningOffTheBottomParser>();
services.AddTransient<ProcessMapPlanOperationDeterminationOfOscillationAnglesParser>();
services.AddTransient<TrajectoryPlanExportService>();
services.AddTransient<TrajectoryFactManualExportService>();
@ -395,6 +408,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanOperationLoadCapacityExportService>();
services.AddTransient<ProcessMapPlanSurveyExportService>();
services.AddTransient<ProcessMapPlanOperationPositioningOffTheBottomExportService>();
services.AddTransient<ProcessMapPlanOperationDeterminationOfOscillationAnglesExportService>();
services.AddTransient<WellOperationParserFactory>();
services.AddTransient<WellOperationExportServiceFactory>();

View File

@ -0,0 +1,17 @@
using System.Collections.Generic;
namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
public class ProcessMapPlanOperationDeterminationOfOscillationAnglesTemplate : ITemplateParameters
{
public string SheetName => "Определение углов осцилляции";
public int HeaderRowsCount => 2;
public string FileName => "ProcessMapPlanOperationDeterminationOfOscillationAnglesTemplate.xlsx";
public IDictionary<string, Cell> Cells => new Dictionary<string, Cell>
{
};
}

View File

@ -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 ProcessMapPlanOperationDeterminationOfOscillationAnglesExportService : ProcessMapPlanExportService<ProcessMapPlanOperationDeterminationOfOscillationAnglesDto>
{
public ProcessMapPlanOperationDeterminationOfOscillationAnglesExportService(
IChangeLogRepository<ProcessMapPlanOperationDeterminationOfOscillationAnglesDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
IWellService wellService)
: base(processMapPlanRepository, wellService)
{
}
protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanOperationDeterminationOfOscillationAnglesTemplate();
protected override async Task<string> BuildFileNameAsync(WellRelatedExportRequest options, CancellationToken token)
{
var caption = await wellService.GetWellCaptionByIdAsync(options.IdWell, token);
return $"{caption}_РТК_План_определения_углов_осцилляции.xlsx";
}
}

View File

@ -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 ProcessMapPlanOperationDeterminationOfOscillationAnglesParser : ProcessMapPlanParser<ProcessMapPlanOperationDeterminationOfOscillationAnglesDto>
{
public ProcessMapPlanOperationDeterminationOfOscillationAnglesParser(IWellOperationRepository wellOperationRepository)
: base(wellOperationRepository)
{
}
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanOperationDeterminationOfOscillationAnglesTemplate();
protected override ProcessMapPlanOperationDeterminationOfOscillationAnglesDto BuildDto(IDictionary<string, object?> 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;
}
}

View File

@ -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;
/// <summary>
/// РТК план определения углов осцилляции
/// </summary>
public class ProcessMapPlanOperationDeterminationOfOscillationAnglesController :
ProcessMapPlanBaseController<ProcessMapPlanOperationDeterminationOfOscillationAngles, ProcessMapPlanOperationDeterminationOfOscillationAnglesDto>
{
public ProcessMapPlanOperationDeterminationOfOscillationAnglesController(
IChangeLogRepository<ProcessMapPlanOperationDeterminationOfOscillationAnglesDto, ProcessMapPlanBaseRequestWithWell> repository,
IWellService wellService,
ProcessMapPlanOperationDeterminationOfOscillationAnglesParser parserService,
ITelemetryService telemetryService,
ProcessMapPlanOperationDeterminationOfOscillationAnglesExportService processMapPlanExportService)
: base(repository, wellService, parserService, processMapPlanExportService, telemetryService)
{
}
protected override string TemplateFileName => "ЕЦП_шаблон_файла_РТК_план_позиционированиеад_забоем.xlsx";
}