2022-12-22 18:08:58 +05:00
|
|
|
|
using AsbCloudApp.Data;
|
2023-02-13 09:10:48 +05:00
|
|
|
|
using AsbCloudApp.Repositories;
|
2022-12-22 18:08:58 +05:00
|
|
|
|
using AsbCloudApp.Services;
|
2023-11-21 15:10:22 +05:00
|
|
|
|
using AsbCloudDb.Model;
|
2022-12-22 18:08:58 +05:00
|
|
|
|
using ClosedXML.Excel;
|
2022-12-29 04:25:08 +05:00
|
|
|
|
using System;
|
2022-12-22 18:08:58 +05:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
2022-12-27 00:02:49 +05:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
2022-12-22 18:08:58 +05:00
|
|
|
|
|
2023-02-20 15:57:08 +05:00
|
|
|
|
namespace AsbCloudInfrastructure.Services.Trajectory
|
2022-12-22 18:08:58 +05:00
|
|
|
|
{
|
2023-04-18 16:22:53 +05:00
|
|
|
|
|
2023-11-21 15:10:22 +05:00
|
|
|
|
public class PlannedTrajectoryImportService : TrajectoryImportService<TrajectoryGeoPlanDto> //IPlannedTrajectoryImportService
|
2022-12-22 18:08:58 +05:00
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* password for PlannedTrajectoryTemplate.xlsx is Drill2022
|
|
|
|
|
*/
|
2023-02-20 15:57:08 +05:00
|
|
|
|
|
2022-12-22 18:08:58 +05:00
|
|
|
|
private readonly IWellService wellService;
|
2023-11-21 15:10:22 +05:00
|
|
|
|
private readonly ITrajectoryEditableRepository<TrajectoryGeoPlanDto> plannedTrajectoryService;
|
|
|
|
|
|
|
|
|
|
//private const string templateFileName = "PlannedTrajectoryTemplate.xlsx";
|
|
|
|
|
//private const string usingTemplateFile = "AsbCloudInfrastructure.Services.Trajectory";
|
|
|
|
|
//private const string sheetNamePlannedTrajectory = "Плановая траектория";
|
|
|
|
|
//private const int headerRowsCount = 2;
|
|
|
|
|
//private const int ColumnWellboreDepth = 1;
|
|
|
|
|
//private const int ColumnZenithAngle = 2;
|
|
|
|
|
//private const int ColumnAzimuthGeo = 3;
|
|
|
|
|
//private const int ColumnAzimuthMagnetic = 4;
|
|
|
|
|
//private const int ColumnVerticalDepth = 5;
|
|
|
|
|
//private const int ColumnRadius = 6;
|
|
|
|
|
//private const int ColumnComment = 7;
|
|
|
|
|
public override string templateFileName { get; set; } = "PlannedTrajectoryTemplate.xlsx";
|
|
|
|
|
public override string usingTemplateFile { get; set; } = "AsbCloudInfrastructure.Services.Trajectory";
|
|
|
|
|
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 ColumnRadius { get; set; } = 6;
|
|
|
|
|
public override int ColumnComment { get; set; } = 7;
|
|
|
|
|
|
|
|
|
|
public PlannedTrajectoryImportService(
|
|
|
|
|
IWellService wellService,
|
|
|
|
|
ITrajectoryEditableRepository<TrajectoryGeoPlanDto> plannedTrajectoryService)
|
|
|
|
|
: base(plannedTrajectoryService, wellService)
|
2022-12-22 18:08:58 +05:00
|
|
|
|
{
|
|
|
|
|
this.wellService = wellService;
|
2023-11-21 15:10:22 +05:00
|
|
|
|
}
|
2022-12-22 18:08:58 +05:00
|
|
|
|
|
2023-11-21 15:10:22 +05:00
|
|
|
|
protected override TrajectoryGeoPlanDto ParseRow(IXLRow row)
|
2022-12-22 18:08:58 +05:00
|
|
|
|
{
|
2023-09-29 16:48:59 +05:00
|
|
|
|
var trajectoryRow = new TrajectoryGeoPlanDto
|
2023-02-20 15:57:08 +05:00
|
|
|
|
{
|
2023-09-29 16:48:59 +05:00
|
|
|
|
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>(),
|
2023-09-29 18:48:17 +05:00
|
|
|
|
Comment = row.Cell(ColumnComment).GetCellValue<string?>()
|
2023-09-29 16:48:59 +05:00
|
|
|
|
};
|
|
|
|
|
|
2022-12-22 18:08:58 +05:00
|
|
|
|
return trajectoryRow;
|
|
|
|
|
}
|
2023-11-21 15:10:22 +05:00
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
2022-12-22 18:08:58 +05:00
|
|
|
|
}
|
2023-04-18 16:22:53 +05:00
|
|
|
|
|
2022-12-22 18:08:58 +05:00
|
|
|
|
}
|
|
|
|
|
|