Hotfix OperationsStatService.CalcTvdLagDays()

This commit is contained in:
ngfrolov 2023-03-10 15:37:49 +05:00
parent db1bd49d60
commit 1f130c0d48
Signed by untrusted user who does not match committer: ng.frolov
GPG Key ID: E99907A0357B29A7
2 changed files with 26 additions and 1 deletions

View File

@ -178,13 +178,16 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
if (lastCorrespondingFactOperation is null)
return 0d;
var lastCorrespondingPlanOperation = wellOperations.FirstOrDefault(o => o.Id == lastCorrespondingFactOperation.IdPlan);
var lastFactOperation = factOperations.LastOrDefault();
var remainingPlanOperations = operationsOrdered
.Where(o => o.IdType == WellOperation.IdOperationTypePlan)
.Where(o => o.DateStart > lastCorrespondingFactOperation.OperationPlan.DateStart);
.Where(o => o.DateStart > lastCorrespondingPlanOperation.DateStart);
var durationRemain = remainingPlanOperations.Sum(o => o.DurationHours);
var factEnd = lastFactOperation.DateStart.AddHours(durationRemain + lastFactOperation.DurationHours);
var planEnd = lastCorrespondingFactOperation.DateStart.AddHours(durationRemain + lastCorrespondingFactOperation.DurationHours);
var lagDays = (planEnd - factEnd).TotalDays;

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>false</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\pubLinuxDebug\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<ProjectGuid>a2768702-47cb-4127-941c-e339d5efcffe</ProjectGuid>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>