forked from ddrilling/AsbCloudServer
Миграция на создание таблицы для учета статистики Качества
This commit is contained in:
parent
af43828d57
commit
73d60d1464
50
AsbCloudApp/Data/SaubStat/DataSaubStatDrillingQualityDto.cs
Normal file
50
AsbCloudApp/Data/SaubStat/DataSaubStatDrillingQualityDto.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
using System;
|
||||||
|
using AsbCloudApp.Data.WellOperation;
|
||||||
|
|
||||||
|
namespace AsbCloudApp.Data;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// dto для хранения данных статистики качества бурения
|
||||||
|
/// </summary>
|
||||||
|
public class DataSaubStatDrillingQualityDto : IId
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Дата и время начала
|
||||||
|
/// </summary>
|
||||||
|
public DateTimeOffset DateStart { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Дата и время окончания
|
||||||
|
/// </summary>
|
||||||
|
public DateTimeOffset DateEnd { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Глубина забоя по стволу начальная
|
||||||
|
/// </summary>
|
||||||
|
public double DepthStart { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Глубина забоя по стволу конечная
|
||||||
|
/// </summary>
|
||||||
|
public double DepthEnd { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Качественная проходка
|
||||||
|
/// </summary>
|
||||||
|
public double DepthDrillingQuality { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Флаг
|
||||||
|
/// </summary>
|
||||||
|
public int IdFeedRegulator { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ключ телеметрии
|
||||||
|
/// </summary>
|
||||||
|
public int IdTelemetry { get; set; }
|
||||||
|
}
|
135
AsbCloudApp/Data/SaubStat/DataSaubStatDto.cs
Normal file
135
AsbCloudApp/Data/SaubStat/DataSaubStatDto.cs
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
using System;
|
||||||
|
using AsbCloudApp.Data.WellOperation;
|
||||||
|
|
||||||
|
namespace AsbCloudApp.Data;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// dto для хранения данных статистики сауб
|
||||||
|
/// </summary>
|
||||||
|
public class DataSaubStatDto : IId
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Дата и время начала
|
||||||
|
/// </summary>
|
||||||
|
public DateTimeOffset DateStart { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Дата и время окончания
|
||||||
|
/// </summary>
|
||||||
|
public DateTimeOffset DateEnd { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Глубина забоя по стволу начальная
|
||||||
|
/// </summary>
|
||||||
|
public double DepthStart { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Глубина забоя по стволу конечная
|
||||||
|
/// </summary>
|
||||||
|
public double DepthEnd { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Скорость бурения
|
||||||
|
/// </summary>
|
||||||
|
public double Speed { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ограничение скорости блока
|
||||||
|
/// </summary>
|
||||||
|
public double? BlockSpeedSp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Давление
|
||||||
|
/// </summary>
|
||||||
|
public double Pressure { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Давление холостого хода
|
||||||
|
/// </summary>
|
||||||
|
public double? PressureIdle { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ограничение фактического давления
|
||||||
|
/// </summary>
|
||||||
|
public double? PressureSp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Фактическая нагрузка
|
||||||
|
/// </summary>
|
||||||
|
public double AxialLoad { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ограничение факт. нагрузки
|
||||||
|
/// </summary>
|
||||||
|
public double? AxialLoadSp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Максимально допустимая нагрузка
|
||||||
|
/// </summary>
|
||||||
|
public double? AxialLoadLimitMax { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Фактический момент
|
||||||
|
/// </summary>
|
||||||
|
public double RotorTorque { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ограничение факт. момента
|
||||||
|
/// </summary>
|
||||||
|
public double? RotorTorqueSp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Максимально допустимый момент
|
||||||
|
/// </summary>
|
||||||
|
public double? RotorTorqueLimitMax { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Работа при достижении ограничения
|
||||||
|
/// </summary>
|
||||||
|
public short? IdFeedRegulator { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Фактическая скорость оборотов ВСП
|
||||||
|
/// </summary>
|
||||||
|
public double RotorSpeed { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Название автоопределённой операции
|
||||||
|
/// </summary>
|
||||||
|
public int IdCategory { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Флаги подсистем
|
||||||
|
/// </summary>
|
||||||
|
public int EnabledSubsystems { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Наличие или отсутствие осцилляции
|
||||||
|
/// </summary>
|
||||||
|
public bool HasOscillation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Фактический расход
|
||||||
|
/// </summary>
|
||||||
|
public double Flow { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ключ телеметрии
|
||||||
|
/// </summary>
|
||||||
|
public int IdTelemetry { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Телеметрия
|
||||||
|
/// </summary>
|
||||||
|
public TelemetryDto Telemetry { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Категория автоопределенной операции
|
||||||
|
/// </summary>
|
||||||
|
public WellOperationCategoryDto OperationCategory { get; set; } = null!;
|
||||||
|
}
|
@ -23,15 +23,15 @@ public interface IDataSaubStatDrillingQualityRepository : ITelemetryDataEditorSe
|
|||||||
Task<IEnumerable<DataSaubStatDto>> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token);
|
Task<IEnumerable<DataSaubStatDto>> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение последних по дате окончания бурения записей в разрезе телеметрий
|
/// Получение последних по дате окончания бурения записей качества в разрезе телеметрий
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="idTelemetries">ключи телеметрий</param>
|
/// <param name="idTelemetries">ключи телеметрий</param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<DataSaubStatDto>> GetLastsAsync(int[] idTelemetries, CancellationToken token);
|
Task<IEnumerable<DataSaubStatDrillingQualityDto>> GetLastsAsync(int[] idTelemetries, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Вставка записей статистики
|
/// Вставка записей статистики качества
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataSaubStats"></param>
|
/// <param name="dataSaubStats"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
|
12464
AsbCloudDb/Migrations/20241004110355_Add_Table_DataSaubStatDrillingQuality.Designer.cs
generated
Normal file
12464
AsbCloudDb/Migrations/20241004110355_Add_Table_DataSaubStatDrillingQuality.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,54 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace AsbCloudDb.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Add_Table_DataSaubStatDrillingQuality : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "t_data_saub_stat_drilling_quality",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
id_telemetry = table.Column<int>(type: "integer", nullable: false, comment: "Ключ телеметрии"),
|
||||||
|
date_start = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "Дата и время начала"),
|
||||||
|
date_end = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "Дата и время окончания"),
|
||||||
|
depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина забоя по стволу начальная"),
|
||||||
|
depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина забоя по стволу конечная"),
|
||||||
|
id_feed_regulator = table.Column<int>(type: "integer", nullable: false, comment: "Флаг"),
|
||||||
|
depth_drilling_quality = table.Column<double>(type: "double precision", nullable: false, comment: "Качественная проходка")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_t_data_saub_stat_drilling_quality", x => x.id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_t_data_saub_stat_drilling_quality_t_telemetry_id_telemetry",
|
||||||
|
column: x => x.id_telemetry,
|
||||||
|
principalTable: "t_telemetry",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
},
|
||||||
|
comment: "Кеш-таблица для хранения данных для построения страницы \"Качество\"");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_t_data_saub_stat_drilling_quality_id_telemetry",
|
||||||
|
table: "t_data_saub_stat_drilling_quality",
|
||||||
|
column: "id_telemetry");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "t_data_saub_stat_drilling_quality");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -19,7 +19,7 @@ namespace AsbCloudDb.Migrations
|
|||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.UseCollation("Russian_Russia.1251")
|
.UseCollation("Russian_Russia.1251")
|
||||||
.HasAnnotation("ProductVersion", "8.0.8")
|
.HasAnnotation("ProductVersion", "8.0.4")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack");
|
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack");
|
||||||
@ -451,6 +451,60 @@ namespace AsbCloudDb.Migrations
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("AsbCloudDb.Model.DataSaubStatDrillingQuality", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("id");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset>("DateEnd")
|
||||||
|
.HasColumnType("timestamp with time zone")
|
||||||
|
.HasColumnName("date_end")
|
||||||
|
.HasComment("Дата и время окончания");
|
||||||
|
|
||||||
|
b.Property<DateTimeOffset>("DateStart")
|
||||||
|
.HasColumnType("timestamp with time zone")
|
||||||
|
.HasColumnName("date_start")
|
||||||
|
.HasComment("Дата и время начала");
|
||||||
|
|
||||||
|
b.Property<double>("DepthDrillingQuality")
|
||||||
|
.HasColumnType("double precision")
|
||||||
|
.HasColumnName("depth_drilling_quality")
|
||||||
|
.HasComment("Качественная проходка");
|
||||||
|
|
||||||
|
b.Property<double>("DepthEnd")
|
||||||
|
.HasColumnType("double precision")
|
||||||
|
.HasColumnName("depth_end")
|
||||||
|
.HasComment("Глубина забоя по стволу конечная");
|
||||||
|
|
||||||
|
b.Property<double>("DepthStart")
|
||||||
|
.HasColumnType("double precision")
|
||||||
|
.HasColumnName("depth_start")
|
||||||
|
.HasComment("Глубина забоя по стволу начальная");
|
||||||
|
|
||||||
|
b.Property<int>("IdFeedRegulator")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("id_feed_regulator")
|
||||||
|
.HasComment("Флаг");
|
||||||
|
|
||||||
|
b.Property<int>("IdTelemetry")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("id_telemetry")
|
||||||
|
.HasComment("Ключ телеметрии");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("IdTelemetry");
|
||||||
|
|
||||||
|
b.ToTable("t_data_saub_stat_drilling_quality", t =>
|
||||||
|
{
|
||||||
|
t.HasComment("Кеш-таблица для хранения данных для построения страницы \"Качество\"");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("AsbCloudDb.Model.Deposit", b =>
|
modelBuilder.Entity("AsbCloudDb.Model.Deposit", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -10720,6 +10774,17 @@ namespace AsbCloudDb.Migrations
|
|||||||
b.Navigation("Telemetry");
|
b.Navigation("Telemetry");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("AsbCloudDb.Model.DataSaubStatDrillingQuality", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("IdTelemetry")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Telemetry");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("AsbCloudDb.Model.DetectedOperation", b =>
|
modelBuilder.Entity("AsbCloudDb.Model.DetectedOperation", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory")
|
b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory")
|
||||||
|
@ -28,7 +28,14 @@ namespace AsbCloudDb.Model
|
|||||||
[Column("depth_end"), Comment("Глубина забоя по стволу конечная")]
|
[Column("depth_end"), Comment("Глубина забоя по стволу конечная")]
|
||||||
public double DepthEnd { get; set; }
|
public double DepthEnd { get; set; }
|
||||||
|
|
||||||
|
[Column("id_feed_regulator"), Comment("Флаг")]
|
||||||
|
public int IdFeedRegulator { get; set; }
|
||||||
|
|
||||||
|
[Column("depth_drilling_quality"), Comment("Качественная проходка")]
|
||||||
|
public double DepthDrillingQuality { get; set; }
|
||||||
|
|
||||||
[ForeignKey(nameof(IdTelemetry))]
|
[ForeignKey(nameof(IdTelemetry))]
|
||||||
public virtual Telemetry Telemetry { get; set; } = null!;
|
public virtual Telemetry Telemetry { get; set; } = null!;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -319,7 +319,8 @@ public static class DependencyInjection
|
|||||||
services.AddTransient<IHelpPageService, HelpPageService>();
|
services.AddTransient<IHelpPageService, HelpPageService>();
|
||||||
services.AddTransient<IScheduleReportService, ScheduleReportService>();
|
services.AddTransient<IScheduleReportService, ScheduleReportService>();
|
||||||
services.AddTransient<IDataSaubStatRepository, DataSaubStatRepository>();
|
services.AddTransient<IDataSaubStatRepository, DataSaubStatRepository>();
|
||||||
//services.AddTransient<IDataSaubStatService, DataSaubStatService>();
|
services.AddTransient<IDataSaubStatDrillingQualityRepository, DataSaubStatDrillingQualityRepository>();
|
||||||
|
services.AddTransient<IDataSaubStatService, DataSaubStatService>();
|
||||||
services.AddTransient<IDataSaubStatService, DataSaubStatDrillingQualityService>();
|
services.AddTransient<IDataSaubStatService, DataSaubStatDrillingQualityService>();
|
||||||
services.AddTransient<IWellOperationService, WellOperationService>();
|
services.AddTransient<IWellOperationService, WellOperationService>();
|
||||||
|
|
||||||
|
@ -25,21 +25,20 @@ public class DataSaubStatDrillingQualityRepository : IDataSaubStatDrillingQualit
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<DataSaubStatDto>> GetLastsAsync(int[] idTelemetries, CancellationToken token)
|
public async Task<IEnumerable<DataSaubStatDrillingQualityDto>> GetLastsAsync(int[] idTelemetries, CancellationToken token)
|
||||||
{
|
{
|
||||||
var timeZoneOffsets = idTelemetries
|
var timeZoneOffsets = idTelemetries
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.ToDictionary(idTelemetry => idTelemetry, idTelemetry => TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours));
|
.ToDictionary(idTelemetry => idTelemetry, idTelemetry => TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours));
|
||||||
|
|
||||||
var stats = await db.Set<DataSaubStat>()
|
var stats = await db.Set<DataSaubStatDrillingQuality>()
|
||||||
.Where(s => idTelemetries.Contains(s.IdTelemetry))
|
.Where(s => idTelemetries.Contains(s.IdTelemetry))
|
||||||
.GroupBy(s => s.IdTelemetry, (key, group) => group.OrderByDescending(el => el.DateEnd).First())
|
.GroupBy(s => s.IdTelemetry, (key, group) => group.OrderByDescending(el => el.DateEnd).First())
|
||||||
.ToArrayAsync(token);
|
.ToArrayAsync(token);
|
||||||
//todo
|
|
||||||
//var result = stats.Select(s => ConvertToDto(s, timeZoneOffsets[s.IdTelemetry]));
|
|
||||||
|
|
||||||
//return result;
|
var result = stats.Select(s => ConvertToDto(s, timeZoneOffsets[s.IdTelemetry]));
|
||||||
return null;
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<DataSaubStatDto>> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token)
|
public async Task<IEnumerable<DataSaubStatDto>> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token)
|
||||||
|
@ -60,22 +60,22 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatService
|
|||||||
{
|
{
|
||||||
GeDate = DateTime.UtcNow.AddDays(-5000)
|
GeDate = DateTime.UtcNow.AddDays(-5000)
|
||||||
};
|
};
|
||||||
var idTelemetries = telemetryDataCache.GetIds(cacheRequest).ToArray();
|
var idTelemetries = new int[119];
|
||||||
|
//telemetryDataCache.GetIds(cacheRequest).ToArray();
|
||||||
|
|
||||||
if (!idTelemetries.Any())
|
if (!idTelemetries.Any())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var stats = new List<DataSaubStatDto>();
|
var stats = await dataSaubStatDrillingQualityRepository.GetLastsAsync(idTelemetries, token);
|
||||||
//await dataSaubStatRepository.GetLastsAsync(idTelemetries, token);
|
|
||||||
|
|
||||||
//for (var i = 0; i < idTelemetries.Length; i++)
|
for (var i = 0; i < idTelemetries.Length; i++)
|
||||||
//{
|
{
|
||||||
// var idTelemetry = idTelemetries[i];
|
var idTelemetry = idTelemetries[i];
|
||||||
// var lastDate = stats.FirstOrDefault(s => s.IdTelemetry == idTelemetry)?.DateEnd.ToUniversalTime() ?? DateTimeOffset.UnixEpoch;
|
var lastDate = stats.FirstOrDefault(s => s.IdTelemetry == idTelemetry)?.DateEnd.ToUniversalTime() ?? DateTimeOffset.UnixEpoch;
|
||||||
// var statsCount = await CreateStatDrillingQualityForTelemetry(idTelemetry, lastDate, token);
|
var statsCount = await CreateStatDrillingQualityForTelemetry(idTelemetry, lastDate, token);
|
||||||
// if (onProgressCallback != null)
|
if (onProgressCallback != null)
|
||||||
// onProgressCallback($"Calculate stat for telemetry: {idTelemetry}; from {lastDate}; results count: {statsCount};", 1d * i / idTelemetries.Length);
|
onProgressCallback($"Calculate stat for telemetry: {idTelemetry}; from {lastDate}; results count: {statsCount};", 1d * i / idTelemetries.Length);
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<int> CreateStatDrillingQualityForTelemetry(
|
private async Task<int> CreateStatDrillingQualityForTelemetry(
|
||||||
@ -100,7 +100,10 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatService
|
|||||||
result.AddRange(data);
|
result.AddRange(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return await dataSaubStatDrillingQualityRepository.InsertRangeAsync(result, token);
|
if(result.Any())
|
||||||
|
return await dataSaubStatDrillingQualityRepository.InsertRangeAsync(result, token);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<DataSaubStatDrillingQualityDto> CreateDataSaubStatDrillingQuality(
|
private static IEnumerable<DataSaubStatDrillingQualityDto> CreateDataSaubStatDrillingQuality(
|
||||||
@ -113,7 +116,7 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatService
|
|||||||
var indexStart = 0;
|
var indexStart = 0;
|
||||||
var indexEnd = 0;
|
var indexEnd = 0;
|
||||||
|
|
||||||
while (indexEnd < dataSaub.Count())
|
while (indexEnd < dataSaub.Count()-1)
|
||||||
{
|
{
|
||||||
indexStart = Array.FindIndex(dataSaub, indexEnd, t => t.IdFeedRegulator == idFeedRegulator);
|
indexStart = Array.FindIndex(dataSaub, indexEnd, t => t.IdFeedRegulator == idFeedRegulator);
|
||||||
if (indexStart < 0)
|
if (indexStart < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user