DD.WellWorkover.Cloud/AsbCloudApp/Data/WellReport/OperatingModeDto.cs

78 lines
2.9 KiB
C#
Raw Normal View History

using AsbCloudApp.Data.ProcessMaps.Operations;
using System;
using System.Collections.Generic;
using System.Linq;
using AsbCloudApp.Data.WellOperation;
namespace AsbCloudApp.Data.WellReport;
//TODO: комментарии
public class OperatingModeDto
{
public OperatingModeDto(IEnumerable<WellOperationBaseDto> factWellOperations)
{
if (factWellOperations.All(x => x.IdWellSectionType != factWellOperations.ElementAt(0).IdWellSectionType))
throw new ArgumentException("Not all entries belong to the same well section", nameof(factWellOperations));
if (factWellOperations.All(x => x.IdType != 1))
throw new ArgumentException("Invalid list. There are planned operations", nameof(factWellOperations));
DepthStart = factWellOperations.Min(w => w.DepthStart);
DepthEnd = factWellOperations.Max(w => w.DepthEnd);
}
public OperatingModeDto(IEnumerable<ProcessMapPlanRotorDto> processMapPlanRotor)
{
if (processMapPlanRotor.All(x => x.IdWellSectionType != processMapPlanRotor.ElementAt(0).IdWellSectionType))
throw new ArgumentException("Not all entries belong to the same well section", nameof(processMapPlanRotor));
DepthStart = processMapPlanRotor.Min(p => p.DepthStart);
DepthEnd = processMapPlanRotor.Max(p => p.DepthEnd);
RopMin = processMapPlanRotor.Min(p => p.RopMax);
RopMax = processMapPlanRotor.Max(p => p.RopMax);
RopAvg = processMapPlanRotor.Average(p => p.RopMax);
WeightOnBitMin = processMapPlanRotor.Min(p => p.WeightOnBit);
WeightOnBitMax = processMapPlanRotor.Max(p => p.WeightOnBitMax);
WeightOnBitAvg = processMapPlanRotor.Average(p => p.WeightOnBit);
DriveTorqueMin = processMapPlanRotor.Min(p => p.TopDriveTorque);
DriveTorqueMax = processMapPlanRotor.Max(p => p.TopDriveTorqueMax);
DriveTorqueAvg = processMapPlanRotor.Average(p => p.TopDriveTorque);
DifferentialPressureMin = processMapPlanRotor.Min(p => p.DifferentialPressure);
DifferentialPressureMax = processMapPlanRotor.Max(p => p.DifferentialPressureMax);
DifferentialPressureAvg = processMapPlanRotor.Average(p => p.DifferentialPressure);
FrowRateMin = processMapPlanRotor.Min(p => p.FlowRate);
FrowRateMax = processMapPlanRotor.Max(p => p.FlowRateMax);
}
public double DepthStart { get; set; }
public double DepthEnd { get; set; }
public double? RopMin { get; set; }
public double? RopMax { get; set; }
public double? RopAvg { get; set; }
public double? WeightOnBitMin { get; set; }
public double? WeightOnBitMax { get; set; }
public double? WeightOnBitAvg { get; set; }
public double? DriveTorqueMin { get; set; }
public double? DriveTorqueMax { get; set; }
public double? DriveTorqueAvg { get; set; }
public double? DifferentialPressureMin { get; set; }
public double? DifferentialPressureMax { get; set; }
public double? DifferentialPressureAvg { get; set; }
public double? FrowRateMin { get; set; }
public double? FrowRateMax { get; set; }
}