forked from ddrilling/AsbCloudServer
РТК план дрилтест
This commit is contained in:
parent
e1c80c65b6
commit
38559d65ae
@ -0,0 +1,33 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AsbCloudApp.Data.ProcessMaps;
|
||||
|
||||
/// <summary>
|
||||
/// РТК план конструкция скважины
|
||||
/// </summary>
|
||||
public class ProcessMapPlanOperationSwitchModeDto : ProcessMapPlanBaseDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Выход на плановый расход, время выхода буровых насосов на плановый расход, сек.
|
||||
/// </summary>
|
||||
[Range(0.0, 3600.0)]
|
||||
public double ExitTimeConsumption { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Выход на плановый расход, расход, л/с
|
||||
/// </summary>
|
||||
[Range(0.0, 100.0)]
|
||||
public double ConsumptionFlowRate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Максимально допустимое давление, атм.
|
||||
/// </summary>
|
||||
[Range(0.0, 400.0)]
|
||||
public double PressureLimitMax { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Комментарий
|
||||
/// </summary>
|
||||
public double Comment { get; set; }
|
||||
}
|
@ -15,7 +15,7 @@ namespace AsbCloudDb.Model
|
||||
public virtual DbSet<Cluster> Clusters => Set<Cluster>();
|
||||
public virtual DbSet<Company> Companies => Set<Company>();
|
||||
public virtual DbSet<CompanyType> CompaniesTypes => Set<CompanyType>();
|
||||
public virtual DbSet<DailyReport> DailyReports => Set <DailyReport>();
|
||||
public virtual DbSet<DailyReport> DailyReports => Set<DailyReport>();
|
||||
public virtual DbSet<Deposit> Deposits => Set<Deposit>();
|
||||
public virtual DbSet<DetectedOperation> DetectedOperations => Set<DetectedOperation>();
|
||||
public virtual DbSet<TrajectoryPlan> TrajectoriesPlan => Set<TrajectoryPlan>();
|
||||
@ -30,7 +30,8 @@ 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<ProcessMapPlanOperationSwitchMode> ProcessMapPlanSection => Set<ProcessMapPlanOperationSwitchMode>();
|
||||
public virtual DbSet<ProcessMapPlanOperationSwitchMode> ProcessMapPlanOperationSwitchMode => Set<ProcessMapPlanOperationSwitchMode>();
|
||||
public virtual DbSet<ProcessMapPlanFunctionsDrillTest> ProcessMapPlanFunctionsDrillTest => Set<ProcessMapPlanFunctionsDrillTest>();
|
||||
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
|
||||
public virtual DbSet<FileCategory> FileCategories => Set<FileCategory>();
|
||||
public virtual DbSet<FileInfo> Files => Set<FileInfo>();
|
||||
@ -71,7 +72,7 @@ namespace AsbCloudDb.Model
|
||||
|
||||
public virtual DbSet<TelemetryWirelineRunOut> TelemetryWirelineRunOut => Set<TelemetryWirelineRunOut>();
|
||||
public virtual DbSet<TrajectoryFact> TrajectoriesFact => Set<TrajectoryFact>();
|
||||
|
||||
|
||||
public virtual DbSet<WellSectionPlan> WellSectionsPlan => Set<WellSectionPlan>();
|
||||
|
||||
// GTR WITS
|
||||
@ -118,7 +119,7 @@ namespace AsbCloudDb.Model
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
optionsBuilder.UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True;"
|
||||
//, builder=>builder.EnableRetryOnFailure(2, System.TimeSpan.FromMinutes(1))
|
||||
@ -145,7 +146,7 @@ namespace AsbCloudDb.Model
|
||||
|
||||
entity.Property(e => e.Timezone)
|
||||
.HasJsonConversion();
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Well>(entity =>
|
||||
{
|
||||
@ -296,7 +297,7 @@ namespace AsbCloudDb.Model
|
||||
entity.HasIndex(d => d.DepthEnd);
|
||||
entity.HasIndex(d => d.DateStart);
|
||||
|
||||
entity.HasOne(o => o.OperationPlan)
|
||||
entity.HasOne(o => o.OperationPlan)
|
||||
.WithMany()
|
||||
.HasForeignKey(o => o.IdPlan)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
@ -351,7 +352,7 @@ namespace AsbCloudDb.Model
|
||||
{
|
||||
entity.HasIndex(e => new { e.IdWell, e.Date })
|
||||
.IsUnique();
|
||||
|
||||
|
||||
entity.Property(e => e.SubsystemBlock)
|
||||
.HasJsonConversion();
|
||||
|
||||
@ -363,7 +364,7 @@ namespace AsbCloudDb.Model
|
||||
});
|
||||
|
||||
modelBuilder.Entity<DetectedOperation>(entity => entity
|
||||
.Property(p=>p.ExtraData)
|
||||
.Property(p => p.ExtraData)
|
||||
.HasJsonConversion());
|
||||
|
||||
modelBuilder.Entity<TelemetryDataSaubStat>(entity =>
|
||||
@ -380,7 +381,8 @@ namespace AsbCloudDb.Model
|
||||
.HasConstraintName("t_schedule_t_driller_id_driller");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<SetpointsRequest>(entity => {
|
||||
modelBuilder.Entity<SetpointsRequest>(entity =>
|
||||
{
|
||||
entity.Property(e => e.Setpoints)
|
||||
.HasJsonConversion();
|
||||
});
|
||||
@ -392,7 +394,7 @@ namespace AsbCloudDb.Model
|
||||
nameof(WitsItemBase<float>.IdRecord),
|
||||
nameof(WitsItemBase<float>.IdItem),
|
||||
nameof(WitsItemBase<float>.DateTime));
|
||||
});
|
||||
});
|
||||
modelBuilder.Entity<WitsItemInt>(entity =>
|
||||
{
|
||||
entity.HasKey(
|
||||
@ -432,7 +434,7 @@ namespace AsbCloudDb.Model
|
||||
.WithMany(mf => mf.Children)
|
||||
.HasForeignKey(mf => mf.IdParent)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
|
||||
modelBuilder.Entity<Manual>()
|
||||
.HasOne(m => m.Directory)
|
||||
.WithMany(f => f.Manuals)
|
||||
@ -488,24 +490,29 @@ namespace AsbCloudDb.Model
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
modelBuilder.Entity<ProcessMapPlanOperationDeterminationOfOscillationAngles>()
|
||||
.HasOne(p => p.Author)
|
||||
.WithMany()
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
.HasOne(p => p.Author)
|
||||
.WithMany()
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
modelBuilder.Entity<ProcessMapPlanOperationTFOrientation>()
|
||||
.HasOne(p => p.Author)
|
||||
.WithMany()
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
.HasOne(p => p.Author)
|
||||
.WithMany()
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
modelBuilder.Entity<ProcessMapPlanOperationSwitchPump>()
|
||||
.HasOne(p => p.Author)
|
||||
.WithMany()
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
.HasOne(p => p.Author)
|
||||
.WithMany()
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
modelBuilder.Entity<ProcessMapPlanOperationSwitchMode>()
|
||||
.HasOne(p => p.Author)
|
||||
.WithMany()
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
.HasOne(p => p.Author)
|
||||
.WithMany()
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
modelBuilder.Entity<ProcessMapPlanFunctionsDrillTest>()
|
||||
.HasOne(p => p.Author)
|
||||
.WithMany()
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
modelBuilder.Entity<ProcessMapPlanRotor>()
|
||||
.HasOne(p => p.Editor)
|
||||
@ -562,6 +569,11 @@ namespace AsbCloudDb.Model
|
||||
.WithMany()
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
modelBuilder.Entity<ProcessMapPlanFunctionsDrillTest>()
|
||||
.HasOne(p => p.Editor)
|
||||
.WithMany()
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
DefaultData.DefaultContextData.Fill(modelBuilder);
|
||||
}
|
||||
|
||||
@ -577,6 +589,6 @@ namespace AsbCloudDb.Model
|
||||
{
|
||||
var sql = $"REFRESH MATERIALIZED VIEW {materializedViewName};";
|
||||
return Database.ExecuteSqlRawAsync(sql, token);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,8 @@ namespace AsbCloudDb.Model
|
||||
DbSet<ProcessMapPlanOperationDeterminationOfOscillationAngles> ProcessMapPlanOperationDeterminationOfOscillationAngles { get; }
|
||||
DbSet<ProcessMapPlanOperationTFOrientation> ProcessMapPlanOperationTFOrientation { get; }
|
||||
DbSet<ProcessMapPlanOperationSwitchPump> ProcessMapPlanOperationSwitchPump { get; }
|
||||
DbSet<ProcessMapPlanOperationSwitchMode> ProcessMapPlanSection { get; }
|
||||
DbSet<ProcessMapPlanOperationSwitchMode> ProcessMapPlanOperationSwitchMode { get; }
|
||||
DbSet<ProcessMapPlanFunctionsDrillTest> ProcessMapPlanFunctionsDrillTest { get; }
|
||||
|
||||
Task<int> RefreshMaterializedViewAsync(string mwName, CancellationToken token);
|
||||
Task<int> RefreshMaterializedViewAsync<TEntity>(CancellationToken token) where TEntity : class;
|
||||
|
@ -0,0 +1,45 @@
|
||||
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_functions_drilltest"), Comment("Дрилтест")]
|
||||
public class ProcessMapPlanFunctionsDrillTest : ProcessMapPlanBase
|
||||
{
|
||||
[Column("weight_on_bit_min"), Comment("Нагрузка минимальная, т")]
|
||||
[Range(1.0, 30.0)]
|
||||
[Required]
|
||||
public double WeightOnBitMin { get; set; }
|
||||
|
||||
[Column("number_of_steps_bit"), Comment("Количество шагов по нагрузке")]
|
||||
[Range(1, 5)]
|
||||
[Required]
|
||||
public int NumberOfStepsBit { get; set; }
|
||||
|
||||
[Column("revolution_per_minute_min"), Comment("Минимальные обороты на ВСП, об/мин.")]
|
||||
[Range(5, 200)]
|
||||
[Required]
|
||||
public int RevolutionPerMinuteMin { get; set; }
|
||||
|
||||
[Column("number_of_steps_rpm"), Comment("Количество шагов оборотов на ВСП, шт.")]
|
||||
[Range(1, 5)]
|
||||
[Required]
|
||||
public int NumberOfStepsRPM { get; set; }
|
||||
|
||||
[Column("length_step"), Comment("Величина проходки шага, м.")]
|
||||
[Range(0.1, 2.0)]
|
||||
[Required]
|
||||
public double LengthStep { get; set; }
|
||||
|
||||
[Column("id_autostart_or_warning"), Comment("Автозапуск или Предупреждение")]
|
||||
[Required]
|
||||
public int IdAutostartOrWarning { get; set; }
|
||||
|
||||
[Column("note"), Comment("Примечание"), StringLength(1024)]
|
||||
public string Note { get; set; } = string.Empty;
|
||||
|
||||
[ForeignKey(nameof(IdPrevious))]
|
||||
public virtual ProcessMapPlanFunctionsDrillTest? Previous { get; set; }
|
||||
}
|
@ -208,6 +208,13 @@ namespace AsbCloudInfrastructure
|
||||
{
|
||||
Item = src.Adapt<ProcessMapPlanOperationSwitchModeDto>()
|
||||
});
|
||||
|
||||
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanFunctionsDrillTestDto>>.NewConfig()
|
||||
.Include<ProcessMapPlanOperationSwitchMode, ChangeLogDto<ProcessMapPlanFunctionsDrillTestDto>>()
|
||||
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanFunctionsDrillTestDto>()
|
||||
{
|
||||
Item = src.Adapt<ProcessMapPlanFunctionsDrillTestDto>()
|
||||
});
|
||||
}
|
||||
|
||||
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
|
||||
@ -313,6 +320,10 @@ namespace AsbCloudInfrastructure
|
||||
IChangeLogRepository<ProcessMapPlanOperationSwitchModeDto, ProcessMapPlanBaseRequestWithWell>,
|
||||
ProcessMapPlanBaseRepository<ProcessMapPlanOperationSwitchMode, ProcessMapPlanOperationSwitchModeDto>>();
|
||||
|
||||
services.AddTransient<
|
||||
IChangeLogRepository<ProcessMapPlanFunctionsDrillTestDto, ProcessMapPlanBaseRequestWithWell>,
|
||||
ProcessMapPlanBaseRepository<ProcessMapPlanFunctionsDrillTest, ProcessMapPlanFunctionsDrillTestDto>>();
|
||||
|
||||
services.AddTransient<IProcessMapReportDrillingService, ProcessMapReportDrillingService>();
|
||||
|
||||
services.AddTransient<TrajectoryService>();
|
||||
@ -369,6 +380,7 @@ namespace AsbCloudInfrastructure
|
||||
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationTFOrientationDto>>();
|
||||
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationSwitchPumpDto>>();
|
||||
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationSwitchModeDto>>();
|
||||
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsDrillTestDto>>();
|
||||
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
|
||||
services.AddTransient<IUserRepository, UserRepository>();
|
||||
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
|
||||
@ -434,6 +446,7 @@ namespace AsbCloudInfrastructure
|
||||
services.AddTransient<ProcessMapPlanOperationTFOrientationParser>();
|
||||
services.AddTransient<ProcessMapPlanOperationSwitchPumpParser>();
|
||||
services.AddTransient<ProcessMapPlanOperationSwitchModeParser>();
|
||||
services.AddTransient<ProcessMapPlanFunctionsDrillTestParser>();
|
||||
|
||||
services.AddTransient<TrajectoryPlanExportService>();
|
||||
services.AddTransient<TrajectoryFactManualExportService>();
|
||||
@ -451,6 +464,7 @@ namespace AsbCloudInfrastructure
|
||||
services.AddTransient<ProcessMapPlanOperationTFOrientationExportService>();
|
||||
services.AddTransient<ProcessMapPlanOperationSwitchPumpExportService>();
|
||||
services.AddTransient<ProcessMapPlanOperationSwitchModeExportService>();
|
||||
services.AddTransient<ProcessMapPlanFunctionsDrillTestExportService>();
|
||||
|
||||
services.AddTransient<WellOperationParserFactory>();
|
||||
services.AddTransient<WellOperationExportServiceFactory>();
|
||||
|
@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
|
||||
|
||||
public class ProcessMapPlanFunctionsDrillTestTemplate : ITemplateParameters
|
||||
{
|
||||
public string SheetName => "Дрилтест";
|
||||
|
||||
public int HeaderRowsCount => 2;
|
||||
|
||||
public string FileName => "ProcessMapPlanFunctionsDrillTestTemplate.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 ProcessMapPlanFunctionsDrillTestExportService : ProcessMapPlanExportService<ProcessMapPlanFunctionsDrillTestDto>
|
||||
{
|
||||
public ProcessMapPlanFunctionsDrillTestExportService(
|
||||
IChangeLogRepository<ProcessMapPlanFunctionsDrillTestDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
|
||||
IWellService wellService)
|
||||
: base(processMapPlanRepository, wellService)
|
||||
{
|
||||
}
|
||||
|
||||
protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanFunctionsDrillTestTemplate();
|
||||
|
||||
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 ProcessMapPlanFunctionsDrillTestParser : ProcessMapPlanParser<ProcessMapPlanFunctionsDrillTestDto>
|
||||
{
|
||||
public ProcessMapPlanFunctionsDrillTestParser(IWellOperationRepository wellOperationRepository)
|
||||
: base(wellOperationRepository)
|
||||
{
|
||||
}
|
||||
|
||||
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanFunctionsDrillTestTemplate();
|
||||
|
||||
protected override ProcessMapPlanFunctionsDrillTestDto 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 ProcessMapPlanFunctionsDrillTestController :
|
||||
ProcessMapPlanBaseController<ProcessMapPlanFunctionsDrillTest, ProcessMapPlanFunctionsDrillTestDto>
|
||||
{
|
||||
public ProcessMapPlanFunctionsDrillTestController(
|
||||
IChangeLogRepository<ProcessMapPlanFunctionsDrillTestDto, ProcessMapPlanBaseRequestWithWell> repository,
|
||||
IWellService wellService,
|
||||
ProcessMapPlanFunctionsDrillTestParser parserService,
|
||||
ITelemetryService telemetryService,
|
||||
ProcessMapPlanFunctionsDrillTestExportService processMapPlanExportService)
|
||||
: base(repository, wellService, parserService, processMapPlanExportService, telemetryService)
|
||||
{
|
||||
}
|
||||
|
||||
protected override string TemplateFileName => "ЕЦП_шаблон_файла_РТК_план_дрилтест.xlsx";
|
||||
}
|
Loading…
Reference in New Issue
Block a user