diff --git a/AsbCloudApp/Data/PlanFactPredictBase.cs b/AsbCloudApp/Data/PlanFactPredictBase.cs
new file mode 100644
index 00000000..c27d476d
--- /dev/null
+++ b/AsbCloudApp/Data/PlanFactPredictBase.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AsbCloudApp.Data
+{
+ ///
+ /// Lines container for Time Vs Depth chart
+ ///
+ public class PlanFactPredictBase
+ {
+ public T Plan { get; set; }
+ public T Fact { get; set; }
+ public T Predict { get; set; }
+ }
+}
diff --git a/AsbCloudApp/Data/WellOperationDto.cs b/AsbCloudApp/Data/WellOperationDto.cs
index e0eb7442..7cca980a 100644
--- a/AsbCloudApp/Data/WellOperationDto.cs
+++ b/AsbCloudApp/Data/WellOperationDto.cs
@@ -19,7 +19,7 @@ namespace AsbCloudApp.Data
public string CategoryInfo { get; set; }
///
- /// 0 = план или 1 = факт
+ /// 0 = план или 1 = факт или прогноз = 2
///
public int IdType { get; set; }
diff --git a/AsbCloudApp/Services/IWellOperationsStatService.cs b/AsbCloudApp/Services/IWellOperationsStatService.cs
index 85c60f82..fce85862 100644
--- a/AsbCloudApp/Services/IWellOperationsStatService.cs
+++ b/AsbCloudApp/Services/IWellOperationsStatService.cs
@@ -9,5 +9,6 @@ namespace AsbCloudApp.Services
{
Task GetStatClusterAsync(int idCluster, CancellationToken token = default);
Task GetStatWellAsync(int idWell, CancellationToken token = default);
+ Task>> GetTvdAsync(int idWell, CancellationToken token);
}
}
diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs
index 2dcf1c72..5c6f3427 100644
--- a/AsbCloudDb/Model/AsbCloudDbContext.cs
+++ b/AsbCloudDb/Model/AsbCloudDbContext.cs
@@ -393,100 +393,90 @@ namespace AsbCloudDb.Model
modelBuilder.Entity(entity =>
{
entity.HasData(new List {
- new WellOperation{ Id = 3762, IdWell = 4, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5},
- new WellOperation{ Id = 1902, IdWell = 1, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-04 13:00"), DurationHours = 3.5},
- new WellOperation{ Id = 9065, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5},
- new WellOperation{ Id = 9880, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 07:30"), DurationHours = 3.5},
- new WellOperation{ Id = 5965, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 18:00"), DurationHours = 3.5},
- new WellOperation{ Id = 1769, IdWell = 1, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 23:00"), DurationHours = 3.5},
- new WellOperation{ Id = 3842, IdWell = 1, IdWellSectionType = 1, IdCategory = 1043, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 05:00"), DurationHours = 3.5},
- new WellOperation{ Id = 7410, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 11:30"), DurationHours = 3.5},
- new WellOperation{ Id = 495, IdWell = 2, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5},
- new WellOperation{ Id = 5088, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 14:30"), DurationHours = 3.5},
- new WellOperation{ Id = 5780, IdWell = 1, IdWellSectionType = 1, IdCategory = 1033, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 21:30"), DurationHours = 3.5},
- new WellOperation{ Id = 6397, IdWell = 2, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5},
- new WellOperation{ Id = 7021, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 22:00"), DurationHours = 3.5},
- new WellOperation{ Id = 6609, IdWell = 1, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 05:30"), DurationHours = 3.5},
- new WellOperation{ Id = 7882, IdWell = 4, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5},
- new WellOperation{ Id = 8371, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1110, StartDate = DateTime.Parse("2021-08-24 21:00"), DurationHours = 3.5},
- new WellOperation{ Id = 2385, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5},
- new WellOperation{ Id = 301, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5},
- new WellOperation{ Id = 6422, IdWell = 2, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5},
- new WellOperation{ Id = 1704, IdWell = 1, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-03 12:30"), DurationHours = 3.5},
- new WellOperation{ Id = 9873, IdWell = 2, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15},
- new WellOperation{ Id = 8289, IdWell = 2, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5},
- new WellOperation{ Id = 6626, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 19:30"), DurationHours = 3.5},
- new WellOperation{ Id = 3031, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5},
- new WellOperation{ Id = 3334, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5},
- new WellOperation{ Id = 2891, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-27 01:30"), DurationHours = 3.5},
- new WellOperation{ Id = 6018, IdWell = 2, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5},
- new WellOperation{ Id = 9137, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-08-27 05:00"), DurationHours = 3.5},
- new WellOperation{ Id = 1873, IdWell = 1, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-03 09:00"), DurationHours = 3.5},
- new WellOperation{ Id = 1825, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5},
- new WellOperation{ Id = 3984, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 3.5},
- new WellOperation{ Id = 2110, IdWell = 4, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5},
- new WellOperation{ Id = 4114, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 22:00"), DurationHours = 3.5},
- new WellOperation{ Id = 4960, IdWell = 5, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5},
- new WellOperation{ Id = 5832, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-25 00:30"), DurationHours = 3.5},
- new WellOperation{ Id = 6306, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5},
- new WellOperation{ Id = 2710, IdWell = 1, IdWellSectionType = 1, IdCategory = 1048, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 01:00"), DurationHours = 3.5},
- new WellOperation{ Id = 1409, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-27 01:30"), DurationHours = 3.5},
- new WellOperation{ Id = 5839, IdWell = 4, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5},
- new WellOperation{ Id = 3671, IdWell = 5, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5},
- new WellOperation{ Id = 5462, IdWell = 1, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-04 09:30"), DurationHours = 3.5},
- new WellOperation{ Id = 6822, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5},
- new WellOperation{ Id = 7958, IdWell = 1, IdWellSectionType = 1, IdCategory = 1045, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 11:00"), DurationHours = 3.5},
- new WellOperation{ Id = 461, IdWell = 5, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5},
- new WellOperation{ Id = 407, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 12:00"), DurationHours = 3.5},
- new WellOperation{ Id = 165, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5},
- new WellOperation{ Id = 9599, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-27 05:00"), DurationHours = 3.5},
- new WellOperation{ Id = 3560, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 08:30"), DurationHours = 3.5},
- new WellOperation{ Id = 239, IdWell = 1, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-04 06:00"), DurationHours = 3.5},
- new WellOperation{ Id = 101, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 18:30"), DurationHours = 3.5},
- new WellOperation{ Id = 1210, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5},
- new WellOperation{ Id = 4979, IdWell = 4, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5},
- new WellOperation{ Id = 4335, IdWell = 1, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 22:30"), DurationHours = 3.5},
- new WellOperation{ Id = 6473, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 04:30"), DurationHours = 3.5},
- new WellOperation{ Id = 3020, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5},
- new WellOperation{ Id = 9013, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 01:00"), DurationHours = 3.5},
- new WellOperation{ Id = 9199, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 11:30"), DurationHours = 3.5},
- new WellOperation{ Id = 5344, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 19:00"), DurationHours = 3.5},
- new WellOperation{ Id = 3080, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-26 15:00"), DurationHours = 3.5},
- new WellOperation{ Id = 3889, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 21:00"), DurationHours = 3.5},
- new WellOperation{ Id = 8701, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5},
- new WellOperation{ Id = 8598, IdWell = 4, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5},
- new WellOperation{ Id = 1789, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, WellDepth = 1110, StartDate = DateTime.Parse("2021-08-25 04:00"), DurationHours = 3.5},
- new WellOperation{ Id = 3895, IdWell = 2, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15},
- new WellOperation{ Id = 5441, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-04 02:30"), DurationHours = 3.5},
- new WellOperation{ Id = 8977, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 04:00"), DurationHours = 3.5},
- new WellOperation{ Id = 2803, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 11:00"), DurationHours = 3.5},
- new WellOperation{ Id = 1863, IdWell = 5, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5},
- new WellOperation{ Id = 8644, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 3.5},
- new WellOperation{ Id = 9330, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 18:30"), DurationHours = 3.5},
- new WellOperation{ Id = 1323, IdWell = 2, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5},
- new WellOperation{ Id = 489, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1110, StartDate = DateTime.Parse("2021-08-25 00:30"), DurationHours = 3.5},
- new WellOperation{ Id = 5618, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 08:00"), DurationHours = 3.5},
- new WellOperation{ Id = 2036, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5},
- new WellOperation{ Id = 1498, IdWell = 4, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15},
- new WellOperation{ Id = 918, IdWell = 5, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15},
- new WellOperation{ Id = 6350, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 02:00"), DurationHours = 3.5},
- new WellOperation{ Id = 4483, IdWell = 1, IdWellSectionType = 1, IdCategory = 1045, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 07:30"), DurationHours = 3.5},
- new WellOperation{ Id = 9937, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-25 18:00"), DurationHours = 3.5},
- new WellOperation{ Id = 8519, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 21:30"), DurationHours = 3.5},
- new WellOperation{ Id = 7148, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-27 12:00"), DurationHours = 17},
- new WellOperation{ Id = 4671, IdWell = 5, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5},
- new WellOperation{ Id = 2999, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5},
- new WellOperation{ Id = 4007, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 04:30"), DurationHours = 3.5},
- new WellOperation{ Id = 1623, IdWell = 2, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5},
- new WellOperation{ Id = 6224, IdWell = 5, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5},
- new WellOperation{ Id = 1950, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5},
- new WellOperation{ Id = 5613, IdWell = 1, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 16:00"), DurationHours = 3.5},
- new WellOperation{ Id = 5719, IdWell = 1, IdWellSectionType = 1, IdCategory = 1033, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 14:30"), DurationHours = 3.5},
- new WellOperation{ Id = 1325, IdWell = 1, IdWellSectionType = 1, IdCategory = 1048, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 08:00"), DurationHours = 3.5},
- new WellOperation{ Id = 9243, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 15:00"), DurationHours = 3.5},
- new WellOperation{ Id = 6891, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5},
- new WellOperation{ Id = 273, IdWell = 1, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 15:30"), DurationHours = 3.5},
- new WellOperation{ Id = 2897, IdWell = 2, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5},
+ new WellOperation{ Id = 42222, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 18:40"), DurationHours = 3.5},
+new WellOperation{ Id = 2003, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 11:00"), DurationHours = 3.5},
+new WellOperation{ Id = 58186, IdWell = 2, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15},
+new WellOperation{ Id = 47573, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5},
+new WellOperation{ Id = 71719, IdWell = 1, IdWellSectionType = 1, IdCategory = 1045, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 12:10"), DurationHours = 3.5},
+new WellOperation{ Id = 91686, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 04:40"), DurationHours = 3.5},
+new WellOperation{ Id = 98686, IdWell = 5, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5},
+new WellOperation{ Id = 3987, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5},
+new WellOperation{ Id = 44563, IdWell = 1, IdWellSectionType = 1, IdCategory = 1045, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 07:30"), DurationHours = 3.5},
+new WellOperation{ Id = 59332, IdWell = 2, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5},
+new WellOperation{ Id = 35943, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 21:00"), DurationHours = 3.5},
+new WellOperation{ Id = 7989, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 08:40"), DurationHours = 3.5},
+new WellOperation{ Id = 29454, IdWell = 5, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5},
+new WellOperation{ Id = 4071, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-04 02:30"), DurationHours = 3.5},
+new WellOperation{ Id = 82004, IdWell = 1, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 23:00"), DurationHours = 3.5},
+new WellOperation{ Id = 59748, IdWell = 2, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5},
+new WellOperation{ Id = 62812, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 19:00"), DurationHours = 3.5},
+new WellOperation{ Id = 9526, IdWell = 2, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5},
+new WellOperation{ Id = 42065, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 01:10"), DurationHours = 3.5},
+new WellOperation{ Id = 18584, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 15:40"), DurationHours = 3.5},
+new WellOperation{ Id = 65446, IdWell = 4, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5},
+new WellOperation{ Id = 5000, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 18:00"), DurationHours = 3.5},
+new WellOperation{ Id = 58571, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 02:10"), DurationHours = 3.5},
+new WellOperation{ Id = 41059, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 19:30"), DurationHours = 3.5},
+new WellOperation{ Id = 82283, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 21:30"), DurationHours = 3.5},
+new WellOperation{ Id = 15387, IdWell = 5, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5},
+new WellOperation{ Id = 6250, IdWell = 1, IdWellSectionType = 1, IdCategory = 1048, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 09:10"), DurationHours = 3.5},
+new WellOperation{ Id = 34860, IdWell = 1, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-04 13:00"), DurationHours = 3.5},
+new WellOperation{ Id = 61847, IdWell = 5, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5},
+new WellOperation{ Id = 82029, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-25 00:30"), DurationHours = 3.5},
+new WellOperation{ Id = 17507, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 08:00"), DurationHours = 3.5},
+new WellOperation{ Id = 87222, IdWell = 5, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5},
+new WellOperation{ Id = 9622, IdWell = 1, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 16:00"), DurationHours = 3.5},
+new WellOperation{ Id = 69090, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5},
+new WellOperation{ Id = 30815, IdWell = 1, IdWellSectionType = 1, IdCategory = 1048, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 01:00"), DurationHours = 3.5},
+new WellOperation{ Id = 59823, IdWell = 2, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5},
+new WellOperation{ Id = 4826, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5},
+new WellOperation{ Id = 72813, IdWell = 2, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5},
+new WellOperation{ Id = 33609, IdWell = 1, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 05:30"), DurationHours = 3.5},
+new WellOperation{ Id = 22988, IdWell = 4, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5},
+new WellOperation{ Id = 80776, IdWell = 4, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15},
+new WellOperation{ Id = 48442, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5},
+new WellOperation{ Id = 82844, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5},
+new WellOperation{ Id = 57789, IdWell = 2, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5},
+new WellOperation{ Id = 99586, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1110, StartDate = DateTime.Parse("2021-08-25 01:40"), DurationHours = 3.5},
+new WellOperation{ Id = 46064, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-08-27 05:00"), DurationHours = 3.5},
+new WellOperation{ Id = 53146, IdWell = 1, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 22:30"), DurationHours = 3.5},
+new WellOperation{ Id = 67566, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 3.5},
+new WellOperation{ Id = 96390, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5},
+new WellOperation{ Id = 88634, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 08:10"), DurationHours = 3.5},
+new WellOperation{ Id = 56365, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 02:00"), DurationHours = 3.5},
+new WellOperation{ Id = 12296, IdWell = 1, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-04 09:30"), DurationHours = 3.5},
+new WellOperation{ Id = 73429, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5},
+new WellOperation{ Id = 25451, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 11:40"), DurationHours = 3.5},
+new WellOperation{ Id = 52344, IdWell = 4, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5},
+new WellOperation{ Id = 28277, IdWell = 2, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5},
+new WellOperation{ Id = 14112, IdWell = 1, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-03 12:30"), DurationHours = 3.5},
+new WellOperation{ Id = 92093, IdWell = 4, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5},
+new WellOperation{ Id = 54204, IdWell = 1, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 15:30"), DurationHours = 3.5},
+new WellOperation{ Id = 46250, IdWell = 2, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5},
+new WellOperation{ Id = 58490, IdWell = 1, IdWellSectionType = 1, IdCategory = 1033, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 14:30"), DurationHours = 3.5},
+new WellOperation{ Id = 42809, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5},
+new WellOperation{ Id = 54743, IdWell = 5, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15},
+new WellOperation{ Id = 82546, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 22:00"), DurationHours = 3.5},
+new WellOperation{ Id = 45594, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 04:00"), DurationHours = 3.5},
+new WellOperation{ Id = 31385, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 18:30"), DurationHours = 3.5},
+new WellOperation{ Id = 77880, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-25 19:10"), DurationHours = 3.5},
+new WellOperation{ Id = 85121, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 04:30"), DurationHours = 3.5},
+new WellOperation{ Id = 84883, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1110, StartDate = DateTime.Parse("2021-08-24 22:10"), DurationHours = 3.5},
+new WellOperation{ Id = 86695, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 15:10"), DurationHours = 3.5},
+new WellOperation{ Id = 35347, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 15:00"), DurationHours = 3.5},
+new WellOperation{ Id = 41956, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, WellDepth = 1110, StartDate = DateTime.Parse("2021-08-25 05:10"), DurationHours = 3.5},
+new WellOperation{ Id = 42008, IdWell = 1, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-04 06:00"), DurationHours = 3.5},
+new WellOperation{ Id = 57353, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 05:40"), DurationHours = 3.5},
+new WellOperation{ Id = 68599, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-26 12:40"), DurationHours = 3.5},
+new WellOperation{ Id = 76342, IdWell = 4, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5},
+new WellOperation{ Id = 66370, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-27 01:30"), DurationHours = 3.5},
+new WellOperation{ Id = 9350, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 11:30"), DurationHours = 3.5},
+new WellOperation{ Id = 80725, IdWell = 4, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5},
+new WellOperation{ Id = 39742, IdWell = 1, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-03 09:00"), DurationHours = 3.5},
+new WellOperation{ Id = 95388, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5},
+new WellOperation{ Id = 18622, IdWell = 5, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5},
+new WellOperation{ Id = 37124, IdWell = 2, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15},
+new WellOperation{ Id = 6511, IdWell = 1, IdWellSectionType = 1, IdCategory = 1033, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 22:40"), DurationHours = 3.5},
});
});
diff --git a/AsbCloudInfrastructure/Helper.cs b/AsbCloudInfrastructure/Helper.cs
index 01fc97b5..7f2db8f6 100644
--- a/AsbCloudInfrastructure/Helper.cs
+++ b/AsbCloudInfrastructure/Helper.cs
@@ -1,4 +1,6 @@
using System;
+using System.Collections.Generic;
+using System.Linq;
namespace AsbCloudInfrastructure
{
@@ -51,5 +53,69 @@ namespace AsbCloudInfrastructure
return (min, max);
}
+
+ public static List> MergeArrays(IEnumerable array1, IEnumerable array2, Func getId)
+ where Tid : IComparable
+ where T : class
+ {
+ var a1 = array1.ToArray();
+ var a2 = array2.ToArray();
+
+ var m = new List>((a1.Length + a2.Length)/3);
+ void Add(T item1, T item2) =>
+ m.Add(new Tuple(item1, item2));
+
+ int i1 = 0;
+ int i2 = 0;
+ while (true)
+ {
+ var is1 = a1.Length > i1;
+ var is2 = a2.Length > i2;
+ if (!(is1 || is2))
+ break;
+
+ if (is1 && is2)
+ {
+ if (getId(a1[i1]).CompareTo(getId(a2[i2])) == 0)
+ Add(a1[i1++], a2[i2++]);
+ else
+ {
+ int nextI1 = Array.IndexOf(a1, a2[i2], i1);
+ int nextI2 = Array.IndexOf(a2, a1[i1], i2);
+
+ if ((nextI1 > -1) && ((nextI2 == -1) || ((nextI1 - i1) < (nextI2 - i2))))
+ {
+ for (; i1 < nextI1; i1++)
+ Add(a1[i1], null);
+ }
+
+ if ((nextI2 > -1) && ((nextI1 == -1) || ((nextI1 - i1) > (nextI2 - i2))))
+ {
+ for (; i2 < nextI2; i2++)
+ Add(null, a2[i2]);
+ }
+
+ if ((nextI1 == -1) && (nextI2 == -1))
+ {
+ for (; i2 < a2.Length; i2++)
+ Add(null, a2[i2]);
+
+ for (; i1 < a1.Length; i1++)
+ Add(a1[i1], null);
+ }
+ }
+ }
+ else if (is1)
+ {
+ Add(a1[i1++], null);
+ }
+ else if (is2)
+ {
+ Add(null, a2[i2++]);
+ }
+ }
+
+ return m;
+ }
}
}
diff --git a/AsbCloudInfrastructure/MapsterExtension.cs b/AsbCloudInfrastructure/MapsterExtension.cs
index 7b8020bc..93c991ff 100644
--- a/AsbCloudInfrastructure/MapsterExtension.cs
+++ b/AsbCloudInfrastructure/MapsterExtension.cs
@@ -12,18 +12,32 @@ namespace Mapster
}
- public static TDestination Adapt(this TSource source, Action afterMapAction = default)
+ public static TDestination Adapt(this object source, Action afterMapAction = default)
{
var dest = source.Adapt();
if (afterMapAction != default)
- afterMapAction(source, dest);
+ afterMapAction(dest);
return dest;
}
- public static IEnumerable Adapt(this IEnumerable sourceList, Action eachAfterMapAction = default)
+ public static TDestination Adapt(this TSource source, Action afterMapAction = default)
+ {
+ var dest = source.Adapt();
+ if (afterMapAction != default)
+ afterMapAction(dest, source);
+ return dest;
+ }
+
+ public static IEnumerable Adapt(this IEnumerable sourceList, Action eachAfterMapAction = default)
{
foreach (var item in sourceList)
- yield return item.Adapt(eachAfterMapAction);
+ {
+ var dest = item.Adapt();
+ if (eachAfterMapAction != default)
+ eachAfterMapAction(dest, item);
+ yield return dest;
+ }
+
}
}
}
diff --git a/AsbCloudInfrastructure/Services/WellOperationsStatService.cs b/AsbCloudInfrastructure/Services/WellOperationsStatService.cs
index 7a9eaca8..884674fd 100644
--- a/AsbCloudInfrastructure/Services/WellOperationsStatService.cs
+++ b/AsbCloudInfrastructure/Services/WellOperationsStatService.cs
@@ -8,6 +8,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using Mapster;
namespace AsbCloudInfrastructure.Services
{
@@ -65,7 +66,9 @@ namespace AsbCloudInfrastructure.Services
private const int idOperationDrilling = 1001;
private const int idOperationBhaDown = 1046;
private const int idOperationBhaUp = 1047;
- private const int IdOperationCasingDown = 1048;
+ private const int idOperationCasingDown = 1048;
+ private const int idOperationTypePlan = 0;
+ private const int idOperationTypeFact = 1;
public WellOperationsStatService(IAsbCloudDbContext db, CacheDb cache, IWellService wellService)
{
@@ -151,8 +154,8 @@ namespace AsbCloudInfrastructure.Services
.ToDictionary(s => s.Id);
var sections = new List(sectionTypes.Count);
- var operationsPlan = MakeOperationsExt(operations.Where(o => o.IdType == 0));
- var operationsFact = MakeOperationsExt(operations.Where(o => o.IdType == 1));
+ var operationsPlan = MakeOperationsExt(operations.Where(o => o.IdType == idOperationTypePlan));
+ var operationsFact = MakeOperationsExt(operations.Where(o => o.IdType == idOperationTypeFact));
foreach ((var id, var sectionType) in sectionTypes)
{
@@ -170,8 +173,8 @@ namespace AsbCloudInfrastructure.Services
private static PlanFactBase GetStat(IEnumerable operations)
{
- var operationsPlan = MakeOperationsExt(operations.Where(o => o.IdType == 0));
- var operationsFact = MakeOperationsExt(operations.Where(o => o.IdType == 1));
+ var operationsPlan = MakeOperationsExt(operations.Where(o => o.IdType == idOperationTypePlan));
+ var operationsFact = MakeOperationsExt(operations.Where(o => o.IdType == idOperationTypeFact));
var section = new PlanFactBase
{
Plan = CalcStat(operationsPlan),
@@ -226,7 +229,7 @@ namespace AsbCloudInfrastructure.Services
private static double CalcCasingDownSpeed(IEnumerable operationsProps)
{
- var ops = operationsProps.Where(o => o.IdCategory == IdOperationCasingDown);
+ var ops = operationsProps.Where(o => o.IdCategory == idOperationCasingDown);
var depth = 0d;
var dHours = 0d;
foreach (var operation in ops)
@@ -321,6 +324,71 @@ namespace AsbCloudInfrastructure.Services
return dDepth / (dHours + double.Epsilon);
}
+ public async Task>> GetTvdAsync(int idWell, CancellationToken token)
+ {
+ var wellOperations = await db.WellOperations
+ .Include(o => o.OperationCategory)
+ .Include(o => o.WellSectionType)
+ .Where(o => o.IdWell == idWell)
+ .OrderBy(o => o.StartDate)
+ .AsNoTracking()
+ .ToListAsync(token)
+ .ConfigureAwait(false);
+
+ var wellOperationsPlan = wellOperations
+ .Where(o => o.IdType == idOperationTypePlan)
+ .OrderBy(o => o.StartDate);
+
+ var wellOperationsFact = wellOperations
+ .Where(o => o.IdType == idOperationTypeFact)
+ .OrderBy(o => o.StartDate);
+
+ var merged = Helper.MergeArrays(wellOperationsPlan, wellOperationsFact, i => i.IdCategory);
+ var tvd = new List>(merged.Count);
+ int iLastMatch = 0;
+ int iLastFact = 0;
+ for (int i = 0; i < merged.Count; i++)
+ {
+ Tuple item = merged[i];
+ var planFactPredict = new PlanFactPredictBase
+ {
+ Plan = item.Item1?.Adapt(WellOperationDtoMutation),
+ Fact = item.Item2?.Adapt(WellOperationDtoMutation),
+ Predict = null,
+ };
+
+ tvd.Add(planFactPredict);
+ if ((item.Item1 is not null) && (item.Item2 is not null))
+ iLastMatch = i;
+ if (item.Item2 is not null)
+ iLastFact = i;
+ }
+
+ if (iLastMatch == 0 || iLastMatch == merged.Count - 1)
+ return tvd;
+
+ var lastMatchPlan = merged[iLastMatch].Item1;
+ var lastMatchPlanOperationEnd = lastMatchPlan.StartDate.AddHours(lastMatchPlan.DurationHours);
+ var lastMatchFact = merged[iLastMatch].Item2;
+ var startOffset = lastMatchFact.StartDate.AddHours(lastMatchFact.DurationHours) - lastMatchPlanOperationEnd;
+
+ for (int i = iLastMatch + 1; i < merged.Count; i++)
+ {
+ if (merged[i].Item1 is null)
+ continue;
+ tvd[i].Predict = merged[i].Item1.Adapt();
+ tvd[i].Predict.IdType = 2;
+ tvd[i].Predict.StartDate = tvd[i].Predict.StartDate + startOffset;
+ }
+ return tvd;
+ }
+
+ private static Action WellOperationDtoMutation = (WellOperationDto dest, WellOperation source) =>
+ {
+ dest.CategoryName = source.OperationCategory?.Name;
+ dest.WellSectionTypeName = source.WellSectionType?.Caption;
+ };
+
private static IEnumerable MakeOperationsExt(IEnumerable operations)
{
var sortedOperations = operations.OrderBy(o => o.StartDate);
diff --git a/AsbCloudWebApi/Controllers/WellOperationStatController.cs b/AsbCloudWebApi/Controllers/WellOperationStatController.cs
index 5983689d..18b9373f 100644
--- a/AsbCloudWebApi/Controllers/WellOperationStatController.cs
+++ b/AsbCloudWebApi/Controllers/WellOperationStatController.cs
@@ -16,12 +16,12 @@ namespace AsbCloudWebApi.Controllers
[Route("api")]
public class WellOperationStatController : ControllerBase
{
- private readonly IWellOperationsStatService sectionsService;
+ private readonly IWellOperationsStatService operationsStatService;
private readonly IWellService wellService;
public WellOperationStatController(IWellOperationsStatService sectionsService, IWellService wellService)
{
- this.sectionsService = sectionsService;
+ this.operationsStatService = sectionsService;
this.wellService = wellService;
}
@@ -35,7 +35,7 @@ namespace AsbCloudWebApi.Controllers
//if (!await CanUserAccessToWellAsync(idCluster, token).ConfigureAwait(false))
// return Forbid();
- var result = await sectionsService.GetStatClusterAsync(idCluster, token)
+ var result = await operationsStatService.GetStatClusterAsync(idCluster, token)
.ConfigureAwait(false);
return Ok(result);
}
@@ -49,12 +49,26 @@ namespace AsbCloudWebApi.Controllers
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
return Forbid();
- var result = await sectionsService.GetStatWellAsync(idWell, token)
+ var result = await operationsStatService.GetStatWellAsync(idWell, token)
.ConfigureAwait(false);
return Ok(result);
}
+ [HttpGet]
+ [Route("well/{idWell}/tvd")]
+ [ProducesResponseType(typeof(IEnumerable>), (int)System.Net.HttpStatusCode.OK)]
+ public async Task GetTvdAsync(int idWell,
+ CancellationToken token = default)
+ {
+ if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
+ return Forbid();
+
+ var result = await operationsStatService.GetTvdAsync(idWell, token)
+ .ConfigureAwait(false);
+ return Ok(result);
+ }
+
private async Task CanUserAccessToWellAsync(int idWell, CancellationToken token = default)
{
int? idCompany = User.GetCompanyId();