forked from ddrilling/AsbCloudServer
fix timezone in tvd
This commit is contained in:
parent
102a0e4dbf
commit
0521809e6e
@ -379,6 +379,8 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
||||
.Select(o => o.IdWellSectionType)
|
||||
.Distinct();
|
||||
|
||||
var tzOffsetHours = wellService.GetTimezone(idWell).Hours;
|
||||
|
||||
if (!wellOperationsPlan.Any())
|
||||
return null;
|
||||
|
||||
@ -402,8 +404,8 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
||||
|
||||
var planFactPredict = new PlanFactPredictBase<WellOperationDto>
|
||||
{
|
||||
Plan = plan?.Adapt(WellOperationDtoMutation),
|
||||
Fact = fact?.Adapt(WellOperationDtoMutation),
|
||||
Plan = Convert(plan, tzOffsetHours),
|
||||
Fact = Convert(fact, tzOffsetHours),
|
||||
Predict = null,
|
||||
};
|
||||
|
||||
@ -438,7 +440,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
||||
{
|
||||
if (merged[i].Item1 is null)
|
||||
continue;
|
||||
tvd[i].Predict = merged[i].Item1.Adapt<WellOperationDto>();
|
||||
tvd[i].Predict = Convert(merged[i].Item1, tzOffsetHours);
|
||||
tvd[i].Predict.IdType = 2;
|
||||
tvd[i].Predict.DateStart = tvd[i].Predict.DateStart + startOffset;
|
||||
tvd[i].Predict.Day = (tvd[i].Predict.DateStart - dateStart).TotalDays;
|
||||
@ -539,10 +541,15 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
||||
return m;
|
||||
}
|
||||
|
||||
private static readonly Action<WellOperationDto, WellOperation> WellOperationDtoMutation = (WellOperationDto dest, WellOperation source) =>
|
||||
private static WellOperationDto Convert(WellOperation source, double tzOffsetHours)
|
||||
{
|
||||
if(source is null)
|
||||
return null;
|
||||
var dest = source.Adapt<WellOperationDto>();
|
||||
dest.CategoryName = source.OperationCategory?.Name;
|
||||
dest.WellSectionTypeName = source.WellSectionType?.Caption;
|
||||
};
|
||||
dest.DateStart = source.DateStart.ToRemoteDateTime(tzOffsetHours);
|
||||
return dest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user