forked from ddrilling/AsbCloudServer
РТК конструкция скважины
This commit is contained in:
parent
af6aea6d46
commit
f8f829669b
@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace AsbCloudApp.Data.ProcessMaps;
|
||||
|
||||
/// <summary>
|
||||
/// РТК план выключение насоса
|
||||
/// </summary>
|
||||
public class ProcessMapPlanOperationSwitchPumpDto : ProcessMapPlanBaseDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Продолжительность, сек.
|
||||
/// </summary>
|
||||
[Range(0.0, 1800.0)]
|
||||
public double Duration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Лимит остаточного давления, атм.
|
||||
/// </summary>
|
||||
[Range(0.0, 100.0)]
|
||||
public double ResidualPressureLimit { get; set; }
|
||||
}
|
@ -30,6 +30,7 @@ namespace AsbCloudDb.Model
|
||||
public virtual DbSet<ProcessMapPlanOperationDeterminationOfOscillationAngles> ProcessMapPlanOperationDeterminationOfOscillationAngles => Set<ProcessMapPlanOperationDeterminationOfOscillationAngles>();
|
||||
public virtual DbSet<ProcessMapPlanOperationTFOrientation> ProcessMapPlanOperationTFOrientation => Set<ProcessMapPlanOperationTFOrientation>();
|
||||
public virtual DbSet<ProcessMapPlanOperationSwitchPump> ProcessMapPlanOperationSwitchPump => Set<ProcessMapPlanOperationSwitchPump>();
|
||||
public virtual DbSet<ProcessMapPlanSection> ProcessMapPlanSection => Set<ProcessMapPlanSection>();
|
||||
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
|
||||
public virtual DbSet<FileCategory> FileCategories => Set<FileCategory>();
|
||||
public virtual DbSet<FileInfo> Files => Set<FileInfo>();
|
||||
@ -501,6 +502,11 @@ namespace AsbCloudDb.Model
|
||||
.WithMany()
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
modelBuilder.Entity<ProcessMapPlanSection>()
|
||||
.HasOne(p => p.Author)
|
||||
.WithMany()
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
modelBuilder.Entity<ProcessMapPlanRotor>()
|
||||
.HasOne(p => p.Editor)
|
||||
.WithMany()
|
||||
@ -551,6 +557,11 @@ namespace AsbCloudDb.Model
|
||||
.WithMany()
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
modelBuilder.Entity<ProcessMapPlanSection>()
|
||||
.HasOne(p => p.Editor)
|
||||
.WithMany()
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
DefaultData.DefaultContextData.Fill(modelBuilder);
|
||||
}
|
||||
|
||||
|
@ -91,6 +91,7 @@ namespace AsbCloudDb.Model
|
||||
DbSet<ProcessMapPlanOperationDeterminationOfOscillationAngles> ProcessMapPlanOperationDeterminationOfOscillationAngles { get; }
|
||||
DbSet<ProcessMapPlanOperationTFOrientation> ProcessMapPlanOperationTFOrientation { get; }
|
||||
DbSet<ProcessMapPlanOperationSwitchPump> ProcessMapPlanOperationSwitchPump { get; }
|
||||
DbSet<ProcessMapPlanSection> ProcessMapPlanSection { get; }
|
||||
|
||||
Task<int> RefreshMaterializedViewAsync(string mwName, CancellationToken token);
|
||||
Task<int> RefreshMaterializedViewAsync<TEntity>(CancellationToken token) where TEntity : class;
|
||||
|
22
AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanSection.cs
Normal file
22
AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanSection.cs
Normal file
@ -0,0 +1,22 @@
|
||||
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_section"), Comment("Конструкция скважины")]
|
||||
public class ProcessMapPlanSection : ProcessMapPlanBase
|
||||
{
|
||||
[Column("outer_diameter"), Comment("Диаметр секции, мм., наружный")]
|
||||
[Range(0.0, 9999.9)]
|
||||
public double OuterDiameter { get; set; }
|
||||
|
||||
[Column("inner_diameter"), Comment("Диаметр секции, мм., внутренний")]
|
||||
[Range(0.0, 9999.9)]
|
||||
public double InnerDiameter { get; set; }
|
||||
|
||||
|
||||
[ForeignKey(nameof(IdPrevious))]
|
||||
public virtual ProcessMapPlanSection? Previous { get; set; }
|
||||
}
|
@ -201,6 +201,13 @@ namespace AsbCloudInfrastructure
|
||||
{
|
||||
Item = src.Adapt<ProcessMapPlanOperationSwitchPumpDto>()
|
||||
});
|
||||
|
||||
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanSectionDto>>.NewConfig()
|
||||
.Include<ProcessMapPlanSection, ChangeLogDto<ProcessMapPlanSectionDto>>()
|
||||
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanSectionDto>()
|
||||
{
|
||||
Item = src.Adapt<ProcessMapPlanSectionDto>()
|
||||
});
|
||||
}
|
||||
|
||||
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
|
||||
@ -302,6 +309,10 @@ namespace AsbCloudInfrastructure
|
||||
IChangeLogRepository<ProcessMapPlanOperationSwitchPumpDto, ProcessMapPlanBaseRequestWithWell>,
|
||||
ProcessMapPlanBaseRepository<ProcessMapPlanOperationSwitchPump, ProcessMapPlanOperationSwitchPumpDto>>();
|
||||
|
||||
services.AddTransient<
|
||||
IChangeLogRepository<ProcessMapPlanSectionDto, ProcessMapPlanBaseRequestWithWell>,
|
||||
ProcessMapPlanBaseRepository<ProcessMapPlanSection, ProcessMapPlanSectionDto>>();
|
||||
|
||||
services.AddTransient<IProcessMapReportDrillingService, ProcessMapReportDrillingService>();
|
||||
|
||||
services.AddTransient<TrajectoryService>();
|
||||
@ -357,6 +368,7 @@ namespace AsbCloudInfrastructure
|
||||
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationDeterminationOfOscillationAnglesDto>>();
|
||||
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationTFOrientationDto>>();
|
||||
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationSwitchPumpDto>>();
|
||||
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanSectionDto>>();
|
||||
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
|
||||
services.AddTransient<IUserRepository, UserRepository>();
|
||||
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
|
||||
@ -421,6 +433,7 @@ namespace AsbCloudInfrastructure
|
||||
services.AddTransient<ProcessMapPlanOperationDeterminationOfOscillationAnglesParser>();
|
||||
services.AddTransient<ProcessMapPlanOperationTFOrientationParser>();
|
||||
services.AddTransient<ProcessMapPlanOperationSwitchPumpParser>();
|
||||
services.AddTransient<ProcessMapPlanSectionParser>();
|
||||
|
||||
services.AddTransient<TrajectoryPlanExportService>();
|
||||
services.AddTransient<TrajectoryFactManualExportService>();
|
||||
@ -437,6 +450,7 @@ namespace AsbCloudInfrastructure
|
||||
services.AddTransient<ProcessMapPlanOperationDeterminationOfOscillationAnglesExportService>();
|
||||
services.AddTransient<ProcessMapPlanOperationTFOrientationExportService>();
|
||||
services.AddTransient<ProcessMapPlanOperationSwitchPumpExportService>();
|
||||
services.AddTransient<ProcessMapPlanSectionExportService>();
|
||||
|
||||
services.AddTransient<WellOperationParserFactory>();
|
||||
services.AddTransient<WellOperationExportServiceFactory>();
|
||||
|
@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
|
||||
|
||||
public class ProcessMapPlanSectionTemplate : ITemplateParameters
|
||||
{
|
||||
public string SheetName => "Конструкция скважины";
|
||||
|
||||
public int HeaderRowsCount => 2;
|
||||
|
||||
public string FileName => "ProcessMapPlanSectionTemplate.xlsx";
|
||||
|
||||
public IDictionary<string, Cell> Cells => new Dictionary<string, Cell>
|
||||
{
|
||||
|
||||
};
|
||||
}
|
@ -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 ProcessMapPlanSectionExportService : ProcessMapPlanExportService<ProcessMapPlanSectionDto>
|
||||
{
|
||||
public ProcessMapPlanSectionExportService(
|
||||
IChangeLogRepository<ProcessMapPlanSectionDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
|
||||
IWellService wellService)
|
||||
: base(processMapPlanRepository, wellService)
|
||||
{
|
||||
}
|
||||
|
||||
protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanSectionTemplate();
|
||||
|
||||
protected override async Task<string> BuildFileNameAsync(WellRelatedExportRequest options, CancellationToken token)
|
||||
{
|
||||
var caption = await wellService.GetWellCaptionByIdAsync(options.IdWell, token);
|
||||
|
||||
return $"{caption}_РТК_План_конструкция_скважины.xlsx";
|
||||
}
|
||||
}
|
@ -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 ProcessMapPlanSectionParser : ProcessMapPlanParser<ProcessMapPlanSectionDto>
|
||||
{
|
||||
public ProcessMapPlanSectionParser(IWellOperationRepository wellOperationRepository)
|
||||
: base(wellOperationRepository)
|
||||
{
|
||||
}
|
||||
|
||||
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanSectionTemplate();
|
||||
|
||||
protected override ProcessMapPlanSectionDto 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;
|
||||
}
|
||||
}
|
@ -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 ProcessMapPlanSectionController :
|
||||
ProcessMapPlanBaseController<ProcessMapPlanSection, ProcessMapPlanSectionDto>
|
||||
{
|
||||
public ProcessMapPlanSectionController(
|
||||
IChangeLogRepository<ProcessMapPlanSectionDto, ProcessMapPlanBaseRequestWithWell> repository,
|
||||
IWellService wellService,
|
||||
ProcessMapPlanSectionParser parserService,
|
||||
ITelemetryService telemetryService,
|
||||
ProcessMapPlanSectionExportService processMapPlanExportService)
|
||||
: base(repository, wellService, parserService, processMapPlanExportService, telemetryService)
|
||||
{
|
||||
}
|
||||
|
||||
protected override string TemplateFileName => "ЕЦП_шаблон_файла_РТК_план_конструкция_скважины.xlsx";
|
||||
}
|
Loading…
Reference in New Issue
Block a user