forked from ddrilling/AsbCloudServer
Merge branch 'feature/#30435481-unification-date/time' into feature/refactoring_well_operation
# Conflicts: # AsbCloudApp/Data/WellOperationPlanDto.cs # AsbCloudApp/Repositories/IWellOperationRepository.cs # AsbCloudApp/Requests/WellOperationRequest.cs # AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs # AsbCloudInfrastructure/Repository/WellOperationRepository.cs # AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs # AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs # AsbCloudInfrastructure/Services/WellService.cs # AsbCloudInfrastructure/XLExtentions.cs # AsbCloudWebApi/Controllers/WellOperationController.cs
This commit is contained in:
commit
640ad8cdc3
@ -74,7 +74,7 @@ public class DailyReportDto : IId,
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата последнего обновления
|
/// Дата последнего обновления
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? DateLastUpdate { get; set; }
|
public DateTimeOffset? DateLastUpdate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Блок фактической траектории
|
/// Блок фактической траектории
|
||||||
|
@ -21,6 +21,6 @@ namespace AsbCloudApp.Data.DrillTestReport
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата отчета
|
/// Дата отчета
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime Date { get; set; } = DateTime.Now;
|
public DateTimeOffset Date { get; set; } = DateTimeOffset.Now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,6 @@ namespace AsbCloudApp.Data.DrillTestReport
|
|||||||
/// Дата и время
|
/// Дата и время
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime DateTime { get; set; }
|
public DateTimeOffset DateTime { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ namespace AsbCloudApp.Data
|
|||||||
/// дата загрузки
|
/// дата загрузки
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime UploadDate { get; set; }
|
public DateTimeOffset UploadDate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// размер в байтах
|
/// размер в байтах
|
||||||
|
@ -33,7 +33,7 @@ namespace AsbCloudApp.Data
|
|||||||
/// Необязательно указывать в запросе на создание.
|
/// Необязательно указывать в запросе на создание.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime DateCreated { get; set; }
|
public DateTimeOffset DateCreated { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Полезный комментарий
|
/// Полезный комментарий
|
||||||
|
@ -20,12 +20,12 @@ namespace AsbCloudApp.Data
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата начала ограничения
|
/// Дата начала ограничения
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime DateStart { get; set; }
|
public DateTimeOffset DateStart { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата окончания ограничения
|
/// Дата окончания ограничения
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime DateEnd { get; set; }
|
public DateTimeOffset DateEnd { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Глубина начала ограничения
|
/// Глубина начала ограничения
|
||||||
|
@ -18,7 +18,7 @@ public class ManualDto : IId
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата загрузки
|
/// Дата загрузки
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime DateDownload { get; set; }
|
public DateTimeOffset DateDownload { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Id автора
|
/// Id автора
|
||||||
|
@ -36,7 +36,7 @@ namespace AsbCloudApp.Data
|
|||||||
/// отметка времени замера
|
/// отметка времени замера
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime Timestamp { get; set; }
|
public DateTimeOffset Timestamp { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// данные замера
|
/// данные замера
|
||||||
|
@ -16,7 +16,7 @@ namespace AsbCloudApp.Data
|
|||||||
/// дата появления события
|
/// дата появления события
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime DateTime { get; set; }
|
public DateTimeOffset DateTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// категория события
|
/// категория события
|
||||||
|
@ -42,17 +42,17 @@ public class NotificationDto : IId
|
|||||||
/// Дата регистрации уведомления
|
/// Дата регистрации уведомления
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime RegistrationDate { get; set; }
|
public DateTimeOffset RegistrationDate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата отправки уведомления
|
/// Дата отправки уведомления
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? SentDate { get; set; }
|
public DateTimeOffset? SentDate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата прочтения уведомления
|
/// Дата прочтения уведомления
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? ReadDate { get; set; }
|
public DateTimeOffset? ReadDate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Состояние уведомления
|
/// Состояние уведомления
|
||||||
@ -82,12 +82,12 @@ public class NotificationDto : IId
|
|||||||
ReadDate = null;
|
ReadDate = null;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
SentDate = DateTime.UtcNow;
|
SentDate = DateTimeOffset.UtcNow;
|
||||||
ReadDate = null;
|
ReadDate = null;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
SentDate = DateTime.UtcNow;
|
SentDate = DateTimeOffset.UtcNow;
|
||||||
ReadDate = DateTime.UtcNow;
|
ReadDate = DateTimeOffset.UtcNow;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public class ProcessMapReportDataSaubStatDto
|
|||||||
/// на начало интервала
|
/// на начало интервала
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime DateStart { get; set; }
|
public DateTimeOffset DateStart { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Режим бурения (Ротор/слайд/ручной)
|
/// Режим бурения (Ротор/слайд/ручной)
|
||||||
|
@ -44,7 +44,7 @@ public class ProcessMapReportWellDrillingDto
|
|||||||
/// на начало интервала
|
/// на начало интервала
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime DateStart { get; set; }
|
public DateTimeOffset DateStart { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Время мех бурения, ч
|
/// Время мех бурения, ч
|
||||||
|
@ -29,17 +29,17 @@ namespace AsbCloudApp.Data
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата формирования
|
/// Дата формирования
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime Date { get; set; }
|
public DateTimeOffset Date { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата начала рапорта
|
/// Дата начала рапорта
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime Begin { get; set; }
|
public DateTimeOffset Begin { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата окончания рапорта
|
/// Дата окончания рапорта
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime End { get; set; }
|
public DateTimeOffset End { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// шаг между точками диаграммы
|
/// шаг между точками диаграммы
|
||||||
|
@ -33,7 +33,7 @@ namespace AsbCloudApp.Data.SAUB
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// отметка времени создания запроса
|
/// отметка времени создания запроса
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime UploadDate { get; set; } = DateTime.Now;
|
public DateTimeOffset UploadDate { get; set; } = DateTimeOffset.Now;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// время в секундах актуальности этого запроса
|
/// время в секундах актуальности этого запроса
|
||||||
|
@ -15,7 +15,7 @@ namespace AsbCloudApp.Data.SAUB
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// отметка времени
|
/// отметка времени
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime Date { get; set; }
|
public DateTimeOffset Date { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// глубина забоя
|
/// глубина забоя
|
||||||
|
@ -10,7 +10,7 @@ namespace AsbCloudApp.Data.SAUB
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// отметка времени
|
/// отметка времени
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime DateTime { get; set; }
|
public DateTimeOffset DateTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Наработка талевого каната с момента перетяжки каната, т*км
|
/// Наработка талевого каната с момента перетяжки каната, т*км
|
||||||
|
@ -39,13 +39,13 @@ namespace AsbCloudApp.Data
|
|||||||
/// Начало бурения
|
/// Начало бурения
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime DrillStart { get; set; }
|
public DateTimeOffset DrillStart { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Конец бурения
|
/// Конец бурения
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime DrillEnd { get; set; }
|
public DateTimeOffset DrillEnd { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Бурильщик
|
/// Бурильщик
|
||||||
|
@ -11,12 +11,12 @@ namespace AsbCloudApp.Data
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата и время начала
|
/// Дата и время начала
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? Start { get; set; }
|
public DateTimeOffset? Start { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата и время окончания
|
/// Дата и время окончания
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? End { get; set; }
|
public DateTimeOffset? End { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Глубина, м
|
/// Глубина, м
|
||||||
|
@ -42,7 +42,7 @@ namespace AsbCloudApp.Data
|
|||||||
/// дата прихода последней телеметрии
|
/// дата прихода последней телеметрии
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime LastTelemetryDate { get; set; }
|
public DateTimeOffset LastTelemetryDate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Статистика по секциям
|
/// Статистика по секциям
|
||||||
|
@ -46,7 +46,7 @@ namespace AsbCloudApp.Data.Trajectory
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата загрузки
|
/// Дата загрузки
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime UpdateDate { get; set; }
|
public DateTimeOffset UpdateDate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ИД пользователя
|
/// ИД пользователя
|
||||||
|
@ -67,12 +67,12 @@ namespace AsbCloudApp.Data
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата/время первой операции
|
/// Дата/время первой операции
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? StartDate { get; set; }
|
public DateTimeOffset? StartDate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата/время кода приходили данные последний раз
|
/// Дата/время кода приходили данные последний раз
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime LastTelemetryDate { get; set; }
|
public DateTimeOffset LastTelemetryDate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ID телеметрии
|
/// ID телеметрии
|
||||||
|
@ -82,14 +82,14 @@ namespace AsbCloudApp.Data
|
|||||||
/// <para>Дата начала первой фактической операции</para>
|
/// <para>Дата начала первой фактической операции</para>
|
||||||
/// <para>Используется как дата начала бурения</para>
|
/// <para>Используется как дата начала бурения</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? FirstFactOperationDateStart { get; set; }
|
public DateTimeOffset? FirstFactOperationDateStart { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>Дата окончания последней прогнозируемой операции</para>
|
/// <para>Дата окончания последней прогнозируемой операции</para>
|
||||||
/// <para>Если скважина завершена, то дата окончания последней фактической операции</para>
|
/// <para>Если скважина завершена, то дата окончания последней фактической операции</para>
|
||||||
/// <para>Используется как прогноз окончания бурения</para>
|
/// <para>Используется как прогноз окончания бурения</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? LastPredictOperationDateEnd { get; set; }
|
public DateTimeOffset? LastPredictOperationDateEnd { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Рейсовая скорость проходки, последнего рейса
|
/// Рейсовая скорость проходки, последнего рейса
|
||||||
|
1
AsbCloudApp/Data/WellOperationPlanDto.cs
Normal file
1
AsbCloudApp/Data/WellOperationPlanDto.cs
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
@ -1,6 +1,4 @@
|
|||||||
using AsbCloudApp.Data;
|
using AsbCloudApp.Data;
|
||||||
using AsbCloudApp.Requests;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -53,7 +51,7 @@ namespace AsbCloudApp.Repositories
|
|||||||
Task<int> InsertRangeAsync(IEnumerable<WellOperationDto> dtos, bool deleteBeforeInsert, CancellationToken token);
|
Task<int> InsertRangeAsync(IEnumerable<WellOperationDto> dtos, bool deleteBeforeInsert, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Обновить несколько существующую операций
|
/// Обновить существующую операцию
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dto"></param>
|
/// <param name="dto"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
|
@ -33,12 +33,12 @@ namespace AsbCloudApp.Requests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата начала периода
|
/// Дата начала периода
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? Begin { get; set; }
|
public DateTimeOffset? Begin { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата окончания периода
|
/// Дата окончания периода
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? End { get; set; }
|
public DateTimeOffset? End { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Признак удаления
|
/// Признак удаления
|
||||||
|
@ -17,12 +17,12 @@ namespace AsbCloudApp.Requests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Больше или равно дате
|
/// Больше или равно дате
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? GtDate { get; set; }
|
public DateTimeOffset? GtDate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Меньше или равно дате
|
/// Меньше или равно дате
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? LtDate { get; set; }
|
public DateTimeOffset? LtDate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Больше или равно глубины забоя
|
/// Больше или равно глубины забоя
|
||||||
|
@ -17,12 +17,12 @@ namespace AsbCloudApp.Requests
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// начальная дата
|
/// начальная дата
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? Begin { get; set; }
|
public DateTimeOffset? Begin { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// конечная дата
|
/// конечная дата
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? End { get; set; }
|
public DateTimeOffset? End { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// строка поиска
|
/// строка поиска
|
||||||
|
@ -15,10 +15,10 @@ public class NotificationDeleteRequest
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Меньше или равно дате отправки
|
/// Меньше или равно дате отправки
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? LtSentDate { get; set; }
|
public DateTimeOffset? LtSentDate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Меньше или равно дате прочтения
|
/// Меньше или равно дате прочтения
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? LtReadDate { get; set; }
|
public DateTimeOffset? LtReadDate { get; set; }
|
||||||
}
|
}
|
@ -20,5 +20,5 @@ public class ProcessMapPlanRequest
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата обновления
|
/// Дата обновления
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? UpdateFrom { get; set; }
|
public DateTimeOffset? UpdateFrom { get; set; }
|
||||||
}
|
}
|
@ -24,12 +24,12 @@ public class ReportParametersRequest: IValidatableObject
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата начала интервала
|
/// Дата начала интервала
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime Begin { get; set; } = default;
|
public DateTimeOffset Begin { get; set; } = default;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата окончания интервала
|
/// Дата окончания интервала
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime End { get; set; } = default;
|
public DateTimeOffset End { get; set; } = default;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||||
@ -37,7 +37,7 @@ public class ReportParametersRequest: IValidatableObject
|
|||||||
if (End < Begin)
|
if (End < Begin)
|
||||||
yield return new("End mast be less then begin");
|
yield return new("End mast be less then begin");
|
||||||
|
|
||||||
if (Begin < new DateTime(2000, 1, 1))
|
if (Begin < new DateTimeOffset(2000, 1, 1, 0, 0, 0, TimeSpan.Zero))
|
||||||
yield return new("Begin mast be > 2000-1-1");
|
yield return new("Begin mast be > 2000-1-1");
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,7 +9,7 @@ namespace AsbCloudApp.Requests
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class SubsystemRequest: RequestBase, IValidatableObject
|
public class SubsystemRequest: RequestBase, IValidatableObject
|
||||||
{
|
{
|
||||||
private static readonly DateTime validationMinDate = new DateTime(2020,01,01,0,0,0,DateTimeKind.Utc);
|
private static readonly DateTimeOffset validationMinDate = new DateTimeOffset(2020,01,01,0,0,0, TimeSpan.Zero);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// идентификатор скважины
|
/// идентификатор скважины
|
||||||
|
@ -15,10 +15,10 @@ public class TrajectoryRequest : RequestBase
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Больше или равно дате
|
/// Больше или равно дате
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? GeDate { get; set; }
|
public DateTimeOffset? GeDate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Меньше или равно дате
|
/// Меньше или равно дате
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? LeDate { get; set; }
|
public DateTimeOffset? LeDate { get; set; }
|
||||||
}
|
}
|
@ -42,12 +42,4 @@ public interface IDailyReportService
|
|||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<PaginationContainer<DailyReportDto>> GetAsync(int idWell, FileReportRequest request, CancellationToken cancellationToken);
|
Task<PaginationContainer<DailyReportDto>> GetAsync(int idWell, FileReportRequest request, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Получить диапазон дат по которым возможно сформировать суточный отчёты
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="idWell"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<DatesRangeDto?> GetDatesRangeAsync(int idWell, CancellationToken cancellationToken);
|
|
||||||
}
|
}
|
@ -46,7 +46,7 @@ namespace AsbCloudApp.Services
|
|||||||
/// <param name="stepSeconds"></param>
|
/// <param name="stepSeconds"></param>
|
||||||
/// <param name="format"></param>
|
/// <param name="format"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
int GetReportPagesCount(int idWell, DateTime begin, DateTime end,
|
int GetReportPagesCount(int idWell, DateTimeOffset begin, DateTimeOffset end,
|
||||||
int stepSeconds, int format);
|
int stepSeconds, int format);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -19,7 +19,7 @@ namespace AsbCloudApp.Services
|
|||||||
/// <param name="workTime"></param>
|
/// <param name="workTime"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<ScheduleDto>> GetAsync(int idWell, DateTime workTime, CancellationToken token);
|
Task<IEnumerable<ScheduleDto>> GetAsync(int idWell, DateTimeOffset workTime, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// получить бурильщика по idWell и времени
|
/// получить бурильщика по idWell и времени
|
||||||
@ -28,7 +28,7 @@ namespace AsbCloudApp.Services
|
|||||||
/// <param name="workTime"></param>
|
/// <param name="workTime"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<DrillerDto?> GetOrDefaultDrillerAsync(int idWell, DateTime workTime, CancellationToken token);
|
Task<DrillerDto?> GetOrDefaultDrillerAsync(int idWell, DateTimeOffset workTime, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получить расписание смен
|
/// Получить расписание смен
|
||||||
|
@ -72,7 +72,7 @@ namespace AsbCloudApp.Services
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="idWell"></param>
|
/// <param name="idWell"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
DateTime GetLastTelemetryDate(int idWell);
|
DateTimeOffset GetLastTelemetryDate(int idWell);
|
||||||
|
|
||||||
//TODO: выяснить и удалить отсюда
|
//TODO: выяснить и удалить отсюда
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -49,7 +49,7 @@ public class NotificationService
|
|||||||
var notification = new NotificationDto
|
var notification = new NotificationDto
|
||||||
{
|
{
|
||||||
IdUser = request.IdUser,
|
IdUser = request.IdUser,
|
||||||
RegistrationDate = DateTime.UtcNow,
|
RegistrationDate = DateTimeOffset.UtcNow,
|
||||||
IdNotificationCategory = notificationCategory.Id,
|
IdNotificationCategory = notificationCategory.Id,
|
||||||
Title = request.Title,
|
Title = request.Title,
|
||||||
Message = request.Message,
|
Message = request.Message,
|
||||||
@ -71,7 +71,7 @@ public class NotificationService
|
|||||||
Console.WriteLine(ex.Message);
|
Console.WriteLine(ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
notification.SentDate = DateTime.UtcNow;
|
notification.SentDate = DateTimeOffset.UtcNow;
|
||||||
await notificationRepository.UpdateAsync(notification, cancellationToken);
|
await notificationRepository.UpdateAsync(notification, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ public class NotificationService
|
|||||||
if(isRead && !notification.SentDate.HasValue)
|
if(isRead && !notification.SentDate.HasValue)
|
||||||
throw new ArgumentInvalidException(nameof(isRead), "Уведомление не может быть прочитано");
|
throw new ArgumentInvalidException(nameof(isRead), "Уведомление не может быть прочитано");
|
||||||
|
|
||||||
notification.ReadDate = isRead ? DateTime.UtcNow : null;
|
notification.ReadDate = isRead ? DateTimeOffset.UtcNow : null;
|
||||||
|
|
||||||
await notificationRepository.UpdateAsync(notification,
|
await notificationRepository.UpdateAsync(notification,
|
||||||
cancellationToken);
|
cancellationToken);
|
||||||
@ -119,7 +119,7 @@ public class NotificationService
|
|||||||
|
|
||||||
var tasks = notifications.Select(notification =>
|
var tasks = notifications.Select(notification =>
|
||||||
{
|
{
|
||||||
notification.SentDate = DateTime.UtcNow;
|
notification.SentDate = DateTimeOffset.UtcNow;
|
||||||
return notificationRepository.UpdateAsync(notification, cancellationToken);
|
return notificationRepository.UpdateAsync(notification, cancellationToken);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public class DailyReport : IId
|
|||||||
public int IdWell { get; set; }
|
public int IdWell { get; set; }
|
||||||
|
|
||||||
[Column("date_last_update", TypeName = "timestamp with time zone"), Comment("Дата последнего обновления")]
|
[Column("date_last_update", TypeName = "timestamp with time zone"), Comment("Дата последнего обновления")]
|
||||||
public DateTime? DateLastUpdate { get; set; }
|
public DateTimeOffset? DateLastUpdate { get; set; }
|
||||||
|
|
||||||
[Column("date", TypeName = "date"), Comment("Дата формирования отчёта")]
|
[Column("date", TypeName = "date"), Comment("Дата формирования отчёта")]
|
||||||
public DateOnly Date { get; set; }
|
public DateOnly Date { get; set; }
|
||||||
|
@ -15,8 +15,8 @@ public class Manual : IId
|
|||||||
[Column("name"), Comment("Название")]
|
[Column("name"), Comment("Название")]
|
||||||
public string Name { get; set; } = null!;
|
public string Name { get; set; } = null!;
|
||||||
|
|
||||||
[Column("date_download"), Comment("Дата загрузки")]
|
[Column("date_download", TypeName = "timestamp with time zone"), Comment("Дата загрузки")]
|
||||||
public DateTime DateDownload { get; set; }
|
public DateTimeOffset DateDownload { get; set; }
|
||||||
|
|
||||||
[Column("id_directory"), Comment("Id директории")]
|
[Column("id_directory"), Comment("Id директории")]
|
||||||
public int IdDirectory { get; set; }
|
public int IdDirectory { get; set; }
|
||||||
|
@ -25,13 +25,13 @@ public class Notification : IId
|
|||||||
public string Message { get; set; } = null!;
|
public string Message { get; set; } = null!;
|
||||||
|
|
||||||
[Column("registration_date"), Comment("Дата регистрации уведомления")]
|
[Column("registration_date"), Comment("Дата регистрации уведомления")]
|
||||||
public DateTime RegistrationDate { get; set; }
|
public DateTimeOffset RegistrationDate { get; set; }
|
||||||
|
|
||||||
[Column("sent_date"), Comment("Дата отправки уведомления")]
|
[Column("sent_date"), Comment("Дата отправки уведомления")]
|
||||||
public DateTime? SentDate { get; set; }
|
public DateTimeOffset? SentDate { get; set; }
|
||||||
|
|
||||||
[Column("read_date"), Comment("Дата прочтения уведомления")]
|
[Column("read_date"), Comment("Дата прочтения уведомления")]
|
||||||
public DateTime? ReadDate { get; set; }
|
public DateTimeOffset? ReadDate { get; set; }
|
||||||
|
|
||||||
[Column("id_transport_type"), Comment("Id типа доставки уведомления")]
|
[Column("id_transport_type"), Comment("Id типа доставки уведомления")]
|
||||||
public int IdTransportType { get; set; }
|
public int IdTransportType { get; set; }
|
||||||
|
@ -27,7 +27,7 @@ namespace AsbCloudInfrastructure.Background
|
|||||||
|
|
||||||
await notificationService.SendAsync(notification, token);
|
await notificationService.SendAsync(notification, token);
|
||||||
|
|
||||||
notification.SentDate = DateTime.UtcNow;
|
notification.SentDate = DateTimeOffset.UtcNow;
|
||||||
await notificationRepository.UpdateAsync(notification, token);
|
await notificationRepository.UpdateAsync(notification, token);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,28 +1,32 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using AsbCloudApp.Data.DailyReport;
|
using AsbCloudApp.Data.DailyReport;
|
||||||
using AsbCloudApp.Data.DailyReport.Blocks.Sign;
|
using AsbCloudApp.Data.DailyReport.Blocks.Sign;
|
||||||
using AsbCloudApp.Data.DailyReport.Blocks.Subsystems;
|
using AsbCloudApp.Data.DailyReport.Blocks.Subsystems;
|
||||||
using AsbCloudApp.Data.DailyReport.Blocks.TimeBalance;
|
using AsbCloudApp.Data.DailyReport.Blocks.TimeBalance;
|
||||||
using AsbCloudApp.Repositories;
|
using AsbCloudApp.Repositories;
|
||||||
using AsbCloudApp.Requests;
|
using AsbCloudApp.Requests;
|
||||||
|
using AsbCloudApp.Services;
|
||||||
using AsbCloudDb;
|
using AsbCloudDb;
|
||||||
using AsbCloudDb.Model;
|
using AsbCloudDb.Model;
|
||||||
using AsbCloudDb.Model.DailyReports;
|
using AsbCloudDb.Model.DailyReports;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Repository;
|
namespace AsbCloudInfrastructure.Repository;
|
||||||
|
|
||||||
public class DailyReportRepository : CrudRepositoryBase<DailyReportDto, DailyReport>,
|
public class DailyReportRepository : CrudRepositoryBase<DailyReportDto, DailyReport>,
|
||||||
IDailyReportRepository
|
IDailyReportRepository
|
||||||
{
|
{
|
||||||
public DailyReportRepository(IAsbCloudDbContext dbContext)
|
private IWellService wellService;
|
||||||
|
|
||||||
|
public DailyReportRepository(IAsbCloudDbContext dbContext, IWellService wellService)
|
||||||
: base(dbContext)
|
: base(dbContext)
|
||||||
{
|
{
|
||||||
|
this.wellService = wellService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<DailyReportDto>> GetAsync(int idWell, FileReportRequest request, CancellationToken cancellationToken)
|
public async Task<IEnumerable<DailyReportDto>> GetAsync(int idWell, FileReportRequest request, CancellationToken cancellationToken)
|
||||||
@ -48,7 +52,8 @@ public class DailyReportRepository : CrudRepositoryBase<DailyReportDto, DailyRep
|
|||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
.ToArrayAsync(cancellationToken);
|
.ToArrayAsync(cancellationToken);
|
||||||
|
|
||||||
var dtos = entities.Select(Convert);
|
var timezoneOffset = wellService.GetTimezone(idWell).Offset;
|
||||||
|
var dtos = entities.Select(entity => Convert(entity, timezoneOffset));
|
||||||
|
|
||||||
return dtos;
|
return dtos;
|
||||||
}
|
}
|
||||||
@ -62,13 +67,13 @@ public class DailyReportRepository : CrudRepositoryBase<DailyReportDto, DailyRep
|
|||||||
return entity is null ? null : Convert(entity);
|
return entity is null ? null : Convert(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DailyReportDto Convert(DailyReport src)
|
protected DailyReportDto Convert(DailyReport src, TimeSpan timezoneOffset)
|
||||||
{
|
{
|
||||||
var dto = new DailyReportDto
|
var dto = new DailyReportDto
|
||||||
{
|
{
|
||||||
Id = src.Id,
|
Id = src.Id,
|
||||||
IdWell = src.IdWell,
|
IdWell = src.IdWell,
|
||||||
DateLastUpdate = src.DateLastUpdate,
|
DateLastUpdate = src.DateLastUpdate?.ToOffset(timezoneOffset),
|
||||||
Date = src.Date,
|
Date = src.Date,
|
||||||
SignBlock = src.SignBlock?.Adapt<SignBlockDto>(),
|
SignBlock = src.SignBlock?.Adapt<SignBlockDto>(),
|
||||||
TimeBalanceBlock = src.TimeBalanceBlock?.Adapt<TimeBalanceBlockDto>(),
|
TimeBalanceBlock = src.TimeBalanceBlock?.Adapt<TimeBalanceBlockDto>(),
|
||||||
|
@ -4,6 +4,7 @@ using AsbCloudApp.Services;
|
|||||||
using AsbCloudDb.Model;
|
using AsbCloudDb.Model;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -111,7 +112,8 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
{
|
{
|
||||||
var dto = well.Adapt<WellDto>();
|
var dto = well.Adapt<WellDto>();
|
||||||
dto.WellType = well.WellType.Caption;
|
dto.WellType = well.WellType.Caption;
|
||||||
dto.LastTelemetryDate = wellService.GetLastTelemetryDate(well.Id);
|
dto.LastTelemetryDate = wellService.GetLastTelemetryDate(well.Id)
|
||||||
|
.ToOffset(TimeSpan.FromHours(well.Timezone.Hours));
|
||||||
dto.Cluster = gCluster.Key.Caption;
|
dto.Cluster = gCluster.Key.Caption;
|
||||||
dto.Deposit = gDeposit.Key.Caption;
|
dto.Deposit = gDeposit.Key.Caption;
|
||||||
return dto;
|
return dto;
|
||||||
|
@ -36,9 +36,6 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
var query = dbSetConfigured
|
var query = dbSetConfigured
|
||||||
.Where(e => e.IdWell == request.IdWell);
|
.Where(e => e.IdWell == request.IdWell);
|
||||||
|
|
||||||
double timezoneOffsetHours = query.FirstOrDefault()
|
|
||||||
?.Well.Timezone.Hours ?? 5d;
|
|
||||||
|
|
||||||
if (request.IdCategory is not null)
|
if (request.IdCategory is not null)
|
||||||
query = query.Where(x => x.IdCategory == request.IdCategory);
|
query = query.Where(x => x.IdCategory == request.IdCategory);
|
||||||
|
|
||||||
@ -53,13 +50,13 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
|
|
||||||
if (request.Begin is not null)
|
if (request.Begin is not null)
|
||||||
{
|
{
|
||||||
var beginUtc = request.Begin.Value.ToUtcDateTimeOffset(timezoneOffsetHours);
|
var beginUtc = request.Begin.Value.ToUniversalTime();
|
||||||
query = query.Where(e => e.UploadDate >= beginUtc);
|
query = query.Where(e => e.UploadDate >= beginUtc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.End is not null)
|
if (request.End is not null)
|
||||||
{
|
{
|
||||||
var endUtc = request.End.Value.ToUtcDateTimeOffset(timezoneOffsetHours);
|
var endUtc = request.End.Value.ToUniversalTime();
|
||||||
query = query.Where(e => e.UploadDate <= endUtc);
|
query = query.Where(e => e.UploadDate <= endUtc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +181,7 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
|
|
||||||
var newFileMark = fileMarkDto.Adapt<FileMark>();
|
var newFileMark = fileMarkDto.Adapt<FileMark>();
|
||||||
newFileMark.Id = default;
|
newFileMark.Id = default;
|
||||||
newFileMark.DateCreated = DateTime.UtcNow;
|
newFileMark.DateCreated = DateTimeOffset.UtcNow;
|
||||||
newFileMark.IdUser = idUser;
|
newFileMark.IdUser = idUser;
|
||||||
newFileMark.User = null!;
|
newFileMark.User = null!;
|
||||||
|
|
||||||
@ -244,7 +241,7 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
IdAuthor = newItem.IdAuthor,
|
IdAuthor = newItem.IdAuthor,
|
||||||
IdCategory = newItem.IdCategory,
|
IdCategory = newItem.IdCategory,
|
||||||
Name = newItem.Name,
|
Name = newItem.Name,
|
||||||
UploadDate = DateTime.UtcNow,
|
UploadDate = DateTimeOffset.UtcNow,
|
||||||
IsDeleted = false,
|
IsDeleted = false,
|
||||||
Size = newItem.Size,
|
Size = newItem.Size,
|
||||||
};
|
};
|
||||||
@ -278,11 +275,11 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
private static FileInfoDto Convert(FileInfo entity, double timezoneOffset)
|
private static FileInfoDto Convert(FileInfo entity, double timezoneOffset)
|
||||||
{
|
{
|
||||||
var dto = entity.Adapt<FileInfoDto>();
|
var dto = entity.Adapt<FileInfoDto>();
|
||||||
dto.UploadDate = entity.UploadDate.ToRemoteDateTime(timezoneOffset);
|
dto.UploadDate = entity.UploadDate.ToOffset(TimeSpan.FromHours(timezoneOffset));
|
||||||
dto.FileMarks = entity.FileMarks.Select(m =>
|
dto.FileMarks = entity.FileMarks.Select(m =>
|
||||||
{
|
{
|
||||||
var mark = m.Adapt<FileMarkDto>();
|
var mark = m.Adapt<FileMarkDto>();
|
||||||
mark.DateCreated = m.DateCreated.ToRemoteDateTime(timezoneOffset);
|
mark.DateCreated = m.DateCreated.ToOffset(TimeSpan.FromHours(timezoneOffset));
|
||||||
return mark;
|
return mark;
|
||||||
});
|
});
|
||||||
return dto;
|
return dto;
|
||||||
|
@ -39,8 +39,8 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
IdWell = request.IdWell,
|
IdWell = request.IdWell,
|
||||||
IdTelemetry = x.IdTelemetry,
|
IdTelemetry = x.IdTelemetry,
|
||||||
IdFeedRegulator = x.IdFeedRegulator,
|
IdFeedRegulator = x.IdFeedRegulator,
|
||||||
DateStart = DateTime.SpecifyKind(x.DateStart.UtcDateTime + timezoneSpan, DateTimeKind.Unspecified),
|
DateStart = x.DateStart.ToOffset(timezoneSpan),
|
||||||
DateEnd = DateTime.SpecifyKind(x.DateEnd.UtcDateTime + timezoneSpan, DateTimeKind.Unspecified),
|
DateEnd = x.DateEnd.ToOffset(timezoneSpan),
|
||||||
DepthStart = x.DepthStart,
|
DepthStart = x.DepthStart,
|
||||||
DepthEnd = x.DepthEnd
|
DepthEnd = x.DepthEnd
|
||||||
});
|
});
|
||||||
@ -56,13 +56,13 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
|
|
||||||
if (request.GtDate.HasValue)
|
if (request.GtDate.HasValue)
|
||||||
{
|
{
|
||||||
var gtDate = request.GtDate.Value.ToUtcDateTimeOffset(timezoneHours);
|
var gtDate = request.GtDate.Value.ToUniversalTime();
|
||||||
query = query.Where(x => x.DateEnd >= gtDate);
|
query = query.Where(x => x.DateEnd >= gtDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.LtDate.HasValue)
|
if (request.LtDate.HasValue)
|
||||||
{
|
{
|
||||||
var ltDate = request.LtDate.Value.ToUtcDateTimeOffset(timezoneHours);
|
var ltDate = request.LtDate.Value.ToUniversalTime();
|
||||||
query = query.Where(x => x.DateStart <= ltDate);
|
query = query.Where(x => x.DateStart <= ltDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,10 +110,10 @@ public class NotificationRepository : CrudRepositoryBase<NotificationDto, Notifi
|
|||||||
query = query.Where(n => n.IdNotificationCategory == request.IdCategory.Value);
|
query = query.Where(n => n.IdNotificationCategory == request.IdCategory.Value);
|
||||||
|
|
||||||
if (request.LtSentDate.HasValue)
|
if (request.LtSentDate.HasValue)
|
||||||
query = query.Where(n => n.SentDate <= request.LtSentDate.Value);
|
query = query.Where(n => n.SentDate <= request.LtSentDate.Value.ToUniversalTime());
|
||||||
|
|
||||||
if (request.LtReadDate.HasValue)
|
if (request.LtReadDate.HasValue)
|
||||||
query = query.Where(n => n.ReadDate <= request.LtReadDate.Value);
|
query = query.Where(n => n.ReadDate <= request.LtReadDate.Value.ToUniversalTime());
|
||||||
|
|
||||||
dbContext.Notifications.RemoveRange(query);
|
dbContext.Notifications.RemoveRange(query);
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
this.wellService = wellService;
|
this.wellService = wellService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<ScheduleDto>> GetAsync(int idWell, DateTime workTime, CancellationToken token)
|
public async Task<IEnumerable<ScheduleDto>> GetAsync(int idWell, DateTimeOffset workTime, CancellationToken token)
|
||||||
{
|
{
|
||||||
var entities = await BuildQuery(idWell, workTime)
|
var entities = await BuildQuery(idWell, workTime)
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
@ -33,7 +33,7 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
return entities.Select(Convert);
|
return entities.Select(Convert);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<DrillerDto?> GetOrDefaultDrillerAsync(int idWell, DateTime workTime, CancellationToken token)
|
public async Task<DrillerDto?> GetOrDefaultDrillerAsync(int idWell, DateTimeOffset workTime, CancellationToken token)
|
||||||
{
|
{
|
||||||
var entities = await BuildQuery(idWell, workTime)
|
var entities = await BuildQuery(idWell, workTime)
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
@ -43,8 +43,7 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
var hoursOffset = wellService.GetTimezone(idWell).Hours;
|
var hoursOffset = wellService.GetTimezone(idWell).Hours;
|
||||||
var remoteDate = workTime.ToUtcDateTimeOffset(hoursOffset).ToRemoteDateTime(hoursOffset);
|
var time = new TimeOnly(workTime.Hour, workTime.Minute, workTime.Second);
|
||||||
var time = new TimeOnly(remoteDate.Hour, remoteDate.Minute, remoteDate.Second);
|
|
||||||
|
|
||||||
var entity = entities.FirstOrDefault(s =>
|
var entity = entities.FirstOrDefault(s =>
|
||||||
s.ShiftStart > s.ShiftEnd ^
|
s.ShiftStart > s.ShiftEnd ^
|
||||||
@ -69,11 +68,11 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IQueryable<Schedule> BuildQuery(int idWell, DateTime workTime)
|
private IQueryable<Schedule> BuildQuery(int idWell, DateTimeOffset workTime)
|
||||||
{
|
{
|
||||||
var hoursOffset = wellService.GetTimezone(idWell).Hours;
|
var hoursOffset = wellService.GetTimezone(idWell).Hours;
|
||||||
|
|
||||||
var workTimeDateTime = workTime.ToUtcDateTimeOffset(hoursOffset);
|
var workTimeDateTime = workTime.ToUniversalTime();
|
||||||
|
|
||||||
return GetQuery().Where(s => s.IdWell == idWell
|
return GetQuery().Where(s => s.IdWell == idWell
|
||||||
&& s.DrillStart <= workTimeDateTime
|
&& s.DrillStart <= workTimeDateTime
|
||||||
@ -82,19 +81,20 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
|
|
||||||
protected override Schedule Convert(ScheduleDto dto)
|
protected override Schedule Convert(ScheduleDto dto)
|
||||||
{
|
{
|
||||||
var hoursOffset = wellService.GetTimezone(dto.IdWell).Hours;
|
|
||||||
var entity = base.Convert(dto);
|
var entity = base.Convert(dto);
|
||||||
entity.DrillStart = dto.DrillStart.ToUtcDateTimeOffset(hoursOffset);
|
entity.DrillStart = dto.DrillStart.ToUniversalTime();
|
||||||
entity.DrillEnd = dto.DrillEnd.ToUtcDateTimeOffset(hoursOffset);
|
entity.DrillEnd = dto.DrillEnd.ToUniversalTime();
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override ScheduleDto Convert(Schedule entity)
|
protected override ScheduleDto Convert(Schedule entity)
|
||||||
{
|
{
|
||||||
var hoursOffset = wellService.GetTimezone(entity.IdWell).Hours;
|
var hoursOffset = wellService.GetTimezone(entity.IdWell).Hours;
|
||||||
|
var timeSpan = TimeSpan.FromHours(hoursOffset);
|
||||||
|
|
||||||
var dto = base.Convert(entity);
|
var dto = base.Convert(entity);
|
||||||
dto.DrillStart = entity.DrillStart.ToRemoteDateTime(hoursOffset);
|
dto.DrillStart = entity.DrillStart.ToOffset(timeSpan);
|
||||||
dto.DrillEnd = entity.DrillEnd.ToRemoteDateTime(hoursOffset);
|
dto.DrillEnd = entity.DrillEnd.ToOffset(timeSpan);
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,15 +50,14 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
{
|
{
|
||||||
var result = base.Convert(src);
|
var result = base.Convert(src);
|
||||||
var timezoneOffsetHours = wellService.GetTimezone(src.IdWell).Hours;
|
var timezoneOffsetHours = wellService.GetTimezone(src.IdWell).Hours;
|
||||||
result.UploadDate = src.UploadDate.ToRemoteDateTime(timezoneOffsetHours);
|
result.UploadDate = src.UploadDate.ToOffset(TimeSpan.FromHours(timezoneOffsetHours));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override SetpointsRequest Convert(SetpointsRequestDto src)
|
protected override SetpointsRequest Convert(SetpointsRequestDto src)
|
||||||
{
|
{
|
||||||
var result = base.Convert(src);
|
var result = base.Convert(src);
|
||||||
var timezoneOffsetHours = wellService.GetTimezone(src.IdWell).Hours;
|
result.UploadDate = src.UploadDate.ToUniversalTime();
|
||||||
result.UploadDate = src.UploadDate.ToUtcDateTimeOffset(timezoneOffsetHours);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using AsbCloudApp.Services;
|
|||||||
using AsbCloudDb.Model;
|
using AsbCloudDb.Model;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -93,14 +94,14 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
{
|
{
|
||||||
var entity = dto.Adapt<TelemetryWirelineRunOut>();
|
var entity = dto.Adapt<TelemetryWirelineRunOut>();
|
||||||
entity.IdTelemetry = idTelemetry;
|
entity.IdTelemetry = idTelemetry;
|
||||||
entity.DateTime = dto.DateTime.ToUtcDateTimeOffset(timezoneOffset);
|
entity.DateTime = dto.DateTime.ToUniversalTime();
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TelemetryWirelineRunOutDto Convert(TelemetryWirelineRunOut entity, WellDto well, double timezoneOffset)
|
private static TelemetryWirelineRunOutDto Convert(TelemetryWirelineRunOut entity, WellDto well, double timezoneOffset)
|
||||||
{
|
{
|
||||||
var dto = entity.Adapt<TelemetryWirelineRunOutDto>();
|
var dto = entity.Adapt<TelemetryWirelineRunOutDto>();
|
||||||
dto.DateTime = entity.DateTime.ToRemoteDateTime(timezoneOffset);
|
dto.DateTime = entity.DateTime.ToOffset(TimeSpan.FromHours(timezoneOffset));
|
||||||
dto.WellInfo = well;
|
dto.WellInfo = well;
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
@ -37,11 +37,10 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
if (!trajectoryRows.All(r => r.IdWell == idWell))
|
if (!trajectoryRows.All(r => r.IdWell == idWell))
|
||||||
throw new ArgumentInvalidException(nameof(trajectoryRows), "Все строки должны относиться к одной скважине");
|
throw new ArgumentInvalidException(nameof(trajectoryRows), "Все строки должны относиться к одной скважине");
|
||||||
|
|
||||||
var offsetHours = wellService.GetTimezone(idWell).Hours;
|
|
||||||
var entities = trajectoryRows
|
var entities = trajectoryRows
|
||||||
.Select(e =>
|
.Select(e =>
|
||||||
{
|
{
|
||||||
var entity = Convert(e, offsetHours);
|
var entity = Convert(e);
|
||||||
entity.Id = 0;
|
entity.Id = 0;
|
||||||
return entity;
|
return entity;
|
||||||
});
|
});
|
||||||
@ -52,8 +51,7 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
|
|
||||||
public async Task<int> AddAsync(Tdto trajectoryRow, CancellationToken token)
|
public async Task<int> AddAsync(Tdto trajectoryRow, CancellationToken token)
|
||||||
{
|
{
|
||||||
var offsetHours = wellService.GetTimezone(trajectoryRow.IdWell).Hours;
|
var entity = Convert(trajectoryRow);
|
||||||
var entity = Convert(trajectoryRow, offsetHours);
|
|
||||||
entity.Id = 0;
|
entity.Id = 0;
|
||||||
db.Set<TEntity>().Add(entity);
|
db.Set<TEntity>().Add(entity);
|
||||||
return await db.SaveChangesAsync(token)
|
return await db.SaveChangesAsync(token)
|
||||||
@ -98,8 +96,7 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
|
|
||||||
public async Task<int> UpdateAsync(Tdto row, CancellationToken token)
|
public async Task<int> UpdateAsync(Tdto row, CancellationToken token)
|
||||||
{
|
{
|
||||||
var offsetHours = wellService.GetTimezone(row.IdWell).Hours;
|
var entity = Convert(row);
|
||||||
var entity = Convert(row, offsetHours);
|
|
||||||
db.Set<TEntity>().Update(entity);
|
db.Set<TEntity>().Update(entity);
|
||||||
return await db.SaveChangesAsync(token)
|
return await db.SaveChangesAsync(token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
@ -108,14 +105,14 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
private static Tdto Convert(TEntity entity, double offsetHours)
|
private static Tdto Convert(TEntity entity, double offsetHours)
|
||||||
{
|
{
|
||||||
var dto = entity.Adapt<Tdto>();
|
var dto = entity.Adapt<Tdto>();
|
||||||
dto.UpdateDate = entity.UpdateDate.ToRemoteDateTime(offsetHours);
|
dto.UpdateDate = entity.UpdateDate.ToOffset(TimeSpan.FromHours(offsetHours));
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TEntity Convert(Tdto dto, double offsetHours)
|
private static TEntity Convert(Tdto dto)
|
||||||
{
|
{
|
||||||
var entity = dto.Adapt<TEntity>();
|
var entity = dto.Adapt<TEntity>();
|
||||||
entity.UpdateDate = DateTime.Now.ToUtcDateTimeOffset(offsetHours);
|
entity.UpdateDate = DateTimeOffset.Now;
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,13 +38,13 @@ namespace AsbCloudInfrastructure.Repository
|
|||||||
|
|
||||||
if (request.GeDate.HasValue)
|
if (request.GeDate.HasValue)
|
||||||
{
|
{
|
||||||
var geDate = request.GeDate.Value.ToUtcDateTimeOffset(timezone.Hours);
|
var geDate = request.GeDate.Value.ToUniversalTime();
|
||||||
query = query.Where(r => r.DateTime >= geDate);
|
query = query.Where(r => r.DateTime >= geDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.LeDate.HasValue)
|
if (request.LeDate.HasValue)
|
||||||
{
|
{
|
||||||
var leDate = request.LeDate.Value.ToUtcDateTimeOffset(timezone.Hours);
|
var leDate = request.LeDate.Value.ToUniversalTime();
|
||||||
query = query.Where(r => r.DateTime <= leDate);
|
query = query.Where(r => r.DateTime <= leDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ public class DailyReportService : IDailyReportService
|
|||||||
editableBlock.IdUser = idUser;
|
editableBlock.IdUser = idUser;
|
||||||
editableBlock.LastUpdateDate = DateTime.UtcNow;
|
editableBlock.LastUpdateDate = DateTime.UtcNow;
|
||||||
|
|
||||||
dailyReport.DateLastUpdate = DateTime.UtcNow;
|
dailyReport.DateLastUpdate = DateTimeOffset.UtcNow;
|
||||||
|
|
||||||
if (dailyReport.Id == 0)
|
if (dailyReport.Id == 0)
|
||||||
return await dailyReportRepository.InsertAsync(dailyReport, cancellationToken);
|
return await dailyReportRepository.InsertAsync(dailyReport, cancellationToken);
|
||||||
@ -107,8 +107,9 @@ public class DailyReportService : IDailyReportService
|
|||||||
IdWell = well.Id
|
IdWell = well.Id
|
||||||
};
|
};
|
||||||
|
|
||||||
var geDate = dailyReport.Date.ToDateTime(TimeOnly.MinValue, DateTimeKind.Unspecified);
|
var offsetHours = wellService.GetTimezone(dailyReport.IdWell).Hours;
|
||||||
var leDate = dailyReport.Date.AddDays(1).ToDateTime(TimeOnly.MinValue, DateTimeKind.Unspecified);
|
var geDate = new DateTimeOffset(dailyReport.Date, TimeOnly.MinValue, TimeSpan.FromHours(offsetHours));
|
||||||
|
var leDate = new DateTimeOffset(dailyReport.Date.AddDays(1), TimeOnly.MinValue, TimeSpan.FromHours(offsetHours));
|
||||||
|
|
||||||
var factOperationRequest = new WellOperationRequest(new []{ idWell })
|
var factOperationRequest = new WellOperationRequest(new []{ idWell })
|
||||||
{
|
{
|
||||||
@ -130,12 +131,12 @@ public class DailyReportService : IDailyReportService
|
|||||||
dailyReport.DepthStart = factWellOperations.FirstOrDefault()?.DepthStart;
|
dailyReport.DepthStart = factWellOperations.FirstOrDefault()?.DepthStart;
|
||||||
dailyReport.DepthEnd = factWellOperations.LastOrDefault()?.DepthEnd;
|
dailyReport.DepthEnd = factWellOperations.LastOrDefault()?.DepthEnd;
|
||||||
|
|
||||||
await UpdateTimeBalanceBlockAsync(dailyReport, factWellOperations, cancellationToken);
|
await UpdateTimeBalanceBlockAsync(dailyReport, factWellOperations, geDate, leDate, cancellationToken);
|
||||||
await UpdateSubsystemBlockAsync(dailyReport, cancellationToken);
|
await UpdateSubsystemBlockAsync(dailyReport, geDate, leDate, cancellationToken);
|
||||||
|
|
||||||
await AddTrajectoryBlockAsync(dailyReport, cancellationToken);
|
await AddTrajectoryBlockAsync(dailyReport, geDate, leDate, cancellationToken);
|
||||||
await AddScheduleBlockAsync(dailyReport, cancellationToken);
|
await AddScheduleBlockAsync(dailyReport, geDate, cancellationToken);
|
||||||
await AddProcessMapWellDrillingBlockAsync(dailyReport, cancellationToken);
|
await AddProcessMapWellDrillingBlockAsync(dailyReport, geDate, leDate, cancellationToken);
|
||||||
|
|
||||||
AddFactWellOperationBlock(dailyReport, factWellOperations);
|
AddFactWellOperationBlock(dailyReport, factWellOperations);
|
||||||
|
|
||||||
@ -152,34 +153,32 @@ public class DailyReportService : IDailyReportService
|
|||||||
Items = Enumerable.Empty<DailyReportDto>()
|
Items = Enumerable.Empty<DailyReportDto>()
|
||||||
};
|
};
|
||||||
|
|
||||||
var datesRange = await GetDatesRangeAsync(idWell, cancellationToken);
|
var datesRange = await wellOperationRepository.GetDatesRangeAsync(idWell, WellOperation.IdOperationTypeFact, cancellationToken);
|
||||||
|
|
||||||
if (datesRange is null)
|
if (datesRange is null)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
var dailyReports = new List<DailyReportDto>();
|
var dailyReports = new List<DailyReportDto>();
|
||||||
|
TimeSpan offset = wellService.GetTimezone(idWell).Offset;
|
||||||
|
|
||||||
if (request.GeDate.HasValue)
|
if (request.GeDate.HasValue)
|
||||||
{
|
{
|
||||||
var startDate = new DateTime(request.GeDate.Value.Year, request.GeDate.Value.Month,
|
var startDate = new DateTimeOffset(request.GeDate.Value, TimeOnly.MinValue, offset);
|
||||||
request.GeDate.Value.Day);
|
|
||||||
|
|
||||||
if (startDate.Date >= datesRange.From.Date)
|
if (startDate >= datesRange.From)
|
||||||
datesRange.From = startDate;
|
datesRange.From = startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.LeDate.HasValue)
|
if (request.LeDate.HasValue)
|
||||||
{
|
{
|
||||||
var finishDate = new DateTime(request.LeDate.Value.Year, request.LeDate.Value.Month,
|
var finishDate = new DateTimeOffset(request.LeDate.Value, TimeOnly.MinValue, offset);
|
||||||
request.LeDate.Value.Day);
|
|
||||||
|
|
||||||
if (finishDate.Date <= datesRange.To.Date)
|
if (finishDate <= datesRange.To)
|
||||||
datesRange.To = finishDate;
|
datesRange.To = finishDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (datesRange.From.AddDays(result.Skip) <= datesRange.To)
|
result.Count = (int)(Math.Ceiling((datesRange.To - DateTimeOffset.UnixEpoch).TotalDays)
|
||||||
result.Count = (int)(Math.Ceiling((datesRange.To - DateTime.UnixEpoch).TotalDays) -
|
- Math.Floor((datesRange.From - DateTimeOffset.UnixEpoch).TotalDays));
|
||||||
Math.Floor((datesRange.From - DateTime.UnixEpoch).TotalDays)) + 1;
|
|
||||||
|
|
||||||
var existingDailyReports = await dailyReportRepository.GetAsync(idWell, request, cancellationToken);
|
var existingDailyReports = await dailyReportRepository.GetAsync(idWell, request, cancellationToken);
|
||||||
|
|
||||||
@ -227,11 +226,11 @@ public class DailyReportService : IDailyReportService
|
|||||||
IdWell = idWell
|
IdWell = idWell
|
||||||
};
|
};
|
||||||
|
|
||||||
var geDate = date.ToDateTime(TimeOnly.MinValue, DateTimeKind.Unspecified);
|
var geDate = new DateTimeOffset(date, TimeOnly.MinValue, offset);
|
||||||
var leDate = date.AddDays(1).ToDateTime(TimeOnly.MinValue, DateTimeKind.Unspecified);
|
var leDate = new DateTimeOffset(date.AddDays(1), TimeOnly.MinValue, offset);
|
||||||
|
|
||||||
var factWellOperationPerDay = factWellOperations.Where(o => o.DateStart.Date >= geDate &&
|
var factWellOperationPerDay = factWellOperations.Where(o => o.DateStart >= geDate &&
|
||||||
o.DateStart.Date <= leDate);
|
o.DateStart <= leDate);
|
||||||
|
|
||||||
AddFactWellOperationBlock(dailyReport, factWellOperationPerDay);
|
AddFactWellOperationBlock(dailyReport, factWellOperationPerDay);
|
||||||
|
|
||||||
@ -239,36 +238,8 @@ public class DailyReportService : IDailyReportService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<DatesRangeDto?> GetDatesRangeAsync(int idWell, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var timezone = wellService.GetTimezone(idWell);
|
|
||||||
var currentDate = DateTimeOffset.UtcNow.ToRemoteDateTime(timezone.Hours);
|
|
||||||
|
|
||||||
var factOperationDatesRange = await wellOperationRepository.GetDatesRangeAsync(idWell, WellOperation.IdOperationTypeFact,
|
|
||||||
cancellationToken);
|
|
||||||
|
|
||||||
if (factOperationDatesRange is null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
var from = (factOperationDatesRange.From.AddDays(1) <= DateTime.UtcNow ?
|
|
||||||
factOperationDatesRange.From :
|
|
||||||
currentDate.AddDays(-1))
|
|
||||||
.Date;
|
|
||||||
|
|
||||||
var to = (factOperationDatesRange.To.AddDays(1) <= DateTime.UtcNow ?
|
|
||||||
factOperationDatesRange.To :
|
|
||||||
currentDate.AddDays(-1))
|
|
||||||
.Date;
|
|
||||||
|
|
||||||
return new DatesRangeDto
|
|
||||||
{
|
|
||||||
From = from,
|
|
||||||
To = to
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task UpdateTimeBalanceBlockAsync(DailyReportDto dailyReport, IEnumerable<WellOperationDto> factWellOperations,
|
private async Task UpdateTimeBalanceBlockAsync(DailyReportDto dailyReport, IEnumerable<WellOperationDto> factWellOperations,
|
||||||
CancellationToken cancellationToken)
|
DateTimeOffset geDateStart, DateTimeOffset leDateEnd, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
const int idWellOperationSlipsTime = 5011;
|
const int idWellOperationSlipsTime = 5011;
|
||||||
|
|
||||||
@ -277,9 +248,6 @@ public class DailyReportService : IDailyReportService
|
|||||||
dailyReport.TimeBalanceBlock.SectionName = wellOperationRepository.GetSectionTypes()
|
dailyReport.TimeBalanceBlock.SectionName = wellOperationRepository.GetSectionTypes()
|
||||||
.FirstOrDefault(s => s.Id == dailyReport.TimeBalanceBlock.IdSection)?.Caption;
|
.FirstOrDefault(s => s.Id == dailyReport.TimeBalanceBlock.IdSection)?.Caption;
|
||||||
|
|
||||||
var geDateStart = dailyReport.Date.ToDateTime(TimeOnly.MinValue, DateTimeKind.Unspecified);
|
|
||||||
var leDateEnd = dailyReport.Date.AddDays(1).ToDateTime(TimeOnly.MinValue, DateTimeKind.Unspecified);
|
|
||||||
|
|
||||||
dailyReport.TimeBalanceBlock.WellOperationSlipsTimeCount = (await detectedOperationService.GetAsync(
|
dailyReport.TimeBalanceBlock.WellOperationSlipsTimeCount = (await detectedOperationService.GetAsync(
|
||||||
new DetectedOperationByWellRequest
|
new DetectedOperationByWellRequest
|
||||||
{
|
{
|
||||||
@ -295,11 +263,9 @@ public class DailyReportService : IDailyReportService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task AddTrajectoryBlockAsync(DailyReportDto dailyReport, CancellationToken cancellationToken)
|
private async Task AddTrajectoryBlockAsync(DailyReportDto dailyReport,
|
||||||
|
DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var geDate = dailyReport.Date.ToDateTime(TimeOnly.MinValue, DateTimeKind.Utc);
|
|
||||||
var leDate = dailyReport.Date.AddDays(1).ToDateTime(TimeOnly.MinValue, DateTimeKind.Utc);
|
|
||||||
|
|
||||||
var trajectory = (await trajectoryFactNnbRepository.GetByRequestAsync(new TrajectoryRequest
|
var trajectory = (await trajectoryFactNnbRepository.GetByRequestAsync(new TrajectoryRequest
|
||||||
{
|
{
|
||||||
IdWell = dailyReport.IdWell,
|
IdWell = dailyReport.IdWell,
|
||||||
@ -316,10 +282,8 @@ public class DailyReportService : IDailyReportService
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task AddScheduleBlockAsync(DailyReportDto dailyReport, CancellationToken cancellationToken)
|
private async Task AddScheduleBlockAsync(DailyReportDto dailyReport, DateTimeOffset workDate, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var workDate = dailyReport.Date.ToDateTime(TimeOnly.MinValue, DateTimeKind.Unspecified);
|
|
||||||
|
|
||||||
dailyReport.ScheduleBlock = (await scheduleRepository.GetAsync(dailyReport.IdWell, workDate, cancellationToken))
|
dailyReport.ScheduleBlock = (await scheduleRepository.GetAsync(dailyReport.IdWell, workDate, cancellationToken))
|
||||||
.Select(s => new ScheduleRecordDto
|
.Select(s => new ScheduleRecordDto
|
||||||
{
|
{
|
||||||
@ -331,7 +295,8 @@ public class DailyReportService : IDailyReportService
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateSubsystemBlockAsync(DailyReportDto dailyReport, CancellationToken cancellationToken)
|
private async Task UpdateSubsystemBlockAsync(DailyReportDto dailyReport,
|
||||||
|
DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
dailyReport.SubsystemBlock ??= new SubsystemBlockDto();
|
dailyReport.SubsystemBlock ??= new SubsystemBlockDto();
|
||||||
|
|
||||||
@ -344,9 +309,6 @@ public class DailyReportService : IDailyReportService
|
|||||||
IdWell = dailyReport.IdWell
|
IdWell = dailyReport.IdWell
|
||||||
}, cancellationToken);
|
}, cancellationToken);
|
||||||
|
|
||||||
var geDate = dailyReport.Date.ToDateTime(TimeOnly.MinValue, DateTimeKind.Unspecified);
|
|
||||||
var leDate = dailyReport.Date.AddDays(1).ToDateTime(TimeOnly.MinValue, DateTimeKind.Unspecified);
|
|
||||||
|
|
||||||
var subsystemsStatPerDay = await subsystemService.GetStatAsync(new SubsystemRequest
|
var subsystemsStatPerDay = await subsystemService.GetStatAsync(new SubsystemRequest
|
||||||
{
|
{
|
||||||
IdWell = dailyReport.IdWell,
|
IdWell = dailyReport.IdWell,
|
||||||
@ -369,11 +331,9 @@ public class DailyReportService : IDailyReportService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task AddProcessMapWellDrillingBlockAsync(DailyReportDto dailyReport, CancellationToken cancellationToken)
|
private async Task AddProcessMapWellDrillingBlockAsync(DailyReportDto dailyReport,
|
||||||
|
DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var geDate = dailyReport.Date.ToDateTime(TimeOnly.MinValue, DateTimeKind.Unspecified);
|
|
||||||
var leDate = dailyReport.Date.AddDays(1).ToDateTime(TimeOnly.MinValue, DateTimeKind.Unspecified);
|
|
||||||
|
|
||||||
var request = new DataSaubStatRequest();
|
var request = new DataSaubStatRequest();
|
||||||
dailyReport.ProcessMapWellDrillingBlock = (await processMapReportDrillingService.GetAsync(dailyReport.IdWell, request,
|
dailyReport.ProcessMapWellDrillingBlock = (await processMapReportDrillingService.GetAsync(dailyReport.IdWell, request,
|
||||||
cancellationToken)).Where(p => p.DateStart >= geDate && p.DateStart <= leDate)
|
cancellationToken)).Where(p => p.DateStart >= geDate && p.DateStart <= leDate)
|
||||||
@ -412,11 +372,10 @@ public class DailyReportService : IDailyReportService
|
|||||||
|
|
||||||
private async Task<bool> IsDateDailyReportInRangeAsync(int idWell, DateOnly dateDailyReport, CancellationToken cancellationToken)
|
private async Task<bool> IsDateDailyReportInRangeAsync(int idWell, DateOnly dateDailyReport, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var datesRange = await GetDatesRangeAsync(idWell, cancellationToken);
|
var datesRange = await wellOperationRepository.GetDatesRangeAsync(idWell, WellOperation.IdOperationTypeFact, cancellationToken);
|
||||||
|
|
||||||
if (datesRange is null)
|
if (datesRange is null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var from = DateOnly.FromDateTime(datesRange.From.DateTime);
|
var from = DateOnly.FromDateTime(datesRange.From.DateTime);
|
||||||
var to = DateOnly.FromDateTime(datesRange.To.DateTime);
|
var to = DateOnly.FromDateTime(datesRange.To.DateTime);
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ public class DetectedOperationService : IDetectedOperationService
|
|||||||
&& v.DepthStart <= dto.DepthStart
|
&& v.DepthStart <= dto.DepthStart
|
||||||
&& v.DepthEnd > dto.DepthStart);
|
&& v.DepthEnd > dto.DepthStart);
|
||||||
|
|
||||||
var dateStart = dto.DateStart;
|
var dateStart = dto.DateStart.ToUniversalTime();
|
||||||
var timeStart = new TimeDto(dateStart);
|
var timeStart = new TimeDto(dateStart);
|
||||||
var driller = schedules.FirstOrDefault(s =>
|
var driller = schedules.FirstOrDefault(s =>
|
||||||
s.DrillStart <= dateStart &&
|
s.DrillStart <= dateStart &&
|
||||||
|
@ -49,7 +49,7 @@ namespace AsbCloudInfrastructure.Services.DrillTestReport
|
|||||||
well.Deposit ?? "-",
|
well.Deposit ?? "-",
|
||||||
well.Cluster ?? "-",
|
well.Cluster ?? "-",
|
||||||
well.Caption ?? "-"),
|
well.Caption ?? "-"),
|
||||||
Date = DateTime.Now,
|
Date = DateTimeOffset.Now,
|
||||||
};
|
};
|
||||||
|
|
||||||
var fileName = string.Format("Drill_test_{0}.xlsx", dto.TimeStampStart.ToString("dd.mm.yyyy_HH_MM_ss"));
|
var fileName = string.Format("Drill_test_{0}.xlsx", dto.TimeStampStart.ToString("dd.mm.yyyy_HH_MM_ss"));
|
||||||
@ -78,15 +78,15 @@ namespace AsbCloudInfrastructure.Services.DrillTestReport
|
|||||||
var dtos = await drillTestRepository.GetAllAsync(telemetry.Id, request, cancellationToken);
|
var dtos = await drillTestRepository.GetAllAsync(telemetry.Id, request, cancellationToken);
|
||||||
foreach (var dto in dtos)
|
foreach (var dto in dtos)
|
||||||
{
|
{
|
||||||
var remoteDateTime = dto.TimeStampStart.ToRemoteDateTime(timezone.Hours);
|
var remoteDateTime = dto.TimeStampStart.ToOffset(TimeSpan.FromHours(timezone.Hours));
|
||||||
|
|
||||||
reports.Add(new DrillTestReportInfoDto
|
reports.Add(new DrillTestReportInfoDto
|
||||||
{
|
{
|
||||||
FileName = string.Format("Drill_test_{0}", dto.TimeStampStart.DateTime),
|
FileName = string.Format("Drill_test_{0}", remoteDateTime),
|
||||||
DrillDepth = (dto.Params
|
DrillDepth = (dto.Params
|
||||||
.Where(p => p.DepthDrillStep.HasValue)
|
.Where(p => p.DepthDrillStep.HasValue)
|
||||||
.Sum(x => x.DepthDrillStep) ?? 0) + dto.DepthStart,
|
.Sum(x => x.DepthDrillStep) ?? 0) + dto.DepthStart,
|
||||||
DateTime = dto.TimeStampStart.DateTime,
|
DateTime = remoteDateTime,
|
||||||
Id = dto.Id,
|
Id = dto.Id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -480,7 +480,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
|
|||||||
IdWell = fileEntity.IdWell,
|
IdWell = fileEntity.IdWell,
|
||||||
Name = fileEntity.Name,
|
Name = fileEntity.Name,
|
||||||
Size = fileEntity.Size,
|
Size = fileEntity.Size,
|
||||||
UploadDate = fileEntity.UploadDate.ToRemoteDateTime(timezoneOffset),
|
UploadDate = fileEntity.UploadDate.ToOffset(TimeSpan.FromHours(timezoneOffset)),
|
||||||
};
|
};
|
||||||
|
|
||||||
var marks = fileEntity.FileMarks?.Where(m => !m.IsDeleted);
|
var marks = fileEntity.FileMarks?.Where(m => !m.IsDeleted);
|
||||||
@ -489,7 +489,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
|
|||||||
part.File.FileMarks = marks.Select(m =>
|
part.File.FileMarks = marks.Select(m =>
|
||||||
{
|
{
|
||||||
var mark = m.Adapt<FileMarkDto>();
|
var mark = m.Adapt<FileMarkDto>();
|
||||||
mark.DateCreated = m.DateCreated.ToRemoteDateTime(timezoneOffset);
|
mark.DateCreated = m.DateCreated.ToOffset(TimeSpan.FromHours(timezoneOffset));
|
||||||
return mark;
|
return mark;
|
||||||
});
|
});
|
||||||
var hasReject = marks.Any(m => m.IdMarkType == idMarkTypeReject);
|
var hasReject = marks.Any(m => m.IdMarkType == idMarkTypeReject);
|
||||||
|
@ -11,7 +11,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
|
|||||||
{
|
{
|
||||||
private const string directionDirectorPositionName = "Руководитель направления по ТСБ";
|
private const string directionDirectorPositionName = "Руководитель направления по ТСБ";
|
||||||
|
|
||||||
private readonly DateTime totalDate;
|
private readonly DateTimeOffset totalDate;
|
||||||
private readonly FileMarkDto? acceptDirectionDirector;
|
private readonly FileMarkDto? acceptDirectionDirector;
|
||||||
private readonly List<FileMarkDto> acceptsOthers;
|
private readonly List<FileMarkDto> acceptsOthers;
|
||||||
private readonly WellDto well;
|
private readonly WellDto well;
|
||||||
@ -157,7 +157,7 @@ namespace AsbCloudInfrastructure.Services.DrillingProgram
|
|||||||
.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Left);
|
.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Left);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string FormatDate(DateTime dateTime)
|
private static string FormatDate(DateTimeOffset dateTime)
|
||||||
=> $"{dateTime.Day:00}.{dateTime.Month:00}.{dateTime.Year:00}";
|
=> $"{dateTime.Day:00}.{dateTime.Month:00}.{dateTime.Year:00}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
return (float)result;
|
return (float)result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DateTime GetDate(double depth, LimitingParameterDataDto dto)
|
private DateTimeOffset GetDate(double depth, LimitingParameterDataDto dto)
|
||||||
{
|
{
|
||||||
var a = depth - dto.DepthStart;
|
var a = depth - dto.DepthStart;
|
||||||
var b = dto.DepthEnd - dto.DepthStart;
|
var b = dto.DepthEnd - dto.DepthStart;
|
||||||
|
@ -57,7 +57,7 @@ public class ManualCatalogService : IManualCatalogService
|
|||||||
var manual = new ManualDto
|
var manual = new ManualDto
|
||||||
{
|
{
|
||||||
Name = name,
|
Name = name,
|
||||||
DateDownload = DateTime.UtcNow,
|
DateDownload = DateTimeOffset.UtcNow,
|
||||||
IdDirectory = idDirectory,
|
IdDirectory = idDirectory,
|
||||||
IdCategory = IdFileCategory,
|
IdCategory = IdFileCategory,
|
||||||
IdAuthor = idAuthor
|
IdAuthor = idAuthor
|
||||||
|
@ -87,8 +87,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
throw new ArgumentInvalidException(nameof(dto), "wrong idCategory");
|
throw new ArgumentInvalidException(nameof(dto), "wrong idCategory");
|
||||||
if (!dto.Data.Any())
|
if (!dto.Data.Any())
|
||||||
throw new ArgumentInvalidException(nameof(dto), "data.data is not optional");
|
throw new ArgumentInvalidException(nameof(dto), "data.data is not optional");
|
||||||
var timezone = wellService.GetTimezone(idWell);
|
var entity = Convert(dto);
|
||||||
var entity = Convert(dto, timezone.Hours);
|
|
||||||
entity.IdWell = idWell;
|
entity.IdWell = idWell;
|
||||||
db.Measures.Add(entity);
|
db.Measures.Add(entity);
|
||||||
return db.SaveChangesAsync(token);
|
return db.SaveChangesAsync(token);
|
||||||
@ -110,7 +109,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
|
|
||||||
var timezone = wellService.GetTimezone(idWell);
|
var timezone = wellService.GetTimezone(idWell);
|
||||||
entity.IdWell = idWell;
|
entity.IdWell = idWell;
|
||||||
entity.Timestamp = dto.Timestamp.ToUtcDateTimeOffset(timezone.Hours);
|
entity.Timestamp = dto.Timestamp.ToOffset(TimeSpan.FromHours(timezone.Hours));
|
||||||
entity.Data = dto.Data.Adapt<RawData>();
|
entity.Data = dto.Data.Adapt<RawData>();
|
||||||
|
|
||||||
return await db.SaveChangesAsync(token).ConfigureAwait(false);
|
return await db.SaveChangesAsync(token).ConfigureAwait(false);
|
||||||
@ -142,13 +141,13 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
{
|
{
|
||||||
var dto = entity.Adapt<MeasureDto>();
|
var dto = entity.Adapt<MeasureDto>();
|
||||||
dto.CategoryName = entity.Category?.Name ?? String.Empty;
|
dto.CategoryName = entity.Category?.Name ?? String.Empty;
|
||||||
dto.Timestamp = entity.Timestamp.ToRemoteDateTime(hours);
|
dto.Timestamp = entity.Timestamp.ToOffset(TimeSpan.FromHours(hours));
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
private Measure Convert(MeasureDto dto, double hours)
|
private Measure Convert(MeasureDto dto)
|
||||||
{
|
{
|
||||||
var entity = dto.Adapt<Measure>();
|
var entity = dto.Adapt<Measure>();
|
||||||
entity.Timestamp = dto.Timestamp.ToUtcDateTimeOffset(hours);
|
entity.Timestamp = dto.Timestamp.ToUniversalTime();
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
|
|||||||
var result = new ProcessMapReportDataSaubStatDto()
|
var result = new ProcessMapReportDataSaubStatDto()
|
||||||
{
|
{
|
||||||
IdWellSectionType = wellSectionType.Id,
|
IdWellSectionType = wellSectionType.Id,
|
||||||
DateStart = firstElemInInterval.DateStart.DateTime,
|
DateStart = firstElemInInterval.DateStart,
|
||||||
WellSectionTypeName = wellSectionType.Caption,
|
WellSectionTypeName = wellSectionType.Caption,
|
||||||
DepthStart = firstElemInInterval.DepthStart,
|
DepthStart = firstElemInInterval.DepthStart,
|
||||||
DepthEnd = lastElemInInterval.DepthEnd,
|
DepthEnd = lastElemInInterval.DepthEnd,
|
||||||
|
@ -64,11 +64,11 @@ public class ReportService : IReportService
|
|||||||
return work.Id;
|
return work.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetReportPagesCount(int idWell, DateTime begin, DateTime end, int stepSeconds, int format)
|
public int GetReportPagesCount(int idWell, DateTimeOffset begin, DateTimeOffset end, int stepSeconds, int format)
|
||||||
{
|
{
|
||||||
var timezoneOffset = wellService.GetTimezone(idWell).Hours;
|
var timezoneOffset = wellService.GetTimezone(idWell).Hours;
|
||||||
var beginRemote = begin.ToTimeZoneOffsetHours(timezoneOffset);
|
var beginRemote = begin.DateTime.ToTimeZoneOffsetHours(timezoneOffset);
|
||||||
var endRemote = end.ToTimeZoneOffsetHours(timezoneOffset);
|
var endRemote = end.DateTime.ToTimeZoneOffsetHours(timezoneOffset);
|
||||||
|
|
||||||
var generator = GetReportGenerator(idWell, beginRemote, endRemote, stepSeconds, format, db);
|
var generator = GetReportGenerator(idWell, beginRemote, endRemote, stepSeconds, format, db);
|
||||||
var pagesCount = generator.GetPagesCount();
|
var pagesCount = generator.GetPagesCount();
|
||||||
@ -87,6 +87,7 @@ public class ReportService : IReportService
|
|||||||
public async Task<IEnumerable<ReportPropertiesDto>> GetAllReportsByWellAsync(int idWell, CancellationToken token)
|
public async Task<IEnumerable<ReportPropertiesDto>> GetAllReportsByWellAsync(int idWell, CancellationToken token)
|
||||||
{
|
{
|
||||||
var timezoneOffset = wellService.GetTimezone(idWell).Hours;
|
var timezoneOffset = wellService.GetTimezone(idWell).Hours;
|
||||||
|
var timeSpan = TimeSpan.FromHours(timezoneOffset);
|
||||||
var propertiesQuery = db.ReportProperties.Include(r => r.File)
|
var propertiesQuery = db.ReportProperties.Include(r => r.File)
|
||||||
.Where(p => p.IdWell == idWell)
|
.Where(p => p.IdWell == idWell)
|
||||||
.OrderBy(o => o.File.UploadDate)
|
.OrderBy(o => o.File.UploadDate)
|
||||||
@ -106,12 +107,12 @@ public class ReportService : IReportService
|
|||||||
IdWell = p.File.IdWell,
|
IdWell = p.File.IdWell,
|
||||||
Name = p.File.Name,
|
Name = p.File.Name,
|
||||||
Size = p.File.Size,
|
Size = p.File.Size,
|
||||||
UploadDate = p.File.UploadDate.ToRemoteDateTime(timezoneOffset),
|
UploadDate = p.File.UploadDate.ToOffset(timeSpan),
|
||||||
},
|
},
|
||||||
IdWell = p.IdWell,
|
IdWell = p.IdWell,
|
||||||
Date = p.File.UploadDate.ToRemoteDateTime(timezoneOffset),
|
Date = p.File.UploadDate.ToOffset(timeSpan),
|
||||||
Begin = p.Begin.ToRemoteDateTime(timezoneOffset),
|
Begin = p.Begin.ToOffset(timeSpan),
|
||||||
End = p.End.ToRemoteDateTime(timezoneOffset),
|
End = p.End.ToOffset(timeSpan),
|
||||||
Step = p.Step,
|
Step = p.Step,
|
||||||
Format = p.Format == 0 ? ".pdf" : ".las"
|
Format = p.Format == 0 ? ".pdf" : ".las"
|
||||||
});
|
});
|
||||||
@ -127,10 +128,10 @@ public class ReportService : IReportService
|
|||||||
CancellationToken token)
|
CancellationToken token)
|
||||||
{
|
{
|
||||||
var timezoneOffset = wellService.GetTimezone(idWell).Hours;
|
var timezoneOffset = wellService.GetTimezone(idWell).Hours;
|
||||||
var beginRemote = request.Begin.ToTimeZoneOffsetHours(timezoneOffset);
|
var beginRemote = request.Begin.DateTime;
|
||||||
var endRemote = request.End.ToTimeZoneOffsetHours(timezoneOffset);
|
var endRemote = request.End.DateTime;
|
||||||
var beginUtc = request.Begin.ToUtcDateTimeOffset(timezoneOffset);
|
var beginUtc = request.Begin.ToUniversalTime();
|
||||||
var endUtc = request.End.ToUtcDateTimeOffset(timezoneOffset);
|
var endUtc = request.End.ToUniversalTime();
|
||||||
|
|
||||||
var tempDir = Path.Combine(Path.GetTempPath(), "report");
|
var tempDir = Path.Combine(Path.GetTempPath(), "report");
|
||||||
|
|
||||||
|
@ -72,13 +72,13 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
|||||||
|
|
||||||
if (request.Begin is not null)
|
if (request.Begin is not null)
|
||||||
{
|
{
|
||||||
var beginUtc = request.Begin.Value.ToUtcDateTimeOffset(timezone.Hours);
|
var beginUtc = request.Begin.Value.ToUniversalTime();
|
||||||
query = query.Where(m => m.DateTime >= beginUtc);
|
query = query.Where(m => m.DateTime >= beginUtc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.End is not null)
|
if (request.End is not null)
|
||||||
{
|
{
|
||||||
var endUtc = request.End.Value.ToUtcDateTimeOffset(timezone.Hours);
|
var endUtc = request.End.Value.ToUniversalTime();
|
||||||
query = query.Where(m => m.DateTime <= endUtc);
|
query = query.Where(m => m.DateTime <= endUtc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
|||||||
WellDepth = message.WellDepth
|
WellDepth = message.WellDepth
|
||||||
};
|
};
|
||||||
|
|
||||||
messageDto.DateTime = message.DateTime.ToRemoteDateTime(timezone.Hours);
|
messageDto.DateTime = message.DateTime.ToOffset(TimeSpan.FromHours(timezone.Hours));
|
||||||
|
|
||||||
if (message.IdTelemetryUser is not null)
|
if (message.IdTelemetryUser is not null)
|
||||||
{
|
{
|
||||||
@ -150,7 +150,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
|||||||
var entity = dto.Adapt<TelemetryMessage>();
|
var entity = dto.Adapt<TelemetryMessage>();
|
||||||
entity.Id = 0;
|
entity.Id = 0;
|
||||||
entity.IdTelemetry = telemetry.Id;
|
entity.IdTelemetry = telemetry.Id;
|
||||||
entity.DateTime = dto.Date.ToUtcDateTimeOffset(timezone.Hours);
|
entity.DateTime = dto.Date.ToOffset(TimeSpan.FromHours(timezone.Hours));
|
||||||
db.TelemetryMessages.Add(entity);
|
db.TelemetryMessages.Add(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,6 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
|||||||
foreach (var item in filtered)
|
foreach (var item in filtered)
|
||||||
{
|
{
|
||||||
item.IdState = 2;
|
item.IdState = 2;
|
||||||
item.UploadDate = DateTime.SpecifyKind(item.UploadDate, DateTimeKind.Utc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await setpointsRepository.UpdateRangeAsync(filtered, token);
|
await setpointsRepository.UpdateRangeAsync(filtered, token);
|
||||||
|
@ -102,7 +102,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
|||||||
if (dateBegin == default)
|
if (dateBegin == default)
|
||||||
{
|
{
|
||||||
var dateRange = telemetryDataCache.GetOrDefaultDataDateRange(telemetry.Id);
|
var dateRange = telemetryDataCache.GetOrDefaultDataDateRange(telemetry.Id);
|
||||||
dateBeginUtc = (dateRange?.To.UtcDateTime ?? DateTime.UtcNow)
|
dateBeginUtc = (dateRange?.To ?? DateTimeOffset.UtcNow)
|
||||||
.AddSeconds(-intervalSec);
|
.AddSeconds(-intervalSec);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -156,7 +156,9 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
|||||||
var to = cacheItem.LastData[^1].DateTime;
|
var to = cacheItem.LastData[^1].DateTime;
|
||||||
from = from ?? cacheItem.LastData[0].DateTime;
|
from = from ?? cacheItem.LastData[0].DateTime;
|
||||||
|
|
||||||
return new DatesRangeDto { From = from.Value, To = to };
|
return new DatesRangeDto {
|
||||||
|
From = from.Value.ToUtcDateTimeOffset(cacheItem.TimezoneHours),
|
||||||
|
To = to.ToUtcDateTimeOffset(cacheItem.TimezoneHours) };
|
||||||
}
|
}
|
||||||
|
|
||||||
public DatesRangeDto? GetOrDefaultCachedDateRange(int idTelemetry)
|
public DatesRangeDto? GetOrDefaultCachedDateRange(int idTelemetry)
|
||||||
|
@ -146,6 +146,8 @@ public class OperationsStatService : IOperationsStatService
|
|||||||
|
|
||||||
private async Task<StatWellDto> CalcWellStatAsync(Well well, CancellationToken token)
|
private async Task<StatWellDto> CalcWellStatAsync(Well well, CancellationToken token)
|
||||||
{
|
{
|
||||||
|
var timezone = wellService.GetTimezone(well.Id);
|
||||||
|
|
||||||
var wellType = (await memoryCache
|
var wellType = (await memoryCache
|
||||||
.GetOrCreateBasicAsync(db.Set<WellType>(), token))
|
.GetOrCreateBasicAsync(db.Set<WellType>(), token))
|
||||||
.FirstOrDefault(t => t.Id == well.IdWellType);
|
.FirstOrDefault(t => t.Id == well.IdWellType);
|
||||||
@ -170,9 +172,8 @@ public class OperationsStatService : IOperationsStatService
|
|||||||
if (!wellOperations.Any())
|
if (!wellOperations.Any())
|
||||||
return statWellDto;
|
return statWellDto;
|
||||||
|
|
||||||
var timezoneOffsetH = wellService.GetTimezone(well.Id).Hours;
|
statWellDto.Sections = CalcSectionsStats(wellOperations, timezone.Hours);
|
||||||
statWellDto.Sections = CalcSectionsStats(wellOperations, timezoneOffsetH);
|
statWellDto.Total = GetStatTotal(wellOperations, well.IdState, timezone.Hours);
|
||||||
statWellDto.Total = GetStatTotal(wellOperations, well.IdState, timezoneOffsetH);
|
|
||||||
statWellDto.TvdLagDays = CalcTvdLagDays(wellOperations);
|
statWellDto.TvdLagDays = CalcTvdLagDays(wellOperations);
|
||||||
statWellDto.TvdDrillingDays = CalcDrillingDays(wellOperations);
|
statWellDto.TvdDrillingDays = CalcDrillingDays(wellOperations);
|
||||||
|
|
||||||
@ -288,8 +289,8 @@ public class OperationsStatService : IOperationsStatService
|
|||||||
|
|
||||||
var section = new StatOperationsDto
|
var section = new StatOperationsDto
|
||||||
{
|
{
|
||||||
Start = operations.FirstOrDefault()?.DateStart.ToRemoteDateTime(timezoneOffsetHours),
|
Start = operations.FirstOrDefault()?.DateStart.ToOffset(TimeSpan.FromHours(timezoneOffsetHours)),
|
||||||
End = operations.Max(o => o.DateStart.ToRemoteDateTime(timezoneOffsetHours).AddHours(o.DurationHours)),
|
End = operations.Max(o => o.DateStart.ToOffset(TimeSpan.FromHours(timezoneOffsetHours)).AddHours(o.DurationHours)),
|
||||||
WellDepthStart = operations.Min(o => o.DepthStart),
|
WellDepthStart = operations.Min(o => o.DepthStart),
|
||||||
WellDepthEnd = operations.Max(o => o.DepthStart),
|
WellDepthEnd = operations.Max(o => o.DepthStart),
|
||||||
Rop = CalcROP(operations),
|
Rop = CalcROP(operations),
|
||||||
|
@ -63,12 +63,12 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
private void DropCacheRelationCompanyWell()
|
private void DropCacheRelationCompanyWell()
|
||||||
=> memoryCache.DropBasic<RelationCompanyWell>();
|
=> memoryCache.DropBasic<RelationCompanyWell>();
|
||||||
|
|
||||||
public DateTime GetLastTelemetryDate(int idWell)
|
public DateTimeOffset GetLastTelemetryDate(int idWell)
|
||||||
{
|
{
|
||||||
var well = GetOrDefault(idWell);
|
var well = GetOrDefault(idWell);
|
||||||
|
|
||||||
if (well?.IdTelemetry is null)
|
if (well?.IdTelemetry is null)
|
||||||
return DateTime.MinValue;
|
return DateTimeOffset.MinValue;
|
||||||
|
|
||||||
var datesRange = telemetryService.GetDatesRange(well.IdTelemetry.Value);
|
var datesRange = telemetryService.GetDatesRange(well.IdTelemetry.Value);
|
||||||
return datesRange.To.DateTime;
|
return datesRange.To.DateTime;
|
||||||
@ -279,7 +279,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
dto.Cluster = entity.Cluster.Caption;
|
dto.Cluster = entity.Cluster.Caption;
|
||||||
dto.Deposit = entity.Cluster.Deposit.Caption;
|
dto.Deposit = entity.Cluster.Deposit.Caption;
|
||||||
if (entity.IdTelemetry is not null)
|
if (entity.IdTelemetry is not null)
|
||||||
dto.LastTelemetryDate = telemetryService.GetDatesRange(entity.IdTelemetry.Value).To.DateTime;
|
dto.LastTelemetryDate = telemetryService.GetDatesRange(entity.IdTelemetry.Value).To.ToOffset(dto.Timezone.Offset);
|
||||||
dto.Companies = entity.RelationCompaniesWells
|
dto.Companies = entity.RelationCompaniesWells
|
||||||
.Select(r => Convert(r.Company))
|
.Select(r => Convert(r.Company))
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -297,47 +297,10 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
|
|
||||||
public SimpleTimezoneDto GetTimezone(int idWell)
|
public SimpleTimezoneDto GetTimezone(int idWell)
|
||||||
{
|
{
|
||||||
var well = GetOrDefault(idWell)
|
var cache = GetCache();
|
||||||
|
var cacheItem = cache.FirstOrDefault(d => d.Id == idWell)
|
||||||
?? throw new ArgumentInvalidException(nameof(idWell), $"idWell: {idWell} does not exist.");
|
?? throw new ArgumentInvalidException(nameof(idWell), $"idWell: {idWell} does not exist.");
|
||||||
return GetTimezone(well);
|
return cacheItem.Timezone.Adapt<SimpleTimezoneDto>();
|
||||||
}
|
|
||||||
|
|
||||||
private SimpleTimezoneDto GetTimezone(WellDto wellDto)
|
|
||||||
{
|
|
||||||
if (wellDto.Timezone is not null)
|
|
||||||
return wellDto.Timezone;
|
|
||||||
|
|
||||||
if (wellDto.Telemetry is not null)
|
|
||||||
{
|
|
||||||
var timezone = telemetryService.GetTimezone(wellDto.Telemetry.Id);
|
|
||||||
if (timezone is not null)
|
|
||||||
return timezone;
|
|
||||||
}
|
|
||||||
|
|
||||||
var well = GetQuery().FirstOrDefault(w => w.Id == wellDto.Id);
|
|
||||||
|
|
||||||
if (well is not null)
|
|
||||||
{
|
|
||||||
var point = GetCoordinates(well);
|
|
||||||
if (point is not null)
|
|
||||||
{
|
|
||||||
if (point.Timezone is not null)
|
|
||||||
{
|
|
||||||
return point.Timezone.Adapt<SimpleTimezoneDto>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (point.Latitude is not null & point.Longitude is not null)
|
|
||||||
{
|
|
||||||
var timezone = timezoneService.GetOrDefaultByCoordinates(point.Latitude!.Value, point.Longitude!.Value);
|
|
||||||
if (timezone is not null)
|
|
||||||
{
|
|
||||||
return timezone;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Exception($"Can't find timezone for well {wellDto.Caption} id: {wellDto.Id}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsTelemetryAssignedToDifferentWell(WellDto wellDto)
|
private bool IsTelemetryAssignedToDifferentWell(WellDto wellDto)
|
||||||
|
@ -12,6 +12,7 @@ using AsbCloudApp.Repositories;
|
|||||||
using AsbCloudApp.Requests;
|
using AsbCloudApp.Requests;
|
||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
using AsbCloudApp.Services.ProcessMaps.WellDrilling;
|
using AsbCloudApp.Services.ProcessMaps.WellDrilling;
|
||||||
|
using AsbCloudDb.Model;
|
||||||
using AsbCloudInfrastructure.Services.DailyReport;
|
using AsbCloudInfrastructure.Services.DailyReport;
|
||||||
using NSubstitute;
|
using NSubstitute;
|
||||||
using System;
|
using System;
|
||||||
@ -114,7 +115,7 @@ public class DailyReportServiceTest
|
|||||||
private readonly ProcessMapReportDataSaubStatDto fakeProcessMapReportWellDrilling = new()
|
private readonly ProcessMapReportDataSaubStatDto fakeProcessMapReportWellDrilling = new()
|
||||||
{
|
{
|
||||||
DrillingMode = "Ротор",
|
DrillingMode = "Ротор",
|
||||||
DateStart = new DateTime(2023, 10, 26),
|
DateStart = new DateTimeOffset(2023, 10, 26, 0, 0, 0, TimeSpan.Zero),
|
||||||
DeltaDepth = 500,
|
DeltaDepth = 500,
|
||||||
Rop = new PlanFactDto<double?>
|
Rop = new PlanFactDto<double?>
|
||||||
{
|
{
|
||||||
@ -179,8 +180,8 @@ public class DailyReportServiceTest
|
|||||||
IdWell = idWell,
|
IdWell = idWell,
|
||||||
ShiftStart = new TimeDto(1),
|
ShiftStart = new TimeDto(1),
|
||||||
ShiftEnd = new TimeDto(5),
|
ShiftEnd = new TimeDto(5),
|
||||||
DrillStart = new DateTime(2023, 01, 26),
|
DrillStart = new DateTimeOffset(2023, 01, 26, 0, 0, 0, TimeSpan.Zero),
|
||||||
DrillEnd = new DateTime(2023, 12, 26),
|
DrillEnd = new DateTimeOffset(2023, 12, 26, 0, 0, 0, TimeSpan.Zero),
|
||||||
Driller = new()
|
Driller = new()
|
||||||
{
|
{
|
||||||
Name = "Иван",
|
Name = "Иван",
|
||||||
@ -283,7 +284,7 @@ public class DailyReportServiceTest
|
|||||||
subsystemServiceMock.GetStatAsync(Arg.Any<SubsystemRequest>(), Arg.Any<CancellationToken>())
|
subsystemServiceMock.GetStatAsync(Arg.Any<SubsystemRequest>(), Arg.Any<CancellationToken>())
|
||||||
.ReturnsForAnyArgs(new[] { fakeSubsystemsStat });
|
.ReturnsForAnyArgs(new[] { fakeSubsystemsStat });
|
||||||
|
|
||||||
scheduleRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<DateTime>(), Arg.Any<CancellationToken>())
|
scheduleRepositoryMock.GetAsync(Arg.Any<int>(), Arg.Any<DateTimeOffset>(), Arg.Any<CancellationToken>())
|
||||||
.ReturnsForAnyArgs(new[] { fakeShedule });
|
.ReturnsForAnyArgs(new[] { fakeShedule });
|
||||||
|
|
||||||
processMapReportWellDrillingServiceMock.GetAsync(Arg.Any<int>(), fakeRequest, Arg.Any<CancellationToken>())
|
processMapReportWellDrillingServiceMock.GetAsync(Arg.Any<int>(), fakeRequest, Arg.Any<CancellationToken>())
|
||||||
@ -524,12 +525,12 @@ public class DailyReportServiceTest
|
|||||||
.Returns(datesRange);
|
.Returns(datesRange);
|
||||||
|
|
||||||
//act
|
//act
|
||||||
var result = await dailyReportService.GetDatesRangeAsync(idWell, CancellationToken.None);
|
var result = await wellOperationRepositoryMock.GetDatesRangeAsync(idWell, WellOperation.IdOperationTypeFact, CancellationToken.None);
|
||||||
|
|
||||||
//assert
|
//assert
|
||||||
Assert.NotNull(result);
|
Assert.NotNull(result);
|
||||||
Assert.True(result.From <= result.To);
|
Assert.True(result.From <= result.To);
|
||||||
Assert.True(result.To < DateTime.UtcNow.Date);
|
Assert.True(result.To < DateTimeOffset.UtcNow);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<object[]> DateDailyReport()
|
public static IEnumerable<object[]> DateDailyReport()
|
||||||
|
@ -39,7 +39,7 @@ public class FileServiceTest
|
|||||||
IdCategory = idCategory,
|
IdCategory = idCategory,
|
||||||
Name = fileName,
|
Name = fileName,
|
||||||
Size = 0,
|
Size = 0,
|
||||||
UploadDate = DateTime.Now
|
UploadDate = DateTimeOffset.Now
|
||||||
};
|
};
|
||||||
|
|
||||||
private static FileMarkDto fileMark = new()
|
private static FileMarkDto fileMark = new()
|
||||||
|
@ -26,7 +26,7 @@ namespace AsbCloudWebApi.Tests.Services.Notification
|
|||||||
IdUser = 1,
|
IdUser = 1,
|
||||||
IdTransportType = 1,
|
IdTransportType = 1,
|
||||||
IdState = 0,
|
IdState = 0,
|
||||||
RegistrationDate = DateTime.Now,
|
RegistrationDate = DateTimeOffset.Now,
|
||||||
IdNotificationCategory = 10000,
|
IdNotificationCategory = 10000,
|
||||||
};
|
};
|
||||||
private readonly UserExtendedDto user = new UserExtendedDto()
|
private readonly UserExtendedDto user = new UserExtendedDto()
|
||||||
|
@ -34,7 +34,7 @@ namespace AsbCloudWebApi.Tests.Services.Trajectory
|
|||||||
IdUser = 1,
|
IdUser = 1,
|
||||||
IdWell = 4,
|
IdWell = 4,
|
||||||
Radius = 3,
|
Radius = 3,
|
||||||
UpdateDate = DateTime.Now,
|
UpdateDate = DateTimeOffset.Now,
|
||||||
VerticalDepth = 100,
|
VerticalDepth = 100,
|
||||||
WellboreDepth = 100,
|
WellboreDepth = 100,
|
||||||
ZenithAngle = 10
|
ZenithAngle = 10
|
||||||
@ -47,7 +47,7 @@ namespace AsbCloudWebApi.Tests.Services.Trajectory
|
|||||||
IdUser = 1,
|
IdUser = 1,
|
||||||
IdWell = 4,
|
IdWell = 4,
|
||||||
Radius = 3,
|
Radius = 3,
|
||||||
UpdateDate = DateTime.Now,
|
UpdateDate = DateTimeOffset.Now,
|
||||||
VerticalDepth = 100,
|
VerticalDepth = 100,
|
||||||
WellboreDepth = 100,
|
WellboreDepth = 100,
|
||||||
ZenithAngle = 10
|
ZenithAngle = 10
|
||||||
@ -62,7 +62,7 @@ namespace AsbCloudWebApi.Tests.Services.Trajectory
|
|||||||
Comment = "комментарий",
|
Comment = "комментарий",
|
||||||
IdUser = 1,
|
IdUser = 1,
|
||||||
IdWell = 4,
|
IdWell = 4,
|
||||||
UpdateDate = DateTime.Now,
|
UpdateDate = DateTimeOffset.Now,
|
||||||
VerticalDepth = 100,
|
VerticalDepth = 100,
|
||||||
WellboreDepth = 100,
|
WellboreDepth = 100,
|
||||||
ZenithAngle = 10
|
ZenithAngle = 10
|
||||||
@ -74,7 +74,7 @@ namespace AsbCloudWebApi.Tests.Services.Trajectory
|
|||||||
Comment = "комментарий",
|
Comment = "комментарий",
|
||||||
IdUser = 1,
|
IdUser = 1,
|
||||||
IdWell = 4,
|
IdWell = 4,
|
||||||
UpdateDate = DateTime.Now,
|
UpdateDate = DateTimeOffset.Now,
|
||||||
VerticalDepth = 100,
|
VerticalDepth = 100,
|
||||||
WellboreDepth = 100,
|
WellboreDepth = 100,
|
||||||
ZenithAngle = 10
|
ZenithAngle = 10
|
||||||
|
@ -21,7 +21,7 @@ public class WellboreServiceTest
|
|||||||
Id = 1,
|
Id = 1,
|
||||||
IdState = 1,
|
IdState = 1,
|
||||||
IdTelemetry = 1,
|
IdTelemetry = 1,
|
||||||
LastTelemetryDate = DateTime.Now,
|
LastTelemetryDate = DateTimeOffset.Now,
|
||||||
Caption = "well 1"
|
Caption = "well 1"
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ public class WellboreServiceTest
|
|||||||
Id = 2,
|
Id = 2,
|
||||||
IdState = 1,
|
IdState = 1,
|
||||||
IdTelemetry = 100,
|
IdTelemetry = 100,
|
||||||
LastTelemetryDate = DateTime.Now,
|
LastTelemetryDate = DateTimeOffset.Now,
|
||||||
Caption = "well 2"
|
Caption = "well 2"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ using AsbCloudApp.Repositories;
|
|||||||
using AsbCloudApp.Requests;
|
using AsbCloudApp.Requests;
|
||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
using AsbCloudApp.Services.DailyReport;
|
using AsbCloudApp.Services.DailyReport;
|
||||||
|
using AsbCloudDb.Model;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
@ -156,7 +157,7 @@ public class DailyReportController : ControllerBase
|
|||||||
{
|
{
|
||||||
await AssertUserAccessToWell(idWell, cancellationToken);
|
await AssertUserAccessToWell(idWell, cancellationToken);
|
||||||
|
|
||||||
var datesRanges = await dailyReportService.GetDatesRangeAsync(idWell, cancellationToken);
|
var datesRanges = await wellOperationRepository.GetDatesRangeAsync(idWell, WellOperation.IdOperationTypeFact, cancellationToken);
|
||||||
|
|
||||||
return Ok(datesRanges);
|
return Ok(datesRanges);
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns>бурильщик</returns>
|
/// <returns>бурильщик</returns>
|
||||||
[HttpGet("driller")]
|
[HttpGet("driller")]
|
||||||
public async Task<ActionResult<DrillerDto?>> GetDrillerAsync(int idWell, DateTime workTime, CancellationToken token)
|
public async Task<ActionResult<DrillerDto?>> GetDrillerAsync(int idWell, DateTimeOffset workTime, CancellationToken token)
|
||||||
{
|
{
|
||||||
if (!await UserHasAccesToWellAsync(idWell, token))
|
if (!await UserHasAccesToWellAsync(idWell, token))
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
@ -35,7 +35,7 @@ public class NotificationPublisher
|
|||||||
{
|
{
|
||||||
foreach (var notification in groupedNotifications)
|
foreach (var notification in groupedNotifications)
|
||||||
{
|
{
|
||||||
notification.SentDate = DateTime.UtcNow;
|
notification.SentDate = DateTimeOffset.UtcNow;
|
||||||
}
|
}
|
||||||
|
|
||||||
var notifications = groupedNotifications.Select(n => n);
|
var notifications = groupedNotifications.Select(n => n);
|
||||||
|
Loading…
Reference in New Issue
Block a user