OperationsStatService add calc cumulative non productive time

This commit is contained in:
Фролов 2022-03-04 10:15:52 +05:00
parent 3f0f292209
commit 3ebb0020f5
2 changed files with 20 additions and 4 deletions

View File

@ -38,6 +38,11 @@ namespace AsbCloudApp.Data
/// </summary>
public double Day { get; set; }
/// <summary>
/// Кол-во дней НПВ от даты начала первой плановой (а если её нет, то фактической) операции
/// </summary>
public double NptDays { get; set; }
/// <summary>
/// Дата начала операции
/// </summary>

View File

@ -417,14 +417,22 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
var dateStart = firstPoint.Item1?.DateStart ?? firstPoint.Item2.DateStart;
int iLastMatch = 0;
int iLastFact = 0;
var nptDays = 0d;
for (int i = 0; i < merged.Count; i++)
{
var item = merged[i];
var plan = item.Item1;
var fact = item.Item2;
if (fact?.IdCategory == idOperationNonProductiveTime)
{
nptDays += fact.DurationHours;
}
var planFactPredict = new PlanFactPredictBase<WellOperationDto>
{
Plan = item.Item1?.Adapt(WellOperationDtoMutation),
Fact = item.Item2?.Adapt(WellOperationDtoMutation),
Plan = plan?.Adapt(WellOperationDtoMutation),
Fact = fact?.Adapt(WellOperationDtoMutation),
Predict = null,
};
@ -432,12 +440,15 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
planFactPredict.Plan.Day = (planFactPredict.Plan.DateStart - dateStart).TotalDays;
if (planFactPredict.Fact is not null)
{
planFactPredict.Fact.Day = (planFactPredict.Fact.DateStart - dateStart).TotalDays;
planFactPredict.Fact.NptDays = nptDays;
}
tvd.Add(planFactPredict);
if ((item.Item1 is not null) && (item.Item2 is not null))
if ((plan is not null) && (fact is not null))
iLastMatch = i;
if (item.Item2 is not null)
if (fact is not null)
iLastFact = i;
}