Запись статического замера

This commit is contained in:
Olga Nemt 2024-06-25 09:24:34 +05:00
parent 8a506d3683
commit 5171eed3a7
8 changed files with 161 additions and 0 deletions

View File

@ -25,6 +25,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<ProcessMapPlanOperationReamingRotor> ProcessMapPlanOperationReamingRotor => Set<ProcessMapPlanOperationReamingRotor>();
public virtual DbSet<ProcessMapPlanOperationReamingSlide> ProcessMapPlanOperationReamingSlide => Set<ProcessMapPlanOperationReamingSlide>();
public virtual DbSet<ProcessMapPlanOperationLoadCapacity> ProcessMapPlanOperationLoadCapacity => Set<ProcessMapPlanOperationLoadCapacity>();
public virtual DbSet<ProcessMapPlanSurvey> ProcessMapPlanSurvey => Set<ProcessMapPlanSurvey>();
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
public virtual DbSet<FileCategory> FileCategories => Set<FileCategory>();
public virtual DbSet<FileInfo> Files => Set<FileInfo>();
@ -471,6 +472,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanSurvey>()
.HasOne(p => p.Author)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanRotor>()
.HasOne(p => p.Editor)
.WithMany()
@ -496,6 +502,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanSurvey>()
.HasOne(p => p.Editor)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
DefaultData.DefaultContextData.Fill(modelBuilder);
}

View File

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

View File

@ -0,0 +1,18 @@
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_survey"), Comment("Запись статического замера")]
public class ProcessMapPlanSurvey : ProcessMapPlanBase
{
[Column("measurement_recording_time"), Comment("Время записи замера, сек")]
[Range(0.0, 1800.0)]
[Required]
public double MeasurementRecordingTime { get; set; }
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanSurvey? Previous { get; set; }
}

View File

@ -166,6 +166,13 @@ namespace AsbCloudInfrastructure
{
Item = src.Adapt<ProcessMapPlanOperationLoadCapacityDto>()
});
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanSurveyDto>>.NewConfig()
.Include<ProcessMapPlanSurvey, ChangeLogDto<ProcessMapPlanSurveyDto>>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanSurveyDto>()
{
Item = src.Adapt<ProcessMapPlanSurveyDto>()
});
}
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
@ -247,6 +254,10 @@ namespace AsbCloudInfrastructure
IChangeLogRepository<ProcessMapPlanOperationLoadCapacityDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanOperationLoadCapacity, ProcessMapPlanOperationLoadCapacityDto>>();
services.AddTransient<
IChangeLogRepository<ProcessMapPlanSurveyDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanSurvey, ProcessMapPlanSurveyDto>>();
services.AddTransient<IProcessMapReportDrillingService, ProcessMapReportDrillingService>();
services.AddTransient<TrajectoryService>();
@ -297,6 +308,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationReamingRotorDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationReamingSlideDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationLoadCapacityDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanSurveyDto>>();
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
services.AddTransient<IUserRepository, UserRepository>();
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
@ -356,6 +368,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanOperationReamingRotorParser>();
services.AddTransient<ProcessMapPlanOperationReamingSlideParser>();
services.AddTransient<ProcessMapPlanOperationLoadCapacityParser>();
services.AddTransient<ProcessMapPlanSurveyParser>();
services.AddTransient<TrajectoryPlanExportService>();
services.AddTransient<TrajectoryFactManualExportService>();
@ -367,6 +380,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanOperationReamingRotorExportService>();
services.AddTransient<ProcessMapPlanOperationReamingSlideExportService>();
services.AddTransient<ProcessMapPlanOperationLoadCapacityExportService>();
services.AddTransient<ProcessMapPlanSurveyExportService>();
services.AddTransient<WellOperationParserFactory>();
services.AddTransient<WellOperationExportServiceFactory>();

View File

@ -0,0 +1,17 @@
using System.Collections.Generic;
namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
public class ProcessMapPlanSurveyTemplate : ITemplateParameters
{
public string SheetName => "Запись статического замера";
public int HeaderRowsCount => 2;
public string FileName => "ProcessMapPlanSurveyTemplate.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 ProcessMapPlanSurveyExportService : ProcessMapPlanExportService<ProcessMapPlanSurveyDto>
{
public ProcessMapPlanSurveyExportService(
IChangeLogRepository<ProcessMapPlanSurveyDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
IWellService wellService)
: base(processMapPlanRepository, wellService)
{
}
protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanSurveyTemplate();
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 ProcessMapPlanSurveyParser : ProcessMapPlanParser<ProcessMapPlanSurveyDto>
{
public ProcessMapPlanSurveyParser(IWellOperationRepository wellOperationRepository)
: base(wellOperationRepository)
{
}
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanSurveyTemplate();
protected override ProcessMapPlanSurveyDto 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 ProcessMapPlanSurveyController :
ProcessMapPlanBaseController<ProcessMapPlanSurvey, ProcessMapPlanSurveyDto>
{
public ProcessMapPlanSurveyController(
IChangeLogRepository<ProcessMapPlanSurveyDto, ProcessMapPlanBaseRequestWithWell> repository,
IWellService wellService,
ProcessMapPlanSurveyParser parserService,
ITelemetryService telemetryService,
ProcessMapPlanSurveyExportService processMapPlanExportService)
: base(repository, wellService, parserService, processMapPlanExportService, telemetryService)
{
}
protected override string TemplateFileName => "ЕЦП_шаблон_файла_РТК_план_запись_статическогоамера.xlsx";
}