DD.WellWorkover.Cloud/AsbCloudDb/Model/WellOperation.cs

90 lines
3.2 KiB
C#
Raw Normal View History

2021-09-10 11:28:57 +05:00
using Microsoft.EntityFrameworkCore;
using System;
2021-07-27 14:43:30 +05:00
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace AsbCloudDb.Model
{
2021-08-16 10:38:48 +05:00
[Table("t_well_operation"), Comment("Данные по операциям на скважине")]
public class WellOperation : ItemInfo, IId
2021-07-27 14:43:30 +05:00
{
public const int IdOperationTypePlan = 0;
public const int IdOperationTypeFact = 1;
2021-07-27 14:43:30 +05:00
[Key]
[Column("id")]
public int Id { get; set; }
[Column("id_well"), Comment("Id скважины")]
2021-07-27 14:43:30 +05:00
public int IdWell { get; set; }
[Column("id_well_section_type"), Comment("Id тип секции скважины")]
public int IdWellSectionType { get; set; }
[Column("id_category"), Comment("Id категории операции")]
public int IdCategory { get; set; }
/// <summary>
/// Тип 0 = План или 1 = Факт
/// </summary>
[Column("id_type"), Comment("0 = План или 1 = Факт")]
public int IdType { get; set; }
[Column("id_plan"), Comment("Id плановой операции")]
public int? IdPlan { get; set; }
[Column("depth_start"), Comment("Глубина на начало операции, м")]
public double DepthStart { get; set; }
2021-07-27 14:43:30 +05:00
[Column("depth_end"), Comment("Глубина после завершения операции, м")]
public double DepthEnd { get; set; }
2021-07-27 14:43:30 +05:00
[Column("date_start", TypeName = "timestamp with time zone"), Comment("Дата начала операции")]
public DateTimeOffset DateStart { get; set; }
[Column("duration_hours"), Comment("Продолжительность, часы")]
public double DurationHours { get; set; }
2021-07-27 14:43:30 +05:00
[Column("category_info"), Comment("Доп. информация к выбраной категории")]
public string? CategoryInfo { get; set; }
[Column("comment"), Comment("Комментарий")]
public string? Comment { get; set; }
[JsonIgnore]
[ForeignKey(nameof(IdWell))]
public virtual Well Well { get; set; } = null!;
[JsonIgnore]
[ForeignKey(nameof(IdWellSectionType))]
public virtual WellSectionType WellSectionType { get; set; } = null!;
2021-07-27 14:43:30 +05:00
[JsonIgnore]
[ForeignKey(nameof(IdCategory))]
public virtual WellOperationCategory OperationCategory { get; set; } = null!;
[JsonIgnore]
[ForeignKey(nameof(IdPlan))]
public virtual WellOperation? OperationPlan { get; set; } = null!;
public bool IsSame(WellOperation other)
{
var isSame = IdWell == other.IdWell &&
IdWellSectionType == other.IdWellSectionType &&
IdCategory == other.IdCategory &&
IdType == other.IdType &&
IdPlan == other.IdPlan &&
DepthStart == other.DepthStart &&
DepthEnd == other.DepthEnd &&
DateStart == other.DateStart &&
DurationHours == other.DurationHours &&
CategoryInfo == other.CategoryInfo &&
Comment == other.Comment;
return isSame;
}
2021-07-27 14:43:30 +05:00
}
2021-07-27 14:43:30 +05:00
}