forked from ddrilling/AsbCloudServer
CS2-99: Fixed well fact end date depending on well state
This commit is contained in:
parent
a0208f412e
commit
1ec76e812f
@ -7,12 +7,12 @@ namespace AsbCloudApp.Data
|
||||
/// <summary>
|
||||
/// Дата и время начала
|
||||
/// </summary>
|
||||
public DateTime Start { get; set; }
|
||||
public DateTime? Start { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дата и время окончания
|
||||
/// </summary>
|
||||
public DateTime End { get; set; }
|
||||
public DateTime? End { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Глубина, м
|
||||
|
@ -186,7 +186,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
||||
return statWellDto;
|
||||
|
||||
statWellDto.Sections = CalcSectionsStats(wellOperations);
|
||||
statWellDto.Total = GetStatTotal(wellOperations);
|
||||
statWellDto.Total = GetStatTotal(wellOperations, well.IdState);
|
||||
|
||||
return statWellDto;
|
||||
}
|
||||
@ -219,14 +219,18 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
||||
return sections;
|
||||
}
|
||||
|
||||
private static PlanFactBase<StatOperationsDto> GetStatTotal(IEnumerable<WellOperation> operations)
|
||||
private static PlanFactBase<StatOperationsDto> GetStatTotal(IEnumerable<WellOperation> operations,
|
||||
int idWellState)
|
||||
{
|
||||
var operationsPlan = operations.Where(o => o.IdType == idOperationTypePlan);
|
||||
var operationsFact = operations.Where(o => o.IdType == idOperationTypeFact);
|
||||
var factEnd = CalcStat(operationsFact);
|
||||
if (idWellState != 2)
|
||||
factEnd.End = null;
|
||||
var section = new PlanFactBase<StatOperationsDto>
|
||||
{
|
||||
Plan = CalcStat(operationsPlan),
|
||||
Fact = CalcStat(operationsFact),
|
||||
Fact = factEnd,
|
||||
};
|
||||
return section;
|
||||
}
|
||||
@ -240,7 +244,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
||||
|
||||
return CalcStat(sectionOperations);
|
||||
}
|
||||
|
||||
|
||||
private static StatOperationsDto CalcStat(IEnumerable<WellOperation> operations)
|
||||
{
|
||||
if (!operations.Any())
|
||||
@ -250,8 +254,8 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
||||
|
||||
var section = new StatOperationsDto
|
||||
{
|
||||
Start = operations.First().DateStart,
|
||||
End = operations.Max(o => (o.DateStart.AddHours(o.DurationHours))),
|
||||
Start = operations.FirstOrDefault()?.DateStart,
|
||||
End = operations.Max(o => o.DateStart.AddHours(o.DurationHours)),
|
||||
WellDepthStart = operations.Min(o => o.DepthStart),
|
||||
WellDepthEnd = operations.Max(o => o.DepthStart),
|
||||
Rop = CalcROP(operations),
|
||||
|
Loading…
Reference in New Issue
Block a user