2025-06-04 11:55:23 +10:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
using PARR.DAL.Context;
|
|
|
|
|
|
using PARR.DAL.Models.Base;
|
2025-12-25 17:01:42 +10:00
|
|
|
|
using PARR.DAL.Models.Schedule;
|
2025-12-19 09:31:25 +10:00
|
|
|
|
using PARR.DAL.Models.Unit;
|
2025-08-19 14:08:25 +10:00
|
|
|
|
using PARR.DAL.Settings;
|
2025-06-04 11:55:23 +10:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
|
|
|
|
|
|
|
namespace PARR.DAL.Models.Job
|
|
|
|
|
|
{
|
2025-06-11 11:14:27 +10:00
|
|
|
|
[Table("Groups", Schema = DataContextSettings.Job)]
|
|
|
|
|
|
[Comment("Таблица описания групп работ, для реализации зонтиков")]
|
|
|
|
|
|
public class JobGroup : IBase
|
2025-06-04 11:55:23 +10:00
|
|
|
|
{
|
|
|
|
|
|
[Key]
|
|
|
|
|
|
public Guid Id { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DateTimeOffset DateCreated { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DateTimeOffset? DateModified { get; set; }
|
|
|
|
|
|
|
2025-06-11 11:14:27 +10:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Наименование работ для интерфеса в ПАРР
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public required string GroupName { get; set; }
|
|
|
|
|
|
|
2025-11-25 12:26:24 +10:00
|
|
|
|
///// <summary>
|
|
|
|
|
|
///// Связана ли работа с групповыми ЭК(зонтами)
|
|
|
|
|
|
///// </summary>
|
|
|
|
|
|
//public bool? IsUmbrella { get; set; }
|
2025-12-19 09:09:22 +10:00
|
|
|
|
|
2025-06-04 11:55:23 +10:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Поле Короткое описания шаблона АСУ ЕСПП
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public required string ShortDescription { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Поле Подробное описания шаблона АСУ ЕСПП
|
|
|
|
|
|
/// </summary>
|
2025-08-19 14:08:25 +10:00
|
|
|
|
private string _fullDescription = string.Empty;
|
|
|
|
|
|
public required string FullDescription
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
//В полное описание подставляем префикс, для дальнейшего поиска наряда
|
|
|
|
|
|
return $"{_fullDescription}\r\n{PrefixSettings.PrefixWithoutVariable}";
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
//удаляем префикс, если он есть
|
|
|
|
|
|
//_fullDescription = value.Replace($"\r\n{PrefixSettings.PrefixWithoutVariable}", string.Empty);
|
|
|
|
|
|
_fullDescription = value.Replace($"{PrefixSettings.PrefixWithoutVariable}", string.Empty).TrimEnd();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//public required string FullDescription { get; set; }
|
2025-06-04 11:55:23 +10:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Поле Решение описания шаблона АСУ ЕСПП
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public required string Solution { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Поле Длительность описания шаблона АСУ ЕСПП
|
|
|
|
|
|
/// </summary>
|
2025-06-25 14:17:34 +10:00
|
|
|
|
public required string TemplateDuration { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-06-04 11:55:23 +10:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Дата начала работ или дата для отсчёта периода следующего выполнения
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public DateTimeOffset ReferenceDate { get; set; }
|
|
|
|
|
|
|
2025-11-25 12:26:24 +10:00
|
|
|
|
|
2025-06-25 14:17:34 +10:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Включить автораспределение
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsAutoDistributionEnabled { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Выполняет агент
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsAgent { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Какое-то имя которое мы передаем агенту, пока непонятно что это такое.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string? AgentName { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Сколько времени ожидать выполнение скрипта агентом (секунд)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public int? AgentTimeOutSec { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Скрипт для автоматического выполнения
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string? AgentScript { get; set; }
|
|
|
|
|
|
|
2025-12-19 09:09:22 +10:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Тип группы
|
|
|
|
|
|
/// </summary>
|
2025-11-14 14:48:56 +10:00
|
|
|
|
public Guid GroupTypeId { get; set; }
|
|
|
|
|
|
|
2025-12-19 09:09:22 +10:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Если тип группы - "Сгруппированный", то это поле обязательно, по нему будем группировать
|
|
|
|
|
|
/// TODO: !!!! Связь с иаблице UnitField не создавалась! Нужно это переделать и унести в отдельную таблицу
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Guid? GroupingUnitFieldId { get; set; }
|
|
|
|
|
|
|
2025-12-25 17:01:42 +10:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Расписание регламентной работы - Тип исключения
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Guid ScheduleExcludeTypeId { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Расписание регламентной работы, исключение - Календарь
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Guid? ScheduleExcludeTypeCalendarId { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-12-19 09:31:25 +10:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Поле по которому группируется (!!!отключено каскадное удаление!!!)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[ForeignKey(nameof(GroupingUnitFieldId))]
|
|
|
|
|
|
public UnitField? GroupingUnitField { get; set; }
|
2025-12-19 09:09:22 +10:00
|
|
|
|
|
2025-11-14 14:48:56 +10:00
|
|
|
|
[ForeignKey(nameof(GroupTypeId))]
|
|
|
|
|
|
public JobGroupType? GroupType { get; set; }
|
|
|
|
|
|
|
2025-06-25 14:17:34 +10:00
|
|
|
|
public ICollection<Job> Jobs { get; set; } = new HashSet<Job>();
|
2025-06-04 11:55:23 +10:00
|
|
|
|
|
2025-06-25 14:17:34 +10:00
|
|
|
|
public ICollection<EsppSchValue> EsppSchValues { get; set; } = new HashSet<EsppSchValue>();
|
2025-12-25 17:01:42 +10:00
|
|
|
|
|
|
|
|
|
|
[ForeignKey(nameof(ScheduleExcludeTypeId))]
|
|
|
|
|
|
public ScheduleExcludeType? ScheduleExcludeType { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[ForeignKey(nameof(ScheduleExcludeTypeCalendarId))]
|
|
|
|
|
|
public ScheduleExcludeTypeCalendar? ScheduleExcludeTypeCalendar { get; set; }
|
2025-06-04 11:55:23 +10:00
|
|
|
|
}
|
|
|
|
|
|
}
|