Правки после ревью-2

This commit is contained in:
Olga Nemt 2023-11-30 09:40:51 +05:00
parent 29171a6e47
commit 6387aeeb17
32 changed files with 9423 additions and 308 deletions

View File

@ -14,7 +14,6 @@
/// </summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="V"></typeparam>
/// <typeparam name="K"></typeparam>
public class PlanFactBase<T, V>
{
/// <summary>

View File

@ -1,4 +1,8 @@
using AsbCloudApp.Data.Trajectory;
using AsbCloudApp.Requests;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudApp.Repositories
{
@ -8,5 +12,12 @@ namespace AsbCloudApp.Repositories
/// <returns></returns>
public interface ITrajectoryNnbRepository : ITrajectoryRepository<TrajectoryGeoFactDto>
{
/// <summary>
/// получение списка траекторий по параметрам запроса
/// </summary>
/// <param name="trajectoryRequest">параметры запроса</param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<IEnumerable<TrajectoryGeoFactDto>> GetByRequestAsync(TrajectoryRequest trajectoryRequest, CancellationToken cancellationToken);
}
}

View File

@ -1,5 +1,4 @@
using AsbCloudApp.Data.Trajectory;
using AsbCloudApp.Requests;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@ -15,9 +14,9 @@ namespace AsbCloudApp.Repositories
/// <summary>
/// Получить все добавленные по скважине координаты траектории
/// </summary>
/// <param name="request">параметры запроса</param>
/// <param name="idWell">ключ скважины</param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<T>> GetAsync(TrajectoryRequest request, CancellationToken token);
Task<IEnumerable<T>> GetAsync(int idWell, CancellationToken token);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,109 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Rename_t_trajectory_plan : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_trajectory_planned_t_user_id_user",
table: "t_trajectory_planned");
migrationBuilder.DropForeignKey(
name: "FK_t_trajectory_planned_t_well_id_well",
table: "t_trajectory_planned");
migrationBuilder.DropPrimaryKey(
name: "PK_t_trajectory_planned",
table: "t_trajectory_planned");
migrationBuilder.RenameTable(
name: "t_trajectory_planned",
newName: "t_trajectory_plan");
migrationBuilder.RenameIndex(
name: "IX_t_trajectory_planned_id_well",
table: "t_trajectory_plan",
newName: "IX_t_trajectory_plan_id_well");
migrationBuilder.RenameIndex(
name: "IX_t_trajectory_planned_id_user",
table: "t_trajectory_plan",
newName: "IX_t_trajectory_plan_id_user");
migrationBuilder.AddPrimaryKey(
name: "PK_t_trajectory_plan",
table: "t_trajectory_plan",
column: "id");
migrationBuilder.AddForeignKey(
name: "FK_t_trajectory_plan_t_user_id_user",
table: "t_trajectory_plan",
column: "id_user",
principalTable: "t_user",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_trajectory_plan_t_well_id_well",
table: "t_trajectory_plan",
column: "id_well",
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_trajectory_plan_t_user_id_user",
table: "t_trajectory_plan");
migrationBuilder.DropForeignKey(
name: "FK_t_trajectory_plan_t_well_id_well",
table: "t_trajectory_plan");
migrationBuilder.DropPrimaryKey(
name: "PK_t_trajectory_plan",
table: "t_trajectory_plan");
migrationBuilder.RenameTable(
name: "t_trajectory_plan",
newName: "t_trajectory_planned");
migrationBuilder.RenameIndex(
name: "IX_t_trajectory_plan_id_well",
table: "t_trajectory_planned",
newName: "IX_t_trajectory_planned_id_well");
migrationBuilder.RenameIndex(
name: "IX_t_trajectory_plan_id_user",
table: "t_trajectory_planned",
newName: "IX_t_trajectory_planned_id_user");
migrationBuilder.AddPrimaryKey(
name: "PK_t_trajectory_planned",
table: "t_trajectory_planned",
column: "id");
migrationBuilder.AddForeignKey(
name: "FK_t_trajectory_planned_t_user_id_user",
table: "t_trajectory_planned",
column: "id_user",
principalTable: "t_user",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_trajectory_planned_t_well_id_well",
table: "t_trajectory_planned",
column: "id_well",
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -262,7 +262,7 @@ namespace AsbCloudDb.Migrations
b.HasComment("Контакты");
});
modelBuilder.Entity("AsbCloudDb.Model.DailyReport.DailyReport", b =>
modelBuilder.Entity("AsbCloudDb.Model.DailyReports.DailyReport", b =>
{
b.Property<int>("IdWell")
.HasColumnType("integer")
@ -2413,12 +2413,6 @@ namespace AsbCloudDb.Migrations
Id = 528,
Description = "Разрешение на удаление контакта",
Name = "WellContact.delete"
},
new
{
Id = 529,
Description = "Разрешение редактировать фактические траектории",
Name = "FactTrajectory.edit"
});
});
@ -4015,11 +4009,6 @@ namespace AsbCloudDb.Migrations
{
IdUserRole = 1,
IdPermission = 528
},
new
{
IdUserRole = 1,
IdPermission = 529
});
});
@ -5191,7 +5180,7 @@ namespace AsbCloudDb.Migrations
b.HasComment("Загрузка фактической траектории");
});
modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryPlanned", b =>
modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryPlan", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -5256,7 +5245,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell");
b.ToTable("t_trajectory_planned");
b.ToTable("t_trajectory_plan");
b.HasComment("Загрузка плановой траектории");
});
@ -8675,7 +8664,7 @@ namespace AsbCloudDb.Migrations
b.Navigation("Well");
});
modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryPlanned", b =>
modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryPlan", b =>
{
b.HasOne("AsbCloudDb.Model.User", "User")
.WithMany()

View File

@ -18,7 +18,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<DailyReport> DailyReports => Set <DailyReport>();
public virtual DbSet<Deposit> Deposits => Set<Deposit>();
public virtual DbSet<DetectedOperation> DetectedOperations => Set<DetectedOperation>();
public virtual DbSet<TrajectoryPlanned> PlannedTrajectories => Set<TrajectoryPlanned>();
public virtual DbSet<TrajectoryPlan> TrajectoriesPlan => Set<TrajectoryPlan>();
public virtual DbSet<ProcessMapWellDrilling> ProcessMapWellDrillings => Set<ProcessMapWellDrilling>();
public virtual DbSet<ProcessMapWellReam> ProcessMapWellReams => Set<ProcessMapWellReam>();
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
@ -61,7 +61,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<LimitingParameter> LimitingParameter => Set<LimitingParameter>();
public virtual DbSet<TelemetryWirelineRunOut> TelemetryWirelineRunOut => Set<TelemetryWirelineRunOut>();
public virtual DbSet<TrajectoryFact> FactTrajectories => Set<TrajectoryFact>();
public virtual DbSet<TrajectoryFact> TrajectoriesFact => Set<TrajectoryFact>();
// GTR WITS
public DbSet<WitsItemFloat> WitsItemFloat => Set<WitsItemFloat>();

View File

@ -160,9 +160,7 @@
new (){ Id = 526, Name = "WellOperation.editCompletedWell", Description = "Разрешение на редактирование операций у завершенной скважины"},
new() { Id = 527, Name = "Manual.delete", Description = "Разрешение на удаление инструкций"},
new (){ Id = 528, Name="WellContact.delete", Description="Разрешение на удаление контакта"},
new (){ Id = 529, Name="FactTrajectory.edit", Description="Разрешение редактировать фактические траектории"}
new (){ Id = 528, Name="WellContact.delete", Description="Разрешение на удаление контакта"}
};
}
}

View File

@ -22,7 +22,7 @@ namespace AsbCloudDb.Model
DbSet<DailyReport> DailyReports { get; }
DbSet<Deposit> Deposits { get; }
DbSet<DetectedOperation> DetectedOperations { get; }
DbSet<TrajectoryPlanned> PlannedTrajectories { get; }
DbSet<TrajectoryPlan> TrajectoriesPlan { get; }
DbSet<ProcessMapWellDrilling> ProcessMapWellDrillings { get; }
DbSet<ProcessMapWellReam> ProcessMapWellReams { get; }
DbSet<DrillingProgramPart> DrillingProgramParts { get; }
@ -79,7 +79,7 @@ namespace AsbCloudDb.Model
DbSet<ManualDirectory> ManualDirectories { get; }
DbSet<Contact> Contacts { get; }
DbSet<DrillTest> DrillTests { get; }
DbSet<TrajectoryFact> FactTrajectories { get; }
DbSet<TrajectoryFact> TrajectoriesFact { get; }
DatabaseFacade Database { get; }
Task<int> RefreshMaterializedViewAsync(string mwName, CancellationToken token);

View File

@ -3,8 +3,8 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model.Trajectory
{
[Table("t_trajectory_planned"), Comment("Загрузка плановой траектории")]
public class TrajectoryPlanned : Trajectory
[Table("t_trajectory_plan"), Comment("Загрузка плановой траектории")]
public class TrajectoryPlan : Trajectory
{
[Column("radius"), Comment("Радиус цели")]
public double? Radius { get; set; }

View File

@ -204,8 +204,8 @@ namespace AsbCloudInfrastructure
services.AddTransient<TrajectoryPlannedExportService>();
services.AddTransient<TrajectoryFactManualExportService>();
services.AddTransient<TrajectoryFactNnbExportService>();
services.AddTransient<TrajectoryPlannedImportService>();
services.AddTransient<TrajectoryFactManualImportService>();
services.AddTransient<TrajectoryPlannedParserService>();
services.AddTransient<TrajectoryFactManualParserService>();
services.AddTransient<IWellOperationRepository, WellOperationRepository>();
services.AddTransient<IDailyReportService, DailyReportService>();
services.AddTransient<IDetectedOperationService, DetectedOperationService>();
@ -268,7 +268,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
services.AddTransient<ITelemetryWirelineRunOutRepository, TelemetryWirelineRunOutRepository>();
services.AddTransient<IWellFinalDocumentsRepository, WellFinalDocumentsRepository>();
services.AddTransient<ITrajectoryEditableRepository<TrajectoryGeoPlanDto>, TrajectoryEditableRepository<TrajectoryPlanned, TrajectoryGeoPlanDto>>();
services.AddTransient<ITrajectoryEditableRepository<TrajectoryGeoPlanDto>, TrajectoryEditableRepository<TrajectoryPlan, TrajectoryGeoPlanDto>>();
services.AddTransient<ITrajectoryEditableRepository<TrajectoryGeoFactDto>, TrajectoryEditableRepository<TrajectoryFact, TrajectoryGeoFactDto>>();
services.AddTransient<ITrajectoryNnbRepository, TrajectoryNnbRepository>();
services.AddTransient<IFaqRepository, FaqRepository>();

View File

@ -1,7 +1,6 @@
using AsbCloudApp.Data.Trajectory;
using AsbCloudApp.Exceptions;
using AsbCloudApp.Repositories;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using AsbCloudDb.Model.Trajectory;
@ -31,7 +30,7 @@ namespace AsbCloudInfrastructure.Repository
this.db = db;
this.wellService = wellService;
}
/// <inheritdoc/>
public async Task<int> AddRangeAsync(IEnumerable<Tdto> trajectoryRows, CancellationToken token)
{
var idWell = trajectoryRows.First().IdWell;
@ -48,11 +47,9 @@ namespace AsbCloudInfrastructure.Repository
});
db.Set<TEntity>().AddRange(entities);
return await db.SaveChangesAsync(token)
.ConfigureAwait(false);
return await db.SaveChangesAsync(token);
}
/// <inheritdoc/>
public async Task<int> AddAsync(Tdto trajectoryRow, CancellationToken token)
{
var offsetHours = wellService.GetTimezone(trajectoryRow.IdWell).Hours;
@ -63,7 +60,6 @@ namespace AsbCloudInfrastructure.Repository
.ConfigureAwait(false);
}
/// <inheritdoc/>
public async Task<int> DeleteRangeAsync(IEnumerable<int> ids, CancellationToken token)
{
var query = db.Set<TEntity>()
@ -73,7 +69,6 @@ namespace AsbCloudInfrastructure.Repository
.ConfigureAwait(false);
}
/// <inheritdoc/>
public async Task<int> DeleteByIdWellAsync(int idWell, CancellationToken token)
{
var query = db.Set<TEntity>()
@ -83,11 +78,10 @@ namespace AsbCloudInfrastructure.Repository
.ConfigureAwait(false);
}
/// <inheritdoc/>
public async Task<IEnumerable<Tdto>> GetAsync(TrajectoryRequest request, CancellationToken token)
public async Task<IEnumerable<Tdto>> GetAsync(int idWell, CancellationToken token)
{
var well = wellService.GetOrDefault(request.IdWell)
?? throw new ArgumentInvalidException(nameof(request.IdWell), "idWell doesn`t exist");
var well = wellService.GetOrDefault(idWell)
?? throw new ArgumentInvalidException(nameof(idWell), "idWell doesn`t exist");
var offsetHours = well.Timezone.Hours;
var query = db.Set<TEntity>()
@ -96,12 +90,12 @@ namespace AsbCloudInfrastructure.Repository
var entities = await query
.OrderBy(e => e.WellboreDepth)
.ToArrayAsync(token);
var result = entities
.Select(r => Convert(r, offsetHours));
return result;
}
/// <inheritdoc/>
public async Task<int> UpdateAsync(Tdto row, CancellationToken token)
{
var offsetHours = wellService.GetTimezone(row.IdWell).Hours;
@ -111,14 +105,14 @@ namespace AsbCloudInfrastructure.Repository
.ConfigureAwait(false);
}
private Tdto Convert(TEntity entity, double offsetHours)
private static Tdto Convert(TEntity entity, double offsetHours)
{
var dto = entity.Adapt<Tdto>();
dto.UpdateDate = entity.UpdateDate.ToRemoteDateTime(offsetHours);
return dto;
}
private TEntity Convert(Tdto dto, double offsetHours)
private static TEntity Convert(Tdto dto, double offsetHours)
{
var entity = dto.Adapt<TEntity>();
entity.UpdateDate = DateTime.Now.ToUtcDateTimeOffset(offsetHours);

View File

@ -2,7 +2,6 @@
using AsbCloudApp.Exceptions;
using AsbCloudApp.Repositories;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using AsbCloudDb.Model.WITS;
using Microsoft.EntityFrameworkCore;
@ -16,11 +15,9 @@ namespace AsbCloudInfrastructure.Repository
public class TrajectoryNnbRepository : ITrajectoryNnbRepository
{
private readonly IAsbCloudDbContext db;
private readonly IWellService wellService;
public TrajectoryNnbRepository(IAsbCloudDbContext db, IWellService wellService)
public TrajectoryNnbRepository(IAsbCloudDbContext db)
{
this.db = db;
this.wellService = wellService;
}
private IQueryable<Record7> BuildQuery(TrajectoryRequest request)
@ -42,8 +39,12 @@ namespace AsbCloudInfrastructure.Repository
return query.OrderBy(e => e.Deptsvym);
}
public async Task<IEnumerable<TrajectoryGeoFactDto>> GetAsync(TrajectoryRequest request, CancellationToken token)
public async Task<IEnumerable<TrajectoryGeoFactDto>> GetAsync(int idWell, CancellationToken token)
{
var request = new TrajectoryRequest()
{
IdWell = idWell,
};
var entities = (await BuildQuery(request)
.Where(coord => coord.Deptsvym.HasValue &&
coord.Svyinc.HasValue &&
@ -65,5 +66,10 @@ namespace AsbCloudInfrastructure.Repository
return result;
}
public Task<IEnumerable<TrajectoryGeoFactDto>> GetByRequestAsync(TrajectoryRequest trajectoryRequest, CancellationToken cancellationToken)
{
throw new System.NotImplementedException();
}
}
}

View File

@ -26,7 +26,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport;
public class DailyReportService : IDailyReportService
{
private readonly IWellService wellService;
private readonly ITrajectoryEditableRepository<TrajectoryGeoFactDto> trajectoryFactRepository;
private readonly ITrajectoryNnbRepository trajectoryFactNnbRepository;
private readonly IDailyReportRepository dailyReportRepository;
private readonly IScheduleRepository scheduleRepository;
private readonly IWellOperationRepository wellOperationRepository;
@ -35,7 +35,7 @@ public class DailyReportService : IDailyReportService
private readonly IDetectedOperationService detectedOperationService;
public DailyReportService(IWellService wellService,
ITrajectoryEditableRepository<TrajectoryGeoFactDto> trajectoryFactRepository,
ITrajectoryNnbRepository trajectoryFactNnbRepository,
IDailyReportRepository dailyReportRepository,
IScheduleRepository scheduleRepository,
IWellOperationRepository wellOperationRepository,
@ -44,7 +44,7 @@ public class DailyReportService : IDailyReportService
IDetectedOperationService detectedOperationService)
{
this.wellService = wellService;
this.trajectoryFactRepository = trajectoryFactRepository;
this.trajectoryFactNnbRepository = trajectoryFactNnbRepository;
this.dailyReportRepository = dailyReportRepository;
this.scheduleRepository = scheduleRepository;
this.wellOperationRepository = wellOperationRepository;
@ -260,7 +260,7 @@ public class DailyReportService : IDailyReportService
private async Task AddTrajectoryBlockAsync(DailyReportDto dailyReport, CancellationToken cancellationToken)
{
var trajectory = (await trajectoryFactRepository.GetAsync(new TrajectoryRequest
var trajectory = (await trajectoryFactNnbRepository.GetByRequestAsync(new TrajectoryRequest
{
IdWell = dailyReport.IdWell,
GeDate = dailyReport.Date,

View File

@ -1,6 +1,5 @@
using AsbCloudApp.Data.Trajectory;
using AsbCloudApp.Repositories;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using ClosedXML.Excel;
using System;
@ -17,31 +16,22 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Export
private readonly IWellService wellService;
private readonly ITrajectoryRepository<T> trajectoryRepository;
protected abstract void AddCoordinatesToRow(IXLRow row, T trajectory);
public abstract string templateFileName { get; set; }
public abstract string usingTemplateFile { get; set; }
public abstract string sheetTrajectory { get; set; }
public abstract int headerRowsCount { get; set; }
public abstract int ColumnWellboreDepth { get; set; }
public abstract int ColumnZenithAngle { get; set; }
public abstract int ColumnAzimuthGeo { get; set; }
public abstract int ColumnAzimuthMagnetic { get; set; }
public abstract int ColumnVerticalDepth { get; set; }
public abstract int ColumnComment { get; set; }
public abstract string templateFileName { get; }
public abstract string usingTemplateFile { get; }
public abstract string sheetTrajectory { get; }
public abstract int headerRowsCount { get; }
public TrajectoryExportService(IWellService wellService, ITrajectoryRepository<T> trajectoryService)
public TrajectoryExportService(IWellService wellService, ITrajectoryRepository<T> trajectoryRepository)
{
this.wellService = wellService;
this.trajectoryRepository = trajectoryService;
this.trajectoryRepository = trajectoryRepository;
}
protected abstract void AddCoordinatesToRow(IXLRow row, T trajectory);
public async Task<Stream> ExportAsync(int idWell, CancellationToken token)
{
var request = new TrajectoryRequest()
{
IdWell = idWell,
};
var trajectorys = await trajectoryRepository.GetAsync(request, token);
var trajectorys = await trajectoryRepository.GetAsync(idWell, token);
return MakeExelFileStream(trajectorys);
}

View File

@ -8,16 +8,10 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Export
public class TrajectoryFactManualExportService : TrajectoryExportService<TrajectoryGeoFactDto>
{
public override string templateFileName { get; set; } = "TrajectoryFactManualTemplate.xlsx";
public override string usingTemplateFile { get; set; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
public override string sheetTrajectory { get; set; } = "Фактическая траектория";
public override int headerRowsCount { get; set; } = 2;
public override int ColumnWellboreDepth { get; set; } = 1;
public override int ColumnZenithAngle { get; set; } = 2;
public override int ColumnAzimuthGeo { get; set; } = 3;
public override int ColumnAzimuthMagnetic { get; set; } = 4;
public override int ColumnVerticalDepth { get; set; } = 5;
public override int ColumnComment { get; set; } = 6;
public override string templateFileName { get; } = "TrajectoryFactManualTemplate.xlsx";
public override string usingTemplateFile { get; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
public override string sheetTrajectory { get; } = "Фактическая траектория";
public override int headerRowsCount { get; } = 2;
public TrajectoryFactManualExportService(
IWellService wellService,
@ -29,12 +23,12 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Export
protected override void AddCoordinatesToRow(IXLRow row, TrajectoryGeoFactDto trajectory)
{
row.Cell(ColumnWellboreDepth).Value = trajectory.WellboreDepth;
row.Cell(ColumnZenithAngle).Value = trajectory.ZenithAngle;
row.Cell(ColumnAzimuthGeo).Value = trajectory.AzimuthGeo;
row.Cell(ColumnAzimuthMagnetic).Value = trajectory.AzimuthMagnetic;
row.Cell(ColumnVerticalDepth).Value = trajectory.VerticalDepth;
row.Cell(ColumnComment).Value = trajectory.Comment;
row.Cell(1).Value = trajectory.WellboreDepth;
row.Cell(2).Value = trajectory.ZenithAngle;
row.Cell(3).Value = trajectory.AzimuthGeo;
row.Cell(4).Value = trajectory.AzimuthMagnetic;
row.Cell(5).Value = trajectory.VerticalDepth;
row.Cell(6).Value = trajectory.Comment;
}
}
}

View File

@ -7,17 +7,11 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Export
{
public class TrajectoryFactNnbExportService : TrajectoryExportService<TrajectoryGeoFactDto>
{
public override string templateFileName { get; set; } = "TrajectoryFactNnbTemplate.xlsx";
public override string usingTemplateFile { get; set; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
public override string sheetTrajectory { get; set; } = "Фактическая ннб-траектория";
public override int headerRowsCount { get; set; } = 2;
public override int ColumnWellboreDepth { get; set; } = 1;
public override int ColumnZenithAngle { get; set; } = 2;
public override int ColumnAzimuthGeo { get; set; } = 3;
public override int ColumnAzimuthMagnetic { get; set; } = 4;
public override int ColumnVerticalDepth { get; set; } = 5;
public override int ColumnComment { get; set; } = 6;
{
public override string templateFileName { get; } = "TrajectoryFactNnbTemplate.xlsx";
public override string usingTemplateFile { get; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
public override string sheetTrajectory { get; } = "Фактическая ннб-траектория";
public override int headerRowsCount { get; } = 2;
public TrajectoryFactNnbExportService(
IWellService wellService,
@ -29,12 +23,12 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Export
protected override void AddCoordinatesToRow(IXLRow row, TrajectoryGeoFactDto trajectory)
{
row.Cell(ColumnWellboreDepth).Value = trajectory.WellboreDepth;
row.Cell(ColumnZenithAngle).Value = trajectory.ZenithAngle;
row.Cell(ColumnAzimuthGeo).Value = trajectory.AzimuthGeo;
row.Cell(ColumnAzimuthMagnetic).Value = trajectory.AzimuthMagnetic;
row.Cell(ColumnVerticalDepth).Value = trajectory.VerticalDepth;
row.Cell(ColumnComment).Value = trajectory.Comment;
row.Cell(1).Value = trajectory.WellboreDepth;
row.Cell(2).Value = trajectory.ZenithAngle;
row.Cell(3).Value = trajectory.AzimuthGeo;
row.Cell(4).Value = trajectory.AzimuthMagnetic;
row.Cell(5).Value = trajectory.VerticalDepth;
row.Cell(6).Value = trajectory.Comment;
}
}
}

View File

@ -10,17 +10,10 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Export
/*
* password for PlannedTrajectoryTemplate.xlsx is Drill2022
*/
public override string templateFileName { get; set; } = "TrajectoryPlannedTemplate.xlsx";
public override string usingTemplateFile { get; set; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
public override string sheetTrajectory { get; set; } = "Плановая траектория";
public override int headerRowsCount { get; set; } = 2;
public override int ColumnWellboreDepth { get; set; } = 1;
public override int ColumnZenithAngle { get; set; } = 2;
public override int ColumnAzimuthGeo { get; set; } = 3;
public override int ColumnAzimuthMagnetic { get; set; } = 4;
public override int ColumnVerticalDepth { get; set; } = 5;
public int ColumnRadius { get; set; } = 6;
public override int ColumnComment { get; set; } = 7;
public override string templateFileName { get; } = "TrajectoryPlannedTemplate.xlsx";
public override string usingTemplateFile { get; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
public override string sheetTrajectory { get; } = "Плановая траектория";
public override int headerRowsCount { get; } = 2;
public TrajectoryPlannedExportService(
IWellService wellService,
@ -31,13 +24,13 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Export
protected override void AddCoordinatesToRow(IXLRow row, TrajectoryGeoPlanDto trajectory)
{
row.Cell(ColumnWellboreDepth).Value = trajectory.WellboreDepth;
row.Cell(ColumnZenithAngle).Value = trajectory.ZenithAngle;
row.Cell(ColumnAzimuthGeo).Value = trajectory.AzimuthGeo;
row.Cell(ColumnAzimuthMagnetic).Value = trajectory.AzimuthMagnetic;
row.Cell(ColumnVerticalDepth).Value = trajectory.VerticalDepth;
row.Cell(ColumnRadius).Value = trajectory.Radius;
row.Cell(ColumnComment).Value = trajectory.Comment;
row.Cell(1).Value = trajectory.WellboreDepth;
row.Cell(2).Value = trajectory.ZenithAngle;
row.Cell(3).Value = trajectory.AzimuthGeo;
row.Cell(4).Value = trajectory.AzimuthMagnetic;
row.Cell(5).Value = trajectory.VerticalDepth;
row.Cell(6).Value = trajectory.Radius;
row.Cell(7).Value = trajectory.Comment;
}
}

View File

@ -1,43 +0,0 @@
using AsbCloudApp.Data.Trajectory;
using AsbCloudApp.Repositories;
using AsbCloudApp.Services;
using ClosedXML.Excel;
namespace AsbCloudInfrastructure.Services.Trajectory.Import
{
public class TrajectoryFactManualImportService : TrajectoryImportService<TrajectoryGeoFactDto>
{
public override string templateFileName { get; set; } = "TrajectoryFactManualTemplate.xlsx";
public override string usingTemplateFile { get; set; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
public override string sheetNamePlannedTrajectory { get; set; } = "Фактическая траектория";
public override int headerRowsCount { get; set; } = 2;
public override int ColumnWellboreDepth { get; set; } = 1;
public override int ColumnZenithAngle { get; set; } = 2;
public override int ColumnAzimuthGeo { get; set; } = 3;
public override int ColumnAzimuthMagnetic { get; set; } = 4;
public override int ColumnVerticalDepth { get; set; } = 5;
public override int ColumnComment { get; set; } = 6;
public TrajectoryFactManualImportService() : base()
{
}
protected override TrajectoryGeoFactDto ParseRow(IXLRow row)
{
var trajectoryRow = new TrajectoryGeoFactDto
{
WellboreDepth = row.Cell(ColumnWellboreDepth).GetCellValue<double>(),
ZenithAngle = row.Cell(ColumnZenithAngle).GetCellValue<double>(),
AzimuthGeo = row.Cell(ColumnAzimuthGeo).GetCellValue<double>(),
AzimuthMagnetic = row.Cell(ColumnAzimuthMagnetic).GetCellValue<double>(),
VerticalDepth = row.Cell(ColumnVerticalDepth).GetCellValue<double>(),
Comment = row.Cell(ColumnComment).GetCellValue<string?>()
};
return trajectoryRow;
}
}
}

View File

@ -0,0 +1,35 @@
using AsbCloudApp.Data.Trajectory;
using ClosedXML.Excel;
namespace AsbCloudInfrastructure.Services.Trajectory.Import
{
public class TrajectoryFactManualParserService : TrajectoryParserService<TrajectoryGeoFactDto>
{
public override string templateFileName { get; } = "TrajectoryFactManualTemplate.xlsx";
public override string usingTemplateFile { get; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
public override string sheetNameTrajectory { get; } = "Фактическая траектория";
public override int headerRowsCount { get; } = 2;
public TrajectoryFactManualParserService() : base()
{
}
protected override TrajectoryGeoFactDto ParseRow(IXLRow row)
{
var trajectoryRow = new TrajectoryGeoFactDto
{
WellboreDepth = row.Cell(1).GetCellValue<double>(),
ZenithAngle = row.Cell(2).GetCellValue<double>(),
AzimuthGeo = row.Cell(3).GetCellValue<double>(),
AzimuthMagnetic = row.Cell(4).GetCellValue<double>(),
VerticalDepth = row.Cell(5).GetCellValue<double>(),
Comment = row.Cell(6).GetCellValue<string?>()
};
//TODO: Добавить валидацию модели IValidatableObject
return trajectoryRow;
}
}
}

View File

@ -1,36 +1,26 @@
using AsbCloudApp.Data.Trajectory;
using AsbCloudApp.Repositories;
using AsbCloudApp.Services;
using ClosedXML.Excel;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Services.Trajectory.Import
{
public abstract class TrajectoryImportService<T> where T : TrajectoryGeoDto
public abstract class TrajectoryParserService<T>
where T : TrajectoryGeoDto
{
private readonly IWellService wellService;
public abstract string templateFileName { get; }
public abstract string usingTemplateFile { get; }
public abstract string sheetNameTrajectory { get; }
public abstract int headerRowsCount { get; }
protected abstract T ParseRow(IXLRow row);
public abstract string templateFileName { get; set; }
public abstract string usingTemplateFile { get; set; }
public abstract string sheetNamePlannedTrajectory { get; set; }
public abstract int headerRowsCount { get; set; }
public abstract int ColumnWellboreDepth { get; set; }
public abstract int ColumnZenithAngle { get; set; }
public abstract int ColumnAzimuthGeo { get; set; }
public abstract int ColumnAzimuthMagnetic { get; set; }
public abstract int ColumnVerticalDepth { get; set; }
public abstract int ColumnComment { get; set; }
public TrajectoryImportService()
public TrajectoryParserService()
{
}
protected abstract T ParseRow(IXLRow row);
public async Task<IEnumerable<T>> ImportAsync(Stream stream, CancellationToken token)
public IEnumerable<T> ImportAsync(Stream stream)
{
using var workbook = new XLWorkbook(stream, XLEventTracking.Disabled);
var trajectoryRows = ParseFileStream(stream);
@ -47,9 +37,9 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Import
private IEnumerable<T> ParseWorkbook(IXLWorkbook workbook)
{
var sheetTrajectory = workbook.Worksheets.FirstOrDefault(ws => ws.Name == sheetNamePlannedTrajectory);
var sheetTrajectory = workbook.Worksheets.FirstOrDefault(ws => ws.Name == sheetNameTrajectory);
if (sheetTrajectory is null)
throw new FileFormatException($"Книга excel не содержит листа {sheetNamePlannedTrajectory}.");
throw new FileFormatException($"Книга excel не содержит листа {sheetNameTrajectory}.");
var trajectoryRows = ParseSheet(sheetTrajectory);
return trajectoryRows;
}

View File

@ -1,47 +0,0 @@
using AsbCloudApp.Data.Trajectory;
using AsbCloudApp.Services;
using ClosedXML.Excel;
namespace AsbCloudInfrastructure.Services.Trajectory.Import
{
public class TrajectoryPlannedImportService : TrajectoryImportService<TrajectoryGeoPlanDto>
{
/*
* password for PlannedTrajectoryTemplate.xlsx is Drill2022
*/
public override string templateFileName { get; set; } = "TrajectoryPlannedTemplate.xlsx";
public override string usingTemplateFile { get; set; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
public override string sheetNamePlannedTrajectory { get; set; } = "Плановая траектория";
public override int headerRowsCount { get; set; } = 2;
public override int ColumnWellboreDepth { get; set; } = 1;
public override int ColumnZenithAngle { get; set; } = 2;
public override int ColumnAzimuthGeo { get; set; } = 3;
public override int ColumnAzimuthMagnetic { get; set; } = 4;
public override int ColumnVerticalDepth { get; set; } = 5;
public int ColumnRadius { get; set; } = 6;
public override int ColumnComment { get; set; } = 7;
public TrajectoryPlannedImportService() : base()
{
}
protected override TrajectoryGeoPlanDto ParseRow(IXLRow row)
{
var trajectoryRow = new TrajectoryGeoPlanDto
{
WellboreDepth = row.Cell(ColumnWellboreDepth).GetCellValue<double>(),
ZenithAngle = row.Cell(ColumnZenithAngle).GetCellValue<double>(),
AzimuthGeo = row.Cell(ColumnAzimuthGeo).GetCellValue<double>(),
AzimuthMagnetic = row.Cell(ColumnAzimuthMagnetic).GetCellValue<double>(),
VerticalDepth = row.Cell(ColumnVerticalDepth).GetCellValue<double>(),
Radius = row.Cell(ColumnRadius).GetCellValue<double>(),
Comment = row.Cell(ColumnComment).GetCellValue<string?>()
};
return trajectoryRow;
}
}
}

View File

@ -0,0 +1,40 @@
using AsbCloudApp.Data.Trajectory;
using ClosedXML.Excel;
namespace AsbCloudInfrastructure.Services.Trajectory.Import
{
public class TrajectoryPlannedParserService : TrajectoryParserService<TrajectoryGeoPlanDto>
{
/*
* password for PlannedTrajectoryTemplate.xlsx is Drill2022
*/
public override string templateFileName { get; } = "TrajectoryPlannedTemplate.xlsx";
public override string usingTemplateFile { get; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
public override string sheetNameTrajectory { get; } = "Плановая траектория";
public override int headerRowsCount { get; } = 2;
public TrajectoryPlannedParserService() : base()
{
}
protected override TrajectoryGeoPlanDto ParseRow(IXLRow row)
{
var trajectoryRow = new TrajectoryGeoPlanDto
{
WellboreDepth = row.Cell(1).GetCellValue<double>(),
ZenithAngle = row.Cell(2).GetCellValue<double>(),
AzimuthGeo = row.Cell(3).GetCellValue<double>(),
AzimuthMagnetic = row.Cell(4).GetCellValue<double>(),
VerticalDepth = row.Cell(5).GetCellValue<double>(),
Radius = row.Cell(6).GetCellValue<double>(),
Comment = row.Cell(7).GetCellValue<string?>()
};
//TODO: Добавить валидацию модели IValidatableObject
return trajectoryRow;
}
}
}

View File

@ -30,11 +30,7 @@ abstract class TrajectoryBaseService<TGeo, TCartesian>
public async Task<IEnumerable<TCartesian>?> GetAsync(int idWell, CancellationToken token)
{
var request = new TrajectoryRequest()
{
IdWell = idWell
};
var geoCoords = await repository.GetAsync(request, token);
var geoCoords = await repository.GetAsync(idWell, token);
var locs = GetTrajectoryVisualisation(geoCoords);
var dtos = locs.Select(l => Convert(l));
return dtos;

View File

@ -23,6 +23,8 @@ namespace AsbCloudWebApi.Tests.Services.Trajectory
private readonly ITrajectoryNnbRepository trajectoryFactNnbRepository;
private readonly TrajectoryFactNnbExportService trajectoryFactNnbExportService;
private readonly int idWell = 4;
private readonly TrajectoryGeoPlanDto[] trajectoryPlannedRows = new TrajectoryGeoPlanDto[2] {
new TrajectoryGeoPlanDto() {
Id = 1,
@ -79,14 +81,6 @@ namespace AsbCloudWebApi.Tests.Services.Trajectory
},
};
private readonly TrajectoryRequest request = new TrajectoryRequest()
{
IdWell = 4,
GeDate = DateTime.Now.AddDays(5),
LeDate = DateTime.Now.AddDays(-5),
};
public TrajectoryExportTest()
{
wellService = Substitute.For<IWellService>();
@ -103,10 +97,10 @@ namespace AsbCloudWebApi.Tests.Services.Trajectory
[Fact]
public async Task Export_trajectory_planned()
{
trajectoryPlannedRepository.GetAsync(request, CancellationToken.None)
trajectoryPlannedRepository.GetAsync(idWell, CancellationToken.None)
.Returns(trajectoryPlannedRows);
var stream = await trajectoryPlannedExportService.ExportAsync(request.IdWell, CancellationToken.None);
var stream = await trajectoryPlannedExportService.ExportAsync(idWell, CancellationToken.None);
Assert.True(stream.Length > 0);
}
@ -114,20 +108,20 @@ namespace AsbCloudWebApi.Tests.Services.Trajectory
[Fact]
public async Task Export_trajectory_fact_manual()
{
trajectoryFactManualReposirory.GetAsync(request, CancellationToken.None)
trajectoryFactManualReposirory.GetAsync(idWell, CancellationToken.None)
.Returns(trajectoryFactRows);
var stream = await trajectoryFactManualExportService.ExportAsync(request.IdWell, CancellationToken.None);
var stream = await trajectoryFactManualExportService.ExportAsync(idWell, CancellationToken.None);
Assert.True(stream.Length > 0);
}
[Fact]
public async Task Export_trajectory_fact_nnb()
{
trajectoryFactNnbRepository.GetAsync(request, CancellationToken.None)
trajectoryFactNnbRepository.GetAsync(idWell, CancellationToken.None)
.Returns(trajectoryFactRows);
var stream = await trajectoryFactNnbExportService.ExportAsync(request.IdWell, CancellationToken.None);
var stream = await trajectoryFactNnbExportService.ExportAsync(idWell, CancellationToken.None);
Assert.True(stream.Length > 0);
}
}

View File

@ -1,29 +1,24 @@
using AsbCloudApp.Services;
using AsbCloudInfrastructure.Services.Trajectory;
using AsbCloudInfrastructure.Services.Trajectory.Import;
using NSubstitute;
using AsbCloudInfrastructure.Services.Trajectory.Import;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
namespace AsbCloudWebApi.Tests.Services.Trajectory
{
public class TrajectoryImportTest
{
private readonly TrajectoryPlannedImportService trajectoryPlannedImportService;
private readonly TrajectoryFactManualImportService trajectoryFactManualImportService;
private readonly TrajectoryPlannedParserService trajectoryPlannedImportService;
private readonly TrajectoryFactManualParserService trajectoryFactManualImportService;
private string usingTemplateFile = "AsbCloudWebApi.Tests.Services.Trajectory.Templates";
public TrajectoryImportTest()
{
trajectoryPlannedImportService = new TrajectoryPlannedImportService();
trajectoryFactManualImportService = new TrajectoryFactManualImportService();
trajectoryPlannedImportService = new TrajectoryPlannedParserService();
trajectoryFactManualImportService = new TrajectoryFactManualParserService();
}
[Fact]
public async Task Import_trajectory_planned()
public void Import_trajectory_planned()
{
var stream = System.Reflection.Assembly.GetExecutingAssembly()
.GetManifestResourceStream($"{usingTemplateFile}.TrajectoryPlannedTemplate.xlsx");
@ -31,13 +26,13 @@ namespace AsbCloudWebApi.Tests.Services.Trajectory
if (stream is null)
Assert.Fail("Файла для импорта не существует");
var trajectoryRows = await trajectoryPlannedImportService.ImportAsync(stream, CancellationToken.None);
var trajectoryRows = trajectoryPlannedImportService.ImportAsync(stream);
Assert.Equal(3, trajectoryRows.Count());
}
[Fact]
public async Task Import_trajectory_fact_manual()
public void Import_trajectory_fact_manual()
{
var stream = System.Reflection.Assembly.GetExecutingAssembly()
.GetManifestResourceStream($"{usingTemplateFile}.TrajectoryFactManualTemplate.xlsx");
@ -45,8 +40,8 @@ namespace AsbCloudWebApi.Tests.Services.Trajectory
if (stream is null)
Assert.Fail("Файла для импорта не существует");
var trajectoryRows = await trajectoryFactManualImportService.ImportAsync(stream, CancellationToken.None);
var trajectoryRows = trajectoryFactManualImportService.ImportAsync(stream);
Assert.Equal(4, trajectoryRows.Count());
}
}

View File

@ -200,7 +200,7 @@ public class DailyReportServiceTest
};
private readonly IWellService wellServiceMock = Substitute.For<IWellService>();
private readonly ITrajectoryEditableRepository<TrajectoryGeoFactDto> trajectoryFactRepositoryMock = Substitute.For<ITrajectoryEditableRepository<TrajectoryGeoFactDto>>();
private readonly ITrajectoryNnbRepository trajectoryFactNnbRepositoryMock = Substitute.For<ITrajectoryNnbRepository>();
private readonly IDailyReportRepository dailyReportRepositoryMock = Substitute.For<IDailyReportRepository>();
private readonly IScheduleRepository scheduleRepositoryMock = Substitute.For<IScheduleRepository>();
private readonly IWellOperationRepository wellOperationRepositoryMock = Substitute.For<IWellOperationRepository>();
@ -234,7 +234,7 @@ public class DailyReportServiceTest
};
dailyReportService = new DailyReportService(wellServiceMock,
trajectoryFactRepositoryMock,
trajectoryFactNnbRepositoryMock,
dailyReportRepositoryMock,
scheduleRepositoryMock,
wellOperationRepositoryMock,
@ -254,7 +254,7 @@ public class DailyReportServiceTest
wellServiceMock.GetOrDefaultAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
.ReturnsForAnyArgs(fakeWell);
trajectoryFactRepositoryMock.GetAsync(Arg.Any<TrajectoryRequest>(), Arg.Any<CancellationToken>())
trajectoryFactNnbRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
.ReturnsForAnyArgs(new[] { fakeLastFactTrajectory });
wellOperationRepositoryMock.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())

View File

@ -53,18 +53,13 @@ public class TrajectoryVisualizationServiceTest
new() { WellboreDepth = 0, ZenithAngle = 10, AzimuthGeo = 20 },
};
var request = new TrajectoryRequest()
{
IdWell = Arg.Any<int>()
};
trajectoryPlanRepositoryMock.GetAsync(request, Arg.Any<CancellationToken>())
trajectoryPlanRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
.ReturnsForAnyArgs(plannedTrajectory);
trajectoryFactRepositoryMock.GetAsync(request, Arg.Any<CancellationToken>())
trajectoryFactRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
.ReturnsForAnyArgs(actualTrajectory);
trajectoryNnbRepositoryMock.GetAsync(request, Arg.Any<CancellationToken>())
trajectoryNnbRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
.ReturnsForAnyArgs(nnbTrajectory);
//act
@ -110,18 +105,13 @@ public class TrajectoryVisualizationServiceTest
new() { WellboreDepth = 50, ZenithAngle = 0, AzimuthGeo = 0 },
};
var request = new TrajectoryRequest()
{
IdWell = Arg.Any<int>()
};
trajectoryPlanRepositoryMock.GetAsync(request, Arg.Any<CancellationToken>())
trajectoryPlanRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
.ReturnsForAnyArgs(plannedTrajectory);
trajectoryFactRepositoryMock.GetAsync(request, Arg.Any<CancellationToken>())
trajectoryFactRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
.ReturnsForAnyArgs(actualTrajectory);
trajectoryNnbRepositoryMock.GetAsync(request, Arg.Any<CancellationToken>())
trajectoryNnbRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
.ReturnsForAnyArgs(nnbTrajectory);
//act
@ -173,18 +163,14 @@ public class TrajectoryVisualizationServiceTest
new() { WellboreDepth = 20, ZenithAngle = 0, AzimuthGeo = 0 },
};
var request = new TrajectoryRequest()
{
IdWell = Arg.Any<int>()
};
trajectoryPlanRepositoryMock.GetAsync(request, Arg.Any<CancellationToken>())
trajectoryPlanRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
.ReturnsForAnyArgs(plannedTrajectory);
trajectoryFactRepositoryMock.GetAsync(request, Arg.Any<CancellationToken>())
trajectoryFactRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
.ReturnsForAnyArgs(actualTrajectory);
trajectoryNnbRepositoryMock.GetAsync(request, Arg.Any<CancellationToken>())
trajectoryNnbRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
.ReturnsForAnyArgs(nnbTrajectory);
//act

View File

@ -57,17 +57,16 @@ namespace AsbCloudWebApi.Controllers.Trajectory
/// <summary>
/// Получаем список всех строк координат траектории (для клиента)
/// </summary>
/// <param name="request">параметры запроса</param>
/// <param name="idWell">ключ скважины</param>
/// <param name="token"> Токен отмены задачи </param>
/// <returns>Список добавленных координат траектории</returns>
[HttpGet("/api/[controller]")]
//[ProducesResponseType(typeof(IEnumerable<Tdto>), (int)System.Net.HttpStatusCode.OK)]
public async Task<IActionResult> GetAsync([FromQuery] TrajectoryRequest request, CancellationToken token)
public async Task<IActionResult> GetAsync(int idWell, CancellationToken token)
{
if (!await CanUserAccessToWellAsync(request.IdWell,
if (!await CanUserAccessToWellAsync(idWell,
token).ConfigureAwait(false))
return Forbid();
var result = await trajectoryRepository.GetAsync(request, token);
var result = await trajectoryRepository.GetAsync(idWell, token);
return Ok(result);
}

View File

@ -24,12 +24,12 @@ namespace AsbCloudWebApi.Controllers.Trajectory
{
protected override string fileName { get; set; }
private readonly TrajectoryImportService<Tdto> trajectoryImportService;
private readonly TrajectoryParserService<Tdto> trajectoryImportService;
private readonly TrajectoryExportService<Tdto> trajectoryExportService;
private readonly ITrajectoryEditableRepository<Tdto> trajectoryRepository;
public TrajectoryEditableController(IWellService wellService,
TrajectoryImportService<Tdto> trajectoryImportService,
TrajectoryParserService<Tdto> trajectoryImportService,
TrajectoryExportService<Tdto> trajectoryExportService,
ITrajectoryEditableRepository<Tdto> trajectoryRepository)
: base(
@ -88,7 +88,7 @@ namespace AsbCloudWebApi.Controllers.Trajectory
try
{
var trajectoryRows = await trajectoryImportService.ImportAsync(stream, token);
var trajectoryRows = trajectoryImportService.ImportAsync(stream);
foreach (var row in trajectoryRows)
{
row.IdWell = idWell;

View File

@ -16,7 +16,7 @@ public class TrajectoryFactManualController : TrajectoryEditableController<Traje
{
protected override string fileName { get; set; }
public TrajectoryFactManualController(IWellService wellService,
TrajectoryFactManualImportService factTrajectoryImportService,
TrajectoryFactManualParserService factTrajectoryImportService,
TrajectoryFactManualExportService factTrajectoryExportService,
ITrajectoryEditableRepository<TrajectoryGeoFactDto> trajectoryFactRepository)
: base(

View File

@ -22,7 +22,7 @@ namespace AsbCloudWebApi.Controllers.Trajectory
private readonly TrajectoryService trajectoryVisualizationService;
public TrajectoryPlannedController(IWellService wellService,
TrajectoryPlannedImportService plannedTrajectoryImportService,
TrajectoryPlannedParserService plannedTrajectoryImportService,
TrajectoryPlannedExportService plannedTrajectoryExportService,
ITrajectoryEditableRepository<TrajectoryGeoPlanDto> plannedTrajectoryRepository,
TrajectoryService trajectoryVisualizationService)