forked from ddrilling/AsbCloudServer
This commit is contained in:
parent
3ea9c955c4
commit
b00b4f3781
52
AsbCloudApp/Data/LimitingParameterDataDto.cs
Normal file
52
AsbCloudApp/Data/LimitingParameterDataDto.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudApp.Data
|
||||
{
|
||||
#nullable enable
|
||||
/// <summary>
|
||||
/// Статистика по ограничивающим параметрам
|
||||
/// </summary>
|
||||
public class LimitingParameterDataDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Идентификатор скважины
|
||||
/// </summary>
|
||||
public int IdWell { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Идентификатор телеметрии
|
||||
/// </summary>
|
||||
public int IdTelemetry { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дата начала ограничения
|
||||
/// </summary>
|
||||
public DateTimeOffset DateStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дата окончания ограничения
|
||||
/// </summary>
|
||||
public DateTimeOffset DateEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Глубина начала ограничения
|
||||
/// </summary>
|
||||
public float DepthStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Глубина окончания ограничения
|
||||
/// </summary>
|
||||
public float DepthEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Идентификатор ограничения
|
||||
/// </summary>
|
||||
public short IdFeedRegulator { get; set; }
|
||||
}
|
||||
#nullable disable
|
||||
}
|
@ -16,18 +16,13 @@ namespace AsbCloudApp.Data
|
||||
/// <summary>
|
||||
/// Время бурения
|
||||
/// </summary>
|
||||
public float TimeMinutes { get; set; }
|
||||
public float TotalMinutes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Глубина бурения
|
||||
/// </summary>
|
||||
public float Depth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Количество включений
|
||||
/// </summary>
|
||||
public int NumberInclusions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Идентификатор критерия бурения
|
||||
/// </summary>
|
||||
|
@ -19,7 +19,7 @@ namespace AsbCloudApp.Repositories
|
||||
/// <param name="wellDto"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<LimitingParameterDto>> GetInfosAsync(LimitingParameterRequest request, WellDto wellDto, CancellationToken token);
|
||||
Task<IEnumerable<LimitingParameterDataDto>> GetStatOrDefaultAsync(LimitingParameterRequest request, WellDto wellDto, CancellationToken token);
|
||||
}
|
||||
#nullable disable
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace AsbCloudApp.Services
|
||||
/// <param name="request"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<LimitingParameterDto>?> GetInfosAsync(LimitingParameterRequest request, CancellationToken token);
|
||||
Task<IEnumerable<LimitingParameterDto>?> GetStatOrDefaultAsync(LimitingParameterRequest request, CancellationToken token);
|
||||
}
|
||||
#nullable disable
|
||||
}
|
||||
|
6596
AsbCloudDb/Migrations/20221123052925_UpdateTable_t_limiting_parameter.Designer.cs
generated
Normal file
6596
AsbCloudDb/Migrations/20221123052925_UpdateTable_t_limiting_parameter.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AsbCloudDb.Migrations
|
||||
{
|
||||
public partial class UpdateTable_t_limiting_parameter : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<float>(
|
||||
name: "depth_start",
|
||||
table: "t_limiting_parameter",
|
||||
type: "real",
|
||||
nullable: false,
|
||||
defaultValue: 0f,
|
||||
oldClrType: typeof(float),
|
||||
oldType: "real",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<float>(
|
||||
name: "depth_end",
|
||||
table: "t_limiting_parameter",
|
||||
type: "real",
|
||||
nullable: false,
|
||||
defaultValue: 0f,
|
||||
oldClrType: typeof(float),
|
||||
oldType: "real",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<DateTimeOffset>(
|
||||
name: "date_start",
|
||||
table: "t_limiting_parameter",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
defaultValue: new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
|
||||
oldClrType: typeof(DateTimeOffset),
|
||||
oldType: "timestamp with time zone",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<DateTimeOffset>(
|
||||
name: "date_end",
|
||||
table: "t_limiting_parameter",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
defaultValue: new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
|
||||
oldClrType: typeof(DateTimeOffset),
|
||||
oldType: "timestamp with time zone",
|
||||
oldNullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<float>(
|
||||
name: "depth_start",
|
||||
table: "t_limiting_parameter",
|
||||
type: "real",
|
||||
nullable: true,
|
||||
oldClrType: typeof(float),
|
||||
oldType: "real");
|
||||
|
||||
migrationBuilder.AlterColumn<float>(
|
||||
name: "depth_end",
|
||||
table: "t_limiting_parameter",
|
||||
type: "real",
|
||||
nullable: true,
|
||||
oldClrType: typeof(float),
|
||||
oldType: "real");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTimeOffset>(
|
||||
name: "date_start",
|
||||
table: "t_limiting_parameter",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTimeOffset),
|
||||
oldType: "timestamp with time zone");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTimeOffset>(
|
||||
name: "date_end",
|
||||
table: "t_limiting_parameter",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTimeOffset),
|
||||
oldType: "timestamp with time zone");
|
||||
}
|
||||
}
|
||||
}
|
@ -1011,19 +1011,19 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTimeOffset?>("DateEnd")
|
||||
b.Property<DateTimeOffset>("DateEnd")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("date_end");
|
||||
|
||||
b.Property<DateTimeOffset?>("DateStart")
|
||||
b.Property<DateTimeOffset>("DateStart")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("date_start");
|
||||
|
||||
b.Property<float?>("DepthEnd")
|
||||
b.Property<float>("DepthEnd")
|
||||
.HasColumnType("real")
|
||||
.HasColumnName("depth_end");
|
||||
|
||||
b.Property<float?>("DepthStart")
|
||||
b.Property<float>("DepthStart")
|
||||
.HasColumnType("real")
|
||||
.HasColumnName("depth_start");
|
||||
|
||||
|
@ -17,16 +17,16 @@ namespace AsbCloudDb.Model
|
||||
public int IdTelemetry { get; set; }
|
||||
|
||||
[Column("date_start")]
|
||||
public DateTimeOffset? DateStart { get; set; }
|
||||
public DateTimeOffset DateStart { get; set; }
|
||||
|
||||
[Column("date_end")]
|
||||
public DateTimeOffset? DateEnd { get; set; }
|
||||
public DateTimeOffset DateEnd { get; set; }
|
||||
|
||||
[Column("depth_start")]
|
||||
public float? DepthStart { get; set; }
|
||||
public float DepthStart { get; set; }
|
||||
|
||||
[Column("depth_end")]
|
||||
public float? DepthEnd { get; set; }
|
||||
public float DepthEnd { get; set; }
|
||||
|
||||
[Column("id_feed_regulator")]
|
||||
public short IdFeedRegulator { get; set; }
|
||||
@ -34,24 +34,6 @@ namespace AsbCloudDb.Model
|
||||
[JsonIgnore]
|
||||
[ForeignKey(nameof(IdTelemetry))]
|
||||
public virtual Telemetry Telemetry { get; set; } = null!;
|
||||
|
||||
public float? GetDepth(DateTimeOffset date)
|
||||
{
|
||||
var a = (date - DateStart.Value).TotalSeconds;
|
||||
var b = (DateEnd.Value - DateStart.Value).TotalSeconds;
|
||||
var c = DepthEnd - DepthStart;
|
||||
var result = DepthStart + (a / b) * c;
|
||||
return (float?)result;
|
||||
}
|
||||
|
||||
public DateTimeOffset? GetDate(double depth)
|
||||
{
|
||||
var a = depth - DepthStart;
|
||||
var b = DepthEnd - DepthStart;
|
||||
var c = (DateEnd.Value - DateStart.Value);
|
||||
var result = DateStart + (a / b) * c;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
}
|
||||
|
@ -19,71 +19,28 @@ namespace AsbCloudInfrastructure.Repository
|
||||
{
|
||||
this.context = context;
|
||||
}
|
||||
public async Task<IEnumerable<LimitingParameterDto>> GetInfosAsync(LimitingParameterRequest request, WellDto wellDto, CancellationToken token)
|
||||
public async Task<IEnumerable<LimitingParameterDataDto>> GetStatOrDefaultAsync(LimitingParameterRequest request, WellDto wellDto, CancellationToken token)
|
||||
{
|
||||
var query = BuildQuery(request, wellDto);
|
||||
|
||||
if (query is null)
|
||||
return Enumerable.Empty<LimitingParameterDto>();
|
||||
return Enumerable.Empty<LimitingParameterDataDto>();
|
||||
|
||||
var data = (await query.ToListAsync(token))
|
||||
.GroupBy(x => x.IdFeedRegulator);
|
||||
|
||||
List<LimitingParameterDto> result = new List<LimitingParameterDto>();
|
||||
foreach (var item in data)
|
||||
{
|
||||
var trimData = TrimLimitingParameters(item, request);
|
||||
|
||||
var allItemDepths = trimData.Sum(x => x.DepthEnd - x.DepthStart);
|
||||
var allItemDates = trimData.Sum(x => {
|
||||
if (x.DateEnd is not null && x.DateStart is not null)
|
||||
return (x.DateEnd.Value - x.DateStart.Value).TotalMinutes;
|
||||
else return default(long);
|
||||
});
|
||||
|
||||
result.Add(new LimitingParameterDto {
|
||||
.Select(x => new LimitingParameterDataDto {
|
||||
IdWell = wellDto.Id,
|
||||
IdFeedRegulator = item.Key,
|
||||
NumberInclusions = trimData.Count(),
|
||||
Depth = allItemDepths.HasValue ? allItemDepths.Value : 0,
|
||||
TimeMinutes = (float)allItemDates
|
||||
IdTelemetry = x.IdTelemetry,
|
||||
IdFeedRegulator = x.IdFeedRegulator,
|
||||
DateStart = x.DateStart,
|
||||
DateEnd = x.DateEnd,
|
||||
DepthStart = x.DepthStart,
|
||||
DepthEnd = x.DepthEnd
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
return data;
|
||||
}
|
||||
|
||||
private IEnumerable<LimitingParameter> TrimLimitingParameters(IEnumerable<LimitingParameter> data, LimitingParameterRequest request)
|
||||
{
|
||||
var result = data.Select((x) =>
|
||||
{
|
||||
if (request.GtDate.HasValue && x.DateStart < request.GtDate.Value)
|
||||
{
|
||||
x.DepthStart = x.GetDepth(request.GtDate.Value);
|
||||
x.DateStart = request.GtDate.Value;
|
||||
}
|
||||
if (request.LtDate.HasValue && x.DateEnd > request.LtDate.Value)
|
||||
{
|
||||
x.DepthEnd = x.GetDepth(request.LtDate.Value);
|
||||
x.DateEnd = request.LtDate.Value;
|
||||
}
|
||||
|
||||
if (request.GtDepth.HasValue && x.DepthStart < request.GtDepth.Value)
|
||||
{
|
||||
x.DateStart = x.GetDate(request.GtDepth.Value);
|
||||
x.DepthStart = (float)request.GtDepth.Value;
|
||||
}
|
||||
if (request.LtDepth.HasValue && x.DepthEnd > request.LtDepth.Value)
|
||||
{
|
||||
x.DateEnd = x.GetDate(request.LtDepth.Value);
|
||||
x.DepthEnd = (float)request.LtDepth.Value;
|
||||
}
|
||||
return x;
|
||||
}).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
private IQueryable<LimitingParameter>? BuildQuery(LimitingParameterRequest request, WellDto wellDto)
|
||||
private IQueryable<LimitingParameter> BuildQuery(LimitingParameterRequest request, WellDto wellDto)
|
||||
{
|
||||
var query = context.LimitingParameter
|
||||
.OrderBy(x => x.Id)
|
||||
|
@ -103,55 +103,98 @@ namespace AsbCloudInfrastructure.Services
|
||||
$"lag(id_feed_regulator, 1) over (order by date) as id_feed_regulator_lag, " +
|
||||
$"lead(id_feed_regulator, 1) over (order by date) as id_feed_regulator_lead " +
|
||||
$"from t_telemetry_data_saub " +
|
||||
$"where id_telemetry = {idTelemetry}" +
|
||||
$"where id_feed_regulator is not null " +
|
||||
$"and id_telemetry = {idTelemetry}" +
|
||||
$"and date >= '{begin:u}'" +
|
||||
$"order by date) as limiting_parameters " +
|
||||
$"where id_feed_regulator_lag is null " +
|
||||
$"or (id_feed_regulator != id_feed_regulator_lag and id_feed_regulator_lead != id_feed_regulator_lag) " +
|
||||
$"order by date;";
|
||||
|
||||
var rows = new List<(short? IdLimiting, DateTimeOffset Date, float? WellDepth)>(32);
|
||||
var limitingParameters = new List<LimitingParameter>(32);
|
||||
using (var result = await ExecuteReaderAsync(db, query, token))
|
||||
{
|
||||
using var result = await ExecuteReaderAsync(db, query, token);
|
||||
int? idLimitingLast = null;
|
||||
LimitingParameter? limitingLast = null;
|
||||
while (result.Read())
|
||||
{
|
||||
var idLimiting = result.GetFieldValue<short?>(1);
|
||||
var wellDepth = result.GetFieldValue<float?>(2);
|
||||
if (idLimitingLast != idLimiting)
|
||||
var date = result.GetFieldValue<DateTimeOffset>(0);
|
||||
var idLimiting = result.GetFieldValue<short>(1);
|
||||
var wellDepth = result.GetFieldValue<float>(2);
|
||||
|
||||
if (limitingLast is null)
|
||||
{
|
||||
idLimitingLast = idLimiting;
|
||||
var date = result.GetFieldValue<DateTimeOffset>(0);
|
||||
rows.Add((idLimiting, date, wellDepth));
|
||||
limitingLast = new LimitingParameter
|
||||
{
|
||||
DateStart = date,
|
||||
DepthStart = wellDepth,
|
||||
IdFeedRegulator = idLimiting
|
||||
};
|
||||
}
|
||||
|
||||
if (limitingLast.IdFeedRegulator != idLimiting)
|
||||
{
|
||||
limitingParameters.Add(new LimitingParameter {
|
||||
IdTelemetry = idTelemetry,
|
||||
IdFeedRegulator = limitingLast.IdFeedRegulator,
|
||||
DateStart = limitingLast.DateStart,
|
||||
DateEnd = date,
|
||||
DepthStart = limitingLast.DepthStart,
|
||||
DepthEnd = wellDepth
|
||||
});
|
||||
|
||||
limitingLast = new LimitingParameter
|
||||
{
|
||||
DateStart = date,
|
||||
DepthStart = wellDepth,
|
||||
IdFeedRegulator = idLimiting
|
||||
};
|
||||
}
|
||||
}
|
||||
await result.DisposeAsync();
|
||||
}
|
||||
|
||||
if (rows.Count < 2)
|
||||
return Enumerable.Empty<LimitingParameter>();
|
||||
//var rows = new List<(short IdLimiting, DateTimeOffset Date, float WellDepth)>(32);
|
||||
//{
|
||||
// using var result = await ExecuteReaderAsync(db, query, token);
|
||||
// int? idLimitingLast = null;
|
||||
// while (result.Read())
|
||||
// {
|
||||
// var idLimiting = result.GetFieldValue<short>(1);
|
||||
// var wellDepth = result.GetFieldValue<float>(2);
|
||||
// if (idLimitingLast != idLimiting)
|
||||
// {
|
||||
// idLimitingLast = idLimiting;
|
||||
// var date = result.GetFieldValue<DateTimeOffset>(0);
|
||||
// rows.Add((idLimiting, date, wellDepth));
|
||||
// }
|
||||
// }
|
||||
// await result.DisposeAsync();
|
||||
//}
|
||||
|
||||
var limitingParameters = new List<LimitingParameter>(32);
|
||||
//if (rows.Count < 2)
|
||||
// return Enumerable.Empty<LimitingParameter>();
|
||||
|
||||
for (int i = 1; i < rows.Count; i++)
|
||||
{
|
||||
var r0 = rows[i - 1];
|
||||
var r1 = rows[i];
|
||||
if (r0.IdLimiting is not null && r0.IdLimiting != r1.IdLimiting)
|
||||
{
|
||||
var limitingParameter = new LimitingParameter()
|
||||
{
|
||||
IdTelemetry = idTelemetry,
|
||||
DateStart = r0.Date,
|
||||
DateEnd = r1.Date,
|
||||
DepthStart = r0.WellDepth,
|
||||
DepthEnd = r1.WellDepth,
|
||||
IdFeedRegulator = (short)r0.IdLimiting
|
||||
};
|
||||
//var limitingParameters = new List<LimitingParameter>(32);
|
||||
|
||||
limitingParameters.Add(limitingParameter);
|
||||
}
|
||||
}
|
||||
//for (int i = 1; i < rows.Count; i++)
|
||||
//{
|
||||
// var r0 = rows[i - 1];
|
||||
// var r1 = rows[i];
|
||||
// if (r0.IdLimiting != r1.IdLimiting)
|
||||
// {
|
||||
// var limitingParameter = new LimitingParameter()
|
||||
// {
|
||||
// IdTelemetry = idTelemetry,
|
||||
// DateStart = r0.Date,
|
||||
// DateEnd = r1.Date,
|
||||
// DepthStart = r0.WellDepth,
|
||||
// DepthEnd = r1.WellDepth,
|
||||
// IdFeedRegulator = (short)r0.IdLimiting
|
||||
// };
|
||||
|
||||
// limitingParameters.Add(limitingParameter);
|
||||
// }
|
||||
//}
|
||||
|
||||
return limitingParameters;
|
||||
}
|
||||
|
@ -2,7 +2,10 @@
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudDb.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -21,13 +24,82 @@ namespace AsbCloudInfrastructure.Services
|
||||
this.wellService = wellService;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<LimitingParameterDto>?> GetInfosAsync(LimitingParameterRequest request, CancellationToken token)
|
||||
public async Task<IEnumerable<LimitingParameterDto>?> GetStatOrDefaultAsync(LimitingParameterRequest request, CancellationToken token)
|
||||
{
|
||||
var well = await wellService.GetOrDefaultAsync(request.IdWell, token);
|
||||
if (well?.IdTelemetry is null || well.Timezone is null)
|
||||
return null;
|
||||
|
||||
return await limitingParameterRepository.GetInfosAsync(request, well, token);
|
||||
var data = (await limitingParameterRepository.GetStatOrDefaultAsync(request, well, token))
|
||||
.GroupBy(x => x.IdFeedRegulator);
|
||||
|
||||
|
||||
List<LimitingParameterDto> result = new List<LimitingParameterDto>();
|
||||
foreach (var item in data)
|
||||
{
|
||||
var trimData = TrimLimitingParameters(item, request);
|
||||
|
||||
var allItemDepths = trimData.Sum(x => x.DepthEnd - x.DepthStart);
|
||||
var allItemDates = trimData.Sum(x => (x.DateEnd - x.DateStart).TotalMinutes);
|
||||
|
||||
result.Add(new LimitingParameterDto
|
||||
{
|
||||
IdWell = well.Id,
|
||||
IdFeedRegulator = item.Key,
|
||||
Depth = allItemDepths,
|
||||
TotalMinutes = (float)allItemDates
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private IEnumerable<LimitingParameterDataDto> TrimLimitingParameters(IEnumerable<LimitingParameterDataDto> data, LimitingParameterRequest request)
|
||||
{
|
||||
var result = data.Select((x) =>
|
||||
{
|
||||
if (request.GtDate.HasValue && x.DateStart < request.GtDate.Value)
|
||||
{
|
||||
x.DepthStart = GetDepth(request.GtDate.Value, x);
|
||||
x.DateStart = request.GtDate.Value;
|
||||
}
|
||||
if (request.LtDate.HasValue && x.DateEnd > request.LtDate.Value)
|
||||
{
|
||||
x.DepthEnd = GetDepth(request.LtDate.Value, x);
|
||||
x.DateEnd = request.LtDate.Value;
|
||||
}
|
||||
|
||||
if (request.GtDepth.HasValue && x.DepthStart < request.GtDepth.Value)
|
||||
{
|
||||
x.DateStart = GetDate(request.GtDepth.Value, x);
|
||||
x.DepthStart = (float)request.GtDepth.Value;
|
||||
}
|
||||
if (request.LtDepth.HasValue && x.DepthEnd > request.LtDepth.Value)
|
||||
{
|
||||
x.DateEnd = GetDate(request.LtDepth.Value, x);
|
||||
x.DepthEnd = (float)request.LtDepth.Value;
|
||||
}
|
||||
return x;
|
||||
}).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
private float GetDepth(DateTimeOffset date, LimitingParameterDataDto dto)
|
||||
{
|
||||
var a = (date - dto.DateStart).TotalSeconds;
|
||||
var b = (dto.DateEnd - dto.DateStart).TotalSeconds;
|
||||
var c = dto.DepthEnd - dto.DepthStart;
|
||||
var result = dto.DepthStart + (a / b) * c;
|
||||
return (float)result;
|
||||
}
|
||||
|
||||
private DateTimeOffset GetDate(double depth, LimitingParameterDataDto dto)
|
||||
{
|
||||
var a = depth - dto.DepthStart;
|
||||
var b = dto.DepthEnd - dto.DepthStart;
|
||||
var c = (dto.DateEnd - dto.DateStart);
|
||||
var result = dto.DateStart + (a / b) * c;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
@ -24,13 +24,13 @@ namespace AsbCloudWebApi.Controllers
|
||||
this.wellService = wellService;
|
||||
}
|
||||
|
||||
[HttpGet("info")]
|
||||
[HttpGet("stat")]
|
||||
[ProducesResponseType(typeof(IEnumerable<LimitingParameterDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetInfosAsync([FromQuery] LimitingParameterRequest request, CancellationToken token = default)
|
||||
{
|
||||
if (!await UserHasAccesToWellAsync(request.IdWell, token))
|
||||
return Forbid();
|
||||
var subsystemResult = await limitingParameterService.GetInfosAsync(request, token);
|
||||
var subsystemResult = await limitingParameterService.GetStatOrDefaultAsync(request, token);
|
||||
return Ok(subsystemResult);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user