forked from ddrilling/AsbCloudServer
CS2-65: United GetSectionsData() and GetWholeWellData() methods
This commit is contained in:
parent
cec8e92d77
commit
791f72cbdb
@ -1,78 +0,0 @@
|
|||||||
namespace AsbCloudApp.Data
|
|
||||||
{
|
|
||||||
public class WellOperationsDto : IId
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Глубина план, м
|
|
||||||
/// </summary>
|
|
||||||
public double WellDepthPlan { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Глубина факт, м
|
|
||||||
/// </summary>
|
|
||||||
public double WellDepthFact { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Период план, д
|
|
||||||
/// </summary>
|
|
||||||
public double DurationPlan { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Период факт, д
|
|
||||||
/// </summary>
|
|
||||||
public double DurationFact { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Механическая скорость проходки план, м/час
|
|
||||||
/// </summary>
|
|
||||||
public double MechSpeedPlan { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Механическая скорость проходки факт, м/час
|
|
||||||
/// </summary>
|
|
||||||
public double MechSpeedFact { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Рейсовая скорость план, м/час
|
|
||||||
/// </summary>
|
|
||||||
public double RouteSpeedPlan { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Рейсовая скорость план, м/час
|
|
||||||
/// </summary>
|
|
||||||
public double RouteSpeedFact { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Скорость подъема КНБК план
|
|
||||||
/// </summary>
|
|
||||||
public double BhaUpSpeedPlan { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Скорость подъема КНБК факт
|
|
||||||
/// </summary>
|
|
||||||
public double BhaUpSpeedFact { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Скорость спуска КНБК план
|
|
||||||
/// </summary>
|
|
||||||
public double BhaDownSpeedPlan { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Скорость спуска КНБК факт
|
|
||||||
/// </summary>
|
|
||||||
public double BhaDownSpeedFact { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Скорость спуска обсадной колонны план
|
|
||||||
/// </summary>
|
|
||||||
public double CasingDownSpeedPlan { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Скорость спуска обсадной колонны факт
|
|
||||||
/// </summary>
|
|
||||||
public double CasingDownSpeedFact { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,5 @@
|
|||||||
using AsbCloudApp.Data;
|
using AsbCloudApp.Data;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@ -6,10 +7,9 @@ namespace AsbCloudApp.Services
|
|||||||
{
|
{
|
||||||
public interface IWellSectionService
|
public interface IWellSectionService
|
||||||
{
|
{
|
||||||
Task<PaginationContainer<WellOperationsDto>> GetAggregatedWellByWellIdAsync(int idWell,
|
Task<IEnumerable<WellSectionDto>> GetSectionsByWellIdAsync(int idWell,
|
||||||
int skip, int take, CancellationToken token);
|
CancellationToken token = default);
|
||||||
Task<PaginationContainer<WellSectionDto>> GetSectionsByWellIdAsync(int idWell, int skip = 0, int take = 32,
|
Task<WellSectionDto> GetSectionByWellIdAsync(int id,
|
||||||
CancellationToken token = default);
|
CancellationToken token = default);
|
||||||
Task<WellSectionDto> GetSectionByWellIdAsync(int id, CancellationToken token = default);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -297,12 +297,13 @@ namespace AsbCloudDb.Model
|
|||||||
|
|
||||||
modelBuilder.Entity<WellSectionType>(entity => {
|
modelBuilder.Entity<WellSectionType>(entity => {
|
||||||
entity.HasData(new List<WellSectionType>{
|
entity.HasData(new List<WellSectionType>{
|
||||||
new WellSectionType{ Id = 1, Caption = "Пилотный ствол"},
|
new WellSectionType{ Id = 1, Caption = "Обощенное по скважине"},
|
||||||
new WellSectionType{ Id = 2, Caption = "Направление"},
|
new WellSectionType{ Id = 2, Caption = "Пилотный ствол"},
|
||||||
new WellSectionType{ Id = 3, Caption = "Кондуктор"},
|
new WellSectionType{ Id = 3, Caption = "Направление"},
|
||||||
new WellSectionType{ Id = 4, Caption = "Эксплуатационная колонна"},
|
new WellSectionType{ Id = 4, Caption = "Кондуктор"},
|
||||||
new WellSectionType{ Id = 5, Caption = "Транспортный ствол"},
|
new WellSectionType{ Id = 5, Caption = "Эксплуатационная колонна"},
|
||||||
new WellSectionType{ Id = 6, Caption = "Хвостовик"},
|
new WellSectionType{ Id = 6, Caption = "Транспортный ствол"},
|
||||||
|
new WellSectionType{ Id = 7, Caption = "Хвостовик"},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -392,208 +393,206 @@ namespace AsbCloudDb.Model
|
|||||||
modelBuilder.Entity<WellOperation>(entity =>
|
modelBuilder.Entity<WellOperation>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasData(new List<WellOperation> {
|
entity.HasData(new List<WellOperation> {
|
||||||
new WellOperation{ Id = 1, IdWell = 1, IdWellSectionType = 1,
|
new WellOperation{ Id = 1, IdWell = 1, IdWellSectionType = 2,
|
||||||
IdCategory = 1001, IdType = 0,
|
IdCategory = 1001, IdType = 0,
|
||||||
WellDepth = 200, StartDate = DateTime.Now.AddHours(1),
|
WellDepth = 200, StartDate = DateTime.Now.AddHours(1),
|
||||||
DurationHours = 1.2},
|
DurationHours = 1.2},
|
||||||
new WellOperation{ Id = 2, IdWell = 1, IdWellSectionType = 1,
|
new WellOperation{ Id = 2, IdWell = 1, IdWellSectionType = 2,
|
||||||
IdCategory = 1001, IdType = 0,
|
IdCategory = 1001, IdType = 0,
|
||||||
WellDepth = 300, StartDate = DateTime.Now.AddHours(2.5),
|
WellDepth = 300, StartDate = DateTime.Now.AddHours(2.5),
|
||||||
DurationHours = 1.5},
|
DurationHours = 1.5},
|
||||||
new WellOperation{ Id = 3, IdWell = 1, IdWellSectionType = 1,
|
new WellOperation{ Id = 3, IdWell = 1, IdWellSectionType = 2,
|
||||||
IdCategory = 1001, IdType = 1,
|
IdCategory = 1001, IdType = 1,
|
||||||
WellDepth = 210, StartDate = DateTime.Now.AddHours(1.5),
|
WellDepth = 210, StartDate = DateTime.Now.AddHours(1.5),
|
||||||
DurationHours = 1},
|
DurationHours = 1},
|
||||||
new WellOperation{ Id = 4, IdWell = 1, IdWellSectionType = 1,
|
new WellOperation{ Id = 4, IdWell = 1, IdWellSectionType = 2,
|
||||||
IdCategory = 1001, IdType = 1,
|
IdCategory = 1001, IdType = 1,
|
||||||
WellDepth = 310, StartDate = DateTime.Now.AddHours(2),
|
WellDepth = 310, StartDate = DateTime.Now.AddHours(2),
|
||||||
DurationHours = 1.5},
|
DurationHours = 1.5},
|
||||||
new WellOperation{ Id = 5, IdWell = 1, IdWellSectionType = 2,
|
new WellOperation{ Id = 5, IdWell = 1, IdWellSectionType = 3,
|
||||||
IdCategory = 1001, IdType = 0,
|
IdCategory = 1001, IdType = 0,
|
||||||
WellDepth = 200, StartDate = DateTime.Now.AddHours(1),
|
WellDepth = 200, StartDate = DateTime.Now.AddHours(1),
|
||||||
DurationHours = 1.2},
|
DurationHours = 1.2},
|
||||||
new WellOperation{ Id = 6, IdWell = 1, IdWellSectionType = 2,
|
new WellOperation{ Id = 6, IdWell = 1, IdWellSectionType = 3,
|
||||||
IdCategory = 1001, IdType = 0,
|
IdCategory = 1001, IdType = 0,
|
||||||
WellDepth = 300, StartDate = DateTime.Now.AddHours(2.5),
|
WellDepth = 300, StartDate = DateTime.Now.AddHours(2.5),
|
||||||
DurationHours = 1.5},
|
DurationHours = 1.5},
|
||||||
new WellOperation{ Id = 7, IdWell = 1, IdWellSectionType = 2,
|
new WellOperation{ Id = 7, IdWell = 1, IdWellSectionType = 3,
|
||||||
IdCategory = 1001, IdType = 1,
|
IdCategory = 1001, IdType = 1,
|
||||||
WellDepth = 210, StartDate = DateTime.Now.AddHours(1.5),
|
WellDepth = 210, StartDate = DateTime.Now.AddHours(1.5),
|
||||||
DurationHours = 1},
|
DurationHours = 1},
|
||||||
new WellOperation{ Id = 8, IdWell = 1, IdWellSectionType = 2,
|
new WellOperation{ Id = 8, IdWell = 1, IdWellSectionType = 3,
|
||||||
IdCategory = 1001, IdType = 1,
|
IdCategory = 1001, IdType = 1,
|
||||||
WellDepth = 310, StartDate = DateTime.Now.AddHours(2),
|
WellDepth = 310, StartDate = DateTime.Now.AddHours(2),
|
||||||
DurationHours = 1.5},
|
DurationHours = 1.5},
|
||||||
new WellOperation{ Id = 9, IdWell = 1, IdWellSectionType = 3,
|
new WellOperation{ Id = 9, IdWell = 1, IdWellSectionType = 4,
|
||||||
IdCategory = 1001, IdType = 0,
|
IdCategory = 1001, IdType = 0,
|
||||||
WellDepth = 500, StartDate = DateTime.Now.AddHours(1),
|
WellDepth = 500, StartDate = DateTime.Now.AddHours(1),
|
||||||
DurationHours = 1.2},
|
DurationHours = 1.2},
|
||||||
new WellOperation{ Id = 10, IdWell = 1, IdWellSectionType = 3,
|
new WellOperation{ Id = 10, IdWell = 1, IdWellSectionType = 4,
|
||||||
IdCategory = 1001, IdType = 0,
|
IdCategory = 1001, IdType = 0,
|
||||||
WellDepth = 510, StartDate = DateTime.Now.AddHours(2),
|
WellDepth = 510, StartDate = DateTime.Now.AddHours(2),
|
||||||
DurationHours = 1.2},
|
DurationHours = 1.2},
|
||||||
new WellOperation{ Id = 11, IdWell = 1, IdWellSectionType = 3,
|
new WellOperation{ Id = 11, IdWell = 1, IdWellSectionType = 4,
|
||||||
IdCategory = 1001, IdType = 1,
|
IdCategory = 1001, IdType = 1,
|
||||||
WellDepth = 510, StartDate = DateTime.Now.AddHours(1.5),
|
WellDepth = 510, StartDate = DateTime.Now.AddHours(1.5),
|
||||||
DurationHours = 1},
|
DurationHours = 1},
|
||||||
new WellOperation{ Id = 12, IdWell = 1, IdWellSectionType = 3,
|
new WellOperation{ Id = 12, IdWell = 1, IdWellSectionType = 4,
|
||||||
IdCategory = 1001, IdType = 1,
|
IdCategory = 1001, IdType = 1,
|
||||||
WellDepth = 520, StartDate = DateTime.Now.AddHours(2),
|
WellDepth = 520, StartDate = DateTime.Now.AddHours(2),
|
||||||
DurationHours = 1.5},
|
DurationHours = 1.5},
|
||||||
|
|
||||||
|
|
||||||
new WellOperation{ Id = 13, IdWell = 1, IdWellSectionType = 1,
|
new WellOperation{ Id = 13, IdWell = 1, IdWellSectionType = 2,
|
||||||
IdCategory = 1046, IdType = 0,
|
IdCategory = 1046, IdType = 0,
|
||||||
WellDepth = 200, StartDate = DateTime.Now.AddHours(2.5),
|
WellDepth = 200, StartDate = DateTime.Now.AddHours(2.5),
|
||||||
DurationHours = 15.5},
|
DurationHours = 15.5},
|
||||||
new WellOperation{ Id = 14, IdWell = 1, IdWellSectionType = 1,
|
new WellOperation{ Id = 14, IdWell = 1, IdWellSectionType = 2,
|
||||||
IdCategory = 1046, IdType = 0,
|
IdCategory = 1046, IdType = 0,
|
||||||
WellDepth = 210, StartDate = DateTime.Now.AddHours(3),
|
WellDepth = 210, StartDate = DateTime.Now.AddHours(3),
|
||||||
DurationHours = 17.2},
|
DurationHours = 17.2},
|
||||||
new WellOperation{ Id = 15, IdWell = 1, IdWellSectionType = 1,
|
new WellOperation{ Id = 15, IdWell = 1, IdWellSectionType = 2,
|
||||||
IdCategory = 1046, IdType = 1,
|
IdCategory = 1046, IdType = 1,
|
||||||
WellDepth = 220, StartDate = DateTime.Now.AddHours(2.7),
|
WellDepth = 220, StartDate = DateTime.Now.AddHours(2.7),
|
||||||
DurationHours = 15.2},
|
DurationHours = 15.2},
|
||||||
new WellOperation{ Id = 16, IdWell = 1, IdWellSectionType = 1,
|
new WellOperation{ Id = 16, IdWell = 1, IdWellSectionType = 2,
|
||||||
IdCategory = 1046, IdType = 1,
|
IdCategory = 1046, IdType = 1,
|
||||||
WellDepth = 230, StartDate = DateTime.Now.AddHours(3.1),
|
WellDepth = 230, StartDate = DateTime.Now.AddHours(3.1),
|
||||||
DurationHours = 17.8},
|
DurationHours = 17.8},
|
||||||
new WellOperation{ Id = 17, IdWell = 1, IdWellSectionType = 2,
|
new WellOperation{ Id = 17, IdWell = 1, IdWellSectionType = 3,
|
||||||
IdCategory = 1046, IdType = 0,
|
IdCategory = 1046, IdType = 0,
|
||||||
WellDepth = 200, StartDate = DateTime.Now.AddHours(2.5),
|
WellDepth = 200, StartDate = DateTime.Now.AddHours(2.5),
|
||||||
DurationHours = 15.5},
|
DurationHours = 15.5},
|
||||||
new WellOperation{ Id = 18, IdWell = 1, IdWellSectionType = 2,
|
new WellOperation{ Id = 18, IdWell = 1, IdWellSectionType = 3,
|
||||||
IdCategory = 1046, IdType = 0,
|
IdCategory = 1046, IdType = 0,
|
||||||
WellDepth = 210, StartDate = DateTime.Now.AddHours(3),
|
WellDepth = 210, StartDate = DateTime.Now.AddHours(3),
|
||||||
DurationHours = 17.2},
|
DurationHours = 17.2},
|
||||||
new WellOperation{ Id = 19, IdWell = 1, IdWellSectionType = 2,
|
new WellOperation{ Id = 19, IdWell = 1, IdWellSectionType = 3,
|
||||||
IdCategory = 1046, IdType = 1,
|
IdCategory = 1046, IdType = 1,
|
||||||
WellDepth = 220, StartDate = DateTime.Now.AddHours(2.7),
|
WellDepth = 220, StartDate = DateTime.Now.AddHours(2.7),
|
||||||
DurationHours = 15.2},
|
DurationHours = 15.2},
|
||||||
new WellOperation{ Id = 20, IdWell = 1, IdWellSectionType = 2,
|
new WellOperation{ Id = 20, IdWell = 1, IdWellSectionType = 3,
|
||||||
IdCategory = 1046, IdType = 1,
|
IdCategory = 1046, IdType = 1,
|
||||||
WellDepth = 230, StartDate = DateTime.Now.AddHours(3.1),
|
WellDepth = 230, StartDate = DateTime.Now.AddHours(3.1),
|
||||||
DurationHours = 17.8},
|
DurationHours = 17.8},
|
||||||
new WellOperation{ Id = 21, IdWell = 1, IdWellSectionType = 3,
|
new WellOperation{ Id = 21, IdWell = 1, IdWellSectionType = 4,
|
||||||
IdCategory = 1046, IdType = 0,
|
IdCategory = 1046, IdType = 0,
|
||||||
WellDepth = 700, StartDate = DateTime.Now.AddHours(2.5),
|
WellDepth = 700, StartDate = DateTime.Now.AddHours(2.5),
|
||||||
DurationHours = 16.2},
|
DurationHours = 16.2},
|
||||||
new WellOperation{ Id = 22, IdWell = 1, IdWellSectionType = 3,
|
new WellOperation{ Id = 22, IdWell = 1, IdWellSectionType = 4,
|
||||||
IdCategory = 1046, IdType = 0,
|
IdCategory = 1046, IdType = 0,
|
||||||
WellDepth = 720, StartDate = DateTime.Now.AddHours(3.5),
|
WellDepth = 720, StartDate = DateTime.Now.AddHours(3.5),
|
||||||
DurationHours = 17.2},
|
DurationHours = 17.2},
|
||||||
new WellOperation{ Id = 23, IdWell = 1, IdWellSectionType = 3,
|
new WellOperation{ Id = 23, IdWell = 1, IdWellSectionType = 4,
|
||||||
IdCategory = 1046, IdType = 1,
|
IdCategory = 1046, IdType = 1,
|
||||||
WellDepth = 715, StartDate = DateTime.Now.AddHours(2.7),
|
WellDepth = 715, StartDate = DateTime.Now.AddHours(2.7),
|
||||||
DurationHours = 15.2},
|
DurationHours = 15.2},
|
||||||
new WellOperation{ Id = 24, IdWell = 1, IdWellSectionType = 3,
|
new WellOperation{ Id = 24, IdWell = 1, IdWellSectionType = 4,
|
||||||
IdCategory = 1046, IdType = 1,
|
IdCategory = 1046, IdType = 1,
|
||||||
WellDepth = 720, StartDate = DateTime.Now.AddHours(3),
|
WellDepth = 720, StartDate = DateTime.Now.AddHours(3),
|
||||||
DurationHours = 18.2},
|
DurationHours = 18.2},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
new WellOperation{ Id = 25, IdWell = 1, IdWellSectionType = 1,
|
new WellOperation{ Id = 25, IdWell = 1, IdWellSectionType = 2,
|
||||||
IdCategory = 1047, IdType = 0,
|
IdCategory = 1047, IdType = 0,
|
||||||
WellDepth = 600, StartDate = DateTime.Now.AddHours(4),
|
WellDepth = 600, StartDate = DateTime.Now.AddHours(4),
|
||||||
DurationHours = 5},
|
DurationHours = 5},
|
||||||
new WellOperation{ Id = 26, IdWell = 1, IdWellSectionType = 1,
|
new WellOperation{ Id = 26, IdWell = 1, IdWellSectionType = 2,
|
||||||
IdCategory = 1047, IdType = 0,
|
IdCategory = 1047, IdType = 0,
|
||||||
WellDepth = 650, StartDate = DateTime.Now.AddHours(4.5),
|
WellDepth = 650, StartDate = DateTime.Now.AddHours(4.5),
|
||||||
DurationHours = 5.5},
|
DurationHours = 5.5},
|
||||||
new WellOperation{ Id = 27, IdWell = 1, IdWellSectionType = 1,
|
new WellOperation{ Id = 27, IdWell = 1, IdWellSectionType = 2,
|
||||||
IdCategory = 1047, IdType = 1,
|
IdCategory = 1047, IdType = 1,
|
||||||
WellDepth = 700, StartDate = DateTime.Now.AddHours(5.5),
|
WellDepth = 700, StartDate = DateTime.Now.AddHours(5.5),
|
||||||
DurationHours = 8},
|
DurationHours = 8},
|
||||||
new WellOperation{ Id = 28, IdWell = 1, IdWellSectionType = 1,
|
new WellOperation{ Id = 28, IdWell = 1, IdWellSectionType = 2,
|
||||||
IdCategory = 1047, IdType = 1,
|
IdCategory = 1047, IdType = 1,
|
||||||
WellDepth = 710, StartDate = DateTime.Now.AddHours(5.7),
|
WellDepth = 710, StartDate = DateTime.Now.AddHours(5.7),
|
||||||
DurationHours = 7.2},
|
DurationHours = 7.2},
|
||||||
new WellOperation{ Id = 29, IdWell = 1, IdWellSectionType = 2,
|
new WellOperation{ Id = 29, IdWell = 1, IdWellSectionType = 3,
|
||||||
IdCategory = 1047, IdType = 0,
|
IdCategory = 1047, IdType = 0,
|
||||||
WellDepth = 600, StartDate = DateTime.Now.AddHours(4),
|
WellDepth = 600, StartDate = DateTime.Now.AddHours(4),
|
||||||
DurationHours = 5},
|
DurationHours = 5},
|
||||||
new WellOperation{ Id = 30, IdWell = 1, IdWellSectionType = 2,
|
new WellOperation{ Id = 30, IdWell = 1, IdWellSectionType = 3,
|
||||||
IdCategory = 1047, IdType = 0,
|
IdCategory = 1047, IdType = 0,
|
||||||
WellDepth = 650, StartDate = DateTime.Now.AddHours(4.5),
|
WellDepth = 650, StartDate = DateTime.Now.AddHours(4.5),
|
||||||
DurationHours = 5.5},
|
DurationHours = 5.5},
|
||||||
new WellOperation{ Id = 31, IdWell = 1, IdWellSectionType = 2,
|
new WellOperation{ Id = 31, IdWell = 1, IdWellSectionType = 3,
|
||||||
IdCategory = 1047, IdType = 1,
|
IdCategory = 1047, IdType = 1,
|
||||||
WellDepth = 700, StartDate = DateTime.Now.AddHours(5.5),
|
WellDepth = 700, StartDate = DateTime.Now.AddHours(5.5),
|
||||||
DurationHours = 8},
|
DurationHours = 8},
|
||||||
new WellOperation{ Id = 32, IdWell = 1, IdWellSectionType = 2,
|
new WellOperation{ Id = 32, IdWell = 1, IdWellSectionType = 3,
|
||||||
IdCategory = 1047, IdType = 1,
|
IdCategory = 1047, IdType = 1,
|
||||||
WellDepth = 710, StartDate = DateTime.Now.AddHours(5.7),
|
WellDepth = 710, StartDate = DateTime.Now.AddHours(5.7),
|
||||||
DurationHours = 7.2},
|
DurationHours = 7.2},
|
||||||
new WellOperation{ Id = 33, IdWell = 1, IdWellSectionType = 3,
|
new WellOperation{ Id = 33, IdWell = 1, IdWellSectionType = 4,
|
||||||
IdCategory = 1047, IdType = 0,
|
IdCategory = 1047, IdType = 0,
|
||||||
WellDepth = 1000, StartDate = DateTime.Now.AddHours(5.25),
|
WellDepth = 1000, StartDate = DateTime.Now.AddHours(5.25),
|
||||||
DurationHours = 2.1},
|
DurationHours = 2.1},
|
||||||
new WellOperation{ Id = 34, IdWell = 1, IdWellSectionType = 3,
|
new WellOperation{ Id = 34, IdWell = 1, IdWellSectionType = 4,
|
||||||
IdCategory = 1047, IdType = 0,
|
IdCategory = 1047, IdType = 0,
|
||||||
WellDepth = 1100, StartDate = DateTime.Now.AddHours(7.5),
|
WellDepth = 1100, StartDate = DateTime.Now.AddHours(7.5),
|
||||||
DurationHours = 2},
|
DurationHours = 2},
|
||||||
new WellOperation{ Id = 35, IdWell = 1, IdWellSectionType = 3,
|
new WellOperation{ Id = 35, IdWell = 1, IdWellSectionType = 4,
|
||||||
IdCategory = 1047, IdType = 1,
|
IdCategory = 1047, IdType = 1,
|
||||||
WellDepth = 1000, StartDate = DateTime.Now.AddHours(5.15),
|
WellDepth = 1000, StartDate = DateTime.Now.AddHours(5.15),
|
||||||
DurationHours = 2.75},
|
DurationHours = 2.75},
|
||||||
new WellOperation{ Id = 36, IdWell = 1, IdWellSectionType = 3,
|
new WellOperation{ Id = 36, IdWell = 1, IdWellSectionType = 4,
|
||||||
IdCategory = 1047, IdType = 1,
|
IdCategory = 1047, IdType = 1,
|
||||||
WellDepth = 1250, StartDate = DateTime.Now.AddHours(6.5),
|
WellDepth = 1250, StartDate = DateTime.Now.AddHours(6.5),
|
||||||
DurationHours = 3.5},
|
DurationHours = 3.5},
|
||||||
|
|
||||||
|
|
||||||
|
new WellOperation{ Id = 37, IdWell = 1, IdWellSectionType = 2,
|
||||||
|
|
||||||
new WellOperation{ Id = 37, IdWell = 1, IdWellSectionType = 1,
|
|
||||||
IdCategory = 1048, IdType = 0,
|
IdCategory = 1048, IdType = 0,
|
||||||
WellDepth = 600, StartDate = DateTime.Now.AddHours(4),
|
WellDepth = 600, StartDate = DateTime.Now.AddHours(4),
|
||||||
DurationHours = 5},
|
DurationHours = 5},
|
||||||
new WellOperation{ Id = 38, IdWell = 1, IdWellSectionType = 1,
|
new WellOperation{ Id = 38, IdWell = 1, IdWellSectionType = 2,
|
||||||
IdCategory = 1048, IdType = 0,
|
IdCategory = 1048, IdType = 0,
|
||||||
WellDepth = 650, StartDate = DateTime.Now.AddHours(4.2),
|
WellDepth = 650, StartDate = DateTime.Now.AddHours(4.2),
|
||||||
DurationHours = 5.5},
|
DurationHours = 5.5},
|
||||||
new WellOperation{ Id = 39, IdWell = 1, IdWellSectionType = 1,
|
new WellOperation{ Id = 39, IdWell = 1, IdWellSectionType = 2,
|
||||||
IdCategory = 1048, IdType = 1,
|
IdCategory = 1048, IdType = 1,
|
||||||
WellDepth = 700, StartDate = DateTime.Now.AddHours(5.5),
|
WellDepth = 700, StartDate = DateTime.Now.AddHours(5.5),
|
||||||
DurationHours = 7},
|
DurationHours = 7},
|
||||||
new WellOperation{ Id = 40, IdWell = 1, IdWellSectionType = 1,
|
new WellOperation{ Id = 40, IdWell = 1, IdWellSectionType = 2,
|
||||||
IdCategory = 1048, IdType = 1,
|
IdCategory = 1048, IdType = 1,
|
||||||
WellDepth = 710, StartDate = DateTime.Now.AddHours(5.7),
|
WellDepth = 710, StartDate = DateTime.Now.AddHours(5.7),
|
||||||
DurationHours = 7.5},
|
DurationHours = 7.5},
|
||||||
new WellOperation{ Id = 41, IdWell = 1, IdWellSectionType = 2,
|
new WellOperation{ Id = 41, IdWell = 1, IdWellSectionType = 3,
|
||||||
IdCategory = 1048, IdType = 0,
|
IdCategory = 1048, IdType = 0,
|
||||||
WellDepth = 600, StartDate = DateTime.Now.AddHours(4),
|
WellDepth = 600, StartDate = DateTime.Now.AddHours(4),
|
||||||
DurationHours = 5},
|
DurationHours = 5},
|
||||||
new WellOperation{ Id = 42, IdWell = 1, IdWellSectionType = 2,
|
new WellOperation{ Id = 42, IdWell = 1, IdWellSectionType = 3,
|
||||||
IdCategory = 1048, IdType = 0,
|
IdCategory = 1048, IdType = 0,
|
||||||
WellDepth = 650, StartDate = DateTime.Now.AddHours(4.2),
|
WellDepth = 650, StartDate = DateTime.Now.AddHours(4.2),
|
||||||
DurationHours = 5.5},
|
DurationHours = 5.5},
|
||||||
new WellOperation{ Id = 43, IdWell = 1, IdWellSectionType = 2,
|
new WellOperation{ Id = 43, IdWell = 1, IdWellSectionType = 3,
|
||||||
IdCategory = 1048, IdType = 1,
|
IdCategory = 1048, IdType = 1,
|
||||||
WellDepth = 700, StartDate = DateTime.Now.AddHours(5.5),
|
WellDepth = 700, StartDate = DateTime.Now.AddHours(5.5),
|
||||||
DurationHours = 7},
|
DurationHours = 7},
|
||||||
new WellOperation{ Id = 44, IdWell = 1, IdWellSectionType = 2,
|
new WellOperation{ Id = 44, IdWell = 1, IdWellSectionType = 3,
|
||||||
IdCategory = 1048, IdType = 1,
|
IdCategory = 1048, IdType = 1,
|
||||||
WellDepth = 710, StartDate = DateTime.Now.AddHours(5.7),
|
WellDepth = 710, StartDate = DateTime.Now.AddHours(5.7),
|
||||||
DurationHours = 7.5},
|
DurationHours = 7.5},
|
||||||
new WellOperation{ Id = 48, IdWell = 1, IdWellSectionType = 2,
|
new WellOperation{ Id = 48, IdWell = 1, IdWellSectionType = 3,
|
||||||
IdCategory = 1048, IdType = 0,
|
IdCategory = 1048, IdType = 0,
|
||||||
WellDepth = 910, StartDate = DateTime.Now.AddHours(5),
|
WellDepth = 910, StartDate = DateTime.Now.AddHours(5),
|
||||||
DurationHours = 12},
|
DurationHours = 12},
|
||||||
new WellOperation{ Id = 49, IdWell = 1, IdWellSectionType = 3,
|
new WellOperation{ Id = 49, IdWell = 1, IdWellSectionType = 4,
|
||||||
IdCategory = 1048, IdType = 0,
|
IdCategory = 1048, IdType = 0,
|
||||||
WellDepth = 910, StartDate = DateTime.Now.AddHours(5),
|
WellDepth = 910, StartDate = DateTime.Now.AddHours(5),
|
||||||
DurationHours = 2},
|
DurationHours = 2},
|
||||||
new WellOperation{ Id = 50, IdWell = 1, IdWellSectionType = 3,
|
new WellOperation{ Id = 50, IdWell = 1, IdWellSectionType = 4,
|
||||||
IdCategory = 1048, IdType = 0,
|
IdCategory = 1048, IdType = 0,
|
||||||
WellDepth = 950, StartDate = DateTime.Now.AddHours(7.5),
|
WellDepth = 950, StartDate = DateTime.Now.AddHours(7.5),
|
||||||
DurationHours = 2},
|
DurationHours = 2},
|
||||||
new WellOperation{ Id = 51, IdWell = 1, IdWellSectionType = 3,
|
new WellOperation{ Id = 51, IdWell = 1, IdWellSectionType = 4,
|
||||||
IdCategory = 1048, IdType = 1,
|
IdCategory = 1048, IdType = 1,
|
||||||
WellDepth = 980, StartDate = DateTime.Now.AddHours(5),
|
WellDepth = 980, StartDate = DateTime.Now.AddHours(5),
|
||||||
DurationHours = 2.5},
|
DurationHours = 2.5},
|
||||||
new WellOperation{ Id = 52, IdWell = 1, IdWellSectionType = 3,
|
new WellOperation{ Id = 52, IdWell = 1, IdWellSectionType = 4,
|
||||||
IdCategory = 1048, IdType = 1,
|
IdCategory = 1048, IdType = 1,
|
||||||
WellDepth = 1010, StartDate = DateTime.Now.AddHours(6.5),
|
WellDepth = 1010, StartDate = DateTime.Now.AddHours(6.5),
|
||||||
DurationHours = 2.5},
|
DurationHours = 2.5},
|
||||||
|
@ -9,6 +9,9 @@ namespace AsbCloudDb.Model
|
|||||||
[Table("t_well_operation"), Comment("Данные по операциям на скважине")]
|
[Table("t_well_operation"), Comment("Данные по операциям на скважине")]
|
||||||
public class WellOperation
|
public class WellOperation
|
||||||
{
|
{
|
||||||
|
public WellOperation ShallowCopy() =>
|
||||||
|
(WellOperation) MemberwiseClone();
|
||||||
|
|
||||||
[Key]
|
[Key]
|
||||||
[Column("id")]
|
[Column("id")]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
@ -23,63 +23,8 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
cachedSectionsTypes = cache.GetCachedTable<WellSectionType>((DbContext)db);
|
cachedSectionsTypes = cache.GetCachedTable<WellSectionType>((DbContext)db);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<PaginationContainer<WellOperationsDto>> GetAggregatedWellByWellIdAsync(int idWell,
|
public async Task<IEnumerable<WellSectionDto>> GetSectionsByWellIdAsync(int idWell,
|
||||||
int skip, int take, CancellationToken token)
|
CancellationToken token = default)
|
||||||
{
|
|
||||||
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<WellOperationsDto, WellOperation>(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<PaginationContainer<WellSectionDto>> GetSectionsByWellIdAsync(int idWell,
|
|
||||||
int skip, int take, CancellationToken token = default)
|
|
||||||
{
|
{
|
||||||
var wellOperations = await (from w in db.WellOperations
|
var wellOperations = await (from w in db.WellOperations
|
||||||
where w.IdWell == idWell
|
where w.IdWell == idWell
|
||||||
@ -88,14 +33,23 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
.ToListAsync(token)
|
.ToListAsync(token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (!wellOperations.Any())
|
||||||
|
return null;
|
||||||
|
|
||||||
var wellOperationsGroupedBySections = wellOperations
|
var wellOperationsGroupedBySections = wellOperations
|
||||||
.GroupBy(op => op.IdWellSectionType).ToList();
|
.GroupBy(op => op.IdWellSectionType).ToList();
|
||||||
|
|
||||||
var result = PaginateData<WellSectionDto, WellOperation>(wellOperationsGroupedBySections,
|
var wellOperationsClone = wellOperations.Select(o => o.ShallowCopy()).ToList();
|
||||||
skip, take);
|
|
||||||
|
|
||||||
if (!wellOperationsGroupedBySections.Any())
|
wellOperationsClone.ForEach(op =>
|
||||||
return result;
|
{
|
||||||
|
op.IdWellSectionType = 1;
|
||||||
|
op.WellSectionType = new WellSectionType { Caption = "Обобщенное по скважине" };
|
||||||
|
});
|
||||||
|
|
||||||
|
var groupedWellOperationsClone = wellOperationsClone.GroupBy(o => o.IdWell);
|
||||||
|
|
||||||
|
wellOperationsGroupedBySections.Add(groupedWellOperationsClone.First());
|
||||||
|
|
||||||
var depthsPlanFactList = GetWellDepthPlanFact(wellOperationsGroupedBySections).ToList();
|
var depthsPlanFactList = GetWellDepthPlanFact(wellOperationsGroupedBySections).ToList();
|
||||||
|
|
||||||
@ -138,9 +92,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
dtos.Add(dto);
|
dtos.Add(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
result.Items = dtos;
|
return dtos;
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<WellSectionDto> GetSectionByWellIdAsync(int id, CancellationToken token = default)
|
public async Task<WellSectionDto> GetSectionByWellIdAsync(int id, CancellationToken token = default)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using AsbCloudApp.Data;
|
using System.Collections.Generic;
|
||||||
|
using AsbCloudApp.Data;
|
||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
@ -25,29 +26,14 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("aggregated")]
|
[ProducesResponseType(typeof(IEnumerable<WellSectionDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||||
[ProducesResponseType(typeof(PaginationContainer<WellOperationsDto>), (int)System.Net.HttpStatusCode.OK)]
|
public async Task<IActionResult> GetSectionsByWellIdAsync(int idWell,
|
||||||
public async Task<IActionResult> GetAggregatedWellByWellIdAsync(int idWell, int skip = 0, int take = 32,
|
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
if(!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
if(!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
var result = await sectionsService.GetAggregatedWellByWellIdAsync(idWell, skip, take, token)
|
var result = await sectionsService.GetSectionsByWellIdAsync(idWell, token)
|
||||||
.ConfigureAwait(false);
|
|
||||||
return Ok(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
[Route("divided")]
|
|
||||||
[ProducesResponseType(typeof(PaginationContainer<WellSectionDto>), (int)System.Net.HttpStatusCode.OK)]
|
|
||||||
public async Task<IActionResult> GetSectionsByWellIdAsync(int idWell, int skip = 0, int take = 32,
|
|
||||||
CancellationToken token = default)
|
|
||||||
{
|
|
||||||
if(!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
|
||||||
return Forbid();
|
|
||||||
|
|
||||||
var result = await sectionsService.GetSectionsByWellIdAsync(idWell, skip, take, token)
|
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user