Правка расчета данных для построения графика твд (дни со старта)

This commit is contained in:
Olga Nemt 2024-08-13 10:18:27 +05:00
parent 770a370d7f
commit d1716fa01b

View File

@ -431,6 +431,10 @@ public class OperationsStatService : IOperationsStatService
int? iLastMatch = null; int? iLastMatch = null;
int iLastFact = 0; int iLastFact = 0;
var nptHours = 0d; var nptHours = 0d;
DateTimeOffset? firstDateStartFact = Fact!.DateStart;
DateTimeOffset? firstDateStartPlan = Plan?.DateStart;
for (int i = 0; i < wellOperations.Length; i++) for (int i = 0; i < wellOperations.Length; i++)
{ {
var item = wellOperations[i]; var item = wellOperations[i];
@ -441,7 +445,13 @@ public class OperationsStatService : IOperationsStatService
if (plan is not null) if (plan is not null)
{ {
planFactPredict.Plan = Convert(plan, tzOffsetHours); planFactPredict.Plan = Convert(plan, tzOffsetHours);
planFactPredict.Plan.Day = (planFactPredict.Plan.DateStart - dateStart).TotalDays;
if (!firstDateStartPlan.HasValue) {
firstDateStartPlan = planFactPredict.Plan.DateStart;
}
planFactPredict.Plan.Day = (planFactPredict.Plan.DateStart - firstDateStartPlan.Value).TotalDays;
if (fact is not null) if (fact is not null)
iLastMatch = i; iLastMatch = i;
} }
@ -451,8 +461,9 @@ public class OperationsStatService : IOperationsStatService
if(WellOperationCategory.NonProductiveTimeSubIds.Contains(fact.IdCategory)) if(WellOperationCategory.NonProductiveTimeSubIds.Contains(fact.IdCategory))
nptHours += fact.DurationHours; nptHours += fact.DurationHours;
planFactPredict.Fact = Convert(fact, tzOffsetHours); planFactPredict.Fact = Convert(fact, tzOffsetHours);
planFactPredict.Fact.Day = (planFactPredict.Fact.DateStart - dateStart).TotalDays; planFactPredict.Fact.Day = (planFactPredict.Fact.DateStart - firstDateStartFact.Value).TotalDays;
planFactPredict.Fact.NptHours = nptHours; planFactPredict.Fact.NptHours = nptHours;
iLastFact = i; iLastFact = i;
} }