Выработка нагрузки

This commit is contained in:
Olga Nemt 2024-06-24 16:45:58 +05:00
parent 328f580100
commit 8a506d3683
8 changed files with 174 additions and 0 deletions

View File

@ -24,6 +24,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<ProcessMapPlanReam> ProcessMapPlanReams => Set<ProcessMapPlanReam>();
public virtual DbSet<ProcessMapPlanOperationReamingRotor> ProcessMapPlanOperationReamingRotor => Set<ProcessMapPlanOperationReamingRotor>();
public virtual DbSet<ProcessMapPlanOperationReamingSlide> ProcessMapPlanOperationReamingSlide => Set<ProcessMapPlanOperationReamingSlide>();
public virtual DbSet<ProcessMapPlanOperationLoadCapacity> ProcessMapPlanOperationLoadCapacity => Set<ProcessMapPlanOperationLoadCapacity>();
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
public virtual DbSet<FileCategory> FileCategories => Set<FileCategory>();
public virtual DbSet<FileInfo> Files => Set<FileInfo>();
@ -465,6 +466,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanOperationLoadCapacity>()
.HasOne(p => p.Author)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanRotor>()
.HasOne(p => p.Editor)
.WithMany()
@ -485,6 +491,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanOperationLoadCapacity>()
.HasOne(p => p.Editor)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
DefaultData.DefaultContextData.Fill(modelBuilder);
}

View File

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

View File

@ -0,0 +1,31 @@
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_load_capacity"), Comment("РТК выработка нагрузки")]
public class ProcessMapPlanOperationLoadCapacity : ProcessMapPlanBase
{
[Column("time_load_capacity_min"), Comment("Время выработки минимальное, сек")]
[Range(0.0, 800.0)]
[Required]
public double TimeLoadCapacityMin { get; set; }
[Column("differential_pressure_min"), Comment("Перепад давления минимальный, атм")]
[Range(0.1, 400.0)]
[Required]
public double DifferentialPressureMin { get; set; }
[Column("weight_on_bit_min"), Comment("Нагрузка минимальная, т")]
[Range(0.1, 99.0)]
[Required]
public double WeightOnBitMin { get; set; }
[Column("note"), Comment("Примечание"), StringLength(1024)]
public string Note { get; set; } = string.Empty;
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanOperationLoadCapacity? Previous { get; set; }
}

View File

@ -159,6 +159,13 @@ namespace AsbCloudInfrastructure
{
Item = src.Adapt<ProcessMapPlanOperationReamingSlideDto>()
});
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanOperationLoadCapacityDto>>.NewConfig()
.Include<ProcessMapPlanOperationLoadCapacity, ChangeLogDto<ProcessMapPlanOperationLoadCapacityDto>>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanOperationLoadCapacityDto>()
{
Item = src.Adapt<ProcessMapPlanOperationLoadCapacityDto>()
});
}
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
@ -236,6 +243,10 @@ namespace AsbCloudInfrastructure
IChangeLogRepository<ProcessMapPlanOperationReamingSlideDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanOperationReamingSlide, ProcessMapPlanOperationReamingSlideDto>>();
services.AddTransient<
IChangeLogRepository<ProcessMapPlanOperationLoadCapacityDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanOperationLoadCapacity, ProcessMapPlanOperationLoadCapacityDto>>();
services.AddTransient<IProcessMapReportDrillingService, ProcessMapReportDrillingService>();
services.AddTransient<TrajectoryService>();
@ -285,6 +296,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanSlideDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationReamingRotorDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationReamingSlideDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationLoadCapacityDto>>();
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
services.AddTransient<IUserRepository, UserRepository>();
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
@ -343,6 +355,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanReamParser>();
services.AddTransient<ProcessMapPlanOperationReamingRotorParser>();
services.AddTransient<ProcessMapPlanOperationReamingSlideParser>();
services.AddTransient<ProcessMapPlanOperationLoadCapacityParser>();
services.AddTransient<TrajectoryPlanExportService>();
services.AddTransient<TrajectoryFactManualExportService>();
@ -353,6 +366,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanReamExportService>();
services.AddTransient<ProcessMapPlanOperationReamingRotorExportService>();
services.AddTransient<ProcessMapPlanOperationReamingSlideExportService>();
services.AddTransient<ProcessMapPlanOperationLoadCapacityExportService>();
services.AddTransient<WellOperationParserFactory>();
services.AddTransient<WellOperationExportServiceFactory>();

View File

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