forked from ddrilling/AsbCloudServer
Добавлено онлайн обновление части статистики по скважине, которую можно брать из кеша.
This commit is contained in:
parent
821fe270f6
commit
e901866910
@ -34,6 +34,6 @@ namespace AsbCloudApp.Data
|
||||
/// <summary>
|
||||
/// Список скважин куста
|
||||
/// </summary>
|
||||
public IEnumerable<WellMapInfoDto> Wells { get; set; } = Enumerable.Empty<WellMapInfoDto>();
|
||||
public IEnumerable<WellMapInfoWithTelemetryStat> Wells { get; set; } = Enumerable.Empty<WellMapInfoWithTelemetryStat>();
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
using AsbCloudDb.Model.Subsystems;
|
||||
using AsbCloudDb.Model.WITS;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using System;
|
||||
using System.Threading;
|
||||
@ -73,7 +74,10 @@ namespace AsbCloudDb.Model
|
||||
Task<int> RefreshMaterializedViewAsync<TEntity>(CancellationToken token) where TEntity : class;
|
||||
int SaveChanges();
|
||||
int SaveChanges(bool acceptAllChangesOnSuccess);
|
||||
Task<int> SaveChangesAsync(CancellationToken cancellationToken);
|
||||
DbSet<TEntity> Set<TEntity>() where TEntity : class;
|
||||
Task<int> SaveChangesAsync(CancellationToken cancellationToken);
|
||||
DbSet<TEntity> Set<TEntity>() where TEntity : class;
|
||||
|
||||
EntityEntry<TEntity> Entry<TEntity>(TEntity entity)
|
||||
where TEntity : class;
|
||||
}
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
using System;
|
||||
// Ignore Spelling: Linq
|
||||
|
||||
using System;
|
||||
|
||||
namespace AsbCloudInfrastructure
|
||||
{
|
||||
|
||||
public static class DateTimeExtentions
|
||||
public static class DateTimeExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Приветсти к UTC из времени куста
|
||||
@ -78,5 +79,4 @@ namespace AsbCloudInfrastructure
|
||||
return indexOfMiddle;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -95,7 +95,8 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
||||
{
|
||||
var entity = GetTelemetryCache()
|
||||
.FirstOrDefault(t => t.Well?.Id == idWell);
|
||||
if (entity.Well?.Timezone is not null && entity.TimeZone.Hours != entity.Well.Timezone.Hours)
|
||||
|
||||
if (entity?.Well?.Timezone is not null && entity.TimeZone.Hours != entity.Well.Timezone.Hours)
|
||||
{
|
||||
entity.TimeZone = entity.Well.Timezone;
|
||||
//TODO: выдаем предупреждение!
|
||||
|
@ -34,20 +34,22 @@ namespace AsbCloudInfrastructure.Services
|
||||
private readonly TelemetryDataCache<TelemetryDataSpinDto> telemetryDataSpinCache;
|
||||
private readonly IWitsRecordRepository<Record7Dto> witsRecord7Repository;
|
||||
private readonly IWitsRecordRepository<Record1Dto> witsRecord1Repository;
|
||||
|
||||
private readonly IGtrRepository gtrRepository;
|
||||
private static IEnumerable<WellMapInfoWithComanies> WellMapInfo = Enumerable.Empty<WellMapInfoWithComanies>();
|
||||
|
||||
public WellInfoService(
|
||||
TelemetryDataCache<TelemetryDataSaubDto> telemetryDataSaubCache,
|
||||
TelemetryDataCache<TelemetryDataSpinDto> telemetryDataSpinCache,
|
||||
IWitsRecordRepository<Record7Dto> witsRecord7Repository,
|
||||
IWitsRecordRepository<Record1Dto> witsRecord1Repository)
|
||||
IWitsRecordRepository<Record1Dto> witsRecord1Repository,
|
||||
IGtrRepository gtrRepository)
|
||||
{
|
||||
this.telemetryDataSaubCache = telemetryDataSaubCache;
|
||||
this.telemetryDataSpinCache = telemetryDataSpinCache;
|
||||
|
||||
this.witsRecord7Repository = witsRecord7Repository;
|
||||
this.witsRecord1Repository = witsRecord1Repository;
|
||||
this.gtrRepository = gtrRepository;
|
||||
}
|
||||
|
||||
public static WorkPeriodic MakeWork()
|
||||
@ -173,10 +175,12 @@ namespace AsbCloudInfrastructure.Services
|
||||
var result = wellInfo.Adapt<WellMapInfoWithTelemetryStat>();
|
||||
if (wellInfo.IdTelemetry.HasValue)
|
||||
{
|
||||
result.LastDataSaub = telemetryDataSaubCache.GetLastOrDefault(wellInfo.IdTelemetry.Value);
|
||||
result.LastDataSpin = telemetryDataSpinCache.GetLastOrDefault(wellInfo.IdTelemetry.Value);
|
||||
result.LastDataDdsDate = GetLastOrDefaultDdsTelemetry(wellInfo.IdTelemetry.Value);
|
||||
result.LastDataGtrDate = null;
|
||||
var idTelemetry = wellInfo.IdTelemetry.Value;
|
||||
result.LastDataSaub = telemetryDataSaubCache.GetLastOrDefault(idTelemetry);
|
||||
result.LastDataSpin = telemetryDataSpinCache.GetLastOrDefault(idTelemetry);
|
||||
result.LastDataDdsDate = GetLastOrDefaultDdsTelemetry(idTelemetry);
|
||||
result.LastDataGtrDate = gtrRepository.GetLastData(wellInfo.Id)
|
||||
.MaxOrDefault(item => item.Date);
|
||||
result.LastDataDpcsDate = null;
|
||||
result.LastDataDpcsDate = null;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
@contentType = application/json
|
||||
@auth = Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImN0eSI6IkpXVCJ9.eyJpZCI6IjEiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiZGV2IiwiaWRDb21wYW55IjoiMSIsImh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vd3MvMjAwOC8wNi9pZGVudGl0eS9jbGFpbXMvcm9sZSI6InJvb3QiLCJuYmYiOjE2NjI1NDgxNjIsImV4cCI6MTY5NDEwNTc2MiwiaXNzIjoiYSIsImF1ZCI6ImEifQ.OEAlNzxi7Jat6pzDBTAjTbChskc-tdJthJexyWwwUKE
|
||||
|
||||
@uid = 20210910_012752700
|
||||
@uid = 20210101_000000000
|
||||
@idCluster = 1
|
||||
@idWell = 1
|
||||
|
||||
@ -20,7 +20,7 @@ Content-Type: {{contentType}}
|
||||
accept: */*
|
||||
Authorization: {{auth}}
|
||||
|
||||
{
|
||||
[{
|
||||
"id":1,
|
||||
"date": "2023-04-18T08:41:49.332Z",
|
||||
"items": {
|
||||
@ -28,4 +28,4 @@ Authorization: {{auth}}
|
||||
"2": 1.1,
|
||||
"3": "string1"
|
||||
}
|
||||
}
|
||||
}]
|
@ -2,7 +2,7 @@
|
||||
@contentType = application/json
|
||||
@auth = Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImN0eSI6IkpXVCJ9.eyJpZCI6IjEiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiZGV2IiwiaWRDb21wYW55IjoiMSIsImh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vd3MvMjAwOC8wNi9pZGVudGl0eS9jbGFpbXMvcm9sZSI6InJvb3QiLCJuYmYiOjE2NjI1NDgxNjIsImV4cCI6MTY5NDEwNTc2MiwiaXNzIjoiYSIsImF1ZCI6ImEifQ.OEAlNzxi7Jat6pzDBTAjTbChskc-tdJthJexyWwwUKE
|
||||
|
||||
@uid = 20210917_165407777
|
||||
@uid = 20210101_000000000
|
||||
|
||||
# https://marketplace.visualstudio.com/items?itemName=humao.rest-client
|
||||
|
||||
|
66
AsbCloudWebApi/Rest/Wits.http
Normal file
66
AsbCloudWebApi/Rest/Wits.http
Normal file
@ -0,0 +1,66 @@
|
||||
@baseUrl = http://127.0.0.1:5000
|
||||
@contentType = application/json
|
||||
@auth = Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImN0eSI6IkpXVCJ9.eyJpZCI6IjEiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiZGV2IiwiaWRDb21wYW55IjoiMSIsImh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vd3MvMjAwOC8wNi9pZGVudGl0eS9jbGFpbXMvcm9sZSI6InJvb3QiLCJuYmYiOjE2NjI1NDgxNjIsImV4cCI6MTY5NDEwNTc2MiwiaXNzIjoiYSIsImF1ZCI6ImEifQ.OEAlNzxi7Jat6pzDBTAjTbChskc-tdJthJexyWwwUKE
|
||||
|
||||
@uid = 20210101_000000000
|
||||
|
||||
# https://marketplace.visualstudio.com/items?itemName=humao.rest-client
|
||||
|
||||
###
|
||||
POST {{baseUrl}}/api/WitsRecord1/{{uid}}
|
||||
Content-Type: {{contentType}}
|
||||
accept: */*
|
||||
|
||||
[
|
||||
{
|
||||
"id": 0,
|
||||
"idTelemetry": 0,
|
||||
"dateTime": "2023-06-30T05:05:05.000Z",
|
||||
"timeStamp": 0,
|
||||
"wellid": "string",
|
||||
"stknum": 0,
|
||||
"recid": 0,
|
||||
"seqid": 0,
|
||||
"date_": 0,
|
||||
"time": 0,
|
||||
"actcod": 0,
|
||||
"deptbitm": 0,
|
||||
"deptbitv": 0,
|
||||
"deptmeas": 0,
|
||||
"deptvert": 0,
|
||||
"blkpos": 0,
|
||||
"ropa": 0,
|
||||
"hkla": 0,
|
||||
"hklx": 0,
|
||||
"woba": 0,
|
||||
"wobx": 0,
|
||||
"torqa": 0,
|
||||
"torqx": 0,
|
||||
"rpma": 0,
|
||||
"sppa": 0,
|
||||
"chkp": 0,
|
||||
"spm1": 0,
|
||||
"spm2": 0,
|
||||
"spm3": 0,
|
||||
"tvolact": 0,
|
||||
"tvolcact": 0,
|
||||
"mfop": 0,
|
||||
"mfoa": 0,
|
||||
"mfia": 0,
|
||||
"mdoa": 0,
|
||||
"mdia": 0,
|
||||
"mtoa": 0,
|
||||
"mtia": 0,
|
||||
"mcoa": 0,
|
||||
"mcia": 0,
|
||||
"stkc": 0,
|
||||
"lagstks": 0,
|
||||
"deptretm": 0,
|
||||
"gasa": 0,
|
||||
"spare1": 0,
|
||||
"spare2": 0,
|
||||
"spare3": 0,
|
||||
"spare4": 0,
|
||||
"spare5": 0
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue
Block a user