forked from ddrilling/AsbCloudServer
57 lines
2.3 KiB
C#
57 lines
2.3 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace AsbCloudDb.Model
|
|
{
|
|
[Table("t_detected_operation"), Comment("автоматически определенные операции по телеметрии")]
|
|
public class DetectedOperation
|
|
{
|
|
[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; }
|
|
|
|
[Column("id_user"), Comment("Id пользователя по телеметрии на момент начала операции")]
|
|
public int IdUsersAtStart { get; set; }
|
|
|
|
[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; }
|
|
|
|
[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; }
|
|
|
|
[Column("value"), Comment("Ключевой показатель операции")]
|
|
public double Value { get; set; }
|
|
|
|
[Column("id_reason_of_end"), Comment("Код признака окончания операции")]
|
|
public int IdReasonOfEnd { get; set; }
|
|
|
|
[JsonIgnore]
|
|
[ForeignKey(nameof(IdTelemetry))]
|
|
public virtual Telemetry Telemetry { get; set; } = null!;
|
|
|
|
[JsonIgnore]
|
|
[ForeignKey(nameof(IdCategory))]
|
|
public virtual WellOperationCategory OperationCategory { get; set; } = null!;
|
|
|
|
public override string ToString()
|
|
=> $"{IdCategory}\t{DateStart:G}\t{DateEnd:G}\t{DurationMinutes:#0.#}\t{DepthStart:#0.#}\t{DepthEnd:#0.#}";
|
|
}
|
|
} |