forked from ddrilling/AsbCloudServer
Merge branch 'master' of https://bitbucket.org/frolovng/asbcloudserver
This commit is contained in:
commit
e9d1abe58f
@ -113,29 +113,6 @@ namespace AsbCloudDb.Model
|
|||||||
.HasConstraintName("t_event_t_telemetry_id_fk");
|
.HasConstraintName("t_event_t_telemetry_id_fk");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<UserRole>(entity =>
|
|
||||||
{
|
|
||||||
entity.HasData(new List<UserRole>{
|
|
||||||
new UserRole{ Id = 1, Caption = "Администратор", },
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<CompanyType>(entity =>
|
|
||||||
{
|
|
||||||
entity.HasData(new List<CompanyType>{
|
|
||||||
new CompanyType{ Id = 1, Caption = "Недрапользователь", },
|
|
||||||
new CompanyType{ Id = 2, Caption = "Буровой подрядчик", },
|
|
||||||
new CompanyType{ Id = 3, Caption = "Сервис автоматизации бурения", },
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<Company>(entity =>
|
|
||||||
{
|
|
||||||
entity.HasData(new List<Company>{
|
|
||||||
new Company{ Id = 1, Caption = "\"ООО\" АСБ", IdCompanyType = 3},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<User>(entity =>
|
modelBuilder.Entity<User>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasOne(d => d.Company)
|
entity.HasOne(d => d.Company)
|
||||||
@ -145,18 +122,6 @@ namespace AsbCloudDb.Model
|
|||||||
|
|
||||||
entity.HasIndex(d => d.Login)
|
entity.HasIndex(d => d.Login)
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
entity.HasData(new List<User>{
|
|
||||||
new User{
|
|
||||||
Id = 1,
|
|
||||||
IdCompany = 1,
|
|
||||||
IdRole = 1,
|
|
||||||
Level = int.MaxValue,
|
|
||||||
Login = "dev",
|
|
||||||
PasswordHash = "Vlcj|4fa529103dde7ff72cfe76185f344d4aa87931f8e1b2044e8a7739947c3d18923464eaad93843e4f809c5e126d013072", // dev
|
|
||||||
Name = "Разработчик",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<Well>(entity =>
|
modelBuilder.Entity<Well>(entity =>
|
||||||
@ -170,8 +135,6 @@ namespace AsbCloudDb.Model
|
|||||||
.WithOne(p => p.Well)
|
.WithOne(p => p.Well)
|
||||||
.HasForeignKey<Well>(d => d.IdTelemetry)
|
.HasForeignKey<Well>(d => d.IdTelemetry)
|
||||||
.HasConstraintName("t_well_t_telemetry_id_fk");
|
.HasConstraintName("t_well_t_telemetry_id_fk");
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<RelationCompanyWell>(entity => {
|
modelBuilder.Entity<RelationCompanyWell>(entity => {
|
||||||
@ -190,54 +153,37 @@ namespace AsbCloudDb.Model
|
|||||||
});
|
});
|
||||||
|
|
||||||
FillData(modelBuilder);
|
FillData(modelBuilder);
|
||||||
|
FillDemoData(modelBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void FillData(ModelBuilder modelBuilder)
|
private static void FillData(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
modelBuilder.Entity<Deposit>(entity =>
|
modelBuilder.Entity<UserRole>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasData(new List<Deposit> {
|
entity.HasData(new List<UserRole>{
|
||||||
new Deposit{Id = 1, Caption = "м/р 1", Latitude = 60.8705722222222, Longitude = 70.3811888888889 },
|
new UserRole{ Id = 1, Caption = "Администратор", },
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<Cluster>(entity =>
|
modelBuilder.Entity<User>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasData(new List<Cluster> {
|
entity.HasData(new List<User>{
|
||||||
new Cluster{Id = 1, Caption = "к221", IdDeposit = 1, Latitude = 60.8705722222222, Longitude = 70.3811888888889},
|
new User{
|
||||||
new Cluster{Id = 2, Caption = "к151", IdDeposit = 1, Latitude = 60.8205750000000, Longitude = 70.1343833333334},
|
Id = 1,
|
||||||
new Cluster{Id = 3, Caption = "к611", IdDeposit = 1, Latitude = 60.8100666666667, Longitude = 69.7778388888889},
|
IdCompany = 1,
|
||||||
new Cluster{Id = 4, Caption = "к203", IdDeposit = 1, Latitude = 60.8928805555556, Longitude = 70.3272055555556},
|
IdRole = 1,
|
||||||
new Cluster{Id = 5, Caption = "к39.1", IdDeposit = 1, Latitude = 60.6672055555556, Longitude = 69.6603861111111},
|
Level = int.MaxValue,
|
||||||
|
Login = "dev",
|
||||||
|
PasswordHash = "Vlcj|4fa529103dde7ff72cfe76185f344d4aa87931f8e1b2044e8a7739947c3d18923464eaad93843e4f809c5e126d013072", // dev
|
||||||
|
Name = "Разработчик",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<Well>(entity =>
|
modelBuilder.Entity<Company>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasData(new List<Well> {
|
entity.HasData(new List<Company>{
|
||||||
new Well{Id = 1, IdCluster = 1, Caption = "скв 42669", Latitude = 60.8705722222222, Longitude = 70.3811888888889},
|
new Company{ Id = 1, Caption = "\"ООО\" АСБ", IdCompanyType = 3},
|
||||||
new Well{Id = 2, IdCluster = 1, Caption = "скв 16311", Latitude = 60.8705722222222, Longitude = 70.3811888888889},
|
|
||||||
new Well{Id = 3, IdCluster = 2, Caption = "скв 16315", Latitude = 60.8205750000000, Longitude = 70.1343833333334},
|
|
||||||
new Well{Id = 4, IdCluster = 2, Caption = "скв 16318", Latitude = 60.8205750000000, Longitude = 70.1343833333334},
|
|
||||||
new Well{Id = 5, IdCluster = 3, Caption = "скв 16310", Latitude = 60.8100666666667, Longitude = 69.7778388888889},
|
|
||||||
new Well{Id = 6, IdCluster = 4, Caption = "скв 16316", Latitude = 60.8928805555556, Longitude = 70.3272055555556},
|
|
||||||
new Well{Id = 7, IdCluster = 5, Caption = "скв 16312", Latitude = 60.6672055555556, Longitude = 69.6603861111111},
|
|
||||||
new Well{Id = 8, IdCluster = 5, Caption = "скв 16313", Latitude = 60.6672055555556, Longitude = 69.6603861111111},
|
|
||||||
new Well{Id = 9, IdCluster = 5, Caption = "скв 16314", Latitude = 60.6672055555556, Longitude = 69.6603861111111},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<RelationCompanyWell>(entity => {
|
|
||||||
entity.HasData(new List<RelationCompanyWell> {
|
|
||||||
new RelationCompanyWell{ IdWell = 1, IdCompany = 1},
|
|
||||||
new RelationCompanyWell{ IdWell = 2, IdCompany = 1},
|
|
||||||
new RelationCompanyWell{ IdWell = 3, IdCompany = 1},
|
|
||||||
new RelationCompanyWell{ IdWell = 4, IdCompany = 1},
|
|
||||||
new RelationCompanyWell{ IdWell = 5, IdCompany = 1},
|
|
||||||
new RelationCompanyWell{ IdWell = 6, IdCompany = 1},
|
|
||||||
new RelationCompanyWell{ IdWell = 7, IdCompany = 1},
|
|
||||||
new RelationCompanyWell{ IdWell = 8, IdCompany = 1},
|
|
||||||
new RelationCompanyWell{ IdWell = 9, IdCompany = 1},
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -265,6 +211,209 @@ namespace AsbCloudDb.Model
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void FillDemoData(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.Entity<CompanyType>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasData(new List<CompanyType>{
|
||||||
|
new CompanyType{ Id = 1, Caption = "Недрапользователь", },
|
||||||
|
new CompanyType{ Id = 2, Caption = "Буровой подрядчик", },
|
||||||
|
new CompanyType{ Id = 3, Caption = "Сервис автоматизации бурения", },
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Deposit>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasData(new List<Deposit> {
|
||||||
|
new Deposit{Id = 1, Caption = "м/р 1", Latitude = 60.8705722222222, Longitude = 70.3811888888889 },
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Cluster>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasData(new List<Cluster> {
|
||||||
|
new Cluster{Id = 1, Caption = "к39.1", IdDeposit = 1, Latitude = 60.8705722222222, Longitude = 70.3811888888889},
|
||||||
|
new Cluster{Id = 2, Caption = "к151", IdDeposit = 1, Latitude = 60.8205750000000, Longitude = 70.1343833333334},
|
||||||
|
new Cluster{Id = 3, Caption = "к611", IdDeposit = 1, Latitude = 60.8100666666667, Longitude = 69.7778388888889},
|
||||||
|
new Cluster{Id = 4, Caption = "к203", IdDeposit = 1, Latitude = 60.8928805555556, Longitude = 70.3272055555556},
|
||||||
|
new Cluster{Id = 5, Caption = "к221", IdDeposit = 1, Latitude = 60.6672055555556, Longitude = 69.6603861111111},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Well>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasData(new List<Well> {
|
||||||
|
new Well{Id = 1, IdCluster = 1, Caption = "скв 16314", Latitude = 60.8705722222222, Longitude = 70.3811888888889},
|
||||||
|
new Well{Id = 2, IdCluster = 1, Caption = "скв 16311", Latitude = 60.8705722222222, Longitude = 70.3811888888889},
|
||||||
|
new Well{Id = 3, IdCluster = 2, Caption = "скв 16315", Latitude = 60.8205750000000, Longitude = 70.1343833333334},
|
||||||
|
new Well{Id = 4, IdCluster = 2, Caption = "скв 16318", Latitude = 60.8205750000000, Longitude = 70.1343833333334},
|
||||||
|
new Well{Id = 5, IdCluster = 3, Caption = "скв 16310", Latitude = 60.8100666666667, Longitude = 69.7778388888889},
|
||||||
|
new Well{Id = 6, IdCluster = 4, Caption = "скв 16316", Latitude = 60.8928805555556, Longitude = 70.3272055555556},
|
||||||
|
new Well{Id = 7, IdCluster = 5, Caption = "скв 16312", Latitude = 60.6672055555556, Longitude = 69.6603861111111},
|
||||||
|
new Well{Id = 8, IdCluster = 5, Caption = "скв 16313", Latitude = 60.6672055555556, Longitude = 69.6603861111111},
|
||||||
|
new Well{Id = 9, IdCluster = 5, Caption = "скв 42669", Latitude = 60.6672055555556, Longitude = 69.6603861111111},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Telemetry>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasData(new List<Telemetry>{
|
||||||
|
new Telemetry{
|
||||||
|
Id = 1,
|
||||||
|
RemoteUid = "123",
|
||||||
|
Info = new TelemetryInfo
|
||||||
|
{
|
||||||
|
Well = "1",
|
||||||
|
Cluster = "1",
|
||||||
|
Comment = "",
|
||||||
|
Deposit = "1",
|
||||||
|
Customer = "1",
|
||||||
|
HmiVersion = "1",
|
||||||
|
PlcVersion = "1",
|
||||||
|
TimeZoneId = "1",
|
||||||
|
DrillingStartDate = DateTime.Parse("2021-06-29T12:01:19.000000"),
|
||||||
|
TimeZoneOffsetTotalHours = 5.0
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<RelationCompanyWell>(entity => {
|
||||||
|
entity.HasData(new List<RelationCompanyWell> {
|
||||||
|
new RelationCompanyWell{ IdWell = 1, IdCompany = 1},
|
||||||
|
new RelationCompanyWell{ IdWell = 2, IdCompany = 1},
|
||||||
|
new RelationCompanyWell{ IdWell = 3, IdCompany = 1},
|
||||||
|
new RelationCompanyWell{ IdWell = 4, IdCompany = 1},
|
||||||
|
new RelationCompanyWell{ IdWell = 5, IdCompany = 1},
|
||||||
|
new RelationCompanyWell{ IdWell = 6, IdCompany = 1},
|
||||||
|
new RelationCompanyWell{ IdWell = 7, IdCompany = 1},
|
||||||
|
new RelationCompanyWell{ IdWell = 8, IdCompany = 1},
|
||||||
|
new RelationCompanyWell{ IdWell = 9, IdCompany = 1},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<TelemetryAnalysis>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasData(new List<TelemetryAnalysis>{
|
||||||
|
new TelemetryAnalysis
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
IdTelemetry = 1,
|
||||||
|
IdOperation = 17,
|
||||||
|
UnixDate = 1626870355,
|
||||||
|
DurationSec = 10,
|
||||||
|
OperationStartDepth = null,
|
||||||
|
OperationEndDepth = 206,
|
||||||
|
IsWellDepthIncreasing = false,
|
||||||
|
IsWellDepthDecreasing = false,
|
||||||
|
IsBitPositionIncreasing = false,
|
||||||
|
IsBitPositionDecreasing = false,
|
||||||
|
IsBitPositionLt20 = true,
|
||||||
|
IsBlockPositionIncreasing = false,
|
||||||
|
IsBlockPositionDecreasing = false,
|
||||||
|
IsRotorSpeedLt3 = true,
|
||||||
|
IsRotorSpeedGt3 = false,
|
||||||
|
IsPressureLt20 = true,
|
||||||
|
IsPressureGt20 = false,
|
||||||
|
IsHookWeightNotChanges = true,
|
||||||
|
IsHookWeightLt3 = true
|
||||||
|
},
|
||||||
|
new TelemetryAnalysis
|
||||||
|
{
|
||||||
|
Id = 2,
|
||||||
|
IdTelemetry = 1,
|
||||||
|
IdOperation = 8,
|
||||||
|
UnixDate = 1626870364,
|
||||||
|
DurationSec = 6,
|
||||||
|
OperationStartDepth = 206,
|
||||||
|
OperationEndDepth = 206,
|
||||||
|
IsWellDepthIncreasing = false,
|
||||||
|
IsWellDepthDecreasing = false,
|
||||||
|
IsBitPositionIncreasing = true,
|
||||||
|
IsBitPositionDecreasing = false,
|
||||||
|
IsBitPositionLt20 = true,
|
||||||
|
IsBlockPositionIncreasing = true,
|
||||||
|
IsBlockPositionDecreasing = false,
|
||||||
|
IsRotorSpeedLt3 = true,
|
||||||
|
IsRotorSpeedGt3 = false,
|
||||||
|
IsPressureLt20 = true,
|
||||||
|
IsPressureGt20 = false,
|
||||||
|
IsHookWeightNotChanges = true,
|
||||||
|
IsHookWeightLt3 = true
|
||||||
|
},
|
||||||
|
new TelemetryAnalysis
|
||||||
|
{
|
||||||
|
Id = 3,
|
||||||
|
IdTelemetry = 1,
|
||||||
|
IdOperation = 10,
|
||||||
|
UnixDate = 1626870370,
|
||||||
|
DurationSec = 2,
|
||||||
|
OperationStartDepth = null,
|
||||||
|
OperationEndDepth = 206,
|
||||||
|
IsWellDepthIncreasing = false,
|
||||||
|
IsWellDepthDecreasing = false,
|
||||||
|
IsBitPositionIncreasing = false,
|
||||||
|
IsBitPositionDecreasing = true,
|
||||||
|
IsBitPositionLt20 = true,
|
||||||
|
IsBlockPositionIncreasing = false,
|
||||||
|
IsBlockPositionDecreasing = true,
|
||||||
|
IsRotorSpeedLt3 = true,
|
||||||
|
IsRotorSpeedGt3 = false,
|
||||||
|
IsPressureLt20 = true,
|
||||||
|
IsPressureGt20 = false,
|
||||||
|
IsHookWeightNotChanges = true,
|
||||||
|
IsHookWeightLt3 = true
|
||||||
|
},
|
||||||
|
new TelemetryAnalysis
|
||||||
|
{
|
||||||
|
Id = 4,
|
||||||
|
IdTelemetry = 1,
|
||||||
|
IdOperation = 17,
|
||||||
|
UnixDate = 1626870372,
|
||||||
|
DurationSec = 7,
|
||||||
|
OperationStartDepth = 206,
|
||||||
|
OperationEndDepth = 206,
|
||||||
|
IsWellDepthIncreasing = false,
|
||||||
|
IsWellDepthDecreasing = false,
|
||||||
|
IsBitPositionIncreasing = false,
|
||||||
|
IsBitPositionDecreasing = false,
|
||||||
|
IsBitPositionLt20 = true,
|
||||||
|
IsBlockPositionIncreasing = false,
|
||||||
|
IsBlockPositionDecreasing = false,
|
||||||
|
IsRotorSpeedLt3 = true,
|
||||||
|
IsRotorSpeedGt3 = false,
|
||||||
|
IsPressureLt20 = true,
|
||||||
|
IsPressureGt20 = false,
|
||||||
|
IsHookWeightNotChanges = true,
|
||||||
|
IsHookWeightLt3 = true
|
||||||
|
},
|
||||||
|
new TelemetryAnalysis
|
||||||
|
{
|
||||||
|
Id = 5,
|
||||||
|
IdTelemetry = 1,
|
||||||
|
IdOperation = 8,
|
||||||
|
UnixDate = 1626870379,
|
||||||
|
DurationSec = 7,
|
||||||
|
OperationStartDepth = 206,
|
||||||
|
OperationEndDepth = 206,
|
||||||
|
IsWellDepthIncreasing = false,
|
||||||
|
IsWellDepthDecreasing = false,
|
||||||
|
IsBitPositionIncreasing = true,
|
||||||
|
IsBitPositionDecreasing = false,
|
||||||
|
IsBitPositionLt20 = true,
|
||||||
|
IsBlockPositionIncreasing = true,
|
||||||
|
IsBlockPositionDecreasing = false,
|
||||||
|
IsRotorSpeedLt3 = true,
|
||||||
|
IsRotorSpeedGt3 = false,
|
||||||
|
IsPressureLt20 = true,
|
||||||
|
IsPressureGt20 = false,
|
||||||
|
IsHookWeightNotChanges = true,
|
||||||
|
IsHookWeightLt3 = true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public IQueryable<Well> GetWellsForCompany(int idCompany)
|
public IQueryable<Well> GetWellsForCompany(int idCompany)
|
||||||
{
|
{
|
||||||
return from well in Wells
|
return from well in Wells
|
||||||
|
@ -36,7 +36,7 @@ namespace AsbCloudDb.Model
|
|||||||
public long UnixDate { get; set; }
|
public long UnixDate { get; set; }
|
||||||
|
|
||||||
[Column("duration_sec"), Comment("Кол-во секунд после предыдущей операции")]
|
[Column("duration_sec"), Comment("Кол-во секунд после предыдущей операции")]
|
||||||
public int Duration { get; set; }
|
public int DurationSec { get; set; }
|
||||||
|
|
||||||
[Column("operation_start_depth"), Comment("Глубина, на которой началась операция")]
|
[Column("operation_start_depth"), Comment("Глубина, на которой началась операция")]
|
||||||
public double? OperationStartDepth { get; set; }
|
public double? OperationStartDepth { get; set; }
|
||||||
@ -57,7 +57,7 @@ namespace AsbCloudDb.Model
|
|||||||
public bool IsBitPositionDecreasing { get; set; }
|
public bool IsBitPositionDecreasing { get; set; }
|
||||||
|
|
||||||
[Column("is_bit_posision_lt_20"), Comment("Положение долота меньше 20м")]
|
[Column("is_bit_posision_lt_20"), Comment("Положение долота меньше 20м")]
|
||||||
public bool IsBitDepthLess20 { get; set; }
|
public bool IsBitPositionLt20 { get; set; }
|
||||||
|
|
||||||
[Column("is_block_posision_incresing"), Comment("Талевый блок спускается")]
|
[Column("is_block_posision_incresing"), Comment("Талевый блок спускается")]
|
||||||
public bool IsBlockPositionIncreasing { get; set; }
|
public bool IsBlockPositionIncreasing { get; set; }
|
||||||
|
@ -116,7 +116,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
if (end != default)
|
if (end != default)
|
||||||
{
|
{
|
||||||
var unixEnd = (end - new DateTime(1970, 1, 1)).TotalSeconds;
|
var unixEnd = (end - new DateTime(1970, 1, 1)).TotalSeconds;
|
||||||
operations = operations.Where(m => (m.UnixDate + m.Duration) <= unixEnd);
|
operations = operations.Where(m => (m.UnixDate + m.DurationSec) <= unixEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
result.Count = operations.Count();
|
result.Count = operations.Count();
|
||||||
@ -136,7 +136,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
Id = operation.Id,
|
Id = operation.Id,
|
||||||
Name = operation.Operation.Name,
|
Name = operation.Operation.Name,
|
||||||
BeginDate = DateTimeOffset.FromUnixTimeSeconds(operation.UnixDate).DateTime,
|
BeginDate = DateTimeOffset.FromUnixTimeSeconds(operation.UnixDate).DateTime,
|
||||||
EndDate = DateTimeOffset.FromUnixTimeSeconds(operation.UnixDate + operation.Duration).DateTime,
|
EndDate = DateTimeOffset.FromUnixTimeSeconds(operation.UnixDate + operation.DurationSec).DateTime,
|
||||||
StartWellDepth = operation.OperationStartDepth ?? 0.0,
|
StartWellDepth = operation.OperationStartDepth ?? 0.0,
|
||||||
EndWellDepth = operation.OperationEndDepth ?? 0.0
|
EndWellDepth = operation.OperationEndDepth ?? 0.0
|
||||||
};
|
};
|
||||||
@ -166,8 +166,8 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
select new OperationDurationDto
|
select new OperationDurationDto
|
||||||
{
|
{
|
||||||
OperationName = g.Key.Name,
|
OperationName = g.Key.Name,
|
||||||
Duration = g.Where(g => g.Duration > 0)
|
Duration = g.Where(g => g.DurationSec > 0)
|
||||||
.Sum(a => a.Duration)
|
.Sum(a => a.DurationSec)
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
return operations;
|
return operations;
|
||||||
@ -198,7 +198,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
{
|
{
|
||||||
IntervalStart = g.Min(d => d.UnixDate),
|
IntervalStart = g.Min(d => d.UnixDate),
|
||||||
OperationName = g.Key.Name,
|
OperationName = g.Key.Name,
|
||||||
OperationsDuration = g.Sum(an => an.Duration)
|
OperationsDuration = g.Sum(an => an.DurationSec)
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
var operationsGroupedByInterval = operations.GroupBy(op => op.IntervalStart)
|
var operationsGroupedByInterval = operations.GroupBy(op => op.IntervalStart)
|
||||||
@ -232,8 +232,8 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
|
|
||||||
if (saubDataCache.CurrentAnalysis.IdOperation == telemetryAnalysis.IdOperation)
|
if (saubDataCache.CurrentAnalysis.IdOperation == telemetryAnalysis.IdOperation)
|
||||||
{
|
{
|
||||||
saubDataCache.CurrentAnalysis.Duration +=
|
saubDataCache.CurrentAnalysis.DurationSec +=
|
||||||
telemetryAnalysis.Duration;
|
telemetryAnalysis.DurationSec;
|
||||||
saubDataCache.CurrentAnalysis.OperationEndDepth = dataSaub.WellDepth;
|
saubDataCache.CurrentAnalysis.OperationEndDepth = dataSaub.WellDepth;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -283,14 +283,14 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
{
|
{
|
||||||
IdTelemetry = dataSaubBases.First().IdTelemetry,
|
IdTelemetry = dataSaubBases.First().IdTelemetry,
|
||||||
UnixDate = (long)(lastSaubDate - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds,
|
UnixDate = (long)(lastSaubDate - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds,
|
||||||
Duration = (int)(dataSaubBases.Last().Date - dataSaubBases.ElementAt(dataSaubBases.Count() - 2).Date).TotalSeconds,
|
DurationSec = (int)(dataSaubBases.Last().Date - dataSaubBases.ElementAt(dataSaubBases.Count() - 2).Date).TotalSeconds,
|
||||||
OperationStartDepth = null,
|
OperationStartDepth = null,
|
||||||
OperationEndDepth = null,
|
OperationEndDepth = null,
|
||||||
IsWellDepthDecreasing = InterpolationLine.IsValueDecreases(wellDepthChangingIndex, -0.0001),
|
IsWellDepthDecreasing = InterpolationLine.IsValueDecreases(wellDepthChangingIndex, -0.0001),
|
||||||
IsWellDepthIncreasing = InterpolationLine.IsValueIncreases(wellDepthChangingIndex, 0.0001),
|
IsWellDepthIncreasing = InterpolationLine.IsValueIncreases(wellDepthChangingIndex, 0.0001),
|
||||||
IsBitPositionDecreasing = InterpolationLine.IsValueDecreases(bitPositionChangingIndex, -0.0001),
|
IsBitPositionDecreasing = InterpolationLine.IsValueDecreases(bitPositionChangingIndex, -0.0001),
|
||||||
IsBitPositionIncreasing = InterpolationLine.IsValueIncreases(bitPositionChangingIndex, 0.0001),
|
IsBitPositionIncreasing = InterpolationLine.IsValueIncreases(bitPositionChangingIndex, 0.0001),
|
||||||
IsBitDepthLess20 = InterpolationLine.IsAverageLessThanBound(saubBitDepths, 20),
|
IsBitPositionLt20 = InterpolationLine.IsAverageLessThanBound(saubBitDepths, 20),
|
||||||
IsBlockPositionDecreasing = InterpolationLine.IsValueDecreases(blockPositionChangingIndex, -0.0001),
|
IsBlockPositionDecreasing = InterpolationLine.IsValueDecreases(blockPositionChangingIndex, -0.0001),
|
||||||
IsBlockPositionIncreasing = InterpolationLine.IsValueIncreases(blockPositionChangingIndex, 0.0001),
|
IsBlockPositionIncreasing = InterpolationLine.IsValueIncreases(blockPositionChangingIndex, 0.0001),
|
||||||
IsRotorSpeedLt3 = InterpolationLine.IsAverageLessThanBound(saubRotorSpeeds, 3),
|
IsRotorSpeedLt3 = InterpolationLine.IsAverageLessThanBound(saubRotorSpeeds, 3),
|
||||||
|
@ -19,7 +19,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
Detect = (data) =>
|
Detect = (data) =>
|
||||||
{
|
{
|
||||||
return !data.IsWellDepthDecreasing && !data.IsWellDepthIncreasing
|
return !data.IsWellDepthDecreasing && !data.IsWellDepthIncreasing
|
||||||
&& data.IsBitDepthLess20 && data.IsHookWeightLt3;
|
&& data.IsBitPositionLt20 && data.IsHookWeightLt3;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new OperationDetector
|
new OperationDetector
|
||||||
|
Loading…
Reference in New Issue
Block a user