Запись для формирования отчета РТК - плоский список:

1. Убраны навигационные свойства Rotor и Slide (и соответствующая DTO)
2. Закомментирован код формирования отчета РТК
This commit is contained in:
Olga Nemt 2023-03-31 15:20:27 +05:00
parent 6f51048ae7
commit e142e1eff5
4 changed files with 136 additions and 154 deletions

View File

@ -33,16 +33,6 @@ namespace AsbCloudApp.Data.ProcessMap
/// </summary> /// </summary>
public double MechDrillingHours { get; set; } public double MechDrillingHours { get; set; }
/// <summary>
/// Слайд
/// </summary>
public ProcessMapReportRowDto Slide { get; set; } = null!;
/// <summary>
/// Ротор
/// </summary>
public ProcessMapReportRowDto Rotor { get; set; } = null!;
/// <summary> /// <summary>
/// название секции скважины /// название секции скважины
/// </summary> /// </summary>
@ -52,5 +42,40 @@ namespace AsbCloudApp.Data.ProcessMap
/// название секции скважины /// название секции скважины
/// </summary> /// </summary>
public string WellSectionTypeName { get; set; } = null!; public string WellSectionTypeName { get; set; } = null!;
/// <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; }
} }
} }

View File

@ -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; }
}
}

View File

@ -107,45 +107,45 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
.Merge().FirstCell() .Merge().FirstCell()
.SetVal(interval.MechDrillingHours); .SetVal(interval.MechDrillingHours);
row = FillIntervalModeData(sheet, "Ротор", interval.Rotor, columnMode, row); //row = FillIntervalModeData(sheet, "Ротор", interval.Rotor, columnMode, row);
row = FillIntervalModeData(sheet, "Слайд", interval.Slide, columnMode, row); //row = FillIntervalModeData(sheet, "Слайд", interval.Slide, columnMode, row);
return row; return row;
} }
private static int FillIntervalModeData(IXLWorksheet sheet, string modeName, ProcessMapReportRowDto modeData, int column, int row) //private static int FillIntervalModeData(IXLWorksheet sheet, string modeName, ProcessMapReportRowDto modeData, int column, int row)
{ //{
int columnDeltaDepth = column + 1; // int columnDeltaDepth = column + 1;
int columnPressure = columnDeltaDepth + 1; // int columnPressure = columnDeltaDepth + 1;
int columnLoad = columnPressure + 5; // int columnLoad = columnPressure + 5;
int columnTorque = columnLoad + 5; // int columnTorque = columnLoad + 5;
int columnSpeed = columnTorque + 5; // int columnSpeed = columnTorque + 5;
int columnUsagePlan = columnSpeed + 5; // int columnUsagePlan = columnSpeed + 5;
int columnUsageFact = columnUsagePlan + 1; // int columnUsageFact = columnUsagePlan + 1;
int columnRop = columnUsageFact + 12; // int columnRop = columnUsageFact + 12;
sheet.Cell(row, column) // sheet.Cell(row, column)
.SetVal(modeName); // .SetVal(modeName);
sheet.Cell(row, columnDeltaDepth) // sheet.Cell(row, columnDeltaDepth)
.SetVal(modeData.DeltaDepth); // .SetVal(modeData.DeltaDepth);
FillIntervalModeDataParam(sheet, modeData.PressureDiff, columnPressure, row); // FillIntervalModeDataParam(sheet, modeData.PressureDiff, columnPressure, row);
FillIntervalModeDataParam(sheet, modeData.AxialLoad, columnLoad, row); // FillIntervalModeDataParam(sheet, modeData.AxialLoad, columnLoad, row);
FillIntervalModeDataParam(sheet, modeData.TopDriveTorque, columnTorque, row); // FillIntervalModeDataParam(sheet, modeData.TopDriveTorque, columnTorque, row);
FillIntervalModeDataSpeed(sheet, modeData.SpeedLimit, columnSpeed, row); // FillIntervalModeDataSpeed(sheet, modeData.SpeedLimit, columnSpeed, row);
sheet.Cell(row, columnUsagePlan) // sheet.Cell(row, columnUsagePlan)
.SetVal(100); // .SetVal(100);
sheet.Cell(row, columnUsageFact) // sheet.Cell(row, columnUsageFact)
.SetVal(modeData.Usage); // .SetVal(modeData.Usage);
sheet.Cell(row, columnRop) // sheet.Cell(row, columnRop)
.SetVal(modeData.Rop); // .SetVal(modeData.Rop);
return row + 1; // return row + 1;
} //}
private static void FillIntervalModeDataParam(IXLWorksheet sheet, ProcessMapReportParamsDto dataParam, int column, int row) private static void FillIntervalModeDataParam(IXLWorksheet sheet, ProcessMapReportParamsDto dataParam, int column, int row)
{ {

View File

@ -146,8 +146,8 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
var slideOperations = intervalOperations.Where(o => o.IdCategory == WellOperationCategory.IdSlide); var slideOperations = intervalOperations.Where(o => o.IdCategory == WellOperationCategory.IdSlide);
var rotorOperations = intervalOperations.Where(o => o.IdCategory == WellOperationCategory.IdRotor); var rotorOperations = intervalOperations.Where(o => o.IdCategory == WellOperationCategory.IdRotor);
dto.Slide = CalcDrillModeStat(depthInterval, slideOperations, intervalProcessMap, intervalTelemetryDataStat, intervalLimitingParametrs, intervalSubsystemsOperationTime); //dto.Slide = CalcDrillModeStat(depthInterval, slideOperations, intervalProcessMap, intervalTelemetryDataStat, intervalLimitingParametrs, intervalSubsystemsOperationTime);
dto.Rotor = CalcDrillModeStat(depthInterval, rotorOperations, intervalProcessMap, intervalTelemetryDataStat, intervalLimitingParametrs, intervalSubsystemsOperationTime); //dto.Rotor = CalcDrillModeStat(depthInterval, rotorOperations, intervalProcessMap, intervalTelemetryDataStat, intervalLimitingParametrs, intervalSubsystemsOperationTime);
return dto; return dto;
} }
@ -201,91 +201,91 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
return result; return result;
} }
private static ProcessMapReportRowDto CalcDrillModeStat( //private static ProcessMapReportRowDto CalcDrillModeStat(
(double min, double max) depthInterval, // (double min, double max) depthInterval,
IEnumerable<WellOperationDto> intervalModeOperations, // IEnumerable<WellOperationDto> intervalModeOperations,
IEnumerable<ProcessMapDto> intervalProcessMap, // IEnumerable<ProcessMapDto> intervalProcessMap,
TelemetryDataSaubStatDto? telemetryDataStat, // TelemetryDataSaubStatDto? telemetryDataStat,
IEnumerable<LimitingParameterDataDto> intervalLimitingParametrs, // IEnumerable<LimitingParameterDataDto> intervalLimitingParametrs,
IEnumerable<SubsystemOperationTimeDto> intervalSubsystemsOperationTime) // IEnumerable<SubsystemOperationTimeDto> intervalSubsystemsOperationTime)
{ //{
var dto = new ProcessMapReportRowDto(); // var dto = new ProcessMapReportRowDto();
if (intervalModeOperations.Any()) // if (intervalModeOperations.Any())
{ // {
var deltaDepth = CalcDeltaDepth(depthInterval, intervalModeOperations); // var deltaDepth = CalcDeltaDepth(depthInterval, intervalModeOperations);
dto.DeltaDepth = deltaDepth; // dto.DeltaDepth = deltaDepth;
dto.Rop = deltaDepth / CalcHours(depthInterval, intervalModeOperations); // dto.Rop = deltaDepth / CalcHours(depthInterval, intervalModeOperations);
}; // };
if (intervalProcessMap.Any()) // if (intervalProcessMap.Any())
{ // {
var processMapFirst = intervalProcessMap.First(); // var processMapFirst = intervalProcessMap.First();
dto.PressureDiff.SetpointPlan = processMapFirst.Pressure.Plan; // dto.PressureDiff.SetpointPlan = processMapFirst.Pressure.Plan;
dto.AxialLoad.SetpointPlan = processMapFirst.AxialLoad.Plan; // dto.AxialLoad.SetpointPlan = processMapFirst.AxialLoad.Plan;
dto.TopDriveTorque.SetpointPlan = processMapFirst.TopDriveTorque.Plan; // dto.TopDriveTorque.SetpointPlan = processMapFirst.TopDriveTorque.Plan;
//dto.SpeedLimit.SetpointPlan = null; // //dto.SpeedLimit.SetpointPlan = null;
} // }
if (telemetryDataStat is not null) // if (telemetryDataStat is not null)
{ // {
dto.PressureDiff.SetpointFact = telemetryDataStat.PressureSp; // dto.PressureDiff.SetpointFact = telemetryDataStat.PressureSp;
dto.PressureDiff.Fact = telemetryDataStat.PressureDelta; // dto.PressureDiff.Fact = telemetryDataStat.PressureDelta;
dto.PressureDiff.Limit = telemetryDataStat.PressureDeltaLimitMax; // dto.PressureDiff.Limit = telemetryDataStat.PressureDeltaLimitMax;
dto.AxialLoad.SetpointFact = telemetryDataStat.AxialLoadSp; // dto.AxialLoad.SetpointFact = telemetryDataStat.AxialLoadSp;
dto.AxialLoad.Fact = telemetryDataStat.AxialLoad; // dto.AxialLoad.Fact = telemetryDataStat.AxialLoad;
dto.AxialLoad.Limit = telemetryDataStat.AxialLoadLimitMax; // dto.AxialLoad.Limit = telemetryDataStat.AxialLoadLimitMax;
dto.TopDriveTorque.SetpointFact = telemetryDataStat.RotorTorqueSp; // dto.TopDriveTorque.SetpointFact = telemetryDataStat.RotorTorqueSp;
dto.TopDriveTorque.Fact = telemetryDataStat.RotorTorque; // dto.TopDriveTorque.Fact = telemetryDataStat.RotorTorque;
dto.TopDriveTorque.Limit = telemetryDataStat.RotorTorqueLimitMax; // dto.TopDriveTorque.Limit = telemetryDataStat.RotorTorqueLimitMax;
dto.SpeedLimit.SetpointFact = telemetryDataStat.BlockSpeedSp; // dto.SpeedLimit.SetpointFact = telemetryDataStat.BlockSpeedSp;
dto.SpeedLimit.Fact = telemetryDataStat.BlockSpeed; // dto.SpeedLimit.Fact = telemetryDataStat.BlockSpeed;
//dto.SpeedLimit.Limit = mull; // //dto.SpeedLimit.Limit = mull;
} // }
if(intervalLimitingParametrs.Any()) // if(intervalLimitingParametrs.Any())
{ // {
const int idLimParamRop = 1; // const int idLimParamRop = 1;
const int idLimParamPressure = 2; // const int idLimParamPressure = 2;
const int idLimParamAxialLoad = 3; // const int idLimParamAxialLoad = 3;
const int idLimParamTorque = 4; // const int idLimParamTorque = 4;
var intervalLimitingParametrsStat = intervalLimitingParametrs // var intervalLimitingParametrsStat = intervalLimitingParametrs
.GroupBy(p => p.IdFeedRegulator) // .GroupBy(p => p.IdFeedRegulator)
.Select(g => new // .Select(g => new
{ // {
IdLimParam = g.Key, // IdLimParam = g.Key,
SumDepth = g.Sum(p => p.DepthEnd - p.DepthStart), // SumDepth = g.Sum(p => p.DepthEnd - p.DepthStart),
}); // });
var totalDepth = intervalLimitingParametrsStat // var totalDepth = intervalLimitingParametrsStat
.Sum(s => s.SumDepth); // .Sum(s => s.SumDepth);
if (totalDepth > 0) // if (totalDepth > 0)
{ // {
dto.AxialLoad.PercDrillingSetpoint = intervalLimitingParametrsStat // dto.AxialLoad.PercDrillingSetpoint = intervalLimitingParametrsStat
.FirstOrDefault(s => s.IdLimParam == idLimParamAxialLoad)?.SumDepth / totalDepth; // .FirstOrDefault(s => s.IdLimParam == idLimParamAxialLoad)?.SumDepth / totalDepth;
dto.PressureDiff.PercDrillingSetpoint = intervalLimitingParametrsStat // dto.PressureDiff.PercDrillingSetpoint = intervalLimitingParametrsStat
.FirstOrDefault(s => s.IdLimParam == idLimParamPressure)?.SumDepth / totalDepth; // .FirstOrDefault(s => s.IdLimParam == idLimParamPressure)?.SumDepth / totalDepth;
dto.TopDriveTorque.PercDrillingSetpoint = intervalLimitingParametrsStat // dto.TopDriveTorque.PercDrillingSetpoint = intervalLimitingParametrsStat
.FirstOrDefault(s => s.IdLimParam == idLimParamTorque)?.SumDepth / totalDepth; // .FirstOrDefault(s => s.IdLimParam == idLimParamTorque)?.SumDepth / totalDepth;
dto.SpeedLimit.PercDrillingSetpoint = intervalLimitingParametrsStat // dto.SpeedLimit.PercDrillingSetpoint = intervalLimitingParametrsStat
.FirstOrDefault(s => s.IdLimParam == idLimParamRop)?.SumDepth / totalDepth; // .FirstOrDefault(s => s.IdLimParam == idLimParamRop)?.SumDepth / totalDepth;
} // }
} // }
if (intervalSubsystemsOperationTime.Any() && dto.DeltaDepth > 0) // if (intervalSubsystemsOperationTime.Any() && dto.DeltaDepth > 0)
{ // {
dto.Usage = intervalSubsystemsOperationTime.Sum(t => t.DepthEnd - t.DepthStart) / dto.DeltaDepth.Value; // 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) private static double CalcDeltaDepth((double min, double max) depthInterval, IEnumerable<WellOperationDto> intervalOperations)
{ {