diff --git a/AsbCloudApp/Data/SAUB/VersionDto.cs b/AsbCloudApp/Data/SAUB/VersionDto.cs
index 37150f32..581640d3 100644
--- a/AsbCloudApp/Data/SAUB/VersionDto.cs
+++ b/AsbCloudApp/Data/SAUB/VersionDto.cs
@@ -12,21 +12,6 @@ public class VersionDto
///
public int IdWell { get; set; }
- ///
- /// дата начала бурения (заполнения данных на панели)
- ///
- public DateTime DrillingStartDate { get; set; }
-
- ///
- /// идентификатор временной зоны
- ///
- public string? TimeZoneId { get; set; }
-
- ///
- /// смещение в часах относительно UTC
- ///
- public double TimeZoneOffsetTotalHours { get; set; }
-
///
/// название скважины
///
@@ -66,9 +51,4 @@ public class VersionDto
/// версия ПО ПЛК Памп мастер
///
public string? PumpPlcVersion { get; set; }
-
- ///
- /// комментарий
- ///
- public string? Comment { get; set; }
}
\ No newline at end of file
diff --git a/AsbCloudInfrastructure/Services/SAUB/TelemetryService.cs b/AsbCloudInfrastructure/Services/SAUB/TelemetryService.cs
index 24c48795..6de56bdc 100644
--- a/AsbCloudInfrastructure/Services/SAUB/TelemetryService.cs
+++ b/AsbCloudInfrastructure/Services/SAUB/TelemetryService.cs
@@ -80,29 +80,43 @@ public class TelemetryService : ITelemetryService
public async Task> GetVersionsAsync(VersionRequest request, CancellationToken token)
{
- var wells = db.Set()
+ var query = db.Set()
.Include(x => x.RelationCompaniesWells)
+ .ThenInclude(x => x.Company)
+ .Include(x => x.Cluster)
+ .ThenInclude(c => c.Deposit)
.Where(x => x.RelationCompaniesWells.Any(y => y.IdCompany == request.IdCompany));
if (request.IdWellState.HasValue)
- wells = wells.Where(x => x.IdState == request.IdWellState);
+ query = query.Where(x => x.IdState == request.IdWellState);
if (request.IdsWell?.Any() == true)
- wells = wells.Where(x => request.IdsWell.Contains(x.Id));
-
- var idTelemetries = await wells.Where(x => x.IdTelemetry.HasValue)
- .Select(x => x.IdTelemetry!.Value)
- .ToArrayAsync(token);
+ query = query.Where(x => request.IdsWell.Contains(x.Id));
+
+ var wells = await query.Where(x => x.IdTelemetry.HasValue)
+ .ToDictionaryAsync(x => x.Id, x => x, token);
+
+ var idTelemetries = wells.Select(x => x.Value.IdTelemetry!.Value);
var telemetries = GetTelemetryCache()
.Where(x => idTelemetries.Contains(x.Id))
.OrderBy(x => x.Info.DrillingStartDate);
- var dtos = telemetries.Select(x =>
- {
- var dto = x.Info.Adapt();
- dto.IdWell = x.Well!.Id;
- dto.DrillingStartDate = x.Info.DrillingStartDate.ToRemoteDateTime(dto.TimeZoneOffsetTotalHours);
+ var dtos = telemetries.Select(x =>
+ {
+ var well = wells[x.Well!.Id];
+
+ var dto = new VersionDto
+ {
+ IdWell = well.Id,
+ Well = well.Caption,
+ Cluster = well.Cluster.Caption,
+ Deposit = well.Cluster.Deposit.Caption,
+ Customer = well.RelationCompaniesWells.Select(r => r.Company).FirstOrDefault(c => c.IdCompanyType == 1)?.Caption,
+ HmiVersion = x.Info.HmiVersion,
+ SaubPlcVersion = x.Info.SaubPlcVersion,
+ SpinPlcVersion = x.Info.SpinPlcVersion,
+ };
return dto;
});
@@ -110,6 +124,7 @@ public class TelemetryService : ITelemetryService
return dtos;
}
+
[Obsolete("This method will be private. Use TelemetryDto.TimeZone prop.")]
public SimpleTimezoneDto GetTimezone(int idTelemetry)
{