2024-07-04 11:02:45 +05:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
2022-04-25 17:41:18 +05:00
|
|
|
using System;
|
2023-12-04 17:36:00 +05:00
|
|
|
using System.Collections.Generic;
|
2022-04-25 17:41:18 +05:00
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
|
|
|
namespace AsbCloudDb.Model
|
|
|
|
{
|
|
|
|
[Table("t_detected_operation"), Comment("автоматически определенные операции по телеметрии")]
|
2024-02-20 13:13:35 +05:00
|
|
|
public class DetectedOperation : IId
|
2022-04-25 17:41:18 +05:00
|
|
|
{
|
|
|
|
[Key]
|
|
|
|
[Column("id")]
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
|
|
|
[Column("id_telemetry")]
|
|
|
|
public int IdTelemetry { get; set; }
|
|
|
|
|
|
|
|
[Column("id_category"), Comment("Id категории операции")]
|
|
|
|
public int IdCategory { get; set; }
|
2024-04-01 15:32:48 +05:00
|
|
|
|
|
|
|
[Column("id_editor"), Comment("Редактор")]
|
|
|
|
public int? IdEditor { get; set; }
|
|
|
|
|
|
|
|
[Column("creation"), Comment("дата создания")]
|
|
|
|
public DateTimeOffset Creation { get; set; }
|
2022-04-25 17:41:18 +05:00
|
|
|
|
|
|
|
[Column("date_start", TypeName = "timestamp with time zone"), Comment("Дата начала операции")]
|
|
|
|
public DateTimeOffset DateStart { get; set; }
|
|
|
|
|
|
|
|
[Column("date_end", TypeName = "timestamp with time zone"), Comment("Дата начала операции")]
|
|
|
|
public DateTimeOffset DateEnd { get; set; }
|
2024-02-20 15:01:13 +05:00
|
|
|
|
|
|
|
[Column("id_user"), Comment("Id пользователя по телеметрии на момент начала операции")]
|
2024-04-01 15:32:48 +05:00
|
|
|
public int? IdUsersAtStart { get; set; }
|
2022-04-25 17:41:18 +05:00
|
|
|
|
|
|
|
[NotMapped]
|
|
|
|
public double DurationMinutes => (DateEnd - DateStart).TotalMinutes;
|
|
|
|
|
|
|
|
[Column("depth_start"), Comment("Глубина на начало операции, м")]
|
|
|
|
public double DepthStart { get; set; }
|
|
|
|
|
|
|
|
[Column("depth_end"), Comment("Глубина после завершения операции, м")]
|
|
|
|
public double DepthEnd { get; set; }
|
|
|
|
|
2022-06-10 18:36:14 +05:00
|
|
|
[Column("value"), Comment("Ключевой показатель операции")]
|
|
|
|
public double Value { get; set; }
|
|
|
|
|
2023-12-18 13:51:40 +05:00
|
|
|
[Column("enabled_subsystems"), Comment("флаги включенных подсистем")]
|
2023-12-05 10:56:49 +05:00
|
|
|
public int EnabledSubsystems { get; set; }
|
|
|
|
|
2023-12-04 17:36:00 +05:00
|
|
|
[Column("extra_data", TypeName = "jsonb"), Comment("доп. инфо по операции")]
|
|
|
|
public IDictionary<string, object> ExtraData { get; set; } = null!;
|
2022-08-09 18:00:22 +05:00
|
|
|
|
2022-04-25 17:41:18 +05:00
|
|
|
[JsonIgnore]
|
|
|
|
[ForeignKey(nameof(IdTelemetry))]
|
2023-02-17 17:36:25 +05:00
|
|
|
public virtual Telemetry Telemetry { get; set; } = null!;
|
2022-04-25 17:41:18 +05:00
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
[ForeignKey(nameof(IdCategory))]
|
2023-02-17 17:36:25 +05:00
|
|
|
public virtual WellOperationCategory OperationCategory { get; set; } = null!;
|
2022-04-25 17:41:18 +05:00
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
=> $"{IdCategory}\t{DateStart:G}\t{DateEnd:G}\t{DurationMinutes:#0.#}\t{DepthStart:#0.#}\t{DepthEnd:#0.#}";
|
|
|
|
}
|
|
|
|
}
|