diff --git a/AsbCloudApp/Data/WellOperationsDto.cs b/AsbCloudApp/Data/WellOperationsDto.cs
deleted file mode 100644
index 75fc1026..00000000
--- a/AsbCloudApp/Data/WellOperationsDto.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-namespace AsbCloudApp.Data
-{
- public class WellOperationsDto : IId
- {
- public int Id { get; set; }
-
-
- ///
- /// Глубина план, м
- ///
- public double WellDepthPlan { get; set; }
-
- ///
- /// Глубина факт, м
- ///
- public double WellDepthFact { get; set; }
-
- ///
- /// Период план, д
- ///
- public double DurationPlan { get; set; }
-
- ///
- /// Период факт, д
- ///
- public double DurationFact { get; set; }
-
- ///
- /// Механическая скорость проходки план, м/час
- ///
- public double MechSpeedPlan { get; set; }
-
- ///
- /// Механическая скорость проходки факт, м/час
- ///
- public double MechSpeedFact { get; set; }
-
- ///
- /// Рейсовая скорость план, м/час
- ///
- public double RouteSpeedPlan { get; set; }
-
- ///
- /// Рейсовая скорость план, м/час
- ///
- public double RouteSpeedFact { get; set; }
-
- ///
- /// Скорость подъема КНБК план
- ///
- public double BhaUpSpeedPlan { get; set; }
-
- ///
- /// Скорость подъема КНБК факт
- ///
- public double BhaUpSpeedFact { get; set; }
-
- ///
- /// Скорость спуска КНБК план
- ///
- public double BhaDownSpeedPlan { get; set; }
-
- ///
- /// Скорость спуска КНБК факт
- ///
- public double BhaDownSpeedFact { get; set; }
-
- ///
- /// Скорость спуска обсадной колонны план
- ///
- public double CasingDownSpeedPlan { get; set; }
-
- ///
- /// Скорость спуска обсадной колонны факт
- ///
- public double CasingDownSpeedFact { get; set; }
- }
-}
diff --git a/AsbCloudApp/Services/IWellSectionService.cs b/AsbCloudApp/Services/IWellSectionService.cs
index f1cce60b..46a6b949 100644
--- a/AsbCloudApp/Services/IWellSectionService.cs
+++ b/AsbCloudApp/Services/IWellSectionService.cs
@@ -1,4 +1,5 @@
using AsbCloudApp.Data;
+using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@@ -6,10 +7,9 @@ namespace AsbCloudApp.Services
{
public interface IWellSectionService
{
- Task> GetAggregatedWellByWellIdAsync(int idWell,
- int skip, int take, CancellationToken token);
- Task> GetSectionsByWellIdAsync(int idWell, int skip = 0, int take = 32,
+ Task> GetSectionsByWellIdAsync(int idWell,
+ CancellationToken token = default);
+ Task GetSectionByWellIdAsync(int id,
CancellationToken token = default);
- Task GetSectionByWellIdAsync(int id, CancellationToken token = default);
}
}
diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs
index 21c1bc95..0f9ce0d1 100644
--- a/AsbCloudDb/Model/AsbCloudDbContext.cs
+++ b/AsbCloudDb/Model/AsbCloudDbContext.cs
@@ -297,12 +297,13 @@ namespace AsbCloudDb.Model
modelBuilder.Entity(entity => {
entity.HasData(new List{
- new WellSectionType{ Id = 1, Caption = "Пилотный ствол"},
- new WellSectionType{ Id = 2, Caption = "Направление"},
- new WellSectionType{ Id = 3, Caption = "Кондуктор"},
- new WellSectionType{ Id = 4, Caption = "Эксплуатационная колонна"},
- new WellSectionType{ Id = 5, Caption = "Транспортный ствол"},
- new WellSectionType{ Id = 6, Caption = "Хвостовик"},
+ new WellSectionType{ Id = 1, Caption = "Обощенное по скважине"},
+ new WellSectionType{ Id = 2, Caption = "Пилотный ствол"},
+ new WellSectionType{ Id = 3, Caption = "Направление"},
+ new WellSectionType{ Id = 4, Caption = "Кондуктор"},
+ new WellSectionType{ Id = 5, Caption = "Эксплуатационная колонна"},
+ new WellSectionType{ Id = 6, Caption = "Транспортный ствол"},
+ new WellSectionType{ Id = 7, Caption = "Хвостовик"},
});
});
}
@@ -392,208 +393,206 @@ namespace AsbCloudDb.Model
modelBuilder.Entity(entity =>
{
entity.HasData(new List {
- new WellOperation{ Id = 1, IdWell = 1, IdWellSectionType = 1,
+ new WellOperation{ Id = 1, IdWell = 1, IdWellSectionType = 2,
IdCategory = 1001, IdType = 0,
WellDepth = 200, StartDate = DateTime.Now.AddHours(1),
DurationHours = 1.2},
- new WellOperation{ Id = 2, IdWell = 1, IdWellSectionType = 1,
+ new WellOperation{ Id = 2, IdWell = 1, IdWellSectionType = 2,
IdCategory = 1001, IdType = 0,
WellDepth = 300, StartDate = DateTime.Now.AddHours(2.5),
DurationHours = 1.5},
- new WellOperation{ Id = 3, IdWell = 1, IdWellSectionType = 1,
+ new WellOperation{ Id = 3, IdWell = 1, IdWellSectionType = 2,
IdCategory = 1001, IdType = 1,
WellDepth = 210, StartDate = DateTime.Now.AddHours(1.5),
DurationHours = 1},
- new WellOperation{ Id = 4, IdWell = 1, IdWellSectionType = 1,
+ new WellOperation{ Id = 4, IdWell = 1, IdWellSectionType = 2,
IdCategory = 1001, IdType = 1,
WellDepth = 310, StartDate = DateTime.Now.AddHours(2),
DurationHours = 1.5},
- new WellOperation{ Id = 5, IdWell = 1, IdWellSectionType = 2,
+ new WellOperation{ Id = 5, IdWell = 1, IdWellSectionType = 3,
IdCategory = 1001, IdType = 0,
WellDepth = 200, StartDate = DateTime.Now.AddHours(1),
DurationHours = 1.2},
- new WellOperation{ Id = 6, IdWell = 1, IdWellSectionType = 2,
+ new WellOperation{ Id = 6, IdWell = 1, IdWellSectionType = 3,
IdCategory = 1001, IdType = 0,
WellDepth = 300, StartDate = DateTime.Now.AddHours(2.5),
DurationHours = 1.5},
- new WellOperation{ Id = 7, IdWell = 1, IdWellSectionType = 2,
+ new WellOperation{ Id = 7, IdWell = 1, IdWellSectionType = 3,
IdCategory = 1001, IdType = 1,
WellDepth = 210, StartDate = DateTime.Now.AddHours(1.5),
DurationHours = 1},
- new WellOperation{ Id = 8, IdWell = 1, IdWellSectionType = 2,
+ new WellOperation{ Id = 8, IdWell = 1, IdWellSectionType = 3,
IdCategory = 1001, IdType = 1,
WellDepth = 310, StartDate = DateTime.Now.AddHours(2),
DurationHours = 1.5},
- new WellOperation{ Id = 9, IdWell = 1, IdWellSectionType = 3,
+ new WellOperation{ Id = 9, IdWell = 1, IdWellSectionType = 4,
IdCategory = 1001, IdType = 0,
WellDepth = 500, StartDate = DateTime.Now.AddHours(1),
DurationHours = 1.2},
- new WellOperation{ Id = 10, IdWell = 1, IdWellSectionType = 3,
+ new WellOperation{ Id = 10, IdWell = 1, IdWellSectionType = 4,
IdCategory = 1001, IdType = 0,
WellDepth = 510, StartDate = DateTime.Now.AddHours(2),
DurationHours = 1.2},
- new WellOperation{ Id = 11, IdWell = 1, IdWellSectionType = 3,
+ new WellOperation{ Id = 11, IdWell = 1, IdWellSectionType = 4,
IdCategory = 1001, IdType = 1,
WellDepth = 510, StartDate = DateTime.Now.AddHours(1.5),
DurationHours = 1},
- new WellOperation{ Id = 12, IdWell = 1, IdWellSectionType = 3,
+ new WellOperation{ Id = 12, IdWell = 1, IdWellSectionType = 4,
IdCategory = 1001, IdType = 1,
WellDepth = 520, StartDate = DateTime.Now.AddHours(2),
DurationHours = 1.5},
- new WellOperation{ Id = 13, IdWell = 1, IdWellSectionType = 1,
+ new WellOperation{ Id = 13, IdWell = 1, IdWellSectionType = 2,
IdCategory = 1046, IdType = 0,
WellDepth = 200, StartDate = DateTime.Now.AddHours(2.5),
DurationHours = 15.5},
- new WellOperation{ Id = 14, IdWell = 1, IdWellSectionType = 1,
+ new WellOperation{ Id = 14, IdWell = 1, IdWellSectionType = 2,
IdCategory = 1046, IdType = 0,
WellDepth = 210, StartDate = DateTime.Now.AddHours(3),
DurationHours = 17.2},
- new WellOperation{ Id = 15, IdWell = 1, IdWellSectionType = 1,
+ new WellOperation{ Id = 15, IdWell = 1, IdWellSectionType = 2,
IdCategory = 1046, IdType = 1,
WellDepth = 220, StartDate = DateTime.Now.AddHours(2.7),
DurationHours = 15.2},
- new WellOperation{ Id = 16, IdWell = 1, IdWellSectionType = 1,
+ new WellOperation{ Id = 16, IdWell = 1, IdWellSectionType = 2,
IdCategory = 1046, IdType = 1,
WellDepth = 230, StartDate = DateTime.Now.AddHours(3.1),
DurationHours = 17.8},
- new WellOperation{ Id = 17, IdWell = 1, IdWellSectionType = 2,
+ new WellOperation{ Id = 17, IdWell = 1, IdWellSectionType = 3,
IdCategory = 1046, IdType = 0,
WellDepth = 200, StartDate = DateTime.Now.AddHours(2.5),
DurationHours = 15.5},
- new WellOperation{ Id = 18, IdWell = 1, IdWellSectionType = 2,
+ new WellOperation{ Id = 18, IdWell = 1, IdWellSectionType = 3,
IdCategory = 1046, IdType = 0,
WellDepth = 210, StartDate = DateTime.Now.AddHours(3),
DurationHours = 17.2},
- new WellOperation{ Id = 19, IdWell = 1, IdWellSectionType = 2,
+ new WellOperation{ Id = 19, IdWell = 1, IdWellSectionType = 3,
IdCategory = 1046, IdType = 1,
WellDepth = 220, StartDate = DateTime.Now.AddHours(2.7),
DurationHours = 15.2},
- new WellOperation{ Id = 20, IdWell = 1, IdWellSectionType = 2,
+ new WellOperation{ Id = 20, IdWell = 1, IdWellSectionType = 3,
IdCategory = 1046, IdType = 1,
WellDepth = 230, StartDate = DateTime.Now.AddHours(3.1),
DurationHours = 17.8},
- new WellOperation{ Id = 21, IdWell = 1, IdWellSectionType = 3,
+ new WellOperation{ Id = 21, IdWell = 1, IdWellSectionType = 4,
IdCategory = 1046, IdType = 0,
WellDepth = 700, StartDate = DateTime.Now.AddHours(2.5),
DurationHours = 16.2},
- new WellOperation{ Id = 22, IdWell = 1, IdWellSectionType = 3,
+ new WellOperation{ Id = 22, IdWell = 1, IdWellSectionType = 4,
IdCategory = 1046, IdType = 0,
WellDepth = 720, StartDate = DateTime.Now.AddHours(3.5),
DurationHours = 17.2},
- new WellOperation{ Id = 23, IdWell = 1, IdWellSectionType = 3,
+ new WellOperation{ Id = 23, IdWell = 1, IdWellSectionType = 4,
IdCategory = 1046, IdType = 1,
WellDepth = 715, StartDate = DateTime.Now.AddHours(2.7),
DurationHours = 15.2},
- new WellOperation{ Id = 24, IdWell = 1, IdWellSectionType = 3,
+ new WellOperation{ Id = 24, IdWell = 1, IdWellSectionType = 4,
IdCategory = 1046, IdType = 1,
WellDepth = 720, StartDate = DateTime.Now.AddHours(3),
DurationHours = 18.2},
- new WellOperation{ Id = 25, IdWell = 1, IdWellSectionType = 1,
+ new WellOperation{ Id = 25, IdWell = 1, IdWellSectionType = 2,
IdCategory = 1047, IdType = 0,
WellDepth = 600, StartDate = DateTime.Now.AddHours(4),
DurationHours = 5},
- new WellOperation{ Id = 26, IdWell = 1, IdWellSectionType = 1,
+ new WellOperation{ Id = 26, IdWell = 1, IdWellSectionType = 2,
IdCategory = 1047, IdType = 0,
WellDepth = 650, StartDate = DateTime.Now.AddHours(4.5),
DurationHours = 5.5},
- new WellOperation{ Id = 27, IdWell = 1, IdWellSectionType = 1,
+ new WellOperation{ Id = 27, IdWell = 1, IdWellSectionType = 2,
IdCategory = 1047, IdType = 1,
WellDepth = 700, StartDate = DateTime.Now.AddHours(5.5),
DurationHours = 8},
- new WellOperation{ Id = 28, IdWell = 1, IdWellSectionType = 1,
+ new WellOperation{ Id = 28, IdWell = 1, IdWellSectionType = 2,
IdCategory = 1047, IdType = 1,
WellDepth = 710, StartDate = DateTime.Now.AddHours(5.7),
DurationHours = 7.2},
- new WellOperation{ Id = 29, IdWell = 1, IdWellSectionType = 2,
+ new WellOperation{ Id = 29, IdWell = 1, IdWellSectionType = 3,
IdCategory = 1047, IdType = 0,
WellDepth = 600, StartDate = DateTime.Now.AddHours(4),
DurationHours = 5},
- new WellOperation{ Id = 30, IdWell = 1, IdWellSectionType = 2,
+ new WellOperation{ Id = 30, IdWell = 1, IdWellSectionType = 3,
IdCategory = 1047, IdType = 0,
WellDepth = 650, StartDate = DateTime.Now.AddHours(4.5),
DurationHours = 5.5},
- new WellOperation{ Id = 31, IdWell = 1, IdWellSectionType = 2,
+ new WellOperation{ Id = 31, IdWell = 1, IdWellSectionType = 3,
IdCategory = 1047, IdType = 1,
WellDepth = 700, StartDate = DateTime.Now.AddHours(5.5),
DurationHours = 8},
- new WellOperation{ Id = 32, IdWell = 1, IdWellSectionType = 2,
+ new WellOperation{ Id = 32, IdWell = 1, IdWellSectionType = 3,
IdCategory = 1047, IdType = 1,
WellDepth = 710, StartDate = DateTime.Now.AddHours(5.7),
DurationHours = 7.2},
- new WellOperation{ Id = 33, IdWell = 1, IdWellSectionType = 3,
+ new WellOperation{ Id = 33, IdWell = 1, IdWellSectionType = 4,
IdCategory = 1047, IdType = 0,
WellDepth = 1000, StartDate = DateTime.Now.AddHours(5.25),
DurationHours = 2.1},
- new WellOperation{ Id = 34, IdWell = 1, IdWellSectionType = 3,
+ new WellOperation{ Id = 34, IdWell = 1, IdWellSectionType = 4,
IdCategory = 1047, IdType = 0,
WellDepth = 1100, StartDate = DateTime.Now.AddHours(7.5),
DurationHours = 2},
- new WellOperation{ Id = 35, IdWell = 1, IdWellSectionType = 3,
+ new WellOperation{ Id = 35, IdWell = 1, IdWellSectionType = 4,
IdCategory = 1047, IdType = 1,
WellDepth = 1000, StartDate = DateTime.Now.AddHours(5.15),
DurationHours = 2.75},
- new WellOperation{ Id = 36, IdWell = 1, IdWellSectionType = 3,
+ new WellOperation{ Id = 36, IdWell = 1, IdWellSectionType = 4,
IdCategory = 1047, IdType = 1,
WellDepth = 1250, StartDate = DateTime.Now.AddHours(6.5),
DurationHours = 3.5},
-
-
- new WellOperation{ Id = 37, IdWell = 1, IdWellSectionType = 1,
+ new WellOperation{ Id = 37, IdWell = 1, IdWellSectionType = 2,
IdCategory = 1048, IdType = 0,
WellDepth = 600, StartDate = DateTime.Now.AddHours(4),
DurationHours = 5},
- new WellOperation{ Id = 38, IdWell = 1, IdWellSectionType = 1,
+ new WellOperation{ Id = 38, IdWell = 1, IdWellSectionType = 2,
IdCategory = 1048, IdType = 0,
WellDepth = 650, StartDate = DateTime.Now.AddHours(4.2),
DurationHours = 5.5},
- new WellOperation{ Id = 39, IdWell = 1, IdWellSectionType = 1,
+ new WellOperation{ Id = 39, IdWell = 1, IdWellSectionType = 2,
IdCategory = 1048, IdType = 1,
WellDepth = 700, StartDate = DateTime.Now.AddHours(5.5),
DurationHours = 7},
- new WellOperation{ Id = 40, IdWell = 1, IdWellSectionType = 1,
+ new WellOperation{ Id = 40, IdWell = 1, IdWellSectionType = 2,
IdCategory = 1048, IdType = 1,
WellDepth = 710, StartDate = DateTime.Now.AddHours(5.7),
DurationHours = 7.5},
- new WellOperation{ Id = 41, IdWell = 1, IdWellSectionType = 2,
+ new WellOperation{ Id = 41, IdWell = 1, IdWellSectionType = 3,
IdCategory = 1048, IdType = 0,
WellDepth = 600, StartDate = DateTime.Now.AddHours(4),
DurationHours = 5},
- new WellOperation{ Id = 42, IdWell = 1, IdWellSectionType = 2,
+ new WellOperation{ Id = 42, IdWell = 1, IdWellSectionType = 3,
IdCategory = 1048, IdType = 0,
WellDepth = 650, StartDate = DateTime.Now.AddHours(4.2),
DurationHours = 5.5},
- new WellOperation{ Id = 43, IdWell = 1, IdWellSectionType = 2,
+ new WellOperation{ Id = 43, IdWell = 1, IdWellSectionType = 3,
IdCategory = 1048, IdType = 1,
WellDepth = 700, StartDate = DateTime.Now.AddHours(5.5),
DurationHours = 7},
- new WellOperation{ Id = 44, IdWell = 1, IdWellSectionType = 2,
+ new WellOperation{ Id = 44, IdWell = 1, IdWellSectionType = 3,
IdCategory = 1048, IdType = 1,
WellDepth = 710, StartDate = DateTime.Now.AddHours(5.7),
DurationHours = 7.5},
- new WellOperation{ Id = 48, IdWell = 1, IdWellSectionType = 2,
+ new WellOperation{ Id = 48, IdWell = 1, IdWellSectionType = 3,
IdCategory = 1048, IdType = 0,
WellDepth = 910, StartDate = DateTime.Now.AddHours(5),
DurationHours = 12},
- new WellOperation{ Id = 49, IdWell = 1, IdWellSectionType = 3,
+ new WellOperation{ Id = 49, IdWell = 1, IdWellSectionType = 4,
IdCategory = 1048, IdType = 0,
WellDepth = 910, StartDate = DateTime.Now.AddHours(5),
DurationHours = 2},
- new WellOperation{ Id = 50, IdWell = 1, IdWellSectionType = 3,
+ new WellOperation{ Id = 50, IdWell = 1, IdWellSectionType = 4,
IdCategory = 1048, IdType = 0,
WellDepth = 950, StartDate = DateTime.Now.AddHours(7.5),
DurationHours = 2},
- new WellOperation{ Id = 51, IdWell = 1, IdWellSectionType = 3,
+ new WellOperation{ Id = 51, IdWell = 1, IdWellSectionType = 4,
IdCategory = 1048, IdType = 1,
WellDepth = 980, StartDate = DateTime.Now.AddHours(5),
DurationHours = 2.5},
- new WellOperation{ Id = 52, IdWell = 1, IdWellSectionType = 3,
+ new WellOperation{ Id = 52, IdWell = 1, IdWellSectionType = 4,
IdCategory = 1048, IdType = 1,
WellDepth = 1010, StartDate = DateTime.Now.AddHours(6.5),
DurationHours = 2.5},
diff --git a/AsbCloudDb/Model/WellOperation.cs b/AsbCloudDb/Model/WellOperation.cs
index 18dd678d..9a513a54 100644
--- a/AsbCloudDb/Model/WellOperation.cs
+++ b/AsbCloudDb/Model/WellOperation.cs
@@ -9,6 +9,9 @@ namespace AsbCloudDb.Model
[Table("t_well_operation"), Comment("Данные по операциям на скважине")]
public class WellOperation
{
+ public WellOperation ShallowCopy() =>
+ (WellOperation) MemberwiseClone();
+
[Key]
[Column("id")]
public int Id { get; set; }
diff --git a/AsbCloudInfrastructure/Services/WellSectionService.cs b/AsbCloudInfrastructure/Services/WellSectionService.cs
index bca4afce..e7aa43c2 100644
--- a/AsbCloudInfrastructure/Services/WellSectionService.cs
+++ b/AsbCloudInfrastructure/Services/WellSectionService.cs
@@ -23,63 +23,8 @@ namespace AsbCloudInfrastructure.Services
cachedSectionsTypes = cache.GetCachedTable((DbContext)db);
}
- public async Task> GetAggregatedWellByWellIdAsync(int idWell,
- int skip, int take, CancellationToken token)
- {
- var wellOperations = await (from w in db.WellOperations
- where w.IdWell == idWell
- select w)
- .ToListAsync(token)
- .ConfigureAwait(false);
-
- var wellOperationsGroupedByIdWell = wellOperations
- .GroupBy(op => op.IdWell).ToList();
-
- var result = PaginateData(wellOperationsGroupedByIdWell,
- skip, take);
-
- if (!wellOperationsGroupedByIdWell.Any())
- return result;
-
- var depthsPlanFactList = GetWellDepthPlanFact(wellOperationsGroupedByIdWell).ToList();
-
- var durationsPlanFactList = GetWellDurationPlanFact(wellOperationsGroupedByIdWell).ToList();
-
- var mechSpeedsList = GetWellMechSpeedPlanFact(wellOperationsGroupedByIdWell).ToList();
-
- var bhaUpSpeedList = GetWellBhaUpSpeedPlanFact(wellOperationsGroupedByIdWell).ToList();
-
- var bhaDownSpeedList = GetWellBhaDownSpeedPlanFact(wellOperationsGroupedByIdWell).ToList();
-
- var casingDownList = GetWellCasingDownPlanFact(wellOperationsGroupedByIdWell).ToList();
-
- var routeSpeeds = GetWellRouteSpeedsPlanFact(wellOperationsGroupedByIdWell).ToList();
-
- var dto = new WellOperationsDto
- {
- WellDepthPlan = depthsPlanFactList[0].DepthPlan,
- WellDepthFact = depthsPlanFactList[0].DepthFact,
- DurationPlan = durationsPlanFactList[0].DurationPlan,
- DurationFact = durationsPlanFactList[0].DurationFact,
- MechSpeedPlan = mechSpeedsList[0].MechSpeedPlan,
- MechSpeedFact = mechSpeedsList[0].MechSpeedFact,
- BhaUpSpeedPlan = bhaUpSpeedList[0].BhaUpSpeedPlan,
- BhaUpSpeedFact = bhaUpSpeedList[0].BhaUpSpeedFact,
- BhaDownSpeedPlan = bhaDownSpeedList[0].BhaDownSpeedPlan,
- BhaDownSpeedFact = bhaDownSpeedList[0].BhaDownSpeedFact,
- CasingDownSpeedPlan = casingDownList[0].CasingDownSpeedPlan,
- CasingDownSpeedFact = casingDownList[0].CasingDownSpeedFact,
- RouteSpeedPlan = routeSpeeds[0].RouteSpeedPlan,
- RouteSpeedFact = routeSpeeds[0].RouteSpeedFact
- };
-
- result.Items.Add(dto);
-
- return result;
- }
-
- public async Task> GetSectionsByWellIdAsync(int idWell,
- int skip, int take, CancellationToken token = default)
+ public async Task> GetSectionsByWellIdAsync(int idWell,
+ CancellationToken token = default)
{
var wellOperations = await (from w in db.WellOperations
where w.IdWell == idWell
@@ -88,14 +33,23 @@ namespace AsbCloudInfrastructure.Services
.ToListAsync(token)
.ConfigureAwait(false);
+ if (!wellOperations.Any())
+ return null;
+
var wellOperationsGroupedBySections = wellOperations
.GroupBy(op => op.IdWellSectionType).ToList();
- var result = PaginateData(wellOperationsGroupedBySections,
- skip, take);
+ var wellOperationsClone = wellOperations.Select(o => o.ShallowCopy()).ToList();
- if (!wellOperationsGroupedBySections.Any())
- return result;
+ wellOperationsClone.ForEach(op =>
+ {
+ op.IdWellSectionType = 1;
+ op.WellSectionType = new WellSectionType { Caption = "Обобщенное по скважине" };
+ });
+
+ var groupedWellOperationsClone = wellOperationsClone.GroupBy(o => o.IdWell);
+
+ wellOperationsGroupedBySections.Add(groupedWellOperationsClone.First());
var depthsPlanFactList = GetWellDepthPlanFact(wellOperationsGroupedBySections).ToList();
@@ -138,9 +92,7 @@ namespace AsbCloudInfrastructure.Services
dtos.Add(dto);
}
- result.Items = dtos;
-
- return result;
+ return dtos;
}
public async Task GetSectionByWellIdAsync(int id, CancellationToken token = default)
diff --git a/AsbCloudWebApi/Controllers/WellSectionController.cs b/AsbCloudWebApi/Controllers/WellSectionController.cs
index 2d8e362d..34cc02a5 100644
--- a/AsbCloudWebApi/Controllers/WellSectionController.cs
+++ b/AsbCloudWebApi/Controllers/WellSectionController.cs
@@ -1,4 +1,5 @@
-using AsbCloudApp.Data;
+using System.Collections.Generic;
+using AsbCloudApp.Data;
using AsbCloudApp.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -25,29 +26,14 @@ namespace AsbCloudWebApi.Controllers
}
[HttpGet]
- [Route("aggregated")]
- [ProducesResponseType(typeof(PaginationContainer), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetAggregatedWellByWellIdAsync(int idWell, int skip = 0, int take = 32,
- CancellationToken token = default)
- {
- if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
- return Forbid();
-
- var result = await sectionsService.GetAggregatedWellByWellIdAsync(idWell, skip, take, token)
- .ConfigureAwait(false);
- return Ok(result);
- }
-
- [HttpGet]
- [Route("divided")]
- [ProducesResponseType(typeof(PaginationContainer), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetSectionsByWellIdAsync(int idWell, int skip = 0, int take = 32,
+ [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)]
+ public async Task GetSectionsByWellIdAsync(int idWell,
CancellationToken token = default)
{
if(!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
return Forbid();
- var result = await sectionsService.GetSectionsByWellIdAsync(idWell, skip, take, token)
+ var result = await sectionsService.GetSectionsByWellIdAsync(idWell, token)
.ConfigureAwait(false);
return Ok(result);
}