forked from ddrilling/AsbCloudServer
Правки после ревью-2
This commit is contained in:
parent
29171a6e47
commit
6387aeeb17
@ -14,7 +14,6 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
/// <typeparam name="V"></typeparam>
|
/// <typeparam name="V"></typeparam>
|
||||||
/// <typeparam name="K"></typeparam>
|
|
||||||
public class PlanFactBase<T, V>
|
public class PlanFactBase<T, V>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
using AsbCloudApp.Data.Trajectory;
|
using AsbCloudApp.Data.Trajectory;
|
||||||
|
using AsbCloudApp.Requests;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace AsbCloudApp.Repositories
|
namespace AsbCloudApp.Repositories
|
||||||
{
|
{
|
||||||
@ -8,5 +12,12 @@ namespace AsbCloudApp.Repositories
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public interface ITrajectoryNnbRepository : ITrajectoryRepository<TrajectoryGeoFactDto>
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using AsbCloudApp.Data.Trajectory;
|
using AsbCloudApp.Data.Trajectory;
|
||||||
using AsbCloudApp.Requests;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -15,9 +14,9 @@ namespace AsbCloudApp.Repositories
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получить все добавленные по скважине координаты траектории
|
/// Получить все добавленные по скважине координаты траектории
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">параметры запроса</param>
|
/// <param name="idWell">ключ скважины</param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<T>> GetAsync(TrajectoryRequest request, CancellationToken token);
|
Task<IEnumerable<T>> GetAsync(int idWell, CancellationToken token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9094
AsbCloudDb/Migrations/20231129111522_Rename_t_trajectory_plan.Designer.cs
generated
Normal file
9094
AsbCloudDb/Migrations/20231129111522_Rename_t_trajectory_plan.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
109
AsbCloudDb/Migrations/20231129111522_Rename_t_trajectory_plan.cs
Normal file
109
AsbCloudDb/Migrations/20231129111522_Rename_t_trajectory_plan.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -262,7 +262,7 @@ namespace AsbCloudDb.Migrations
|
|||||||
b.HasComment("Контакты");
|
b.HasComment("Контакты");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("AsbCloudDb.Model.DailyReport.DailyReport", b =>
|
modelBuilder.Entity("AsbCloudDb.Model.DailyReports.DailyReport", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("IdWell")
|
b.Property<int>("IdWell")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
@ -2413,12 +2413,6 @@ namespace AsbCloudDb.Migrations
|
|||||||
Id = 528,
|
Id = 528,
|
||||||
Description = "Разрешение на удаление контакта",
|
Description = "Разрешение на удаление контакта",
|
||||||
Name = "WellContact.delete"
|
Name = "WellContact.delete"
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 529,
|
|
||||||
Description = "Разрешение редактировать фактические траектории",
|
|
||||||
Name = "FactTrajectory.edit"
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -4015,11 +4009,6 @@ namespace AsbCloudDb.Migrations
|
|||||||
{
|
{
|
||||||
IdUserRole = 1,
|
IdUserRole = 1,
|
||||||
IdPermission = 528
|
IdPermission = 528
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
IdUserRole = 1,
|
|
||||||
IdPermission = 529
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -5191,7 +5180,7 @@ namespace AsbCloudDb.Migrations
|
|||||||
b.HasComment("Загрузка фактической траектории");
|
b.HasComment("Загрузка фактической траектории");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryPlanned", b =>
|
modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryPlan", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
@ -5256,7 +5245,7 @@ namespace AsbCloudDb.Migrations
|
|||||||
|
|
||||||
b.HasIndex("IdWell");
|
b.HasIndex("IdWell");
|
||||||
|
|
||||||
b.ToTable("t_trajectory_planned");
|
b.ToTable("t_trajectory_plan");
|
||||||
|
|
||||||
b.HasComment("Загрузка плановой траектории");
|
b.HasComment("Загрузка плановой траектории");
|
||||||
});
|
});
|
||||||
@ -8675,7 +8664,7 @@ namespace AsbCloudDb.Migrations
|
|||||||
b.Navigation("Well");
|
b.Navigation("Well");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryPlanned", b =>
|
modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryPlan", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("AsbCloudDb.Model.User", "User")
|
b.HasOne("AsbCloudDb.Model.User", "User")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
|
@ -18,7 +18,7 @@ namespace AsbCloudDb.Model
|
|||||||
public virtual DbSet<DailyReport> DailyReports => Set <DailyReport>();
|
public virtual DbSet<DailyReport> DailyReports => Set <DailyReport>();
|
||||||
public virtual DbSet<Deposit> Deposits => Set<Deposit>();
|
public virtual DbSet<Deposit> Deposits => Set<Deposit>();
|
||||||
public virtual DbSet<DetectedOperation> DetectedOperations => Set<DetectedOperation>();
|
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<ProcessMapWellDrilling> ProcessMapWellDrillings => Set<ProcessMapWellDrilling>();
|
||||||
public virtual DbSet<ProcessMapWellReam> ProcessMapWellReams => Set<ProcessMapWellReam>();
|
public virtual DbSet<ProcessMapWellReam> ProcessMapWellReams => Set<ProcessMapWellReam>();
|
||||||
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
|
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
|
||||||
@ -61,7 +61,7 @@ namespace AsbCloudDb.Model
|
|||||||
public virtual DbSet<LimitingParameter> LimitingParameter => Set<LimitingParameter>();
|
public virtual DbSet<LimitingParameter> LimitingParameter => Set<LimitingParameter>();
|
||||||
|
|
||||||
public virtual DbSet<TelemetryWirelineRunOut> TelemetryWirelineRunOut => Set<TelemetryWirelineRunOut>();
|
public virtual DbSet<TelemetryWirelineRunOut> TelemetryWirelineRunOut => Set<TelemetryWirelineRunOut>();
|
||||||
public virtual DbSet<TrajectoryFact> FactTrajectories => Set<TrajectoryFact>();
|
public virtual DbSet<TrajectoryFact> TrajectoriesFact => Set<TrajectoryFact>();
|
||||||
|
|
||||||
// GTR WITS
|
// GTR WITS
|
||||||
public DbSet<WitsItemFloat> WitsItemFloat => Set<WitsItemFloat>();
|
public DbSet<WitsItemFloat> WitsItemFloat => Set<WitsItemFloat>();
|
||||||
|
@ -160,9 +160,7 @@
|
|||||||
new (){ Id = 526, Name = "WellOperation.editCompletedWell", Description = "Разрешение на редактирование операций у завершенной скважины"},
|
new (){ Id = 526, Name = "WellOperation.editCompletedWell", Description = "Разрешение на редактирование операций у завершенной скважины"},
|
||||||
|
|
||||||
new() { Id = 527, Name = "Manual.delete", Description = "Разрешение на удаление инструкций"},
|
new() { Id = 527, Name = "Manual.delete", Description = "Разрешение на удаление инструкций"},
|
||||||
new (){ Id = 528, Name="WellContact.delete", Description="Разрешение на удаление контакта"},
|
new (){ Id = 528, Name="WellContact.delete", Description="Разрешение на удаление контакта"}
|
||||||
|
|
||||||
new (){ Id = 529, Name="FactTrajectory.edit", Description="Разрешение редактировать фактические траектории"}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ namespace AsbCloudDb.Model
|
|||||||
DbSet<DailyReport> DailyReports { get; }
|
DbSet<DailyReport> DailyReports { get; }
|
||||||
DbSet<Deposit> Deposits { get; }
|
DbSet<Deposit> Deposits { get; }
|
||||||
DbSet<DetectedOperation> DetectedOperations { get; }
|
DbSet<DetectedOperation> DetectedOperations { get; }
|
||||||
DbSet<TrajectoryPlanned> PlannedTrajectories { get; }
|
DbSet<TrajectoryPlan> TrajectoriesPlan { get; }
|
||||||
DbSet<ProcessMapWellDrilling> ProcessMapWellDrillings { get; }
|
DbSet<ProcessMapWellDrilling> ProcessMapWellDrillings { get; }
|
||||||
DbSet<ProcessMapWellReam> ProcessMapWellReams { get; }
|
DbSet<ProcessMapWellReam> ProcessMapWellReams { get; }
|
||||||
DbSet<DrillingProgramPart> DrillingProgramParts { get; }
|
DbSet<DrillingProgramPart> DrillingProgramParts { get; }
|
||||||
@ -79,7 +79,7 @@ namespace AsbCloudDb.Model
|
|||||||
DbSet<ManualDirectory> ManualDirectories { get; }
|
DbSet<ManualDirectory> ManualDirectories { get; }
|
||||||
DbSet<Contact> Contacts { get; }
|
DbSet<Contact> Contacts { get; }
|
||||||
DbSet<DrillTest> DrillTests { get; }
|
DbSet<DrillTest> DrillTests { get; }
|
||||||
DbSet<TrajectoryFact> FactTrajectories { get; }
|
DbSet<TrajectoryFact> TrajectoriesFact { get; }
|
||||||
DatabaseFacade Database { get; }
|
DatabaseFacade Database { get; }
|
||||||
|
|
||||||
Task<int> RefreshMaterializedViewAsync(string mwName, CancellationToken token);
|
Task<int> RefreshMaterializedViewAsync(string mwName, CancellationToken token);
|
||||||
|
@ -3,8 +3,8 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
|
|
||||||
namespace AsbCloudDb.Model.Trajectory
|
namespace AsbCloudDb.Model.Trajectory
|
||||||
{
|
{
|
||||||
[Table("t_trajectory_planned"), Comment("Загрузка плановой траектории")]
|
[Table("t_trajectory_plan"), Comment("Загрузка плановой траектории")]
|
||||||
public class TrajectoryPlanned : Trajectory
|
public class TrajectoryPlan : Trajectory
|
||||||
{
|
{
|
||||||
[Column("radius"), Comment("Радиус цели")]
|
[Column("radius"), Comment("Радиус цели")]
|
||||||
public double? Radius { get; set; }
|
public double? Radius { get; set; }
|
@ -204,8 +204,8 @@ namespace AsbCloudInfrastructure
|
|||||||
services.AddTransient<TrajectoryPlannedExportService>();
|
services.AddTransient<TrajectoryPlannedExportService>();
|
||||||
services.AddTransient<TrajectoryFactManualExportService>();
|
services.AddTransient<TrajectoryFactManualExportService>();
|
||||||
services.AddTransient<TrajectoryFactNnbExportService>();
|
services.AddTransient<TrajectoryFactNnbExportService>();
|
||||||
services.AddTransient<TrajectoryPlannedImportService>();
|
services.AddTransient<TrajectoryPlannedParserService>();
|
||||||
services.AddTransient<TrajectoryFactManualImportService>();
|
services.AddTransient<TrajectoryFactManualParserService>();
|
||||||
services.AddTransient<IWellOperationRepository, WellOperationRepository>();
|
services.AddTransient<IWellOperationRepository, WellOperationRepository>();
|
||||||
services.AddTransient<IDailyReportService, DailyReportService>();
|
services.AddTransient<IDailyReportService, DailyReportService>();
|
||||||
services.AddTransient<IDetectedOperationService, DetectedOperationService>();
|
services.AddTransient<IDetectedOperationService, DetectedOperationService>();
|
||||||
@ -268,7 +268,7 @@ namespace AsbCloudInfrastructure
|
|||||||
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
|
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
|
||||||
services.AddTransient<ITelemetryWirelineRunOutRepository, TelemetryWirelineRunOutRepository>();
|
services.AddTransient<ITelemetryWirelineRunOutRepository, TelemetryWirelineRunOutRepository>();
|
||||||
services.AddTransient<IWellFinalDocumentsRepository, WellFinalDocumentsRepository>();
|
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<ITrajectoryEditableRepository<TrajectoryGeoFactDto>, TrajectoryEditableRepository<TrajectoryFact, TrajectoryGeoFactDto>>();
|
||||||
services.AddTransient<ITrajectoryNnbRepository, TrajectoryNnbRepository>();
|
services.AddTransient<ITrajectoryNnbRepository, TrajectoryNnbRepository>();
|
||||||
services.AddTransient<IFaqRepository, FaqRepository>();
|
services.AddTransient<IFaqRepository, FaqRepository>();
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using AsbCloudApp.Data.Trajectory;
|
using AsbCloudApp.Data.Trajectory;
|
||||||
using AsbCloudApp.Exceptions;
|
using AsbCloudApp.Exceptions;
|
||||||
using AsbCloudApp.Repositories;
|
using AsbCloudApp.Repositories;
|
||||||
using AsbCloudApp.Requests;
|
|
||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
using AsbCloudDb.Model;
|
using AsbCloudDb.Model;
|
||||||
using AsbCloudDb.Model.Trajectory;
|
using AsbCloudDb.Model.Trajectory;
|
||||||
@ -31,7 +30,7 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
this.db = db;
|
this.db = db;
|
||||||
this.wellService = wellService;
|
this.wellService = wellService;
|
||||||
}
|
}
|
||||||
/// <inheritdoc/>
|
|
||||||
public async Task<int> AddRangeAsync(IEnumerable<Tdto> trajectoryRows, CancellationToken token)
|
public async Task<int> AddRangeAsync(IEnumerable<Tdto> trajectoryRows, CancellationToken token)
|
||||||
{
|
{
|
||||||
var idWell = trajectoryRows.First().IdWell;
|
var idWell = trajectoryRows.First().IdWell;
|
||||||
@ -48,11 +47,9 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
});
|
});
|
||||||
|
|
||||||
db.Set<TEntity>().AddRange(entities);
|
db.Set<TEntity>().AddRange(entities);
|
||||||
return await db.SaveChangesAsync(token)
|
return await db.SaveChangesAsync(token);
|
||||||
.ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public async Task<int> AddAsync(Tdto trajectoryRow, CancellationToken token)
|
public async Task<int> AddAsync(Tdto trajectoryRow, CancellationToken token)
|
||||||
{
|
{
|
||||||
var offsetHours = wellService.GetTimezone(trajectoryRow.IdWell).Hours;
|
var offsetHours = wellService.GetTimezone(trajectoryRow.IdWell).Hours;
|
||||||
@ -63,7 +60,6 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public async Task<int> DeleteRangeAsync(IEnumerable<int> ids, CancellationToken token)
|
public async Task<int> DeleteRangeAsync(IEnumerable<int> ids, CancellationToken token)
|
||||||
{
|
{
|
||||||
var query = db.Set<TEntity>()
|
var query = db.Set<TEntity>()
|
||||||
@ -73,7 +69,6 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public async Task<int> DeleteByIdWellAsync(int idWell, CancellationToken token)
|
public async Task<int> DeleteByIdWellAsync(int idWell, CancellationToken token)
|
||||||
{
|
{
|
||||||
var query = db.Set<TEntity>()
|
var query = db.Set<TEntity>()
|
||||||
@ -83,11 +78,10 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
public async Task<IEnumerable<Tdto>> GetAsync(int idWell, CancellationToken token)
|
||||||
public async Task<IEnumerable<Tdto>> GetAsync(TrajectoryRequest request, CancellationToken token)
|
|
||||||
{
|
{
|
||||||
var well = wellService.GetOrDefault(request.IdWell)
|
var well = wellService.GetOrDefault(idWell)
|
||||||
?? throw new ArgumentInvalidException(nameof(request.IdWell), "idWell doesn`t exist");
|
?? throw new ArgumentInvalidException(nameof(idWell), "idWell doesn`t exist");
|
||||||
|
|
||||||
var offsetHours = well.Timezone.Hours;
|
var offsetHours = well.Timezone.Hours;
|
||||||
var query = db.Set<TEntity>()
|
var query = db.Set<TEntity>()
|
||||||
@ -96,12 +90,12 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
var entities = await query
|
var entities = await query
|
||||||
.OrderBy(e => e.WellboreDepth)
|
.OrderBy(e => e.WellboreDepth)
|
||||||
.ToArrayAsync(token);
|
.ToArrayAsync(token);
|
||||||
|
|
||||||
var result = entities
|
var result = entities
|
||||||
.Select(r => Convert(r, offsetHours));
|
.Select(r => Convert(r, offsetHours));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public async Task<int> UpdateAsync(Tdto row, CancellationToken token)
|
public async Task<int> UpdateAsync(Tdto row, CancellationToken token)
|
||||||
{
|
{
|
||||||
var offsetHours = wellService.GetTimezone(row.IdWell).Hours;
|
var offsetHours = wellService.GetTimezone(row.IdWell).Hours;
|
||||||
@ -111,14 +105,14 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Tdto Convert(TEntity entity, double offsetHours)
|
private static Tdto Convert(TEntity entity, double offsetHours)
|
||||||
{
|
{
|
||||||
var dto = entity.Adapt<Tdto>();
|
var dto = entity.Adapt<Tdto>();
|
||||||
dto.UpdateDate = entity.UpdateDate.ToRemoteDateTime(offsetHours);
|
dto.UpdateDate = entity.UpdateDate.ToRemoteDateTime(offsetHours);
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TEntity Convert(Tdto dto, double offsetHours)
|
private static TEntity Convert(Tdto dto, double offsetHours)
|
||||||
{
|
{
|
||||||
var entity = dto.Adapt<TEntity>();
|
var entity = dto.Adapt<TEntity>();
|
||||||
entity.UpdateDate = DateTime.Now.ToUtcDateTimeOffset(offsetHours);
|
entity.UpdateDate = DateTime.Now.ToUtcDateTimeOffset(offsetHours);
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using AsbCloudApp.Exceptions;
|
using AsbCloudApp.Exceptions;
|
||||||
using AsbCloudApp.Repositories;
|
using AsbCloudApp.Repositories;
|
||||||
using AsbCloudApp.Requests;
|
using AsbCloudApp.Requests;
|
||||||
using AsbCloudApp.Services;
|
|
||||||
using AsbCloudDb.Model;
|
using AsbCloudDb.Model;
|
||||||
using AsbCloudDb.Model.WITS;
|
using AsbCloudDb.Model.WITS;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
@ -16,11 +15,9 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
public class TrajectoryNnbRepository : ITrajectoryNnbRepository
|
public class TrajectoryNnbRepository : ITrajectoryNnbRepository
|
||||||
{
|
{
|
||||||
private readonly IAsbCloudDbContext db;
|
private readonly IAsbCloudDbContext db;
|
||||||
private readonly IWellService wellService;
|
public TrajectoryNnbRepository(IAsbCloudDbContext db)
|
||||||
public TrajectoryNnbRepository(IAsbCloudDbContext db, IWellService wellService)
|
|
||||||
{
|
{
|
||||||
this.db = db;
|
this.db = db;
|
||||||
this.wellService = wellService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IQueryable<Record7> BuildQuery(TrajectoryRequest request)
|
private IQueryable<Record7> BuildQuery(TrajectoryRequest request)
|
||||||
@ -42,8 +39,12 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
return query.OrderBy(e => e.Deptsvym);
|
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)
|
var entities = (await BuildQuery(request)
|
||||||
.Where(coord => coord.Deptsvym.HasValue &&
|
.Where(coord => coord.Deptsvym.HasValue &&
|
||||||
coord.Svyinc.HasValue &&
|
coord.Svyinc.HasValue &&
|
||||||
@ -65,5 +66,10 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task<IEnumerable<TrajectoryGeoFactDto>> GetByRequestAsync(TrajectoryRequest trajectoryRequest, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport;
|
|||||||
public class DailyReportService : IDailyReportService
|
public class DailyReportService : IDailyReportService
|
||||||
{
|
{
|
||||||
private readonly IWellService wellService;
|
private readonly IWellService wellService;
|
||||||
private readonly ITrajectoryEditableRepository<TrajectoryGeoFactDto> trajectoryFactRepository;
|
private readonly ITrajectoryNnbRepository trajectoryFactNnbRepository;
|
||||||
private readonly IDailyReportRepository dailyReportRepository;
|
private readonly IDailyReportRepository dailyReportRepository;
|
||||||
private readonly IScheduleRepository scheduleRepository;
|
private readonly IScheduleRepository scheduleRepository;
|
||||||
private readonly IWellOperationRepository wellOperationRepository;
|
private readonly IWellOperationRepository wellOperationRepository;
|
||||||
@ -35,7 +35,7 @@ public class DailyReportService : IDailyReportService
|
|||||||
private readonly IDetectedOperationService detectedOperationService;
|
private readonly IDetectedOperationService detectedOperationService;
|
||||||
|
|
||||||
public DailyReportService(IWellService wellService,
|
public DailyReportService(IWellService wellService,
|
||||||
ITrajectoryEditableRepository<TrajectoryGeoFactDto> trajectoryFactRepository,
|
ITrajectoryNnbRepository trajectoryFactNnbRepository,
|
||||||
IDailyReportRepository dailyReportRepository,
|
IDailyReportRepository dailyReportRepository,
|
||||||
IScheduleRepository scheduleRepository,
|
IScheduleRepository scheduleRepository,
|
||||||
IWellOperationRepository wellOperationRepository,
|
IWellOperationRepository wellOperationRepository,
|
||||||
@ -44,7 +44,7 @@ public class DailyReportService : IDailyReportService
|
|||||||
IDetectedOperationService detectedOperationService)
|
IDetectedOperationService detectedOperationService)
|
||||||
{
|
{
|
||||||
this.wellService = wellService;
|
this.wellService = wellService;
|
||||||
this.trajectoryFactRepository = trajectoryFactRepository;
|
this.trajectoryFactNnbRepository = trajectoryFactNnbRepository;
|
||||||
this.dailyReportRepository = dailyReportRepository;
|
this.dailyReportRepository = dailyReportRepository;
|
||||||
this.scheduleRepository = scheduleRepository;
|
this.scheduleRepository = scheduleRepository;
|
||||||
this.wellOperationRepository = wellOperationRepository;
|
this.wellOperationRepository = wellOperationRepository;
|
||||||
@ -260,7 +260,7 @@ public class DailyReportService : IDailyReportService
|
|||||||
|
|
||||||
private async Task AddTrajectoryBlockAsync(DailyReportDto dailyReport, CancellationToken cancellationToken)
|
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,
|
IdWell = dailyReport.IdWell,
|
||||||
GeDate = dailyReport.Date,
|
GeDate = dailyReport.Date,
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using AsbCloudApp.Data.Trajectory;
|
using AsbCloudApp.Data.Trajectory;
|
||||||
using AsbCloudApp.Repositories;
|
using AsbCloudApp.Repositories;
|
||||||
using AsbCloudApp.Requests;
|
|
||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
using ClosedXML.Excel;
|
using ClosedXML.Excel;
|
||||||
using System;
|
using System;
|
||||||
@ -17,31 +16,22 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Export
|
|||||||
private readonly IWellService wellService;
|
private readonly IWellService wellService;
|
||||||
|
|
||||||
private readonly ITrajectoryRepository<T> trajectoryRepository;
|
private readonly ITrajectoryRepository<T> trajectoryRepository;
|
||||||
protected abstract void AddCoordinatesToRow(IXLRow row, T trajectory);
|
public abstract string templateFileName { get; }
|
||||||
public abstract string templateFileName { get; set; }
|
public abstract string usingTemplateFile { get; }
|
||||||
public abstract string usingTemplateFile { get; set; }
|
public abstract string sheetTrajectory { get; }
|
||||||
public abstract string sheetTrajectory { get; set; }
|
public abstract int headerRowsCount { get; }
|
||||||
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 TrajectoryExportService(IWellService wellService, ITrajectoryRepository<T> trajectoryService)
|
public TrajectoryExportService(IWellService wellService, ITrajectoryRepository<T> trajectoryRepository)
|
||||||
{
|
{
|
||||||
this.wellService = wellService;
|
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)
|
public async Task<Stream> ExportAsync(int idWell, CancellationToken token)
|
||||||
{
|
{
|
||||||
var request = new TrajectoryRequest()
|
var trajectorys = await trajectoryRepository.GetAsync(idWell, token);
|
||||||
{
|
|
||||||
IdWell = idWell,
|
|
||||||
};
|
|
||||||
var trajectorys = await trajectoryRepository.GetAsync(request, token);
|
|
||||||
return MakeExelFileStream(trajectorys);
|
return MakeExelFileStream(trajectorys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,16 +8,10 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Export
|
|||||||
|
|
||||||
public class TrajectoryFactManualExportService : TrajectoryExportService<TrajectoryGeoFactDto>
|
public class TrajectoryFactManualExportService : TrajectoryExportService<TrajectoryGeoFactDto>
|
||||||
{
|
{
|
||||||
public override string templateFileName { get; set; } = "TrajectoryFactManualTemplate.xlsx";
|
public override string templateFileName { get; } = "TrajectoryFactManualTemplate.xlsx";
|
||||||
public override string usingTemplateFile { get; set; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
|
public override string usingTemplateFile { get; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
|
||||||
public override string sheetTrajectory { get; set; } = "Фактическая траектория";
|
public override string sheetTrajectory { get; } = "Фактическая траектория";
|
||||||
public override int headerRowsCount { get; set; } = 2;
|
public override int headerRowsCount { get; } = 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 TrajectoryFactManualExportService(
|
public TrajectoryFactManualExportService(
|
||||||
IWellService wellService,
|
IWellService wellService,
|
||||||
@ -29,12 +23,12 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Export
|
|||||||
|
|
||||||
protected override void AddCoordinatesToRow(IXLRow row, TrajectoryGeoFactDto trajectory)
|
protected override void AddCoordinatesToRow(IXLRow row, TrajectoryGeoFactDto trajectory)
|
||||||
{
|
{
|
||||||
row.Cell(ColumnWellboreDepth).Value = trajectory.WellboreDepth;
|
row.Cell(1).Value = trajectory.WellboreDepth;
|
||||||
row.Cell(ColumnZenithAngle).Value = trajectory.ZenithAngle;
|
row.Cell(2).Value = trajectory.ZenithAngle;
|
||||||
row.Cell(ColumnAzimuthGeo).Value = trajectory.AzimuthGeo;
|
row.Cell(3).Value = trajectory.AzimuthGeo;
|
||||||
row.Cell(ColumnAzimuthMagnetic).Value = trajectory.AzimuthMagnetic;
|
row.Cell(4).Value = trajectory.AzimuthMagnetic;
|
||||||
row.Cell(ColumnVerticalDepth).Value = trajectory.VerticalDepth;
|
row.Cell(5).Value = trajectory.VerticalDepth;
|
||||||
row.Cell(ColumnComment).Value = trajectory.Comment;
|
row.Cell(6).Value = trajectory.Comment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,16 +8,10 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Export
|
|||||||
|
|
||||||
public class TrajectoryFactNnbExportService : TrajectoryExportService<TrajectoryGeoFactDto>
|
public class TrajectoryFactNnbExportService : TrajectoryExportService<TrajectoryGeoFactDto>
|
||||||
{
|
{
|
||||||
public override string templateFileName { get; set; } = "TrajectoryFactNnbTemplate.xlsx";
|
public override string templateFileName { get; } = "TrajectoryFactNnbTemplate.xlsx";
|
||||||
public override string usingTemplateFile { get; set; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
|
public override string usingTemplateFile { get; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
|
||||||
public override string sheetTrajectory { get; set; } = "Фактическая ннб-траектория";
|
public override string sheetTrajectory { get; } = "Фактическая ннб-траектория";
|
||||||
public override int headerRowsCount { get; set; } = 2;
|
public override int headerRowsCount { get; } = 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 TrajectoryFactNnbExportService(
|
public TrajectoryFactNnbExportService(
|
||||||
IWellService wellService,
|
IWellService wellService,
|
||||||
@ -29,12 +23,12 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Export
|
|||||||
|
|
||||||
protected override void AddCoordinatesToRow(IXLRow row, TrajectoryGeoFactDto trajectory)
|
protected override void AddCoordinatesToRow(IXLRow row, TrajectoryGeoFactDto trajectory)
|
||||||
{
|
{
|
||||||
row.Cell(ColumnWellboreDepth).Value = trajectory.WellboreDepth;
|
row.Cell(1).Value = trajectory.WellboreDepth;
|
||||||
row.Cell(ColumnZenithAngle).Value = trajectory.ZenithAngle;
|
row.Cell(2).Value = trajectory.ZenithAngle;
|
||||||
row.Cell(ColumnAzimuthGeo).Value = trajectory.AzimuthGeo;
|
row.Cell(3).Value = trajectory.AzimuthGeo;
|
||||||
row.Cell(ColumnAzimuthMagnetic).Value = trajectory.AzimuthMagnetic;
|
row.Cell(4).Value = trajectory.AzimuthMagnetic;
|
||||||
row.Cell(ColumnVerticalDepth).Value = trajectory.VerticalDepth;
|
row.Cell(5).Value = trajectory.VerticalDepth;
|
||||||
row.Cell(ColumnComment).Value = trajectory.Comment;
|
row.Cell(6).Value = trajectory.Comment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,17 +10,10 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Export
|
|||||||
/*
|
/*
|
||||||
* password for PlannedTrajectoryTemplate.xlsx is Drill2022
|
* password for PlannedTrajectoryTemplate.xlsx is Drill2022
|
||||||
*/
|
*/
|
||||||
public override string templateFileName { get; set; } = "TrajectoryPlannedTemplate.xlsx";
|
public override string templateFileName { get; } = "TrajectoryPlannedTemplate.xlsx";
|
||||||
public override string usingTemplateFile { get; set; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
|
public override string usingTemplateFile { get; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
|
||||||
public override string sheetTrajectory { get; set; } = "Плановая траектория";
|
public override string sheetTrajectory { get; } = "Плановая траектория";
|
||||||
public override int headerRowsCount { get; set; } = 2;
|
public override int headerRowsCount { get; } = 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 TrajectoryPlannedExportService(
|
public TrajectoryPlannedExportService(
|
||||||
IWellService wellService,
|
IWellService wellService,
|
||||||
@ -31,13 +24,13 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Export
|
|||||||
|
|
||||||
protected override void AddCoordinatesToRow(IXLRow row, TrajectoryGeoPlanDto trajectory)
|
protected override void AddCoordinatesToRow(IXLRow row, TrajectoryGeoPlanDto trajectory)
|
||||||
{
|
{
|
||||||
row.Cell(ColumnWellboreDepth).Value = trajectory.WellboreDepth;
|
row.Cell(1).Value = trajectory.WellboreDepth;
|
||||||
row.Cell(ColumnZenithAngle).Value = trajectory.ZenithAngle;
|
row.Cell(2).Value = trajectory.ZenithAngle;
|
||||||
row.Cell(ColumnAzimuthGeo).Value = trajectory.AzimuthGeo;
|
row.Cell(3).Value = trajectory.AzimuthGeo;
|
||||||
row.Cell(ColumnAzimuthMagnetic).Value = trajectory.AzimuthMagnetic;
|
row.Cell(4).Value = trajectory.AzimuthMagnetic;
|
||||||
row.Cell(ColumnVerticalDepth).Value = trajectory.VerticalDepth;
|
row.Cell(5).Value = trajectory.VerticalDepth;
|
||||||
row.Cell(ColumnRadius).Value = trajectory.Radius;
|
row.Cell(6).Value = trajectory.Radius;
|
||||||
row.Cell(ColumnComment).Value = trajectory.Comment;
|
row.Cell(7).Value = trajectory.Comment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,36 +1,26 @@
|
|||||||
using AsbCloudApp.Data.Trajectory;
|
using AsbCloudApp.Data.Trajectory;
|
||||||
using AsbCloudApp.Repositories;
|
|
||||||
using AsbCloudApp.Services;
|
|
||||||
using ClosedXML.Excel;
|
using ClosedXML.Excel;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.Trajectory.Import
|
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 TrajectoryParserService()
|
||||||
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()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
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);
|
using var workbook = new XLWorkbook(stream, XLEventTracking.Disabled);
|
||||||
var trajectoryRows = ParseFileStream(stream);
|
var trajectoryRows = ParseFileStream(stream);
|
||||||
@ -47,9 +37,9 @@ namespace AsbCloudInfrastructure.Services.Trajectory.Import
|
|||||||
|
|
||||||
private IEnumerable<T> ParseWorkbook(IXLWorkbook workbook)
|
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)
|
if (sheetTrajectory is null)
|
||||||
throw new FileFormatException($"Книга excel не содержит листа {sheetNamePlannedTrajectory}.");
|
throw new FileFormatException($"Книга excel не содержит листа {sheetNameTrajectory}.");
|
||||||
var trajectoryRows = ParseSheet(sheetTrajectory);
|
var trajectoryRows = ParseSheet(sheetTrajectory);
|
||||||
return trajectoryRows;
|
return trajectoryRows;
|
||||||
}
|
}
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -30,11 +30,7 @@ abstract class TrajectoryBaseService<TGeo, TCartesian>
|
|||||||
|
|
||||||
public async Task<IEnumerable<TCartesian>?> GetAsync(int idWell, CancellationToken token)
|
public async Task<IEnumerable<TCartesian>?> GetAsync(int idWell, CancellationToken token)
|
||||||
{
|
{
|
||||||
var request = new TrajectoryRequest()
|
var geoCoords = await repository.GetAsync(idWell, token);
|
||||||
{
|
|
||||||
IdWell = idWell
|
|
||||||
};
|
|
||||||
var geoCoords = await repository.GetAsync(request, token);
|
|
||||||
var locs = GetTrajectoryVisualisation(geoCoords);
|
var locs = GetTrajectoryVisualisation(geoCoords);
|
||||||
var dtos = locs.Select(l => Convert(l));
|
var dtos = locs.Select(l => Convert(l));
|
||||||
return dtos;
|
return dtos;
|
||||||
|
@ -23,6 +23,8 @@ namespace AsbCloudWebApi.Tests.Services.Trajectory
|
|||||||
private readonly ITrajectoryNnbRepository trajectoryFactNnbRepository;
|
private readonly ITrajectoryNnbRepository trajectoryFactNnbRepository;
|
||||||
private readonly TrajectoryFactNnbExportService trajectoryFactNnbExportService;
|
private readonly TrajectoryFactNnbExportService trajectoryFactNnbExportService;
|
||||||
|
|
||||||
|
private readonly int idWell = 4;
|
||||||
|
|
||||||
private readonly TrajectoryGeoPlanDto[] trajectoryPlannedRows = new TrajectoryGeoPlanDto[2] {
|
private readonly TrajectoryGeoPlanDto[] trajectoryPlannedRows = new TrajectoryGeoPlanDto[2] {
|
||||||
new TrajectoryGeoPlanDto() {
|
new TrajectoryGeoPlanDto() {
|
||||||
Id = 1,
|
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()
|
public TrajectoryExportTest()
|
||||||
{
|
{
|
||||||
wellService = Substitute.For<IWellService>();
|
wellService = Substitute.For<IWellService>();
|
||||||
@ -103,10 +97,10 @@ namespace AsbCloudWebApi.Tests.Services.Trajectory
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Export_trajectory_planned()
|
public async Task Export_trajectory_planned()
|
||||||
{
|
{
|
||||||
trajectoryPlannedRepository.GetAsync(request, CancellationToken.None)
|
trajectoryPlannedRepository.GetAsync(idWell, CancellationToken.None)
|
||||||
.Returns(trajectoryPlannedRows);
|
.Returns(trajectoryPlannedRows);
|
||||||
|
|
||||||
var stream = await trajectoryPlannedExportService.ExportAsync(request.IdWell, CancellationToken.None);
|
var stream = await trajectoryPlannedExportService.ExportAsync(idWell, CancellationToken.None);
|
||||||
Assert.True(stream.Length > 0);
|
Assert.True(stream.Length > 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -114,20 +108,20 @@ namespace AsbCloudWebApi.Tests.Services.Trajectory
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task Export_trajectory_fact_manual()
|
public async Task Export_trajectory_fact_manual()
|
||||||
{
|
{
|
||||||
trajectoryFactManualReposirory.GetAsync(request, CancellationToken.None)
|
trajectoryFactManualReposirory.GetAsync(idWell, CancellationToken.None)
|
||||||
.Returns(trajectoryFactRows);
|
.Returns(trajectoryFactRows);
|
||||||
|
|
||||||
var stream = await trajectoryFactManualExportService.ExportAsync(request.IdWell, CancellationToken.None);
|
var stream = await trajectoryFactManualExportService.ExportAsync(idWell, CancellationToken.None);
|
||||||
Assert.True(stream.Length > 0);
|
Assert.True(stream.Length > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Export_trajectory_fact_nnb()
|
public async Task Export_trajectory_fact_nnb()
|
||||||
{
|
{
|
||||||
trajectoryFactNnbRepository.GetAsync(request, CancellationToken.None)
|
trajectoryFactNnbRepository.GetAsync(idWell, CancellationToken.None)
|
||||||
.Returns(trajectoryFactRows);
|
.Returns(trajectoryFactRows);
|
||||||
|
|
||||||
var stream = await trajectoryFactNnbExportService.ExportAsync(request.IdWell, CancellationToken.None);
|
var stream = await trajectoryFactNnbExportService.ExportAsync(idWell, CancellationToken.None);
|
||||||
Assert.True(stream.Length > 0);
|
Assert.True(stream.Length > 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,24 @@
|
|||||||
using AsbCloudApp.Services;
|
using AsbCloudInfrastructure.Services.Trajectory.Import;
|
||||||
using AsbCloudInfrastructure.Services.Trajectory;
|
|
||||||
using AsbCloudInfrastructure.Services.Trajectory.Import;
|
|
||||||
using NSubstitute;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace AsbCloudWebApi.Tests.Services.Trajectory
|
namespace AsbCloudWebApi.Tests.Services.Trajectory
|
||||||
{
|
{
|
||||||
public class TrajectoryImportTest
|
public class TrajectoryImportTest
|
||||||
{
|
{
|
||||||
private readonly TrajectoryPlannedImportService trajectoryPlannedImportService;
|
private readonly TrajectoryPlannedParserService trajectoryPlannedImportService;
|
||||||
private readonly TrajectoryFactManualImportService trajectoryFactManualImportService;
|
private readonly TrajectoryFactManualParserService trajectoryFactManualImportService;
|
||||||
|
|
||||||
private string usingTemplateFile = "AsbCloudWebApi.Tests.Services.Trajectory.Templates";
|
private string usingTemplateFile = "AsbCloudWebApi.Tests.Services.Trajectory.Templates";
|
||||||
|
|
||||||
public TrajectoryImportTest()
|
public TrajectoryImportTest()
|
||||||
{
|
{
|
||||||
trajectoryPlannedImportService = new TrajectoryPlannedImportService();
|
trajectoryPlannedImportService = new TrajectoryPlannedParserService();
|
||||||
trajectoryFactManualImportService = new TrajectoryFactManualImportService();
|
trajectoryFactManualImportService = new TrajectoryFactManualParserService();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Import_trajectory_planned()
|
public void Import_trajectory_planned()
|
||||||
{
|
{
|
||||||
var stream = System.Reflection.Assembly.GetExecutingAssembly()
|
var stream = System.Reflection.Assembly.GetExecutingAssembly()
|
||||||
.GetManifestResourceStream($"{usingTemplateFile}.TrajectoryPlannedTemplate.xlsx");
|
.GetManifestResourceStream($"{usingTemplateFile}.TrajectoryPlannedTemplate.xlsx");
|
||||||
@ -31,13 +26,13 @@ namespace AsbCloudWebApi.Tests.Services.Trajectory
|
|||||||
if (stream is null)
|
if (stream is null)
|
||||||
Assert.Fail("Файла для импорта не существует");
|
Assert.Fail("Файла для импорта не существует");
|
||||||
|
|
||||||
var trajectoryRows = await trajectoryPlannedImportService.ImportAsync(stream, CancellationToken.None);
|
var trajectoryRows = trajectoryPlannedImportService.ImportAsync(stream);
|
||||||
|
|
||||||
Assert.Equal(3, trajectoryRows.Count());
|
Assert.Equal(3, trajectoryRows.Count());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Import_trajectory_fact_manual()
|
public void Import_trajectory_fact_manual()
|
||||||
{
|
{
|
||||||
var stream = System.Reflection.Assembly.GetExecutingAssembly()
|
var stream = System.Reflection.Assembly.GetExecutingAssembly()
|
||||||
.GetManifestResourceStream($"{usingTemplateFile}.TrajectoryFactManualTemplate.xlsx");
|
.GetManifestResourceStream($"{usingTemplateFile}.TrajectoryFactManualTemplate.xlsx");
|
||||||
@ -45,7 +40,7 @@ namespace AsbCloudWebApi.Tests.Services.Trajectory
|
|||||||
if (stream is null)
|
if (stream is null)
|
||||||
Assert.Fail("Файла для импорта не существует");
|
Assert.Fail("Файла для импорта не существует");
|
||||||
|
|
||||||
var trajectoryRows = await trajectoryFactManualImportService.ImportAsync(stream, CancellationToken.None);
|
var trajectoryRows = trajectoryFactManualImportService.ImportAsync(stream);
|
||||||
|
|
||||||
Assert.Equal(4, trajectoryRows.Count());
|
Assert.Equal(4, trajectoryRows.Count());
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ public class DailyReportServiceTest
|
|||||||
};
|
};
|
||||||
|
|
||||||
private readonly IWellService wellServiceMock = Substitute.For<IWellService>();
|
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 IDailyReportRepository dailyReportRepositoryMock = Substitute.For<IDailyReportRepository>();
|
||||||
private readonly IScheduleRepository scheduleRepositoryMock = Substitute.For<IScheduleRepository>();
|
private readonly IScheduleRepository scheduleRepositoryMock = Substitute.For<IScheduleRepository>();
|
||||||
private readonly IWellOperationRepository wellOperationRepositoryMock = Substitute.For<IWellOperationRepository>();
|
private readonly IWellOperationRepository wellOperationRepositoryMock = Substitute.For<IWellOperationRepository>();
|
||||||
@ -234,7 +234,7 @@ public class DailyReportServiceTest
|
|||||||
};
|
};
|
||||||
|
|
||||||
dailyReportService = new DailyReportService(wellServiceMock,
|
dailyReportService = new DailyReportService(wellServiceMock,
|
||||||
trajectoryFactRepositoryMock,
|
trajectoryFactNnbRepositoryMock,
|
||||||
dailyReportRepositoryMock,
|
dailyReportRepositoryMock,
|
||||||
scheduleRepositoryMock,
|
scheduleRepositoryMock,
|
||||||
wellOperationRepositoryMock,
|
wellOperationRepositoryMock,
|
||||||
@ -254,7 +254,7 @@ public class DailyReportServiceTest
|
|||||||
wellServiceMock.GetOrDefaultAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
|
wellServiceMock.GetOrDefaultAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
|
||||||
.ReturnsForAnyArgs(fakeWell);
|
.ReturnsForAnyArgs(fakeWell);
|
||||||
|
|
||||||
trajectoryFactRepositoryMock.GetAsync(Arg.Any<TrajectoryRequest>(), Arg.Any<CancellationToken>())
|
trajectoryFactNnbRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
|
||||||
.ReturnsForAnyArgs(new[] { fakeLastFactTrajectory });
|
.ReturnsForAnyArgs(new[] { fakeLastFactTrajectory });
|
||||||
|
|
||||||
wellOperationRepositoryMock.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())
|
wellOperationRepositoryMock.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())
|
||||||
|
@ -53,18 +53,13 @@ public class TrajectoryVisualizationServiceTest
|
|||||||
new() { WellboreDepth = 0, ZenithAngle = 10, AzimuthGeo = 20 },
|
new() { WellboreDepth = 0, ZenithAngle = 10, AzimuthGeo = 20 },
|
||||||
};
|
};
|
||||||
|
|
||||||
var request = new TrajectoryRequest()
|
trajectoryPlanRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
|
||||||
{
|
|
||||||
IdWell = Arg.Any<int>()
|
|
||||||
};
|
|
||||||
|
|
||||||
trajectoryPlanRepositoryMock.GetAsync(request, Arg.Any<CancellationToken>())
|
|
||||||
.ReturnsForAnyArgs(plannedTrajectory);
|
.ReturnsForAnyArgs(plannedTrajectory);
|
||||||
|
|
||||||
trajectoryFactRepositoryMock.GetAsync(request, Arg.Any<CancellationToken>())
|
trajectoryFactRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
|
||||||
.ReturnsForAnyArgs(actualTrajectory);
|
.ReturnsForAnyArgs(actualTrajectory);
|
||||||
|
|
||||||
trajectoryNnbRepositoryMock.GetAsync(request, Arg.Any<CancellationToken>())
|
trajectoryNnbRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
|
||||||
.ReturnsForAnyArgs(nnbTrajectory);
|
.ReturnsForAnyArgs(nnbTrajectory);
|
||||||
|
|
||||||
//act
|
//act
|
||||||
@ -110,18 +105,13 @@ public class TrajectoryVisualizationServiceTest
|
|||||||
new() { WellboreDepth = 50, ZenithAngle = 0, AzimuthGeo = 0 },
|
new() { WellboreDepth = 50, ZenithAngle = 0, AzimuthGeo = 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
var request = new TrajectoryRequest()
|
trajectoryPlanRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
|
||||||
{
|
|
||||||
IdWell = Arg.Any<int>()
|
|
||||||
};
|
|
||||||
|
|
||||||
trajectoryPlanRepositoryMock.GetAsync(request, Arg.Any<CancellationToken>())
|
|
||||||
.ReturnsForAnyArgs(plannedTrajectory);
|
.ReturnsForAnyArgs(plannedTrajectory);
|
||||||
|
|
||||||
trajectoryFactRepositoryMock.GetAsync(request, Arg.Any<CancellationToken>())
|
trajectoryFactRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
|
||||||
.ReturnsForAnyArgs(actualTrajectory);
|
.ReturnsForAnyArgs(actualTrajectory);
|
||||||
|
|
||||||
trajectoryNnbRepositoryMock.GetAsync(request, Arg.Any<CancellationToken>())
|
trajectoryNnbRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
|
||||||
.ReturnsForAnyArgs(nnbTrajectory);
|
.ReturnsForAnyArgs(nnbTrajectory);
|
||||||
|
|
||||||
//act
|
//act
|
||||||
@ -173,18 +163,14 @@ public class TrajectoryVisualizationServiceTest
|
|||||||
new() { WellboreDepth = 20, ZenithAngle = 0, AzimuthGeo = 0 },
|
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);
|
.ReturnsForAnyArgs(plannedTrajectory);
|
||||||
|
|
||||||
trajectoryFactRepositoryMock.GetAsync(request, Arg.Any<CancellationToken>())
|
trajectoryFactRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
|
||||||
.ReturnsForAnyArgs(actualTrajectory);
|
.ReturnsForAnyArgs(actualTrajectory);
|
||||||
|
|
||||||
trajectoryNnbRepositoryMock.GetAsync(request, Arg.Any<CancellationToken>())
|
trajectoryNnbRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<CancellationToken>())
|
||||||
.ReturnsForAnyArgs(nnbTrajectory);
|
.ReturnsForAnyArgs(nnbTrajectory);
|
||||||
|
|
||||||
//act
|
//act
|
||||||
|
@ -57,17 +57,16 @@ namespace AsbCloudWebApi.Controllers.Trajectory
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получаем список всех строк координат траектории (для клиента)
|
/// Получаем список всех строк координат траектории (для клиента)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">параметры запроса</param>
|
/// <param name="idWell">ключ скважины</param>
|
||||||
/// <param name="token"> Токен отмены задачи </param>
|
/// <param name="token"> Токен отмены задачи </param>
|
||||||
/// <returns>Список добавленных координат траектории</returns>
|
/// <returns>Список добавленных координат траектории</returns>
|
||||||
[HttpGet("/api/[controller]")]
|
|
||||||
//[ProducesResponseType(typeof(IEnumerable<Tdto>), (int)System.Net.HttpStatusCode.OK)]
|
//[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))
|
token).ConfigureAwait(false))
|
||||||
return Forbid();
|
return Forbid();
|
||||||
var result = await trajectoryRepository.GetAsync(request, token);
|
var result = await trajectoryRepository.GetAsync(idWell, token);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,12 +24,12 @@ namespace AsbCloudWebApi.Controllers.Trajectory
|
|||||||
{
|
{
|
||||||
protected override string fileName { get; set; }
|
protected override string fileName { get; set; }
|
||||||
|
|
||||||
private readonly TrajectoryImportService<Tdto> trajectoryImportService;
|
private readonly TrajectoryParserService<Tdto> trajectoryImportService;
|
||||||
private readonly TrajectoryExportService<Tdto> trajectoryExportService;
|
private readonly TrajectoryExportService<Tdto> trajectoryExportService;
|
||||||
private readonly ITrajectoryEditableRepository<Tdto> trajectoryRepository;
|
private readonly ITrajectoryEditableRepository<Tdto> trajectoryRepository;
|
||||||
|
|
||||||
public TrajectoryEditableController(IWellService wellService,
|
public TrajectoryEditableController(IWellService wellService,
|
||||||
TrajectoryImportService<Tdto> trajectoryImportService,
|
TrajectoryParserService<Tdto> trajectoryImportService,
|
||||||
TrajectoryExportService<Tdto> trajectoryExportService,
|
TrajectoryExportService<Tdto> trajectoryExportService,
|
||||||
ITrajectoryEditableRepository<Tdto> trajectoryRepository)
|
ITrajectoryEditableRepository<Tdto> trajectoryRepository)
|
||||||
: base(
|
: base(
|
||||||
@ -88,7 +88,7 @@ namespace AsbCloudWebApi.Controllers.Trajectory
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var trajectoryRows = await trajectoryImportService.ImportAsync(stream, token);
|
var trajectoryRows = trajectoryImportService.ImportAsync(stream);
|
||||||
foreach (var row in trajectoryRows)
|
foreach (var row in trajectoryRows)
|
||||||
{
|
{
|
||||||
row.IdWell = idWell;
|
row.IdWell = idWell;
|
||||||
|
@ -16,7 +16,7 @@ public class TrajectoryFactManualController : TrajectoryEditableController<Traje
|
|||||||
{
|
{
|
||||||
protected override string fileName { get; set; }
|
protected override string fileName { get; set; }
|
||||||
public TrajectoryFactManualController(IWellService wellService,
|
public TrajectoryFactManualController(IWellService wellService,
|
||||||
TrajectoryFactManualImportService factTrajectoryImportService,
|
TrajectoryFactManualParserService factTrajectoryImportService,
|
||||||
TrajectoryFactManualExportService factTrajectoryExportService,
|
TrajectoryFactManualExportService factTrajectoryExportService,
|
||||||
ITrajectoryEditableRepository<TrajectoryGeoFactDto> trajectoryFactRepository)
|
ITrajectoryEditableRepository<TrajectoryGeoFactDto> trajectoryFactRepository)
|
||||||
: base(
|
: base(
|
||||||
|
@ -22,7 +22,7 @@ namespace AsbCloudWebApi.Controllers.Trajectory
|
|||||||
private readonly TrajectoryService trajectoryVisualizationService;
|
private readonly TrajectoryService trajectoryVisualizationService;
|
||||||
|
|
||||||
public TrajectoryPlannedController(IWellService wellService,
|
public TrajectoryPlannedController(IWellService wellService,
|
||||||
TrajectoryPlannedImportService plannedTrajectoryImportService,
|
TrajectoryPlannedParserService plannedTrajectoryImportService,
|
||||||
TrajectoryPlannedExportService plannedTrajectoryExportService,
|
TrajectoryPlannedExportService plannedTrajectoryExportService,
|
||||||
ITrajectoryEditableRepository<TrajectoryGeoPlanDto> plannedTrajectoryRepository,
|
ITrajectoryEditableRepository<TrajectoryGeoPlanDto> plannedTrajectoryRepository,
|
||||||
TrajectoryService trajectoryVisualizationService)
|
TrajectoryService trajectoryVisualizationService)
|
||||||
|
Loading…
Reference in New Issue
Block a user