#6623067 Изменение методики расчета рейсовой скорости

This commit is contained in:
ai.astrakhantsev 2022-10-18 11:00:34 +05:00
parent 1f5867e4b3
commit 9d67a7089b
3 changed files with 39 additions and 5 deletions

View File

@ -287,10 +287,11 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
}; };
while (iterator.MoveNext()) while (iterator.MoveNext())
{ {
if (iterator.Current.IdCategory == WellOperationService.idOperationTypeRepair)
race.Repair += iterator.Current.DurationHours;
if (iterator.Current.IdCategory == WellOperationService.idOperationNonProductiveTime) if (iterator.Current.IdCategory == WellOperationService.idOperationNonProductiveTime)
{
race.NonProductiveHours += iterator.Current.DurationHours; race.NonProductiveHours += iterator.Current.DurationHours;
}
if (iterator.Current.IdCategory == WellOperationService.idOperationBhaDisassembly) if (iterator.Current.IdCategory == WellOperationService.idOperationBhaDisassembly)
{ {
race.EndDate = iterator.Current.DateStart.ToRemoteDateTime(timezoneOffsetH); race.EndDate = iterator.Current.DateStart.ToRemoteDateTime(timezoneOffsetH);
@ -311,7 +312,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
var dHours = 0d; var dHours = 0d;
foreach (var race in races) foreach (var race in races)
{ {
dHours += race.DeltaHoursTimeNoNpt; dHours += race.DeltaHoursTimeNoNptAndRepair;
dDepth += race.DeltaDepth; dDepth += race.DeltaDepth;
} }
return dDepth / (dHours + double.Epsilon); return dDepth / (dHours + double.Epsilon);

View File

@ -4,18 +4,50 @@ using System.Collections.Generic;
namespace AsbCloudInfrastructure.Services.WellOperationService namespace AsbCloudInfrastructure.Services.WellOperationService
{ {
#nullable enable
class Race class Race
{ {
/// <summary>
/// Дата начала рейса
/// </summary>
public DateTime StartDate { get; set; } public DateTime StartDate { get; set; }
/// <summary>
/// Глубина начала рейса
/// </summary>
public double StartWellDepth { get; set; } public double StartWellDepth { get; set; }
/// <summary>
/// Дата окончания рейса
/// </summary>
public DateTime EndDate { get; set; } public DateTime EndDate { get; set; }
/// <summary>
/// Глубина окончания рейса
/// </summary>
public double EndWellDepth { get; set; } public double EndWellDepth { get; set; }
/// <summary>
/// Время рейса, часы
/// </summary>
public double DrillingTime { get; set; } public double DrillingTime { get; set; }
/// <summary>
/// Время НПВ, часы
/// </summary>
public double NonProductiveHours { get; set; } public double NonProductiveHours { get; set; }
/// <summary>
/// Ремонт
/// </summary>
public double Repair { get; set; }
public double DeltaDepth => EndWellDepth - StartWellDepth; public double DeltaDepth => EndWellDepth - StartWellDepth;
public double DeltaHoursTimeNoNpt => (EndDate - StartDate).TotalHours - NonProductiveHours; public double DeltaHoursTimeNoNpt => (EndDate - StartDate).TotalHours - NonProductiveHours;
public double DeltaHoursTimeNoNptAndRepair => DeltaHoursTimeNoNpt - Repair;
public double Speed => DeltaDepth / (DeltaHoursTimeNoNpt + double.Epsilon); public double Speed => DeltaDepth / (DeltaHoursTimeNoNpt + double.Epsilon);
public List<WellOperation> Operations { get; internal set; } public List<WellOperation>? Operations { get; internal set; }
} }
#nullable disable
} }

View File

@ -31,6 +31,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
public const int idOperationCasingDown = 1048; public const int idOperationCasingDown = 1048;
public const int idOperationTypePlan = 0; public const int idOperationTypePlan = 0;
public const int idOperationTypeFact = 1; public const int idOperationTypeFact = 1;
public const int idOperationTypeRepair = 1031;
public WellOperationService(IAsbCloudDbContext db, CacheDb cache, IWellService wellService) public WellOperationService(IAsbCloudDbContext db, CacheDb cache, IWellService wellService)
{ {