forked from ddrilling/AsbCloudServer
Рефакторинг DTO ГГД. Фикс репозитория
This commit is contained in:
parent
88c928cd5d
commit
151e481a98
@ -6,7 +6,8 @@ namespace AsbCloudApp.Data.WellOperation;
|
|||||||
|
|
||||||
public class WellOperationDto : ItemInfoDto,
|
public class WellOperationDto : ItemInfoDto,
|
||||||
IId,
|
IId,
|
||||||
IWellRelated
|
IWellRelated,
|
||||||
|
IValidatableObject
|
||||||
{
|
{
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
[Required]
|
[Required]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -176,10 +176,10 @@ public class WellOperationRepository : CrudRepositoryBase<WellOperationDto, Well
|
|||||||
private IQueryable<WellOperation> BuildQuery(WellOperationRequest request)
|
private IQueryable<WellOperation> BuildQuery(WellOperationRequest request)
|
||||||
{
|
{
|
||||||
var currentWellOperations = GetQuery()
|
var currentWellOperations = GetQuery()
|
||||||
.Where(e => request.IdsWell != null && request.IdsWell.Contains(e.Id));
|
.Where(e => request.IdsWell != null && request.IdsWell.Contains(e.IdWell));
|
||||||
|
|
||||||
var query = GetQuery()
|
var query = GetQuery()
|
||||||
.Where(e => request.IdsWell != null && request.IdsWell.Contains(e.Id))
|
.Where(e => request.IdsWell != null && request.IdsWell.Contains(e.IdWell))
|
||||||
.Select(o => new WellOperation
|
.Select(o => new WellOperation
|
||||||
{
|
{
|
||||||
Id = o.Id,
|
Id = o.Id,
|
||||||
|
@ -13,6 +13,7 @@ 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.Data.DailyReport.Blocks.WellOperation;
|
using AsbCloudApp.Data.DailyReport.Blocks.WellOperation;
|
||||||
|
using AsbCloudApp.Data.WellOperation;
|
||||||
using AsbCloudApp.Requests;
|
using AsbCloudApp.Requests;
|
||||||
using AsbCloudApp.Services.DailyReport;
|
using AsbCloudApp.Services.DailyReport;
|
||||||
using AsbCloudApp.Services.ProcessMaps.WellDrilling;
|
using AsbCloudApp.Services.ProcessMaps.WellDrilling;
|
||||||
@ -107,14 +108,14 @@ public class DailyReportService : IDailyReportService
|
|||||||
};
|
};
|
||||||
|
|
||||||
var geDate = dailyReport.Date.ToDateTime(TimeOnly.MinValue, DateTimeKind.Unspecified);
|
var geDate = dailyReport.Date.ToDateTime(TimeOnly.MinValue, DateTimeKind.Unspecified);
|
||||||
var ltDate = dailyReport.Date.AddDays(1).ToDateTime(TimeOnly.MinValue, DateTimeKind.Unspecified);
|
var leDate = dailyReport.Date.AddDays(1).ToDateTime(TimeOnly.MinValue, DateTimeKind.Unspecified);
|
||||||
|
|
||||||
var factOperationRequest = new WellOperationRequest
|
var factOperationRequest = new WellOperationRequest
|
||||||
{
|
{
|
||||||
IdWell = idWell,
|
IdsWell = new []{ idWell },
|
||||||
OperationType = WellOperation.IdOperationTypeFact,
|
OperationType = WellOperation.IdOperationTypeFact,
|
||||||
GeDate = geDate,
|
GeDate = geDate,
|
||||||
LtDate = ltDate
|
LeDate = leDate
|
||||||
};
|
};
|
||||||
|
|
||||||
var factWellOperations = (await wellOperationRepository.GetAsync(factOperationRequest, cancellationToken))
|
var factWellOperations = (await wellOperationRepository.GetAsync(factOperationRequest, cancellationToken))
|
||||||
@ -184,14 +185,14 @@ public class DailyReportService : IDailyReportService
|
|||||||
var existingDailyReports = await dailyReportRepository.GetAsync(idWell, request, cancellationToken);
|
var existingDailyReports = await dailyReportRepository.GetAsync(idWell, request, cancellationToken);
|
||||||
|
|
||||||
var geDateFactWellOperation = datesRange.From.AddDays(result.Skip);
|
var geDateFactWellOperation = datesRange.From.AddDays(result.Skip);
|
||||||
var ltDateFactWellOperation = geDateFactWellOperation.AddDays(result.Take);
|
var leDateFactWellOperation = geDateFactWellOperation.AddDays(result.Take);
|
||||||
|
|
||||||
var factWellOperationRequest = new WellOperationRequest
|
var factWellOperationRequest = new WellOperationRequest
|
||||||
{
|
{
|
||||||
IdWell = idWell,
|
IdsWell = new[] { idWell },
|
||||||
OperationType = WellOperation.IdOperationTypeFact,
|
OperationType = WellOperation.IdOperationTypeFact,
|
||||||
GeDate = geDateFactWellOperation,
|
GeDate = geDateFactWellOperation,
|
||||||
LtDate = ltDateFactWellOperation
|
LeDate = leDateFactWellOperation
|
||||||
};
|
};
|
||||||
|
|
||||||
var factWellOperations = await wellOperationRepository.GetAsync(factWellOperationRequest, cancellationToken);
|
var factWellOperations = await wellOperationRepository.GetAsync(factWellOperationRequest, cancellationToken);
|
||||||
@ -200,7 +201,7 @@ public class DailyReportService : IDailyReportService
|
|||||||
{
|
{
|
||||||
for (var day = result.Skip; day - result.Skip < result.Take && datesRange.To.AddDays(-day) >= datesRange.From; day++)
|
for (var day = result.Skip; day - result.Skip < result.Take && datesRange.To.AddDays(-day) >= datesRange.From; day++)
|
||||||
{
|
{
|
||||||
var dateDailyReport = DateOnly.FromDateTime(datesRange.To.AddDays(-day));
|
var dateDailyReport = DateOnly.FromDateTime(datesRange.To.AddDays(-day).DateTime);
|
||||||
|
|
||||||
AddDailyReport(dateDailyReport);
|
AddDailyReport(dateDailyReport);
|
||||||
}
|
}
|
||||||
@ -209,7 +210,7 @@ public class DailyReportService : IDailyReportService
|
|||||||
{
|
{
|
||||||
for (var day = result.Skip; day - result.Skip < result.Take && datesRange.From.AddDays(day) <= datesRange.To; day++)
|
for (var day = result.Skip; day - result.Skip < result.Take && datesRange.From.AddDays(day) <= datesRange.To; day++)
|
||||||
{
|
{
|
||||||
var dateDailyReport = DateOnly.FromDateTime(datesRange.From.AddDays(day));
|
var dateDailyReport = DateOnly.FromDateTime(datesRange.From.AddDays(day).DateTime);
|
||||||
|
|
||||||
AddDailyReport(dateDailyReport);
|
AddDailyReport(dateDailyReport);
|
||||||
}
|
}
|
||||||
@ -401,7 +402,7 @@ public class DailyReportService : IDailyReportService
|
|||||||
WellOperations = factWellOperations.GroupBy(o => o.IdCategory)
|
WellOperations = factWellOperations.GroupBy(o => o.IdCategory)
|
||||||
.Select(g => new WellOperationRecordDto
|
.Select(g => new WellOperationRecordDto
|
||||||
{
|
{
|
||||||
CategoryName = g.First().CategoryName,
|
CategoryName = g.First().OperationCategoryName,
|
||||||
DurationHours = g.Sum(o => o.DurationHours)
|
DurationHours = g.Sum(o => o.DurationHours)
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@ -418,8 +419,8 @@ public class DailyReportService : IDailyReportService
|
|||||||
if (datesRange is null)
|
if (datesRange is null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var from = DateOnly.FromDateTime(datesRange.From);
|
var from = DateOnly.FromDateTime(datesRange.From.DateTime);
|
||||||
var to = DateOnly.FromDateTime(datesRange.To);
|
var to = DateOnly.FromDateTime(datesRange.To.DateTime);
|
||||||
|
|
||||||
return dateDailyReport >= from && dateDailyReport <= to;
|
return dateDailyReport >= from && dateDailyReport <= to;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Http.Extensions;
|
|||||||
using AsbCloudApp.Exceptions;
|
using AsbCloudApp.Exceptions;
|
||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
using AsbCloudApp.Data;
|
using AsbCloudApp.Data;
|
||||||
|
using AsbCloudApp.Data.WellOperation;
|
||||||
using AsbCloudInfrastructure.Services.DetectOperations.Detectors;
|
using AsbCloudInfrastructure.Services.DetectOperations.Detectors;
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.DetectOperations;
|
namespace AsbCloudInfrastructure.Services.DetectOperations;
|
||||||
|
@ -10,6 +10,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using AsbCloudApp.Data.WellOperation;
|
||||||
using AsbCloudInfrastructure.Services.DetectOperations.Detectors;
|
using AsbCloudInfrastructure.Services.DetectOperations.Detectors;
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.DetectOperations;
|
namespace AsbCloudInfrastructure.Services.DetectOperations;
|
||||||
|
@ -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.ToUtcDateTimeOffset(timezone.Hours) ?? DateTime.UtcNow)
|
dateBeginUtc = (dateRange?.To.UtcDateTime ?? DateTime.UtcNow)
|
||||||
.AddSeconds(-intervalSec);
|
.AddSeconds(-intervalSec);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -8,6 +8,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using AsbCloudApp.Data.WellOperation;
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services
|
namespace AsbCloudInfrastructure.Services
|
||||||
{
|
{
|
||||||
@ -133,7 +134,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
this.wellOperationRepository = wellOperationRepository;
|
this.wellOperationRepository = wellOperationRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<Dictionary<int, WellOperationDataDto>>> GetAsync(IEnumerable<int> idsWells, CancellationToken token)
|
public async Task<IEnumerable<Dictionary<int, WellOperationDto>>> GetAsync(IEnumerable<int> idsWells, CancellationToken token)
|
||||||
{
|
{
|
||||||
var sections = await wellSectionTypeRepository.GetAllAsync(token);
|
var sections = await wellSectionTypeRepository.GetAllAsync(token);
|
||||||
var sectionsDict = sections.ToDictionary(s => s.Id, s => s.Caption);
|
var sectionsDict = sections.ToDictionary(s => s.Id, s => s.Caption);
|
||||||
@ -144,7 +145,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
var idsWellSectionTypes = WellSectionTypesWithCategories.Select(t => t.IdSectionType).Distinct();
|
var idsWellSectionTypes = WellSectionTypesWithCategories.Select(t => t.IdSectionType).Distinct();
|
||||||
var usedCategories = WellSectionTypesWithCategories.Select(c => c.IdCategory).Distinct();
|
var usedCategories = WellSectionTypesWithCategories.Select(c => c.IdCategory).Distinct();
|
||||||
|
|
||||||
var wellOperationRequest = new WellsOperationRequest()
|
var wellOperationRequest = new WellOperationRequest
|
||||||
{
|
{
|
||||||
IdsWell = idsWells,
|
IdsWell = idsWells,
|
||||||
OperationCategoryIds = usedCategories,
|
OperationCategoryIds = usedCategories,
|
||||||
@ -155,7 +156,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
|
|
||||||
var renamedOperations = operations.Select(o => UpdateIdWellSectionAndIdCategory(o, sectionsDict, categoriesDict));
|
var renamedOperations = operations.Select(o => UpdateIdWellSectionAndIdCategory(o, sectionsDict, categoriesDict));
|
||||||
|
|
||||||
var wellOperationsWithComposite = new List<Dictionary<int, WellOperationDataDto>>();
|
var wellOperationsWithComposite = new List<Dictionary<int, WellOperationDto>>();
|
||||||
var compositeDepth = 0d;
|
var compositeDepth = 0d;
|
||||||
foreach ((int IdSection, int IdCategory) in WellSectionTypesWithCategories)
|
foreach ((int IdSection, int IdCategory) in WellSectionTypesWithCategories)
|
||||||
{
|
{
|
||||||
@ -168,7 +169,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
|
|
||||||
var groupedByWell = filteredByTemplate.GroupBy(o => o.IdWell);
|
var groupedByWell = filteredByTemplate.GroupBy(o => o.IdWell);
|
||||||
|
|
||||||
var aggreagtedByWell = groupedByWell.Select(g => new WellOperationDataDto
|
var aggreagtedByWell = groupedByWell.Select(g => new WellOperationDto
|
||||||
{
|
{
|
||||||
IdCategory = IdCategory,
|
IdCategory = IdCategory,
|
||||||
IdWell = g.Key,
|
IdWell = g.Key,
|
||||||
@ -197,15 +198,15 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
return wellOperationsWithComposite;
|
return wellOperationsWithComposite;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static WellOperationDataDto UpdateIdWellSectionAndIdCategory(
|
private static WellOperationDto UpdateIdWellSectionAndIdCategory(
|
||||||
WellOperationDataDto dto,
|
WellOperationDto dto,
|
||||||
Dictionary<int, string> sectionTypes,
|
IDictionary<int, string> sectionTypes,
|
||||||
Dictionary<int, string> operationCategories)
|
IDictionary<int, string> operationCategories)
|
||||||
{
|
{
|
||||||
if (dto.IdWellSectionType == wellSectionTransportTable)
|
if (dto.IdWellSectionType == wellSectionTransportTable)
|
||||||
{
|
{
|
||||||
dto.IdWellSectionType = wellSectionProductionString;
|
dto.IdWellSectionType = wellSectionProductionString;
|
||||||
dto.WellSectionTypeCaption = sectionTypes[dto.IdWellSectionType] ?? string.Empty;
|
dto.WellSectionTypeCaption = sectionTypes[dto.IdWellSectionType];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((SettingsForSectionCategoryChange.TryGetValue((dto.IdWellSectionType, dto.IdCategory), out int newIdCategory)))
|
if ((SettingsForSectionCategoryChange.TryGetValue((dto.IdWellSectionType, dto.IdCategory), out int newIdCategory)))
|
||||||
|
@ -10,6 +10,7 @@ using System.Linq;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using AsbCloudApp.Data.SAUB;
|
using AsbCloudApp.Data.SAUB;
|
||||||
|
using AsbCloudApp.Data.WellOperation;
|
||||||
using AsbCloudApp.Repositories;
|
using AsbCloudApp.Repositories;
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.WellOperationService;
|
namespace AsbCloudInfrastructure.Services.WellOperationService;
|
||||||
@ -552,8 +553,8 @@ public class OperationsStatService : IOperationsStatService
|
|||||||
private static WellOperationDto Convert(WellOperation source, double tzOffsetHours)
|
private static WellOperationDto Convert(WellOperation source, double tzOffsetHours)
|
||||||
{
|
{
|
||||||
var destination = source.Adapt<WellOperationDto>();
|
var destination = source.Adapt<WellOperationDto>();
|
||||||
destination.CategoryName = source.OperationCategory?.Name;
|
destination.OperationCategoryName = source.OperationCategory.Name;
|
||||||
destination.WellSectionTypeName = source.WellSectionType?.Caption;
|
destination.WellSectionTypeCaption = source.WellSectionType.Caption;
|
||||||
destination.DateStart = source.DateStart.ToRemoteDateTime(tzOffsetHours);
|
destination.DateStart = source.DateStart.ToRemoteDateTime(tzOffsetHours);
|
||||||
return destination;
|
return destination;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
this.telemetryService = telemetryService;
|
this.telemetryService = telemetryService;
|
||||||
this.timezoneService = timezoneService;
|
this.timezoneService = timezoneService;
|
||||||
this.wellInfoService = wellInfoService;
|
this.wellInfoService = wellInfoService;
|
||||||
this.wellOperationRepository = new WellOperationRepository(db, memoryCache, this, wellOperationCategoryRepository);
|
wellOperationRepository = new WellOperationRepository(db, memoryCache, wellOperationCategoryRepository, this);
|
||||||
companyTypesService = new CrudCacheRepositoryBase<CompanyTypeDto, CompanyType>(dbContext, memoryCache);
|
companyTypesService = new CrudCacheRepositoryBase<CompanyTypeDto, CompanyType>(dbContext, memoryCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
return DateTime.MinValue;
|
return DateTime.MinValue;
|
||||||
|
|
||||||
var datesRange = telemetryService.GetDatesRange(well.IdTelemetry.Value);
|
var datesRange = telemetryService.GetDatesRange(well.IdTelemetry.Value);
|
||||||
return datesRange.To;
|
return datesRange.To.DateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@ -273,12 +273,13 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
if (entity.Timezone is null)
|
if (entity.Timezone is null)
|
||||||
dto.Timezone = GetTimezone(entity.Id);
|
dto.Timezone = GetTimezone(entity.Id);
|
||||||
|
|
||||||
dto.StartDate = wellOperationRepository.FirstOperationDate(entity.Id)?.ToRemoteDateTime(dto.Timezone.Hours);
|
//TODO: фикс
|
||||||
|
//dto.StartDate = wellOperationRepository.GetDatesRangeAsync(entity.Id, ).FirstOperationDate(entity.Id)?.ToRemoteDateTime(dto.Timezone.Hours);
|
||||||
dto.WellType = entity.WellType.Caption;
|
dto.WellType = entity.WellType.Caption;
|
||||||
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;
|
dto.LastTelemetryDate = telemetryService.GetDatesRange(entity.IdTelemetry.Value).To.DateTime;
|
||||||
dto.Companies = entity.RelationCompaniesWells
|
dto.Companies = entity.RelationCompaniesWells
|
||||||
.Select(r => Convert(r.Company))
|
.Select(r => Convert(r.Company))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -19,6 +19,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using AsbCloudApp.Data.WellOperation;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace AsbCloudWebApi.Tests.Services;
|
namespace AsbCloudWebApi.Tests.Services;
|
||||||
@ -154,7 +155,7 @@ public class DailyReportServiceTest
|
|||||||
IdWell = idWell,
|
IdWell = idWell,
|
||||||
IdParentCategory = 4001,
|
IdParentCategory = 4001,
|
||||||
IdWellSectionType = 1,
|
IdWellSectionType = 1,
|
||||||
CategoryName = "Механическое. бурение",
|
OperationCategoryName = "Механическое. бурение",
|
||||||
DateStart = new DateTime(2023, 10, 26),
|
DateStart = new DateTime(2023, 10, 26),
|
||||||
DepthStart = 80,
|
DepthStart = 80,
|
||||||
DepthEnd = 150,
|
DepthEnd = 150,
|
||||||
@ -164,7 +165,7 @@ public class DailyReportServiceTest
|
|||||||
private readonly WellOperationDto fakeLastFactWellOperation = new()
|
private readonly WellOperationDto fakeLastFactWellOperation = new()
|
||||||
{
|
{
|
||||||
IdWell = idWell,
|
IdWell = idWell,
|
||||||
CategoryName = "Механическое. бурение",
|
OperationCategoryName = "Механическое. бурение",
|
||||||
IdWellSectionType = 1,
|
IdWellSectionType = 1,
|
||||||
IdParentCategory = 4001,
|
IdParentCategory = 4001,
|
||||||
DateStart = new DateTime(2023, 10, 26),
|
DateStart = new DateTime(2023, 10, 26),
|
||||||
|
@ -15,6 +15,7 @@ using System.Threading.Tasks;
|
|||||||
using Xunit;
|
using Xunit;
|
||||||
using AsbCloudApp.Repositories;
|
using AsbCloudApp.Repositories;
|
||||||
using AsbCloudApp.Data;
|
using AsbCloudApp.Data;
|
||||||
|
using AsbCloudApp.Data.WellOperation;
|
||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
|
|
||||||
namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
||||||
@ -50,9 +51,9 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
new() {Id = 31, Caption = "Техническая колонна", Order = 2}
|
new() {Id = 31, Caption = "Техническая колонна", Order = 2}
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly static IEnumerable<WellOperationDataDto> wellOperations1 = new List<WellOperationDataDto>()
|
private readonly static IEnumerable<WellOperationDto> wellOperations1 = new List<WellOperationDto>()
|
||||||
{
|
{
|
||||||
new WellOperationDataDto()
|
new()
|
||||||
{
|
{
|
||||||
DepthStart = 50,
|
DepthStart = 50,
|
||||||
DurationHours = 1,
|
DurationHours = 1,
|
||||||
@ -62,7 +63,7 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
OperationCategoryName = "Шаблонирование перед спуском",
|
OperationCategoryName = "Шаблонирование перед спуском",
|
||||||
WellSectionTypeCaption = "Направление"
|
WellSectionTypeCaption = "Направление"
|
||||||
},
|
},
|
||||||
new WellOperationDataDto()
|
new()
|
||||||
{
|
{
|
||||||
DepthStart = 84,
|
DepthStart = 84,
|
||||||
DurationHours = 1,
|
DurationHours = 1,
|
||||||
@ -74,9 +75,9 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly static IEnumerable<WellOperationDataDto> wellOperations2 = new List<WellOperationDataDto>()
|
private readonly static IEnumerable<WellOperationDto> wellOperations2 = new List<WellOperationDto>()
|
||||||
{
|
{
|
||||||
new WellOperationDataDto()
|
new()
|
||||||
{
|
{
|
||||||
DepthStart = 10,
|
DepthStart = 10,
|
||||||
DurationHours = 1.5,
|
DurationHours = 1.5,
|
||||||
@ -86,7 +87,7 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
OperationCategoryName = "Бурение ротором",
|
OperationCategoryName = "Бурение ротором",
|
||||||
WellSectionTypeCaption = "Направление"
|
WellSectionTypeCaption = "Направление"
|
||||||
},
|
},
|
||||||
new WellOperationDataDto()
|
new()
|
||||||
{
|
{
|
||||||
DepthStart = 20,
|
DepthStart = 20,
|
||||||
DurationHours = 3.5,
|
DurationHours = 3.5,
|
||||||
@ -98,9 +99,9 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly static IEnumerable<WellOperationDataDto> wellOperations3 = new List<WellOperationDataDto>()
|
private readonly static IEnumerable<WellOperationDto> wellOperations3 = new List<WellOperationDto>()
|
||||||
{
|
{
|
||||||
new WellOperationDataDto()
|
new()
|
||||||
{
|
{
|
||||||
DepthStart = 1372,
|
DepthStart = 1372,
|
||||||
DurationHours = 3,
|
DurationHours = 3,
|
||||||
@ -110,7 +111,7 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
OperationCategoryName = "Промывка",
|
OperationCategoryName = "Промывка",
|
||||||
WellSectionTypeCaption = "Кондуктор"
|
WellSectionTypeCaption = "Кондуктор"
|
||||||
},
|
},
|
||||||
new WellOperationDataDto()
|
new()
|
||||||
{
|
{
|
||||||
DepthStart = 1435,
|
DepthStart = 1435,
|
||||||
DurationHours = 4,
|
DurationHours = 4,
|
||||||
@ -122,9 +123,9 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly static IEnumerable<WellOperationDataDto> wellOperations4 = new List<WellOperationDataDto>()
|
private readonly static IEnumerable<WellOperationDto> wellOperations4 = new List<WellOperationDto>()
|
||||||
{
|
{
|
||||||
new WellOperationDataDto()
|
new()
|
||||||
{
|
{
|
||||||
DepthStart = 1000,
|
DepthStart = 1000,
|
||||||
DurationHours = 10,
|
DurationHours = 10,
|
||||||
@ -134,7 +135,7 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
OperationCategoryName = "Подъем инструмента",
|
OperationCategoryName = "Подъем инструмента",
|
||||||
WellSectionTypeCaption = "Техническая колонна"
|
WellSectionTypeCaption = "Техническая колонна"
|
||||||
},
|
},
|
||||||
new WellOperationDataDto()
|
new()
|
||||||
{
|
{
|
||||||
DepthStart = 500,
|
DepthStart = 500,
|
||||||
DurationHours = 5,
|
DurationHours = 5,
|
||||||
@ -144,7 +145,7 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
OperationCategoryName = "Проработка принудительная",
|
OperationCategoryName = "Проработка принудительная",
|
||||||
WellSectionTypeCaption = "Техническая колонна"
|
WellSectionTypeCaption = "Техническая колонна"
|
||||||
},
|
},
|
||||||
new WellOperationDataDto()
|
new()
|
||||||
{
|
{
|
||||||
DepthStart = 600,
|
DepthStart = 600,
|
||||||
DurationHours = 5,
|
DurationHours = 5,
|
||||||
@ -181,7 +182,7 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
public async Task GetAsync_return_composite_and_others_with_category_5013()
|
public async Task GetAsync_return_composite_and_others_with_category_5013()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
wellOperationRepository.GetAsync(Arg.Any<WellsOperationRequest>(), Arg.Any<CancellationToken>())
|
wellOperationRepository.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())
|
||||||
.Returns(wellOperations1);
|
.Returns(wellOperations1);
|
||||||
|
|
||||||
var idsWell = new List<int>() { 55, 64 };
|
var idsWell = new List<int>() { 55, 64 };
|
||||||
@ -216,7 +217,7 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
public async Task GetAsync_return_composite_with_minimum_depth_start()
|
public async Task GetAsync_return_composite_with_minimum_depth_start()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
wellOperationRepository.GetAsync(Arg.Any<WellsOperationRequest>(), Arg.Any<CancellationToken>())
|
wellOperationRepository.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())
|
||||||
.Returns(wellOperations2);
|
.Returns(wellOperations2);
|
||||||
|
|
||||||
var idsWell = new List<int>() { 55, 64 };
|
var idsWell = new List<int>() { 55, 64 };
|
||||||
@ -242,7 +243,7 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
public async Task GetAsync_return_data3()
|
public async Task GetAsync_return_data3()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
wellOperationRepository.GetAsync(Arg.Any<WellsOperationRequest>(), Arg.Any<CancellationToken>())
|
wellOperationRepository.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())
|
||||||
.Returns(wellOperations3);
|
.Returns(wellOperations3);
|
||||||
|
|
||||||
var idsWell = new List<int>() { 55, 64 };
|
var idsWell = new List<int>() { 55, 64 };
|
||||||
@ -272,7 +273,7 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
public async Task GetAsync_return_data4()
|
public async Task GetAsync_return_data4()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
wellOperationRepository.GetAsync(Arg.Any<WellsOperationRequest>(), Arg.Any<CancellationToken>())
|
wellOperationRepository.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())
|
||||||
.Returns(wellOperations4);
|
.Returns(wellOperations4);
|
||||||
|
|
||||||
var idsWell = new List<int>() { 55, 64 };
|
var idsWell = new List<int>() { 55, 64 };
|
||||||
@ -312,13 +313,13 @@ namespace AsbCloudWebApi.Tests.Services.WellCompositeOperation
|
|||||||
public async Task GetAsync_return_data5()
|
public async Task GetAsync_return_data5()
|
||||||
{
|
{
|
||||||
// arrange
|
// arrange
|
||||||
var wellOperations = new List<WellOperationDataDto>();
|
var wellOperations = new List<WellOperationDto>();
|
||||||
wellOperations.AddRange(wellOperations1);
|
wellOperations.AddRange(wellOperations1);
|
||||||
wellOperations.AddRange(wellOperations2);
|
wellOperations.AddRange(wellOperations2);
|
||||||
wellOperations.AddRange(wellOperations3);
|
wellOperations.AddRange(wellOperations3);
|
||||||
wellOperations.AddRange(wellOperations4);
|
wellOperations.AddRange(wellOperations4);
|
||||||
|
|
||||||
wellOperationRepository.GetAsync(Arg.Any<WellsOperationRequest>(), Arg.Any<CancellationToken>())
|
wellOperationRepository.GetAsync(Arg.Any<WellOperationRequest>(), Arg.Any<CancellationToken>())
|
||||||
.Returns(wellOperations);
|
.Returns(wellOperations);
|
||||||
|
|
||||||
var idsWell = new List<int>() { 55, 64 };
|
var idsWell = new List<int>() { 55, 64 };
|
||||||
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using AsbCloudApp.Data.WellOperation;
|
||||||
|
|
||||||
namespace AsbCloudWebApi.Controllers
|
namespace AsbCloudWebApi.Controllers
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using AsbCloudApp.Data;
|
using AsbCloudApp.Data.DetectedOperation;
|
||||||
using AsbCloudApp.Data.DetectedOperation;
|
|
||||||
using AsbCloudApp.Requests;
|
using AsbCloudApp.Requests;
|
||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
@ -7,6 +6,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using AsbCloudApp.Data.WellOperation;
|
||||||
using AsbCloudInfrastructure.Services.DetectOperations;
|
using AsbCloudInfrastructure.Services.DetectOperations;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using AsbCloudApp.Data.WellOperation;
|
||||||
|
|
||||||
namespace AsbCloudWebApi.Controllers
|
namespace AsbCloudWebApi.Controllers
|
||||||
{
|
{
|
||||||
@ -24,7 +25,7 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[ProducesResponseType(typeof(IList<IDictionary<int, WellOperationDataDto>>), (int)System.Net.HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(IList<IDictionary<int, WellOperationDto>>), (int)System.Net.HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> GetAsync([FromQuery] IEnumerable<int> idsWells, CancellationToken token)
|
public async Task<IActionResult> GetAsync([FromQuery] IEnumerable<int> idsWells, CancellationToken token)
|
||||||
{
|
{
|
||||||
foreach (var idWell in idsWells)
|
foreach (var idWell in idsWells)
|
||||||
|
Loading…
Reference in New Issue
Block a user