Merge branch 'dev' into feature/daily_report

This commit is contained in:
Никита Фролов 2023-11-08 14:23:52 +05:00
commit b6edb0faff
13 changed files with 9000 additions and 67 deletions

View File

@ -9,8 +9,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsbCloudApp", "AsbCloudApp\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsbCloudInfrastructure", "AsbCloudInfrastructure\AsbCloudInfrastructure.csproj", "{67DBFC52-BAE4-4903-827A-AD0288C292B6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{D04A84E7-5F08-4042-8FB5-476EE49E9D22}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsbCloudDb", "AsbCloudDb\AsbCloudDb.csproj", "{40FBD29B-724B-4496-B5D9-1A5D14102456}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsbCloudWebApi.Tests", "AsbCloudWebApi.Tests\AsbCloudWebApi.Tests.csproj", "{9CF6FBB1-9AF5-45AB-A521-24F11A79B540}"
@ -35,10 +33,6 @@ Global
{67DBFC52-BAE4-4903-827A-AD0288C292B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{67DBFC52-BAE4-4903-827A-AD0288C292B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{67DBFC52-BAE4-4903-827A-AD0288C292B6}.Release|Any CPU.Build.0 = Release|Any CPU
{D04A84E7-5F08-4042-8FB5-476EE49E9D22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D04A84E7-5F08-4042-8FB5-476EE49E9D22}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D04A84E7-5F08-4042-8FB5-476EE49E9D22}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D04A84E7-5F08-4042-8FB5-476EE49E9D22}.Release|Any CPU.Build.0 = Release|Any CPU
{40FBD29B-724B-4496-B5D9-1A5D14102456}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{40FBD29B-724B-4496-B5D9-1A5D14102456}.Debug|Any CPU.Build.0 = Debug|Any CPU
{40FBD29B-724B-4496-B5D9-1A5D14102456}.Release|Any CPU.ActiveCfg = Release|Any CPU

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_Data_To_WellSectionType : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "t_well_section_type",
columns: new[] { "id", "caption", "order" },
values: new object[,]
{
{ 34, "Хвостовик 6", 6.5f },
{ 35, "Хвостовик 7", 6.6f },
{ 36, "Хвостовик 8", 6.7f },
{ 37, "Хвостовик 9", 6.8f },
{ 38, "Хвостовик 10", 6.9f }
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 34);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 35);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 36);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 37);
migrationBuilder.DeleteData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 38);
}
}
}

View File

@ -7130,6 +7130,36 @@ namespace AsbCloudDb.Migrations
Id = 33,
Caption = "Техническая колонна 3",
Order = 2.2f
},
new
{
Id = 34,
Caption = "Хвостовик 6",
Order = 6.5f
},
new
{
Id = 35,
Caption = "Хвостовик 7",
Order = 6.6f
},
new
{
Id = 36,
Caption = "Хвостовик 8",
Order = 6.7f
},
new
{
Id = 37,
Caption = "Хвостовик 9",
Order = 6.8f
},
new
{
Id = 38,
Caption = "Хвостовик 10",
Order = 6.9f
});
});

View File

@ -42,6 +42,12 @@
new (){ Id = 31, Caption = "Техническая колонна", Order = 2},
new (){ Id = 32, Caption = "Техническая колонна 2", Order = 2.1f},
new (){ Id = 33, Caption = "Техническая колонна 3", Order = 2.2f},
new (){ Id = 34, Caption = "Хвостовик 6", Order = 6.5f},
new (){ Id = 35, Caption = "Хвостовик 7", Order = 6.6f},
new (){ Id = 36, Caption = "Хвостовик 8", Order = 6.7f},
new (){ Id = 37, Caption = "Хвостовик 9", Order = 6.8f},
new (){ Id = 38, Caption = "Хвостовик 10", Order = 6.9f},
};
}
}

View File

@ -54,6 +54,7 @@ public class BackgroundWorker : BackgroundService
protected override async Task ExecuteAsync(CancellationToken token)
{
Trace.TraceInformation($"{GetType().Name} started");
while (!token.IsCancellationRequested && works.TryDequeue(out CurrentWork))
{
try

View File

@ -1,41 +0,0 @@
using System.Linq;
namespace System.Collections.Generic
{
public class OrderedList<T>: IEnumerable<T>, ICollection<T>
where T : notnull
{
private readonly List<T> list = new List<T>();
private readonly Func<T, object> keySelector;
private readonly bool isDescending = false;
private IOrderedEnumerable<T> OrdredList => isDescending
? list.OrderByDescending(keySelector)
: list.OrderBy(keySelector);
public int Count => list.Count;
public bool IsReadOnly => false;
public OrderedList(Func<T, object> keySelector, bool isDescending = false)
{
this.keySelector = keySelector;
this.isDescending = isDescending;
}
public void Add(T item) => list.Add(item);
public void Clear()=> list.Clear();
public bool Contains(T item)=> list.Contains(item);
public void CopyTo(T[] array, int arrayIndex)=> list.CopyTo(array, arrayIndex);
public bool Remove(T item)=> list.Remove(item);
public IEnumerator<T> GetEnumerator() => OrdredList.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
}

View File

@ -42,6 +42,7 @@ public class PeriodicBackgroundWorker : BackgroundService
protected override async Task ExecuteAsync(CancellationToken token)
{
Trace.TraceInformation($"{GetType().Name} started");
while (!token.IsCancellationRequested)
{
try

View File

@ -0,0 +1,11 @@
# BackgroundWorker
Класс выполнения разовой фоновой работы.
Для каждой работы создается свой scope.
# NotificationBackgroundWorker
Предназначен для различных оповещений пользователей разными способами.
Фактически это дополнительный экземпляр BackgroundWorker, чтобы оповещения не ждали завершения долгих операций из стандартного BackgroundWorker.
Не должен давать большой нагрузки БД.
# PeriodicBackgroundWorker
Класс выполнения периодической фоновой работы.

View File

@ -1,12 +0,0 @@
# Проблемы фонового сервиса
- Нужно состояние по загрузки сервиса и очереди работ.
- Все ли задачи укладываются в таймаут,
- Сколько свободного времени остается,
- Что делает текущая задача,
- нет управления сервисом. Для исключения его влияния на другие процессы сервера.
- отключать/включать целиком
- отключать/включать отдельную периодическую задачу
# Сделать
- Разработать dto статуса задачи
- Отказаться от периодической задачи, при добавлении в хранилище задач период будет параметром метода добавления.

View File

@ -55,10 +55,12 @@ public class WorkSubsystemOperationTimeCalc : Work
{
IdTelemetry = outer,
inner.SingleOrDefault()?.LastDate,
});
})
.OrderByDescending(i => i.IdTelemetry);
var count = telemetryLastDetectedDates.Count();
var i = 0d;
foreach (var item in telemetryLastDetectedDates)
{
onProgressCallback($"Start handling telemetry: {item.IdTelemetry} from {item.LastDate}", i++ / count);

View File

@ -82,7 +82,7 @@ public class WellInfoService
}
var wellOperationsStat = operationsStat.FirstOrDefault(s => s.Id == well.Id);
var wellLastFactSection = wellOperationsStat?.Sections.LastOrDefault(s => s.Fact is not null);
var wellLastFactSection = wellOperationsStat?.Sections.OrderBy(s => s.Fact?.WellDepthStart).LastOrDefault(s => s.Fact is not null);
currentDepth ??= wellLastFactSection?.Fact?.WellDepthEnd;
var wellProcessMaps = processMapPlanWellDrillings

View File

@ -1,8 +1,6 @@
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using AsbCloudDb.Model;
using AsbCloudInfrastructure.Services.DetectOperations;
using AsbCloudInfrastructure.Services;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
@ -10,10 +8,7 @@ using System.Threading.Tasks;
using System.Threading;
using AsbCloudInfrastructure.Background;
using AsbCloudApp.Data.SAUB;
using AsbCloudInfrastructure.Services.SAUB;
using AsbCloudInfrastructure.Services.Subsystems;
using System.Linq;
using DocumentFormat.OpenXml.InkML;
using AsbCloudDb;
using AsbCloudApp.Repositories;