forked from ddrilling/AsbCloudServer
Смена типов дат для WellOperationPlanDto и всё, что с ним связано
This commit is contained in:
parent
3def1ad101
commit
b5f71b9816
@ -21,7 +21,7 @@ namespace AsbCloudApp.Data
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// дата последней сопоставленной плановой операции
|
/// дата последней сопоставленной плановой операции
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? DateLastAssosiatedPlanOperation { get; set; }
|
public DateTimeOffset? DateLastAssosiatedPlanOperation { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ namespace AsbCloudApp.Repositories
|
|||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<WellOperationPlanDto> GetOperationsPlanAsync(int idWell, DateTime? currentDate, CancellationToken token);
|
Task<WellOperationPlanDto> GetOperationsPlanAsync(int idWell, DateTimeOffset? currentDate, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// дата/время первой операции по скважине
|
/// дата/время первой операции по скважине
|
||||||
|
@ -43,7 +43,7 @@ public class WellOperationRepository : IWellOperationRepository
|
|||||||
.OrderBy(s => s.Order)
|
.OrderBy(s => s.Order)
|
||||||
.Select(s => s.Adapt<WellSectionTypeDto>());
|
.Select(s => s.Adapt<WellSectionTypeDto>());
|
||||||
|
|
||||||
public async Task<WellOperationPlanDto> GetOperationsPlanAsync(int idWell, DateTime? currentDate, CancellationToken token)
|
public async Task<WellOperationPlanDto> GetOperationsPlanAsync(int idWell, DateTimeOffset? currentDate, CancellationToken token)
|
||||||
{
|
{
|
||||||
var timezone = wellService.GetTimezone(idWell);
|
var timezone = wellService.GetTimezone(idWell);
|
||||||
var request = new WellOperationRequest()
|
var request = new WellOperationRequest()
|
||||||
@ -67,16 +67,16 @@ public class WellOperationRepository : IWellOperationRepository
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<DateTime?> GetDateLastAssosiatedPlanOperationAsync(
|
private async Task<DateTimeOffset?> GetDateLastAssosiatedPlanOperationAsync(
|
||||||
int idWell,
|
int idWell,
|
||||||
DateTime? lessThenDate,
|
DateTimeOffset? lessThenDate,
|
||||||
double timeZoneHours,
|
double timeZoneHours,
|
||||||
CancellationToken token)
|
CancellationToken token)
|
||||||
{
|
{
|
||||||
if (lessThenDate is null)
|
if (lessThenDate is null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var currentDateOffset = lessThenDate.Value.ToUtcDateTimeOffset(timeZoneHours);
|
var currentDateOffset = lessThenDate.Value.ToUniversalTime();
|
||||||
var timeZoneOffset = TimeSpan.FromHours(timeZoneHours);
|
var timeZoneOffset = TimeSpan.FromHours(timeZoneHours);
|
||||||
|
|
||||||
var lastFactOperation = await db.WellOperations
|
var lastFactOperation = await db.WellOperations
|
||||||
@ -90,7 +90,7 @@ public class WellOperationRepository : IWellOperationRepository
|
|||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
if (lastFactOperation is not null)
|
if (lastFactOperation is not null)
|
||||||
return DateTime.SpecifyKind(lastFactOperation.OperationPlan!.DateStart.UtcDateTime + timeZoneOffset, DateTimeKind.Unspecified);
|
return lastFactOperation.OperationPlan!.DateStart;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
[ProducesResponseType(typeof(WellOperationPlanDto), (int)System.Net.HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(WellOperationPlanDto), (int)System.Net.HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> GetOperationsPlanAsync(
|
public async Task<IActionResult> GetOperationsPlanAsync(
|
||||||
[FromRoute] int idWell,
|
[FromRoute] int idWell,
|
||||||
[FromQuery] DateTime currentDate,
|
[FromQuery] DateTimeOffset currentDate,
|
||||||
CancellationToken token)
|
CancellationToken token)
|
||||||
{
|
{
|
||||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||||
|
Loading…
Reference in New Issue
Block a user