2024-08-15 09:22:46 +05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
|
|
|
|
|
namespace AsbCloudApp.Data.WellOperation;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Операция по скважине
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class WellOperationBaseDto : ItemInfoDto,
|
|
|
|
|
IId,
|
|
|
|
|
IWellRelated,
|
|
|
|
|
IValidatableObject
|
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
[Required]
|
|
|
|
|
public int Id { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
[Required]
|
|
|
|
|
public int IdWell { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Id секции скважины
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int IdWellSectionType { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 0 = план или 1 = факт или прогноз = 2
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Required]
|
|
|
|
|
public int IdType { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// id категории операции
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int IdCategory { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Глубина на начало операции, м
|
|
|
|
|
/// </summary>
|
|
|
|
|
public double DepthStart { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Глубина после завершения операции, м
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Required]
|
|
|
|
|
[Range(0, 50_000)]
|
|
|
|
|
public double DepthEnd { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Дата начала операции
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Required]
|
|
|
|
|
public DateTimeOffset DateStart { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Продолжительность, часы
|
|
|
|
|
/// </summary>
|
|
|
|
|
public double DurationHours { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Наименование секции
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string? WellSectionTypeCaption { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Наименование категории
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string? OperationCategoryName { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// id плановой операции для сопоставления
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int? IdPlan { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Ключ родителя у категории
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int? IdParentCategory { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// дополнительная информация по операции
|
|
|
|
|
/// </summary>
|
|
|
|
|
[StringLength(8192)]
|
|
|
|
|
public string? CategoryInfo { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Полезный комментарий
|
|
|
|
|
/// </summary>
|
|
|
|
|
[StringLength(4096, ErrorMessage = "Комментарий не может быть длиннее 4096 символов")]
|
|
|
|
|
public string? Comment { get; set; }
|
|
|
|
|
|
2024-08-19 10:51:09 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// ctor
|
|
|
|
|
/// </summary>
|
|
|
|
|
public WellOperationBaseDto() { }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ctor
|
|
|
|
|
/// </summary>
|
|
|
|
|
public WellOperationBaseDto(WellOperationBaseDto wellOperation)
|
|
|
|
|
{
|
|
|
|
|
Id = wellOperation.Id ;
|
|
|
|
|
IdWell = wellOperation.IdWell ;
|
|
|
|
|
IdWellSectionType = wellOperation.IdWellSectionType ;
|
|
|
|
|
IdType = wellOperation.IdType ;
|
|
|
|
|
IdCategory = wellOperation.IdCategory ;
|
|
|
|
|
DepthStart = wellOperation.DepthStart ;
|
|
|
|
|
DepthEnd = wellOperation.DepthEnd ;
|
|
|
|
|
DateStart = wellOperation.DateStart ;
|
|
|
|
|
DurationHours = wellOperation.DurationHours ;
|
|
|
|
|
WellSectionTypeCaption = wellOperation.WellSectionTypeCaption ;
|
|
|
|
|
OperationCategoryName = wellOperation.OperationCategoryName ;
|
|
|
|
|
IdPlan = wellOperation.IdPlan ;
|
|
|
|
|
IdParentCategory = wellOperation.IdParentCategory ;
|
|
|
|
|
CategoryInfo = wellOperation.CategoryInfo ;
|
|
|
|
|
Comment = wellOperation.Comment;
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-15 09:22:46 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Валидация даты
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="validationContext"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
|
|
|
|
{
|
|
|
|
|
var gtDate = new DateTimeOffset(2010, 1, 1, 0, 0, 0, TimeSpan.Zero);
|
|
|
|
|
if (DateStart <= gtDate)
|
|
|
|
|
yield return new ValidationResult(
|
|
|
|
|
$"{nameof(DateStart)}: DateStart не может быть меньше {gtDate}",
|
|
|
|
|
new[] { nameof(DateStart) });
|
|
|
|
|
}
|
2024-08-19 10:51:09 +05:00
|
|
|
|
|
2024-08-15 09:22:46 +05:00
|
|
|
|
}
|