forked from ddrilling/AsbCloudServer
refactor WellboreDto
This commit is contained in:
parent
5ff75e519f
commit
d62866919f
@ -5,6 +5,23 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace AsbCloudApp.Data
|
namespace AsbCloudApp.Data
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// базовая информация о скважине
|
||||||
|
/// </summary>
|
||||||
|
public class WellWithTimezoneDto : WellInfoDto
|
||||||
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
|
[Required]
|
||||||
|
public SimpleTimezoneDto Timezone { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 0 - неизвестно,
|
||||||
|
/// 1 - в работе,
|
||||||
|
/// 2 - завершена
|
||||||
|
/// </summary>
|
||||||
|
public int IdState { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Скважина
|
/// Скважина
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -7,41 +7,18 @@ namespace AsbCloudApp.Data;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class WellboreDto
|
public class WellboreDto
|
||||||
{
|
{
|
||||||
/// <summary>
|
public WellWithTimezoneDto Well { get; set; }
|
||||||
/// Идентификатор
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
public int Id { get; set; }
|
/// Идентификатор
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Название
|
/// Название
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; set; } = null!;
|
public string Name { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Идентификатор скважины
|
|
||||||
/// </summary>
|
|
||||||
public int IdWell { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Состояние скважины
|
|
||||||
/// </summary>
|
|
||||||
public int IdWellState { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Идентификатор телеметрии
|
|
||||||
/// </summary>
|
|
||||||
public int? IdWellTelemetry { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Временная зона скважины
|
|
||||||
/// </summary>
|
|
||||||
public SimpleTimezoneDto? WellTimezone { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Название скважины
|
|
||||||
/// </summary>
|
|
||||||
public string WellName { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Начальная глубина ствола
|
/// Начальная глубина ствола
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -7,6 +7,7 @@ using AsbCloudApp.Repositories;
|
|||||||
using AsbCloudApp.Requests;
|
using AsbCloudApp.Requests;
|
||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
using AsbCloudDb.Model;
|
using AsbCloudDb.Model;
|
||||||
|
using Mapster;
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services;
|
namespace AsbCloudInfrastructure.Services;
|
||||||
|
|
||||||
@ -55,13 +56,8 @@ public class WellboreService : IWellboreService
|
|||||||
var groupedOperations = wellOperations.GroupBy(o => o.IdWellSectionType);
|
var groupedOperations = wellOperations.GroupBy(o => o.IdWellSectionType);
|
||||||
var wellWellbores = groupedOperations.Select(group => new WellboreDto {
|
var wellWellbores = groupedOperations.Select(group => new WellboreDto {
|
||||||
Id = group.Key,
|
Id = group.Key,
|
||||||
IdWell = well.Id,
|
|
||||||
IdWellState = well.IdState,
|
|
||||||
IdWellTelemetry = well.IdTelemetry,
|
|
||||||
Name = sections[group.Key].Caption,
|
Name = sections[group.Key].Caption,
|
||||||
WellName = well.Caption,
|
Well = well.Adapt<WellWithTimezoneDto>(),
|
||||||
WellTimezone = well.Timezone,
|
|
||||||
|
|
||||||
DateStart = group.Min(operation => operation.DateStart),
|
DateStart = group.Min(operation => operation.DateStart),
|
||||||
DateEnd = group.Max(operation => operation.DateStart.AddHours(operation.DurationHours)),
|
DateEnd = group.Max(operation => operation.DateStart.AddHours(operation.DurationHours)),
|
||||||
DepthStart = group.Min(operation => operation.DepthStart),
|
DepthStart = group.Min(operation => operation.DepthStart),
|
||||||
@ -71,7 +67,7 @@ public class WellboreService : IWellboreService
|
|||||||
}
|
}
|
||||||
|
|
||||||
return wellbores
|
return wellbores
|
||||||
.OrderBy(w =>w.IdWell).ThenBy(w=>w.Id)
|
.OrderBy(w => w.Well.Id).ThenBy(w => w.Id)
|
||||||
.Skip(skip).Take(take);
|
.Skip(skip).Take(take);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user