From 9eb10709417c381f32f0c8e8e415a4f464becbc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= Date: Wed, 12 Jan 2022 17:46:33 +0500 Subject: [PATCH] Add Day to TVD --- AsbCloudApp/Data/WellOperationDto.cs | 5 +++++ .../WellOperationService/OperationsStatService.cs | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/AsbCloudApp/Data/WellOperationDto.cs b/AsbCloudApp/Data/WellOperationDto.cs index 35fa5007..765c021f 100644 --- a/AsbCloudApp/Data/WellOperationDto.cs +++ b/AsbCloudApp/Data/WellOperationDto.cs @@ -33,6 +33,11 @@ namespace AsbCloudApp.Data /// public double DepthEnd { get; set; } + /// + /// Кол-во дней от даты начала первой плановой (а если её нет, то фактической) операции + /// + public double Day { get; set; } + /// /// Дата начала операции /// diff --git a/AsbCloudInfrastructure/Services/WellOperationService/OperationsStatService.cs b/AsbCloudInfrastructure/Services/WellOperationService/OperationsStatService.cs index 480aaebb..effeeae2 100644 --- a/AsbCloudInfrastructure/Services/WellOperationService/OperationsStatService.cs +++ b/AsbCloudInfrastructure/Services/WellOperationService/OperationsStatService.cs @@ -413,6 +413,8 @@ namespace AsbCloudInfrastructure.Services.WellOperationService var merged = MergeArraysBySections(sectionsIds, wellOperationsPlan, wellOperationsFact); var tvd = new List>(merged.Count); + var firstPoint = merged.First(); + var dateStart = firstPoint.Item1?.DateStart ?? firstPoint.Item2.DateStart; int iLastMatch = 0; int iLastFact = 0; for (int i = 0; i < merged.Count; i++) @@ -426,6 +428,12 @@ namespace AsbCloudInfrastructure.Services.WellOperationService Predict = null, }; + if(planFactPredict.Plan is not null) + planFactPredict.Plan.Day = (planFactPredict.Plan.DateStart - dateStart).TotalDays; + + if (planFactPredict.Fact is not null) + planFactPredict.Fact.Day = (planFactPredict.Fact.DateStart - dateStart).TotalDays; + tvd.Add(planFactPredict); if ((item.Item1 is not null) && (item.Item2 is not null)) iLastMatch = i; @@ -451,7 +459,9 @@ namespace AsbCloudInfrastructure.Services.WellOperationService tvd[i].Predict = merged[i].Item1.Adapt(); tvd[i].Predict.IdType = 2; tvd[i].Predict.DateStart = tvd[i].Predict.DateStart + startOffset; + tvd[i].Predict.Day = (tvd[i].Predict.DateStart - dateStart).TotalDays; } + return tvd; }