forked from ddrilling/AsbCloudServer
Merge pull request 'Запись для формирования отчета РТК - плоский список:' (#41) from feature/refactoring-dtos-for-rtk-report into dev
Reviewed-on: http://test.digitaldrilling.ru:8080/DDrilling/AsbCloudServer/pulls/41
This commit is contained in:
commit
4766a8ee8a
@ -1,13 +1,12 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AsbCloudApp.Data.ProcessMap
|
||||
{
|
||||
/// <summary>
|
||||
/// РТК
|
||||
/// </summary>
|
||||
public class ProcessMapDto : IId, IWellRelated
|
||||
public class ProcessMapPlanDto : IId, IWellRelated
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public int Id { get; set; }
|
@ -13,16 +13,34 @@ namespace AsbCloudApp.Data.ProcessMap
|
||||
public int IdWell { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Глубина по стволу, м
|
||||
/// название секции скважины
|
||||
/// </summary>
|
||||
public int IdWellSectionType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// название секции скважины
|
||||
/// </summary>
|
||||
public string WellSectionTypeName { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Глубина по стволу от, м
|
||||
/// <para>
|
||||
/// на начало интервала
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public double DepthStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Глубина по стволу до, м
|
||||
/// <para>
|
||||
/// на конец интервала
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public double DepthEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дата/ время
|
||||
/// <para>
|
||||
/// <para>
|
||||
/// на начало интервала
|
||||
/// </para>
|
||||
/// </summary>
|
||||
@ -34,23 +52,43 @@ namespace AsbCloudApp.Data.ProcessMap
|
||||
public double MechDrillingHours { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Слайд
|
||||
/// Режим бурения (Ротор/слайд/ручной)
|
||||
/// </summary>
|
||||
public ProcessMapReportRowDto Slide { get; set; } = null!;
|
||||
public string DrillingMode { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Ротор
|
||||
/// Проходка, м
|
||||
/// </summary>
|
||||
public ProcessMapReportRowDto Rotor { get; set; } = null!;
|
||||
public double? DeltaDepth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// название секции скважины
|
||||
/// Перепад давления, атм
|
||||
/// </summary>
|
||||
public int IdWellSectionType { get; set; }
|
||||
public ProcessMapReportParamsDto PressureDiff { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// название секции скважины
|
||||
/// Нагрузка, т
|
||||
/// </summary>
|
||||
public string WellSectionTypeName { get; set; } = null!;
|
||||
public ProcessMapReportParamsDto AxialLoad { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Момент на ВСП, кНхМ
|
||||
/// </summary>
|
||||
public ProcessMapReportParamsDto TopDriveTorque { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Ограничение скорости, м/ч
|
||||
/// </summary>
|
||||
public ProcessMapReportParamsDto SpeedLimit { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Процент использования системы АПД, %
|
||||
/// </summary>
|
||||
public double Usage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Фактическая механическая скорость, м/ч
|
||||
/// </summary>
|
||||
public double Rop { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,6 @@ namespace AsbCloudApp.Data.ProcessMap
|
||||
/// <summary>
|
||||
/// Процент бурения по уставке, %
|
||||
/// </summary>
|
||||
public double? PercDrillingSetpoint { get; set; }
|
||||
public double? PercDrillingBySetpoint { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,43 +0,0 @@
|
||||
namespace AsbCloudApp.Data.ProcessMap
|
||||
{
|
||||
/// <summary>
|
||||
/// Строки РТК
|
||||
/// </summary>
|
||||
public class ProcessMapReportRowDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Проходка, м
|
||||
/// </summary>
|
||||
public double? DeltaDepth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Перепад давления, атм
|
||||
/// </summary>
|
||||
public ProcessMapReportParamsDto PressureDiff { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Нагрузка, т
|
||||
/// </summary>
|
||||
public ProcessMapReportParamsDto AxialLoad { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Момент на ВСП, кНхМ
|
||||
/// </summary>
|
||||
public ProcessMapReportParamsDto TopDriveTorque { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Ограничение скорости, м/ч
|
||||
/// </summary>
|
||||
public ProcessMapReportParamsDto SpeedLimit { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Процент использования системы АПД, %
|
||||
/// </summary>
|
||||
public double Usage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Фактическая механическая скорость, м/ч
|
||||
/// </summary>
|
||||
public double Rop { get; set; }
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ namespace AsbCloudApp.Repositories
|
||||
/// <summary>
|
||||
/// ÐÒÊ
|
||||
/// </summary>
|
||||
public interface IProcessMapRepository : IRepositoryWellRelated<ProcessMapDto>
|
||||
public interface IProcessMapRepository : IRepositoryWellRelated<ProcessMapPlanDto>
|
||||
{
|
||||
/// <summary>
|
||||
/// Ïîëó÷èòü ïàðàìåòðû áóðåíèÿ íà÷èíàÿ ñ äàòû.
|
||||
@ -20,7 +20,7 @@ namespace AsbCloudApp.Repositories
|
||||
/// <param name="updateFrom"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<ProcessMapDto>> GetAllAsync(int idWell,
|
||||
Task<IEnumerable<ProcessMapPlanDto>> GetAllAsync(int idWell,
|
||||
DateTime? updateFrom, CancellationToken token = default);
|
||||
|
||||
/// <summary>
|
||||
@ -29,6 +29,6 @@ namespace AsbCloudApp.Repositories
|
||||
/// <param name="requests"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<ProcessMapDto>> GetProcessMapAsync(IEnumerable<ProcessMapRequest> requests, CancellationToken token);
|
||||
Task<IEnumerable<ProcessMapPlanDto>> GetProcessMapAsync(IEnumerable<ProcessMapRequest> requests, CancellationToken token);
|
||||
}
|
||||
}
|
@ -34,6 +34,6 @@ namespace AsbCloudApp.Repositories
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<ProcessMapDto>> GetCompositeProcessMap(int idWell, CancellationToken token);
|
||||
Task<IEnumerable<ProcessMapPlanDto>> GetCompositeProcessMap(int idWell, CancellationToken token);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ using System.Threading.Tasks;
|
||||
namespace AsbCloudInfrastructure.Repository
|
||||
{
|
||||
#nullable enable
|
||||
public class ProcessMapRepository : CrudWellRelatedRepositoryBase<ProcessMapDto, ProcessMap>,
|
||||
public class ProcessMapRepository : CrudWellRelatedRepositoryBase<ProcessMapPlanDto, ProcessMap>,
|
||||
IProcessMapRepository
|
||||
{
|
||||
private readonly IWellService wellService;
|
||||
@ -32,7 +32,7 @@ namespace AsbCloudInfrastructure.Repository
|
||||
this.wellService = wellService;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ProcessMapDto>> GetAllAsync(int idWell,
|
||||
public async Task<IEnumerable<ProcessMapPlanDto>> GetAllAsync(int idWell,
|
||||
DateTime? updateFrom, CancellationToken token)
|
||||
{
|
||||
var requests = new[]
|
||||
@ -53,7 +53,7 @@ namespace AsbCloudInfrastructure.Repository
|
||||
return dtos;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ProcessMapDto>> GetProcessMapAsync(IEnumerable<ProcessMapRequest> requests, CancellationToken token)
|
||||
public async Task<IEnumerable<ProcessMapPlanDto>> GetProcessMapAsync(IEnumerable<ProcessMapRequest> requests, CancellationToken token)
|
||||
{
|
||||
var entities = await BuildQuery(requests)
|
||||
.ToListAsync(token)
|
||||
@ -62,7 +62,7 @@ namespace AsbCloudInfrastructure.Repository
|
||||
return dtos;
|
||||
}
|
||||
|
||||
public override async Task<int> InsertAsync(ProcessMapDto dto,
|
||||
public override async Task<int> InsertAsync(ProcessMapPlanDto dto,
|
||||
CancellationToken token)
|
||||
{
|
||||
dto.LastUpdate = DateTime.UtcNow;
|
||||
@ -70,7 +70,7 @@ namespace AsbCloudInfrastructure.Repository
|
||||
return result;
|
||||
}
|
||||
|
||||
public override async Task<int> UpdateAsync(ProcessMapDto dto,
|
||||
public override async Task<int> UpdateAsync(ProcessMapPlanDto dto,
|
||||
CancellationToken token)
|
||||
{
|
||||
dto.LastUpdate = DateTime.UtcNow;
|
||||
@ -105,9 +105,9 @@ namespace AsbCloudInfrastructure.Repository
|
||||
}
|
||||
return query;
|
||||
}
|
||||
protected override ProcessMapDto Convert(ProcessMap entity)
|
||||
protected override ProcessMapPlanDto Convert(ProcessMap entity)
|
||||
{
|
||||
var dto = entity.Adapt<ProcessMapDto>();
|
||||
var dto = entity.Adapt<ProcessMapPlanDto>();
|
||||
dto.LastUpdate = entity.LastUpdate.ToRemoteDateTime(entity.Well.Timezone.Hours);
|
||||
dto.AxialLoad = new PlanLimitDto
|
||||
{
|
||||
@ -137,7 +137,7 @@ namespace AsbCloudInfrastructure.Repository
|
||||
return dto;
|
||||
}
|
||||
|
||||
protected override ProcessMap Convert(ProcessMapDto dto)
|
||||
protected override ProcessMap Convert(ProcessMapPlanDto dto)
|
||||
{
|
||||
var entity = dto.Adapt<ProcessMap>();
|
||||
entity.AxialLoadPlan = dto.AxialLoad.Plan;
|
||||
|
@ -50,7 +50,7 @@ namespace AsbCloudInfrastructure.Repository
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<IEnumerable<ProcessMapDto>> GetCompositeProcessMap(int idWell, CancellationToken token)
|
||||
public async Task<IEnumerable<ProcessMapPlanDto>> GetCompositeProcessMap(int idWell, CancellationToken token)
|
||||
{
|
||||
var dtos = await GetAsync(idWell, token);
|
||||
|
||||
|
@ -107,45 +107,45 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
|
||||
.Merge().FirstCell()
|
||||
.SetVal(interval.MechDrillingHours);
|
||||
|
||||
row = FillIntervalModeData(sheet, "Ротор", interval.Rotor, columnMode, row);
|
||||
row = FillIntervalModeData(sheet, "Слайд", interval.Slide, columnMode, row);
|
||||
//row = FillIntervalModeData(sheet, "Ротор", interval.Rotor, columnMode, row);
|
||||
//row = FillIntervalModeData(sheet, "Слайд", interval.Slide, columnMode, row);
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
private static int FillIntervalModeData(IXLWorksheet sheet, string modeName, ProcessMapReportRowDto modeData, int column, int row)
|
||||
{
|
||||
int columnDeltaDepth = column + 1;
|
||||
int columnPressure = columnDeltaDepth + 1;
|
||||
int columnLoad = columnPressure + 5;
|
||||
int columnTorque = columnLoad + 5;
|
||||
int columnSpeed = columnTorque + 5;
|
||||
int columnUsagePlan = columnSpeed + 5;
|
||||
int columnUsageFact = columnUsagePlan + 1;
|
||||
int columnRop = columnUsageFact + 12;
|
||||
//private static int FillIntervalModeData(IXLWorksheet sheet, string modeName, ProcessMapReportRowDto modeData, int column, int row)
|
||||
//{
|
||||
// int columnDeltaDepth = column + 1;
|
||||
// int columnPressure = columnDeltaDepth + 1;
|
||||
// int columnLoad = columnPressure + 5;
|
||||
// int columnTorque = columnLoad + 5;
|
||||
// int columnSpeed = columnTorque + 5;
|
||||
// int columnUsagePlan = columnSpeed + 5;
|
||||
// int columnUsageFact = columnUsagePlan + 1;
|
||||
// int columnRop = columnUsageFact + 12;
|
||||
|
||||
sheet.Cell(row, column)
|
||||
.SetVal(modeName);
|
||||
// sheet.Cell(row, column)
|
||||
// .SetVal(modeName);
|
||||
|
||||
sheet.Cell(row, columnDeltaDepth)
|
||||
.SetVal(modeData.DeltaDepth);
|
||||
// sheet.Cell(row, columnDeltaDepth)
|
||||
// .SetVal(modeData.DeltaDepth);
|
||||
|
||||
FillIntervalModeDataParam(sheet, modeData.PressureDiff, columnPressure, row);
|
||||
FillIntervalModeDataParam(sheet, modeData.AxialLoad, columnLoad, row);
|
||||
FillIntervalModeDataParam(sheet, modeData.TopDriveTorque, columnTorque, row);
|
||||
FillIntervalModeDataSpeed(sheet, modeData.SpeedLimit, columnSpeed, row);
|
||||
// FillIntervalModeDataParam(sheet, modeData.PressureDiff, columnPressure, row);
|
||||
// FillIntervalModeDataParam(sheet, modeData.AxialLoad, columnLoad, row);
|
||||
// FillIntervalModeDataParam(sheet, modeData.TopDriveTorque, columnTorque, row);
|
||||
// FillIntervalModeDataSpeed(sheet, modeData.SpeedLimit, columnSpeed, row);
|
||||
|
||||
sheet.Cell(row, columnUsagePlan)
|
||||
.SetVal(100);
|
||||
// sheet.Cell(row, columnUsagePlan)
|
||||
// .SetVal(100);
|
||||
|
||||
sheet.Cell(row, columnUsageFact)
|
||||
.SetVal(modeData.Usage);
|
||||
// sheet.Cell(row, columnUsageFact)
|
||||
// .SetVal(modeData.Usage);
|
||||
|
||||
sheet.Cell(row, columnRop)
|
||||
.SetVal(modeData.Rop);
|
||||
// sheet.Cell(row, columnRop)
|
||||
// .SetVal(modeData.Rop);
|
||||
|
||||
return row + 1;
|
||||
}
|
||||
// return row + 1;
|
||||
//}
|
||||
|
||||
private static void FillIntervalModeDataParam(IXLWorksheet sheet, ProcessMapReportParamsDto dataParam, int column, int row)
|
||||
{
|
||||
@ -168,7 +168,7 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
|
||||
.SetVal(dataParam.Limit);
|
||||
|
||||
sheet.Cell(row, column + columnOffsetPercent)
|
||||
.SetVal(dataParam.PercDrillingSetpoint);
|
||||
.SetVal(dataParam.PercDrillingBySetpoint);
|
||||
}
|
||||
|
||||
private static void FillIntervalModeDataSpeed(IXLWorksheet sheet, ProcessMapReportParamsDto dataParam, int column, int row)
|
||||
@ -192,7 +192,7 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
|
||||
.SetVal(dataParam.Limit);
|
||||
|
||||
sheet.Cell(row, column + columnOffsetPercent)
|
||||
.SetVal(dataParam.PercDrillingSetpoint);
|
||||
.SetVal(dataParam.PercDrillingBySetpoint);
|
||||
}
|
||||
|
||||
private static Stream GetExcelTemplateStream()
|
||||
|
@ -96,7 +96,7 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
|
||||
|
||||
private static IEnumerable<ProcessMapReportDto> HandleSection(
|
||||
IEnumerable<WellOperationDto> sectionOperations,
|
||||
IEnumerable<ProcessMapDto> sectionProcessMap,
|
||||
IEnumerable<ProcessMapPlanDto> sectionProcessMap,
|
||||
IEnumerable<TelemetryDataSaubStatDto> telemetryDataStat,
|
||||
IEnumerable<LimitingParameterDataDto> limitingParameters,
|
||||
IEnumerable<SubsystemOperationTimeDto> subsystemsOperationTime)
|
||||
@ -116,7 +116,7 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
|
||||
private static ProcessMapReportDto MakeProcessMapReportDto(
|
||||
(double min, double max) depthInterval,
|
||||
IEnumerable<WellOperationDto> sectionOperations,
|
||||
IEnumerable<ProcessMapDto> sectionProcessMap,
|
||||
IEnumerable<ProcessMapPlanDto> sectionProcessMap,
|
||||
IEnumerable<TelemetryDataSaubStatDto> telemetryDataStat,
|
||||
IEnumerable<LimitingParameterDataDto> limitingParameters,
|
||||
IEnumerable<SubsystemOperationTimeDto> subsystemsOperationTime)
|
||||
@ -146,8 +146,8 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
|
||||
var slideOperations = intervalOperations.Where(o => o.IdCategory == WellOperationCategory.IdSlide);
|
||||
var rotorOperations = intervalOperations.Where(o => o.IdCategory == WellOperationCategory.IdRotor);
|
||||
|
||||
dto.Slide = CalcDrillModeStat(depthInterval, slideOperations, intervalProcessMap, intervalTelemetryDataStat, intervalLimitingParametrs, intervalSubsystemsOperationTime);
|
||||
dto.Rotor = CalcDrillModeStat(depthInterval, rotorOperations, intervalProcessMap, intervalTelemetryDataStat, intervalLimitingParametrs, intervalSubsystemsOperationTime);
|
||||
//dto.Slide = CalcDrillModeStat(depthInterval, slideOperations, intervalProcessMap, intervalTelemetryDataStat, intervalLimitingParametrs, intervalSubsystemsOperationTime);
|
||||
//dto.Rotor = CalcDrillModeStat(depthInterval, rotorOperations, intervalProcessMap, intervalTelemetryDataStat, intervalLimitingParametrs, intervalSubsystemsOperationTime);
|
||||
|
||||
return dto;
|
||||
}
|
||||
@ -201,91 +201,91 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
|
||||
return result;
|
||||
}
|
||||
|
||||
private static ProcessMapReportRowDto CalcDrillModeStat(
|
||||
(double min, double max) depthInterval,
|
||||
IEnumerable<WellOperationDto> intervalModeOperations,
|
||||
IEnumerable<ProcessMapDto> intervalProcessMap,
|
||||
TelemetryDataSaubStatDto? telemetryDataStat,
|
||||
IEnumerable<LimitingParameterDataDto> intervalLimitingParametrs,
|
||||
IEnumerable<SubsystemOperationTimeDto> intervalSubsystemsOperationTime)
|
||||
{
|
||||
var dto = new ProcessMapReportRowDto();
|
||||
if (intervalModeOperations.Any())
|
||||
{
|
||||
var deltaDepth = CalcDeltaDepth(depthInterval, intervalModeOperations);
|
||||
dto.DeltaDepth = deltaDepth;
|
||||
dto.Rop = deltaDepth / CalcHours(depthInterval, intervalModeOperations);
|
||||
};
|
||||
//private static ProcessMapReportRowDto CalcDrillModeStat(
|
||||
// (double min, double max) depthInterval,
|
||||
// IEnumerable<WellOperationDto> intervalModeOperations,
|
||||
// IEnumerable<ProcessMapDto> intervalProcessMap,
|
||||
// TelemetryDataSaubStatDto? telemetryDataStat,
|
||||
// IEnumerable<LimitingParameterDataDto> intervalLimitingParametrs,
|
||||
// IEnumerable<SubsystemOperationTimeDto> intervalSubsystemsOperationTime)
|
||||
//{
|
||||
// var dto = new ProcessMapReportRowDto();
|
||||
// if (intervalModeOperations.Any())
|
||||
// {
|
||||
// var deltaDepth = CalcDeltaDepth(depthInterval, intervalModeOperations);
|
||||
// dto.DeltaDepth = deltaDepth;
|
||||
// dto.Rop = deltaDepth / CalcHours(depthInterval, intervalModeOperations);
|
||||
// };
|
||||
|
||||
if (intervalProcessMap.Any())
|
||||
{
|
||||
var processMapFirst = intervalProcessMap.First();
|
||||
dto.PressureDiff.SetpointPlan = processMapFirst.Pressure.Plan;
|
||||
dto.AxialLoad.SetpointPlan = processMapFirst.AxialLoad.Plan;
|
||||
dto.TopDriveTorque.SetpointPlan = processMapFirst.TopDriveTorque.Plan;
|
||||
//dto.SpeedLimit.SetpointPlan = null;
|
||||
}
|
||||
// if (intervalProcessMap.Any())
|
||||
// {
|
||||
// var processMapFirst = intervalProcessMap.First();
|
||||
// dto.PressureDiff.SetpointPlan = processMapFirst.Pressure.Plan;
|
||||
// dto.AxialLoad.SetpointPlan = processMapFirst.AxialLoad.Plan;
|
||||
// dto.TopDriveTorque.SetpointPlan = processMapFirst.TopDriveTorque.Plan;
|
||||
// //dto.SpeedLimit.SetpointPlan = null;
|
||||
// }
|
||||
|
||||
if (telemetryDataStat is not null)
|
||||
{
|
||||
dto.PressureDiff.SetpointFact = telemetryDataStat.PressureSp;
|
||||
dto.PressureDiff.Fact = telemetryDataStat.PressureDelta;
|
||||
dto.PressureDiff.Limit = telemetryDataStat.PressureDeltaLimitMax;
|
||||
// if (telemetryDataStat is not null)
|
||||
// {
|
||||
// dto.PressureDiff.SetpointFact = telemetryDataStat.PressureSp;
|
||||
// dto.PressureDiff.Fact = telemetryDataStat.PressureDelta;
|
||||
// dto.PressureDiff.Limit = telemetryDataStat.PressureDeltaLimitMax;
|
||||
|
||||
dto.AxialLoad.SetpointFact = telemetryDataStat.AxialLoadSp;
|
||||
dto.AxialLoad.Fact = telemetryDataStat.AxialLoad;
|
||||
dto.AxialLoad.Limit = telemetryDataStat.AxialLoadLimitMax;
|
||||
// dto.AxialLoad.SetpointFact = telemetryDataStat.AxialLoadSp;
|
||||
// dto.AxialLoad.Fact = telemetryDataStat.AxialLoad;
|
||||
// dto.AxialLoad.Limit = telemetryDataStat.AxialLoadLimitMax;
|
||||
|
||||
dto.TopDriveTorque.SetpointFact = telemetryDataStat.RotorTorqueSp;
|
||||
dto.TopDriveTorque.Fact = telemetryDataStat.RotorTorque;
|
||||
dto.TopDriveTorque.Limit = telemetryDataStat.RotorTorqueLimitMax;
|
||||
// dto.TopDriveTorque.SetpointFact = telemetryDataStat.RotorTorqueSp;
|
||||
// dto.TopDriveTorque.Fact = telemetryDataStat.RotorTorque;
|
||||
// dto.TopDriveTorque.Limit = telemetryDataStat.RotorTorqueLimitMax;
|
||||
|
||||
dto.SpeedLimit.SetpointFact = telemetryDataStat.BlockSpeedSp;
|
||||
dto.SpeedLimit.Fact = telemetryDataStat.BlockSpeed;
|
||||
//dto.SpeedLimit.Limit = mull;
|
||||
}
|
||||
// dto.SpeedLimit.SetpointFact = telemetryDataStat.BlockSpeedSp;
|
||||
// dto.SpeedLimit.Fact = telemetryDataStat.BlockSpeed;
|
||||
// //dto.SpeedLimit.Limit = mull;
|
||||
// }
|
||||
|
||||
if(intervalLimitingParametrs.Any())
|
||||
{
|
||||
const int idLimParamRop = 1;
|
||||
const int idLimParamPressure = 2;
|
||||
const int idLimParamAxialLoad = 3;
|
||||
const int idLimParamTorque = 4;
|
||||
// if(intervalLimitingParametrs.Any())
|
||||
// {
|
||||
// const int idLimParamRop = 1;
|
||||
// const int idLimParamPressure = 2;
|
||||
// const int idLimParamAxialLoad = 3;
|
||||
// const int idLimParamTorque = 4;
|
||||
|
||||
var intervalLimitingParametrsStat = intervalLimitingParametrs
|
||||
.GroupBy(p => p.IdFeedRegulator)
|
||||
.Select(g => new
|
||||
{
|
||||
IdLimParam = g.Key,
|
||||
SumDepth = g.Sum(p => p.DepthEnd - p.DepthStart),
|
||||
});
|
||||
// var intervalLimitingParametrsStat = intervalLimitingParametrs
|
||||
// .GroupBy(p => p.IdFeedRegulator)
|
||||
// .Select(g => new
|
||||
// {
|
||||
// IdLimParam = g.Key,
|
||||
// SumDepth = g.Sum(p => p.DepthEnd - p.DepthStart),
|
||||
// });
|
||||
|
||||
var totalDepth = intervalLimitingParametrsStat
|
||||
.Sum(s => s.SumDepth);
|
||||
// var totalDepth = intervalLimitingParametrsStat
|
||||
// .Sum(s => s.SumDepth);
|
||||
|
||||
if (totalDepth > 0)
|
||||
{
|
||||
dto.AxialLoad.PercDrillingSetpoint = intervalLimitingParametrsStat
|
||||
.FirstOrDefault(s => s.IdLimParam == idLimParamAxialLoad)?.SumDepth / totalDepth;
|
||||
// if (totalDepth > 0)
|
||||
// {
|
||||
// dto.AxialLoad.PercDrillingSetpoint = intervalLimitingParametrsStat
|
||||
// .FirstOrDefault(s => s.IdLimParam == idLimParamAxialLoad)?.SumDepth / totalDepth;
|
||||
|
||||
dto.PressureDiff.PercDrillingSetpoint = intervalLimitingParametrsStat
|
||||
.FirstOrDefault(s => s.IdLimParam == idLimParamPressure)?.SumDepth / totalDepth;
|
||||
// dto.PressureDiff.PercDrillingSetpoint = intervalLimitingParametrsStat
|
||||
// .FirstOrDefault(s => s.IdLimParam == idLimParamPressure)?.SumDepth / totalDepth;
|
||||
|
||||
dto.TopDriveTorque.PercDrillingSetpoint = intervalLimitingParametrsStat
|
||||
.FirstOrDefault(s => s.IdLimParam == idLimParamTorque)?.SumDepth / totalDepth;
|
||||
// dto.TopDriveTorque.PercDrillingSetpoint = intervalLimitingParametrsStat
|
||||
// .FirstOrDefault(s => s.IdLimParam == idLimParamTorque)?.SumDepth / totalDepth;
|
||||
|
||||
dto.SpeedLimit.PercDrillingSetpoint = intervalLimitingParametrsStat
|
||||
.FirstOrDefault(s => s.IdLimParam == idLimParamRop)?.SumDepth / totalDepth;
|
||||
}
|
||||
}
|
||||
// dto.SpeedLimit.PercDrillingSetpoint = intervalLimitingParametrsStat
|
||||
// .FirstOrDefault(s => s.IdLimParam == idLimParamRop)?.SumDepth / totalDepth;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (intervalSubsystemsOperationTime.Any() && dto.DeltaDepth > 0)
|
||||
{
|
||||
dto.Usage = intervalSubsystemsOperationTime.Sum(t => t.DepthEnd - t.DepthStart) / dto.DeltaDepth.Value;
|
||||
}
|
||||
// if (intervalSubsystemsOperationTime.Any() && dto.DeltaDepth > 0)
|
||||
// {
|
||||
// dto.Usage = intervalSubsystemsOperationTime.Sum(t => t.DepthEnd - t.DepthStart) / dto.DeltaDepth.Value;
|
||||
// }
|
||||
|
||||
return dto;
|
||||
}
|
||||
// return dto;
|
||||
//}
|
||||
|
||||
private static double CalcDeltaDepth((double min, double max) depthInterval, IEnumerable<WellOperationDto> intervalOperations)
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
|
||||
int? idSection = wellLastFactSection?.Id;
|
||||
|
||||
ProcessMapDto? welllProcessMap;
|
||||
ProcessMapPlanDto? welllProcessMap;
|
||||
if (idSection is not null)
|
||||
{
|
||||
welllProcessMap = wellProcessMaps.FirstOrDefault(p => p.IdWellSectionType == idSection);
|
||||
|
@ -18,7 +18,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
[Authorize]
|
||||
public class ProcessMapController : CrudWellRelatedController<ProcessMapDto, IProcessMapRepository>
|
||||
public class ProcessMapController : CrudWellRelatedController<ProcessMapPlanDto, IProcessMapRepository>
|
||||
{
|
||||
private readonly ITelemetryService telemetryService;
|
||||
private readonly IProcessMapReportService processMapReportService;
|
||||
@ -49,14 +49,14 @@ namespace AsbCloudWebApi.Controllers
|
||||
[Obsolete("use GetByUidAsync(..) instead")]
|
||||
[Route("/api/telemetry/{uid}/drillFlowChart")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(typeof(IEnumerable<ProcessMapDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(IEnumerable<ProcessMapPlanDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public IActionResult GetByTelemetry(string uid, DateTime updateFrom, CancellationToken token)
|
||||
{
|
||||
var idWell = telemetryService.GetIdWellByTelemetryUid(uid);
|
||||
if (idWell is null)
|
||||
return BadRequest($"Wrong uid {uid}");
|
||||
|
||||
var dto = Enumerable.Empty<ProcessMapDto>();
|
||||
var dto = Enumerable.Empty<ProcessMapPlanDto>();
|
||||
return Ok(dto);
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpGet]
|
||||
[Route("/api/telemetry/{uid}/processMap")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(typeof(IEnumerable<ProcessMapDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(IEnumerable<ProcessMapPlanDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetByUidAsync(string uid, DateTime updateFrom, CancellationToken token)
|
||||
{
|
||||
var idWell = telemetryService.GetIdWellByTelemetryUid(uid);
|
||||
@ -133,7 +133,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public override async Task<ActionResult<int>> InsertAsync([FromBody] ProcessMapDto value, CancellationToken token)
|
||||
public override async Task<ActionResult<int>> InsertAsync([FromBody] ProcessMapPlanDto value, CancellationToken token)
|
||||
{
|
||||
value.IdUser = User.GetUserId() ?? -1;
|
||||
return await base.InsertAsync(value, token);
|
||||
@ -146,7 +146,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns>1 - успешно отредактировано, 0 - нет</returns>
|
||||
[HttpPut]
|
||||
public override async Task<ActionResult<int>> UpdateAsync([FromBody] ProcessMapDto value, CancellationToken token)
|
||||
public override async Task<ActionResult<int>> UpdateAsync([FromBody] ProcessMapPlanDto value, CancellationToken token)
|
||||
{
|
||||
value.IdUser = User.GetUserId() ?? -1;
|
||||
return await base.UpdateAsync(value, token);
|
||||
|
@ -73,7 +73,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpGet("getCompositeProcessMap")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<ProcessMapDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(IEnumerable<ProcessMapPlanDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetCompositeProcessMap(int idWell, CancellationToken token = default)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
|
Loading…
Reference in New Issue
Block a user