2023-09-19 10:01:50 +10:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
using PARR.DAL.Models.Base;
|
2023-10-24 15:40:52 +10:00
|
|
|
|
using PARR.DAL.Settings;
|
2023-09-19 10:01:50 +10:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
|
|
|
|
|
|
|
namespace PARR.DAL.Models
|
|
|
|
|
|
{
|
|
|
|
|
|
[Table("ApplicationsInWorks")]
|
|
|
|
|
|
[Index(nameof(WorkId), nameof(ApplicationId), IsUnique = true)]
|
|
|
|
|
|
public class ApplicationsInWork : IBase
|
|
|
|
|
|
{
|
|
|
|
|
|
[Key]
|
|
|
|
|
|
public Guid Id { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DateTimeOffset DateCreated { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DateTimeOffset? DateModified { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public Guid WorkId { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public Guid ApplicationId { get; set; }
|
|
|
|
|
|
|
2023-11-16 14:24:22 +10:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// TemplateDuration в формате ЕСПП
|
|
|
|
|
|
/// </summary>
|
2023-09-20 12:09:07 +10:00
|
|
|
|
public required string TemplateDuration { get; set; }
|
|
|
|
|
|
|
2023-11-16 14:24:22 +10:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// TemplateDuration в формате TimeSpan
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public TimeSpan? TemplateDurationTimeSpan
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
//ЕСПП кривоногие, они почему-то таймспан пишут так "7 00:00:00", а правильно так: "7:00:00:00"
|
|
|
|
|
|
var durationWithTimeSpanFormat = TemplateDuration.Replace(" ", ":");
|
|
|
|
|
|
|
|
|
|
|
|
return TimeSpan.Parse(durationWithTimeSpanFormat);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-09 10:08:07 +10:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Краткое описание
|
|
|
|
|
|
/// </summary>
|
2023-09-20 12:09:07 +10:00
|
|
|
|
public required string ShortDescription { get; set; }
|
|
|
|
|
|
|
2023-10-24 15:40:52 +10:00
|
|
|
|
|
|
|
|
|
|
private string _fullDescription = string.Empty;
|
|
|
|
|
|
public required string FullDescription
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
//В полное описание подставляем префикс, для дальнейшего поиска наряда
|
2024-02-19 12:01:17 +10:00
|
|
|
|
return $"{_fullDescription}\r\n{PrefixSettings.PrefixWithoutVariable}";
|
2023-10-24 15:40:52 +10:00
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
//удаляем префикс, если он есть
|
2024-04-11 09:05:16 +10:00
|
|
|
|
//_fullDescription = value.Replace($"\r\n{PrefixSettings.PrefixWithoutVariable}", string.Empty);
|
|
|
|
|
|
_fullDescription = value.Replace($"{PrefixSettings.PrefixWithoutVariable}", string.Empty).TrimEnd();
|
2023-10-24 15:40:52 +10:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-09-20 12:09:07 +10:00
|
|
|
|
|
2024-09-09 10:08:07 +10:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Решение
|
|
|
|
|
|
/// </summary>
|
2023-09-20 12:09:07 +10:00
|
|
|
|
public required string Solution { get; set; }
|
|
|
|
|
|
|
2023-10-17 10:53:02 +10:00
|
|
|
|
|
2024-07-01 14:04:24 +10:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Включить автораспределение
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsAutoDistributionEnabled { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Дата начала работ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public DateTimeOffset ReferenceDate { get; set; }
|
|
|
|
|
|
|
2023-10-17 10:53:02 +10:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Выполняет агент
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsAgent { get; set; }
|
|
|
|
|
|
|
2023-10-10 15:52:34 +10:00
|
|
|
|
/// <summary>
|
2023-10-17 10:53:02 +10:00
|
|
|
|
/// Какое-то имя которое мы передаем агенту, пока непонятно что это такое.
|
2023-10-10 15:52:34 +10:00
|
|
|
|
/// </summary>
|
2023-10-17 10:53:02 +10:00
|
|
|
|
public string? AgentName { get; set; }
|
2023-10-10 15:52:34 +10:00
|
|
|
|
|
2023-10-17 16:59:53 +10:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Сколько времени ожидать выполнение скрипта агентом (секунд)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public int? AgentTimeOutSec { get; set; }
|
|
|
|
|
|
|
2023-10-10 15:52:34 +10:00
|
|
|
|
/// <summary>
|
2023-10-17 10:53:02 +10:00
|
|
|
|
/// Скрипт для автоматического выполнения
|
2023-10-10 15:52:34 +10:00
|
|
|
|
/// </summary>
|
2023-10-17 10:53:02 +10:00
|
|
|
|
public string? AgentScript { get; set; }
|
2023-10-10 15:52:34 +10:00
|
|
|
|
|
2025-12-09 16:00:38 +10:00
|
|
|
|
//[ForeignKey(nameof(WorkId))]
|
|
|
|
|
|
//public Work? Work { get; set; }
|
2023-09-19 10:01:50 +10:00
|
|
|
|
|
|
|
|
|
|
[ForeignKey(nameof(ApplicationId))]
|
|
|
|
|
|
public Application? Application { get; set; }
|
|
|
|
|
|
|
2025-06-25 14:17:34 +10:00
|
|
|
|
// public ICollection<Template> Templates { get; set; } = new HashSet<Template>();
|
2023-10-10 15:52:34 +10:00
|
|
|
|
|
2025-06-25 14:17:34 +10:00
|
|
|
|
//public ICollection<EsppSchValue> EsppSchValues { get; set; } = new HashSet<EsppSchValue>();
|
2024-06-03 15:17:14 +10:00
|
|
|
|
|
|
|
|
|
|
public ICollection<AppInWorkInWorkGroup> WorkGroups { get; set; } = new HashSet<AppInWorkInWorkGroup>();
|
2024-09-09 10:08:07 +10:00
|
|
|
|
|
2025-12-05 14:07:48 +10:00
|
|
|
|
//public JobAutoControl? JobAutoControl { get; set; }
|
2023-09-19 10:01:50 +10:00
|
|
|
|
}
|
|
|
|
|
|
}
|