Смена типов дат для WellOperationPlanDto и всё, что с ним связано

This commit is contained in:
Olga Nemt 2024-03-25 10:04:06 +05:00
parent 3def1ad101
commit b5f71b9816
4 changed files with 8 additions and 8 deletions

View File

@ -21,7 +21,7 @@ namespace AsbCloudApp.Data
/// <summary>
/// дата последней сопоставленной плановой операции
/// </summary>
public DateTime? DateLastAssosiatedPlanOperation { get; set; }
public DateTimeOffset? DateLastAssosiatedPlanOperation { get; set; }
}

View File

@ -25,7 +25,7 @@ namespace AsbCloudApp.Repositories
/// <param name="token"></param>
/// </summary>
/// <returns></returns>
Task<WellOperationPlanDto> GetOperationsPlanAsync(int idWell, DateTime? currentDate, CancellationToken token);
Task<WellOperationPlanDto> GetOperationsPlanAsync(int idWell, DateTimeOffset? currentDate, CancellationToken token);
/// <summary>
/// дата/время первой операции по скважине

View File

@ -43,7 +43,7 @@ public class WellOperationRepository : IWellOperationRepository
.OrderBy(s => s.Order)
.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 request = new WellOperationRequest()
@ -67,16 +67,16 @@ public class WellOperationRepository : IWellOperationRepository
return result;
}
private async Task<DateTime?> GetDateLastAssosiatedPlanOperationAsync(
private async Task<DateTimeOffset?> GetDateLastAssosiatedPlanOperationAsync(
int idWell,
DateTime? lessThenDate,
DateTimeOffset? lessThenDate,
double timeZoneHours,
CancellationToken token)
{
if (lessThenDate is null)
return null;
var currentDateOffset = lessThenDate.Value.ToUtcDateTimeOffset(timeZoneHours);
var currentDateOffset = lessThenDate.Value.ToUniversalTime();
var timeZoneOffset = TimeSpan.FromHours(timeZoneHours);
var lastFactOperation = await db.WellOperations
@ -90,7 +90,7 @@ public class WellOperationRepository : IWellOperationRepository
.ConfigureAwait(false);
if (lastFactOperation is not null)
return DateTime.SpecifyKind(lastFactOperation.OperationPlan!.DateStart.UtcDateTime + timeZoneOffset, DateTimeKind.Unspecified);
return lastFactOperation.OperationPlan!.DateStart;
return null;
}

View File

@ -99,7 +99,7 @@ namespace AsbCloudWebApi.Controllers
[ProducesResponseType(typeof(WellOperationPlanDto), (int)System.Net.HttpStatusCode.OK)]
public async Task<IActionResult> GetOperationsPlanAsync(
[FromRoute] int idWell,
[FromQuery] DateTime currentDate,
[FromQuery] DateTimeOffset currentDate,
CancellationToken token)
{
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))