forked from ddrilling/AsbCloudServer
Merge branch 'master' of https://bitbucket.org/frolovng/asbcloudserver
This commit is contained in:
commit
582629c8d7
@ -207,6 +207,7 @@ namespace AsbCloudDb.Model
|
||||
modelBuilder.Entity<WellOperationCategory>(entity =>
|
||||
{
|
||||
entity.HasData(new List<WellOperationCategory> {
|
||||
// Автоматически опеределяемые операции
|
||||
new WellOperationCategory {Id = 1, Name = "Невозможно определить операцию", Code = 0},
|
||||
new WellOperationCategory {Id = 2, Name = "Роторное бурение", Code = 0 },
|
||||
new WellOperationCategory {Id = 3, Name = "Слайдирование", Code = 0 },
|
||||
@ -223,7 +224,76 @@ namespace AsbCloudDb.Model
|
||||
new WellOperationCategory {Id = 14, Name = "Удержание в клиньях", Code = 0 },
|
||||
new WellOperationCategory {Id = 15, Name = "Неподвижное состояние", Code = 0 },
|
||||
new WellOperationCategory {Id = 16, Name = "Вращение без циркуляции", Code = 0 },
|
||||
new WellOperationCategory {Id = 17, Name = "На поверхности", Code = 0 }
|
||||
new WellOperationCategory {Id = 17, Name = "На поверхности", Code = 0 },
|
||||
// Операции ручного ввода
|
||||
new WellOperationCategory {Id = 1018, Name = "Бурение", Code = 0 },
|
||||
new WellOperationCategory {Id = 1019, Name = "Бурение в интервале", Code = 0 },
|
||||
new WellOperationCategory {Id = 1020, Name = "Бурение до глубины", Code = 0 },
|
||||
new WellOperationCategory {Id = 1021, Name = "Бурение под направление", Code = 0 },
|
||||
new WellOperationCategory {Id = 1022, Name = "ГИС (инклиметрия)", Code = 0 },
|
||||
new WellOperationCategory {Id = 1023, Name = "ГИС (инклинометрия)", Code = 0 },
|
||||
new WellOperationCategory {Id = 1024, Name = "ГФР - АМАК, АКЦ кондуктора", Code = 0 },
|
||||
new WellOperationCategory {Id = 1025, Name = "Демонтаж ПВО, Установка ФА", Code = 0 },
|
||||
new WellOperationCategory {Id = 1026, Name = "Оборудование устья", Code = 0 },
|
||||
new WellOperationCategory {Id = 1027, Name = "ОЗЦ", Code = 0 },
|
||||
new WellOperationCategory {Id = 1028, Name = "ГИС", Code = 0 },
|
||||
new WellOperationCategory {Id = 1029, Name = "Окончание цикла бурения", Code = 0 },
|
||||
new WellOperationCategory {Id = 1030, Name = "Опрессовка ПВО", Code = 0 },
|
||||
new WellOperationCategory {Id = 1031, Name = "Опресовка Ц.К.", Code = 0 },
|
||||
new WellOperationCategory {Id = 1032, Name = "Опрессовка ВЗД", Code = 0 },
|
||||
new WellOperationCategory {Id = 1033, Name = "Перевод скв на KCL", Code = 0 },
|
||||
new WellOperationCategory {Id = 1034, Name = "Перезапись гаммы", Code = 0 },
|
||||
new WellOperationCategory {Id = 1035, Name = "Перезапись ГК", Code = 0 },
|
||||
new WellOperationCategory {Id = 1036, Name = "Перетяжка тальканата", Code = 0 },
|
||||
new WellOperationCategory {Id = 1037, Name = "Подъем", Code = 0 },
|
||||
new WellOperationCategory {Id = 1038, Name = "Подъем ЛБТ", Code = 0 },
|
||||
new WellOperationCategory {Id = 1039, Name = "Подъем инструмента", Code = 0 },
|
||||
new WellOperationCategory {Id = 1040, Name = "ПР и Сборка КНБК", Code = 0 },
|
||||
new WellOperationCategory {Id = 1041, Name = "ПР к бурению и сборке КНБК", Code = 0 },
|
||||
new WellOperationCategory {Id = 1042, Name = "ПР к промывке", Code = 0 },
|
||||
new WellOperationCategory {Id = 1043, Name = "ПР к спуску кондуктора", Code = 0 },
|
||||
new WellOperationCategory {Id = 1044, Name = "ПР к спуску направления", Code = 0 },
|
||||
new WellOperationCategory {Id = 1045, Name = "ПР к спуску ОК", Code = 0 },
|
||||
new WellOperationCategory {Id = 1046, Name = "ПР к спуску ЭК-146", Code = 0 },
|
||||
new WellOperationCategory {Id = 1047, Name = "ПР к цементажу", Code = 0 },
|
||||
new WellOperationCategory {Id = 1048, Name = "ПР к цементированию кондуктора", Code = 0 },
|
||||
new WellOperationCategory {Id = 1049, Name = "ПР к цементированию направления", Code = 0 },
|
||||
new WellOperationCategory {Id = 1050, Name = "ПР к цементированию ЭК", Code = 0 },
|
||||
new WellOperationCategory {Id = 1051, Name = "ПР. Спуск направления", Code = 0 },
|
||||
new WellOperationCategory {Id = 1052, Name = "ПР. цементаж направления", Code = 0 },
|
||||
new WellOperationCategory {Id = 1053, Name = "Промывка", Code = 0 },
|
||||
new WellOperationCategory {Id = 1054, Name = "Промежуточная промывка", Code = 0 },
|
||||
new WellOperationCategory {Id = 1055, Name = "Промывка на забое", Code = 0 },
|
||||
new WellOperationCategory {Id = 1056, Name = "Промывка перед бурением", Code = 0 },
|
||||
new WellOperationCategory {Id = 1057, Name = "Промывка перед ГИС", Code = 0 },
|
||||
new WellOperationCategory {Id = 1058, Name = "Промывка перед подъемом", Code = 0 },
|
||||
new WellOperationCategory {Id = 1059, Name = "Промывка перед цементажем", Code = 0 },
|
||||
new WellOperationCategory {Id = 1060, Name = "Промывка перед цементированием", Code = 0 },
|
||||
new WellOperationCategory {Id = 1061, Name = "Промывка прокачка", Code = 0 },
|
||||
new WellOperationCategory {Id = 1062, Name = "Промывка с прокачкой", Code = 0 },
|
||||
new WellOperationCategory {Id = 1063, Name = "Разборка КНБК", Code = 0 },
|
||||
new WellOperationCategory {Id = 1064, Name = "Разбуривание тех.оснастки", Code = 0 },
|
||||
new WellOperationCategory {Id = 1065, Name = "Разбурка ЦКОДа", Code = 0 },
|
||||
new WellOperationCategory {Id = 1066, Name = "Ремонт наг.линии подпорного насоса", Code = 0 },
|
||||
new WellOperationCategory {Id = 1067, Name = "Ремонт наг.линии подпорного насоса", Code = 0 },
|
||||
new WellOperationCategory {Id = 1068, Name = "Сборка КНБК", Code = 0 },
|
||||
new WellOperationCategory {Id = 1069, Name = "Сборка роторной КНБК", Code = 0 },
|
||||
new WellOperationCategory {Id = 1070, Name = "Спуск инструмента", Code = 0 },
|
||||
new WellOperationCategory {Id = 1071, Name = "Спуск КНБК", Code = 0 },
|
||||
new WellOperationCategory {Id = 1072, Name = "Подъем КНБК", Code = 0 },
|
||||
new WellOperationCategory {Id = 1073, Name = "Спуск ЛБТ", Code = 0 },
|
||||
new WellOperationCategory {Id = 1074, Name = "Спуск ОК", Code = 0 },
|
||||
new WellOperationCategory {Id = 1075, Name = "Спуск ЭК", Code = 0 },
|
||||
new WellOperationCategory {Id = 1076, Name = "Тех СПО", Code = 0 },
|
||||
new WellOperationCategory {Id = 1077, Name = "Тех СПО-подъем", Code = 0 },
|
||||
new WellOperationCategory {Id = 1078, Name = "Тех СПО-спуск", Code = 0 },
|
||||
new WellOperationCategory {Id = 1079, Name = "ТО СВП", Code = 0 },
|
||||
new WellOperationCategory {Id = 1080, Name = "Цементаж", Code = 0 },
|
||||
new WellOperationCategory {Id = 1081, Name = "Цементаж кондуктора", Code = 0 },
|
||||
new WellOperationCategory {Id = 1082, Name = "Цементаж направления", Code = 0 },
|
||||
new WellOperationCategory {Id = 1083, Name = "Цементаж ЭК", Code = 0 },
|
||||
new WellOperationCategory {Id = 1084, Name = "Шаблонировка ствола", Code = 0 },
|
||||
new WellOperationCategory {Id = 1085, Name = "Cпуск направления", Code = 0 }
|
||||
});
|
||||
});
|
||||
|
||||
@ -339,6 +409,52 @@ namespace AsbCloudDb.Model
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WellOperation>(entity =>
|
||||
{
|
||||
entity.HasData(new List<WellOperation> {
|
||||
new WellOperation{ Id = 1, IdWell = 1, IdWellSectionType = 1,
|
||||
IdOperationCategory = 18, Type = 0,
|
||||
WellDepth = 200, StartDate = DateTime.Now.AddHours(1),
|
||||
DurationHours = 1.2},
|
||||
new WellOperation{ Id = 2, IdWell = 1, IdWellSectionType = 1,
|
||||
IdOperationCategory = 18, Type = 1,
|
||||
WellDepth = 300, StartDate = DateTime.Now.AddHours(1),
|
||||
DurationHours = 1},
|
||||
new WellOperation{ Id = 3, IdWell = 1, IdWellSectionType = 1,
|
||||
IdOperationCategory = 71, Type = 0,
|
||||
WellDepth = 400, StartDate = DateTime.Now.AddHours(2.5),
|
||||
DurationHours = 15.2},
|
||||
new WellOperation{ Id = 4, IdWell = 1, IdWellSectionType = 1,
|
||||
IdOperationCategory = 71, Type = 1,
|
||||
WellDepth = 500, StartDate = DateTime.Now.AddHours(3),
|
||||
DurationHours = 17.2},
|
||||
new WellOperation{ Id = 5, IdWell = 1, IdWellSectionType = 2,
|
||||
IdOperationCategory = 72, Type = 0,
|
||||
WellDepth = 600, StartDate = DateTime.Now.AddHours(4),
|
||||
DurationHours = 5},
|
||||
new WellOperation{ Id = 6, IdWell = 1, IdWellSectionType = 2,
|
||||
IdOperationCategory = 72, Type = 1,
|
||||
WellDepth = 700, StartDate = DateTime.Now.AddHours(4.3),
|
||||
DurationHours = 7},
|
||||
new WellOperation{ Id = 7, IdWell = 1, IdWellSectionType = 2,
|
||||
IdOperationCategory = 74, Type = 0,
|
||||
WellDepth = 800, StartDate = DateTime.Now.AddHours(5),
|
||||
DurationHours = 12},
|
||||
new WellOperation{ Id = 8, IdWell = 1, IdWellSectionType = 2,
|
||||
IdOperationCategory = 74, Type = 1,
|
||||
WellDepth = 900, StartDate = DateTime.Now.AddHours(4.5),
|
||||
DurationHours = 12},
|
||||
new WellOperation{ Id = 9, IdWell = 1, IdWellSectionType = 3,
|
||||
IdOperationCategory = 72, Type = 0,
|
||||
WellDepth = 950, StartDate = DateTime.Now.AddHours(5),
|
||||
DurationHours = 2},
|
||||
new WellOperation{ Id = 10, IdWell = 1, IdWellSectionType = 3,
|
||||
IdOperationCategory = 72, Type = 1,
|
||||
WellDepth = 900, StartDate = DateTime.Now.AddHours(5),
|
||||
DurationHours = 2.5}
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity<TelemetryAnalysis>(entity =>
|
||||
{
|
||||
entity.HasData(new List<TelemetryAnalysis>{
|
||||
|
@ -52,7 +52,6 @@ namespace AsbCloudInfrastructure.Services
|
||||
if (!wellOperationsGroupedBySections.Any())
|
||||
return result;
|
||||
|
||||
// TODO: Подставить нормальные ID операций спускоа, подъема и т.д.
|
||||
var depthsPlanFactList = GetWellDepthPlanFact(wellOperationsGroupedBySections).ToList();
|
||||
|
||||
var durationsPlanFactList = GetWellDurationPlanFact(wellOperationsGroupedBySections).ToList();
|
||||
@ -73,7 +72,8 @@ namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
var dto = new WellSectionDto
|
||||
{
|
||||
SectionType = wellOperationsGroupedBySections[i].FirstOrDefault().OperationCategory.Name,
|
||||
SectionType = wellOperationsGroupedBySections[i]
|
||||
.FirstOrDefault().OperationCategory.Name,
|
||||
WellDepthPlan = depthsPlanFactList[i].DepthPlan,
|
||||
WellDepthFact = depthsPlanFactList[i].DepthFact,
|
||||
DurationPlan = durationsPlanFactList[i].DurationPlan,
|
||||
@ -215,29 +215,19 @@ namespace AsbCloudInfrastructure.Services
|
||||
private static IEnumerable<(double MechSpeedPlan, double MechSpeedFact)> GetWellMechSpeedPlanFact(
|
||||
IEnumerable<IGrouping<int, WellOperation>> groupedOperations)
|
||||
{
|
||||
var mechSpeedBase = groupedOperations.Select(g => new
|
||||
{
|
||||
DepthChangePlanSum = g.Where(o => o.Type == 0 && o.IdOperationCategory == 1)
|
||||
.Select((el, i) => i > 0 ? el.WellDepth - g.ElementAt(i - 1).WellDepth : 0).Sum(),
|
||||
DurationsPlanSum = g.Where(o => o.Type == 0 && o.IdOperationCategory == 1)
|
||||
.Select(el => el.DurationHours).Sum(),
|
||||
DepthChangeFactSum = g.Where(o => o.Type == 1 && o.IdOperationCategory == 1)
|
||||
.Select((el, i) => i > 0 ? el.WellDepth - g.ElementAt(i - 1).WellDepth : 0).Sum(),
|
||||
DurationsFactSum = g.Where(o => o.Type == 1 && o.IdOperationCategory == 1)
|
||||
.Select(el => el.DurationHours).Sum()
|
||||
});
|
||||
var mechSpeedBase = GetParams(groupedOperations, 18);
|
||||
|
||||
return mechSpeedBase.Select(el =>
|
||||
(
|
||||
MechSpeedPlan: el.DepthChangePlanSum / el.DurationsPlanSum,
|
||||
MechSpeedFact: el.DepthChangeFactSum / el.DurationsFactSum
|
||||
MechSpeedPlan: el.DepthDifferencePlanSum / el.DurationDifferencePlanSum,
|
||||
MechSpeedFact: el.DepthDifferenceFactSum / el.DurationDifferenceFactSum
|
||||
));
|
||||
}
|
||||
|
||||
private static IEnumerable<(double BhaUpSpeedPlan, double BhaUpSpeedFact)> GetWellBhaUpSpeedPlanFact(
|
||||
IEnumerable<IGrouping<int, WellOperation>> groupedOperations)
|
||||
{
|
||||
var bhaUpSpeedBase = GetParams(groupedOperations, 2);
|
||||
var bhaUpSpeedBase = GetParams(groupedOperations, 72);
|
||||
|
||||
return bhaUpSpeedBase.Select(el =>
|
||||
(
|
||||
@ -249,7 +239,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
private static IEnumerable<(double BhaDownSpeedPlan, double BhaDownSpeedFact)> GetWellBhaDownSpeedPlanFact(
|
||||
IEnumerable<IGrouping<int, WellOperation>> groupedOperations)
|
||||
{
|
||||
var bhaDownSpeedBase = GetParams(groupedOperations, 3);
|
||||
var bhaDownSpeedBase = GetParams(groupedOperations, 71);
|
||||
|
||||
return bhaDownSpeedBase.Select(el =>
|
||||
(
|
||||
@ -261,7 +251,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
private static IEnumerable<(double CasingDownSpeedPlan, double CasingDownSpeedFact)> GetWellCasingDownPlanFact(
|
||||
IEnumerable<IGrouping<int, WellOperation>> groupedOperations)
|
||||
{
|
||||
var casingDownBase = GetParams(groupedOperations, 4);
|
||||
var casingDownBase = GetParams(groupedOperations, 74);
|
||||
|
||||
return casingDownBase.Select(el =>
|
||||
(
|
||||
@ -291,42 +281,44 @@ namespace AsbCloudInfrastructure.Services
|
||||
private static IEnumerable<(double RouteSpeedPlan, double RouteSpeedFact)> GetWellRouteSpeedsPlanFact(
|
||||
IEnumerable<IGrouping<int, WellOperation>> groupedOperations)
|
||||
{
|
||||
var bhaRaiseDecreaseCollection = new List<(WellOperation FirstDecreasePlan, WellOperation LastIncreasePlan,
|
||||
WellOperation FirstDecreaseFact, WellOperation LastIncreaseFact)>();
|
||||
var bhaRaiseDecreaseCollection = new List<(WellOperation FirstBhaPositionDecreasePlan,
|
||||
WellOperation LastBhaPositionIncreasePlan,
|
||||
WellOperation FirstBhaPositionDecreaseFact,
|
||||
WellOperation LastBhaPositionIncreaseFact)>();
|
||||
|
||||
foreach (var group in groupedOperations)
|
||||
{
|
||||
var firstBhaPositionDecreasePlan = group.Any(o => o.IdOperationCategory == 5 && o.Type == 0)
|
||||
? group.First(o => o.IdOperationCategory == 5 && o.Type == 0)
|
||||
var firstBhaPositionDecreasePlan = group.Any(o => o.IdOperationCategory == 71 && o.Type == 0)
|
||||
? group.First(o => o.IdOperationCategory == 71 && o.Type == 0)
|
||||
: null;
|
||||
|
||||
var lastBhaPositionIncreasePlan = group.Any(o => o.IdOperationCategory == 6 && o.Type == 0)
|
||||
? group.First(o => o.IdOperationCategory == 5 && o.Type == 0)
|
||||
var lastBhaPositionIncreasePlan = group.Any(o => o.IdOperationCategory == 72 && o.Type == 0)
|
||||
? group.First(o => o.IdOperationCategory == 72 && o.Type == 0)
|
||||
: null;
|
||||
|
||||
var firstBhaPositionDecreaseFact = group.Any(o => o.IdOperationCategory == 5 && o.Type == 1)
|
||||
? group.First(o => o.IdOperationCategory == 5 && o.Type == 1)
|
||||
: null;
|
||||
|
||||
var lastBhaPositionIncreaseFact = group.Any(o => o.IdOperationCategory == 6 && o.Type == 1)
|
||||
? group.First(o => o.IdOperationCategory == 5 && o.Type == 1)
|
||||
var firstBhaPositionDecreaseFact = group.Any(o => o.IdOperationCategory == 71 && o.Type == 1)
|
||||
? group.First(o => o.IdOperationCategory == 71 && o.Type == 1)
|
||||
: null;
|
||||
|
||||
var lastBhaPositionIncreaseFact = group.Any(o => o.IdOperationCategory == 71 && o.Type == 1)
|
||||
? group.First(o => o.IdOperationCategory == 71 && o.Type == 1)
|
||||
: null;
|
||||
|
||||
bhaRaiseDecreaseCollection.Add((firstBhaPositionDecreasePlan,
|
||||
lastBhaPositionIncreasePlan, firstBhaPositionDecreaseFact,
|
||||
lastBhaPositionIncreaseFact));
|
||||
}
|
||||
|
||||
var routeSpeedsBase = bhaRaiseDecreaseCollection.Select(el => new // TODO: check value for null
|
||||
var routeSpeedsBase = bhaRaiseDecreaseCollection.Select(el => new
|
||||
{
|
||||
RouteDepthPlan = el.FirstDecreasePlan.WellDepth - el.LastIncreasePlan.WellDepth,
|
||||
RouteDepthFact = el.FirstDecreaseFact.WellDepth - el.LastIncreaseFact.WellDepth,
|
||||
RouteDurationPlan = (el.LastIncreasePlan.StartDate +
|
||||
TimeSpan.FromHours(el.LastIncreasePlan.DurationHours) -
|
||||
el.FirstDecreasePlan.StartDate).TotalHours,
|
||||
RouteDurationFact = (el.LastIncreaseFact.StartDate +
|
||||
TimeSpan.FromHours(el.LastIncreaseFact.DurationHours) -
|
||||
el.FirstDecreaseFact.StartDate).TotalHours
|
||||
RouteDepthPlan = (el.FirstBhaPositionDecreasePlan?.WellDepth - el.LastBhaPositionIncreasePlan?.WellDepth) ?? 0,
|
||||
RouteDepthFact = (el.FirstBhaPositionDecreaseFact?.WellDepth - el.LastBhaPositionIncreaseFact?.WellDepth) ?? 0,
|
||||
RouteDurationPlan = (el.LastBhaPositionIncreasePlan?.StartDate +
|
||||
TimeSpan.FromHours(el.LastBhaPositionIncreasePlan?.DurationHours ?? 0) -
|
||||
el.FirstBhaPositionDecreasePlan?.StartDate)?.TotalHours ?? 0,
|
||||
RouteDurationFact = (el.LastBhaPositionIncreaseFact?.StartDate +
|
||||
TimeSpan.FromHours(el.LastBhaPositionIncreaseFact?.DurationHours ?? 0) -
|
||||
el.FirstBhaPositionDecreaseFact?.StartDate)?.TotalHours ?? 0
|
||||
});
|
||||
|
||||
return routeSpeedsBase.Select(el =>
|
||||
|
Loading…
Reference in New Issue
Block a user