РТК план выставление

This commit is contained in:
Olga Nemt 2024-06-25 15:22:32 +05:00
parent 52b1e6c043
commit 0c8632b6f3
11 changed files with 322 additions and 2 deletions

View File

@ -0,0 +1,94 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data.ProcessMaps;
/// <summary>
/// РТК план выставление
/// </summary>
public class ProcessMapPlanOperationTFOrientationDto : ProcessMapPlanBaseDto
{
/// <summary>
/// План TF, град
/// </summary>
[Range(0.0, 360.0)]
public double planTF { get; set; }
/// <summary>
/// Пружина, град
/// </summary>
[Range(0.0, 10000.0)]
public double Spring { get; set; }
/// <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, 35.0)]
public double MaxTorque { get; set; }
/// <summary>
/// Проработка 1, Количество расхаживаний, шт
/// </summary>
[Range(0.0, 99.0)]
public double Reaming1NumberOfRepetitions { get; set; }
/// <summary>
/// Проработка 1, Скорость, м/ч., Вверх
/// </summary>
[Range(0.0, 999.0)]
public double Reaming1ROPUp { get; set; }
/// <summary>
/// Проработка 1, Скорость, м/ч., Вниз
/// </summary>
[Range(0.0, 999.0)]
public double Reaming1ROPDown { get; set; }
/// <summary>
/// Проработка 1, Расход, л/с., Вверх
/// </summary>
[Range(0.0, 100.0)]
public double Reaming1FlowRateUp { get; set; }
/// <summary>
/// Проработка 1, Расход, л/с., Вниз
/// </summary>
[Range(0.0, 100.0)]
public double Reaming1FlowRateDown { get; set; }
/// <summary>
/// Проработка 1, Интервал расхаживания, м.
/// </summary>
[Range(0.0, 30.0)]
public double Reaming1Interval { get; set; }
/// <summary>
/// Остановка над забоем, м.
/// </summary>
[Range(0.0, 10.0)]
public double Reaming1StopPointOffBottom { get; set; }
}

View File

@ -28,6 +28,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<ProcessMapPlanSurvey> ProcessMapPlanSurvey => Set<ProcessMapPlanSurvey>();
public virtual DbSet<ProcessMapPlanOperationPositioningOffTheBottom> ProcessMapPlanOperationPositioningOffTheBottom => Set<ProcessMapPlanOperationPositioningOffTheBottom>();
public virtual DbSet<ProcessMapPlanOperationDeterminationOfOscillationAngles> ProcessMapPlanOperationDeterminationOfOscillationAngles => Set<ProcessMapPlanOperationDeterminationOfOscillationAngles>();
public virtual DbSet<ProcessMapPlanOperationTFOrientation> ProcessMapPlanOperationTFOrientation => Set<ProcessMapPlanOperationTFOrientation>();
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
public virtual DbSet<FileCategory> FileCategories => Set<FileCategory>();
public virtual DbSet<FileInfo> Files => Set<FileInfo>();
@ -489,6 +490,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanOperationTFOrientation>()
.HasOne(p => p.Author)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanRotor>()
.HasOne(p => p.Editor)
.WithMany()
@ -529,6 +535,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanOperationTFOrientation>()
.HasOne(p => p.Editor)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
DefaultData.DefaultContextData.Fill(modelBuilder);
}

View File

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

View File

@ -78,7 +78,7 @@ public class ProcessMapPlanOperationReamingRotor : ProcessMapPlanBase
[Required]
public double Reaming1StopPointOffBottom { get; set; }
[Column("reaming2_number_of_ repetitions"), Comment("Проработка 2, Количество повторений, шт.")]
[Column("reaming2_number_of_repetitions"), Comment("Проработка 2, Количество повторений, шт.")]
[Range(0.0, 99.0)]
public double Reaming2NumberOfRepetitions { get; set; }

View File

@ -33,7 +33,7 @@ public class ProcessMapPlanOperationReamingSlide : ProcessMapPlanBase
[Required]
public double MaxTorque { get; set; }
[Column("reaming1_number_of_ repetitions"), Comment("Проработка 1, Количество повторений, шт.")]
[Column("reaming1_number_of_repetitions"), Comment("Проработка 1, Количество повторений, шт.")]
[Range(0.0, 99.0)]
[Required]
public double Reaming1NumberOfRepetitions { get; set; }

View File

@ -0,0 +1,83 @@
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_tf_orientation"), Comment("Выставление")]
public class ProcessMapPlanOperationTFOrientation : ProcessMapPlanBase
{
[Column("plan_tf"), Comment("План TF, град")]
[Range(0.0, 360.0)]
[Required]
public double planTF { get; set; }
[Column("spring"), Comment("Пружина, град ")]
[Range(0.0, 10000.0)]
[Required]
public double Spring { get; set; }
[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_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; }
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanOperationTFOrientation? Previous { get; set; }
}

View File

@ -187,6 +187,13 @@ namespace AsbCloudInfrastructure
{
Item = src.Adapt<ProcessMapPlanOperationDeterminationOfOscillationAnglesDto>()
});
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanOperationTFOrientationDto>>.NewConfig()
.Include<ProcessMapPlanOperationTFOrientation, ChangeLogDto<ProcessMapPlanOperationTFOrientationDto>>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanOperationTFOrientationDto>()
{
Item = src.Adapt<ProcessMapPlanOperationTFOrientationDto>()
});
}
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
@ -280,6 +287,10 @@ namespace AsbCloudInfrastructure
IChangeLogRepository<ProcessMapPlanOperationDeterminationOfOscillationAnglesDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanOperationDeterminationOfOscillationAngles, ProcessMapPlanOperationDeterminationOfOscillationAnglesDto>>();
services.AddTransient<
IChangeLogRepository<ProcessMapPlanOperationTFOrientationDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanOperationTFOrientation, ProcessMapPlanOperationTFOrientationDto>>();
services.AddTransient<IProcessMapReportDrillingService, ProcessMapReportDrillingService>();
services.AddTransient<TrajectoryService>();
@ -333,6 +344,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanSurveyDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationPositioningOffTheBottomDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationDeterminationOfOscillationAnglesDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationTFOrientationDto>>();
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
services.AddTransient<IUserRepository, UserRepository>();
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
@ -395,6 +407,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanSurveyParser>();
services.AddTransient<ProcessMapPlanOperationPositioningOffTheBottomParser>();
services.AddTransient<ProcessMapPlanOperationDeterminationOfOscillationAnglesParser>();
services.AddTransient<ProcessMapPlanOperationTFOrientationParser>();
services.AddTransient<TrajectoryPlanExportService>();
services.AddTransient<TrajectoryFactManualExportService>();
@ -409,6 +422,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanSurveyExportService>();
services.AddTransient<ProcessMapPlanOperationPositioningOffTheBottomExportService>();
services.AddTransient<ProcessMapPlanOperationDeterminationOfOscillationAnglesExportService>();
services.AddTransient<ProcessMapPlanOperationTFOrientationExportService>();
services.AddTransient<WellOperationParserFactory>();
services.AddTransient<WellOperationExportServiceFactory>();

View File

@ -0,0 +1,17 @@
using System.Collections.Generic;
namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
public class ProcessMapPlanOperationTFOrientationTemplate : ITemplateParameters
{
public string SheetName => "Определение выставление";
public int HeaderRowsCount => 2;
public string FileName => "ProcessMapPlanOperationTFOrientationTemplate.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 ProcessMapPlanOperationTFOrientationExportService : ProcessMapPlanExportService<ProcessMapPlanOperationTFOrientationDto>
{
public ProcessMapPlanOperationTFOrientationExportService(
IChangeLogRepository<ProcessMapPlanOperationTFOrientationDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
IWellService wellService)
: base(processMapPlanRepository, wellService)
{
}
protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanOperationTFOrientationTemplate();
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 ProcessMapPlanOperationTFOrientationParser : ProcessMapPlanParser<ProcessMapPlanOperationTFOrientationDto>
{
public ProcessMapPlanOperationTFOrientationParser(IWellOperationRepository wellOperationRepository)
: base(wellOperationRepository)
{
}
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanOperationTFOrientationTemplate();
protected override ProcessMapPlanOperationTFOrientationDto 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 ProcessMapPlanOperationTFOrientationController :
ProcessMapPlanBaseController<ProcessMapPlanOperationTFOrientation, ProcessMapPlanOperationTFOrientationDto>
{
public ProcessMapPlanOperationTFOrientationController(
IChangeLogRepository<ProcessMapPlanOperationTFOrientationDto, ProcessMapPlanBaseRequestWithWell> repository,
IWellService wellService,
ProcessMapPlanOperationTFOrientationParser parserService,
ITelemetryService telemetryService,
ProcessMapPlanOperationTFOrientationExportService processMapPlanExportService)
: base(repository, wellService, parserService, processMapPlanExportService, telemetryService)
{
}
protected override string TemplateFileName => "ЕЦП_шаблон_файла_РТК_план_выставление.xlsx";
}