feat(all): ! Критические изменения логики работы всех сервисорв, База Данных имееет неокончательную версию. Template, Scheduler переведены на работу с Unit+Job+JobGroup вместо Host+ApplicationsInWork
This commit is contained in:
@@ -111,9 +111,9 @@ namespace PARR.DAL.Models
|
||||
[ForeignKey(nameof(ApplicationId))]
|
||||
public Application? Application { get; set; }
|
||||
|
||||
public ICollection<Template> Templates { get; set; } = new HashSet<Template>();
|
||||
// public ICollection<Template> Templates { get; set; } = new HashSet<Template>();
|
||||
|
||||
public ICollection<EsppSchValue> EsppSchValues { get; set; } = new HashSet<EsppSchValue>();
|
||||
//public ICollection<EsppSchValue> EsppSchValues { get; set; } = new HashSet<EsppSchValue>();
|
||||
|
||||
public ICollection<AppInWorkInWorkGroup> WorkGroups { get; set; } = new HashSet<AppInWorkInWorkGroup>();
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.DAL.Models.Job;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PARR.DAL.Models
|
||||
@@ -8,22 +9,28 @@ namespace PARR.DAL.Models
|
||||
/// </summary>
|
||||
[Table("EsppSchValues")]
|
||||
//[Index(nameof(ApplicationsInWorkId), nameof(TypeValueId), nameof(TypeConfigId), IsUnique = true)]
|
||||
[PrimaryKey(nameof(ApplicationsInWorkId), nameof(TypeValueId), nameof(TypeConfigId))]
|
||||
//[PrimaryKey(nameof(ApplicationsInWorkId), nameof(TypeValueId), nameof(TypeConfigId))]
|
||||
[PrimaryKey(nameof(JobGroupId), nameof(TypeValueId), nameof(TypeConfigId))]
|
||||
public class EsppSchValue
|
||||
{
|
||||
public Guid ApplicationsInWorkId { get; set; }
|
||||
//public Guid ApplicationsInWorkId { get; set; }
|
||||
|
||||
public Guid TypeValueId { get; set; }
|
||||
|
||||
public Guid TypeConfigId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(ApplicationsInWorkId))]
|
||||
public ApplicationsInWork? ApplicationsInWork { get; set; }
|
||||
public Guid JobGroupId { get; set; }
|
||||
|
||||
//[ForeignKey(nameof(ApplicationsInWorkId))]
|
||||
//public ApplicationsInWork? ApplicationsInWork { get; set; }
|
||||
|
||||
[ForeignKey(nameof(TypeValueId))]
|
||||
public EsppSchTypeValue? EsppSchTypeValue { get; set; }
|
||||
|
||||
[ForeignKey(nameof(TypeConfigId))]
|
||||
public EsppSchTypeConfig? EsppSchTypeConfig { get; set; }
|
||||
|
||||
[ForeignKey(nameof(JobGroupId))]
|
||||
public JobGroup? JobGroup { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace PARR.DAL.Models
|
||||
|
||||
public ICollection<ApplicationInHost> ApplicationsInHosts { get; set; } = new HashSet<ApplicationInHost>();
|
||||
|
||||
public ICollection<Template> Templates { get; set; } = new HashSet<Template>();
|
||||
//public ICollection<Template> Templates { get; set; } = new HashSet<Template>();
|
||||
|
||||
|
||||
[ForeignKey(nameof(EkStatusCode))]
|
||||
|
||||
@@ -45,14 +45,61 @@ namespace PARR.DAL.Models.Job
|
||||
/// <summary>
|
||||
/// Поле Длительность описания шаблона АСУ ЕСПП
|
||||
/// </summary>
|
||||
public required string Duration { get; set; }
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Дата начала работ или дата для отсчёта периода следующего выполнения
|
||||
/// </summary>
|
||||
public DateTimeOffset ReferenceDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Включить автораспределение
|
||||
/// </summary>
|
||||
public bool IsAutoDistributionEnabled { get; set; }
|
||||
|
||||
public ICollection<Job> Job { get; set; } = new HashSet<Job>();
|
||||
/// <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; }
|
||||
|
||||
public ICollection<Job> Jobs { get; set; } = new HashSet<Job>();
|
||||
|
||||
public ICollection<EsppSchValue> EsppSchValues { get; set; } = new HashSet<EsppSchValue>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,13 +48,13 @@ namespace PARR.DAL.Models
|
||||
|
||||
public DateTimeOffset NextRun { get; set; }
|
||||
|
||||
public Guid ApplicationInWorkId { get; set; }
|
||||
//public Guid ApplicationInWorkId { get; set; }
|
||||
|
||||
public Guid JobId { get; set; }//TODO Вернуть не NULL!!!
|
||||
|
||||
public Guid UnitId { get; set; }//TODO Вернуть не NULL!!!
|
||||
|
||||
public Guid HostId { get; set; }
|
||||
//public Guid HostId { get; set; }
|
||||
|
||||
#region Initiator
|
||||
public string? InitiatorIp { get; set; }
|
||||
@@ -64,11 +64,11 @@ namespace PARR.DAL.Models
|
||||
public string? InitiatorComment { get; set; }
|
||||
#endregion
|
||||
|
||||
[ForeignKey(nameof(ApplicationInWorkId))]
|
||||
public ApplicationsInWork? ApplicationsInWork { get; set; }
|
||||
//[ForeignKey(nameof(ApplicationInWorkId))]
|
||||
//public ApplicationsInWork? ApplicationsInWork { get; set; }
|
||||
|
||||
[ForeignKey(nameof(HostId))]
|
||||
public Host? Host { get; set; }
|
||||
//[ForeignKey(nameof(HostId))]
|
||||
//public Host? Host { get; set; }
|
||||
|
||||
[ForeignKey(nameof(JobId))]
|
||||
public Job.Job? Job { get; set; }
|
||||
|
||||
@@ -28,6 +28,28 @@ namespace PARR.DAL.Models.Unit
|
||||
// todo: добавить еще поля??? (которые есть у всех ЭК)
|
||||
|
||||
|
||||
[NotMapped]
|
||||
public BaseFields? BaseFields
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
if (UnitValues.Any())
|
||||
{
|
||||
var result = new BaseFields();
|
||||
|
||||
result.IP = UnitValues.FirstOrDefault(t => t.Field?.AihitName == "IP_АДРЕС")?.Value?.Value;
|
||||
result.ResponseArea = UnitValues.FirstOrDefault(t => t.Field?.AihitName == "ЗО_РГ")?.Value?.Value;
|
||||
result.WorkGroup = UnitValues.FirstOrDefault(t => t.Field?.AihitName == "РАБОЧАЯ_ГР_ОТВ_ЗА_ЭК")?.Value?.Value;
|
||||
result.Status = UnitValues.FirstOrDefault(t => t.Field?.AihitName == "СТАТУС")?.Value?.Value;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public ICollection<UnitInField> UnitFields { get; set; } = new HashSet<UnitInField>();
|
||||
|
||||
public ICollection<UnitInValue> UnitValues { get; set; } = new HashSet<UnitInValue>();
|
||||
@@ -44,5 +66,19 @@ namespace PARR.DAL.Models.Unit
|
||||
/// </summary>
|
||||
[InverseProperty(nameof(UnitInUnit.ParentUnit))]
|
||||
public ICollection<UnitInUnit> ChildUnits { get; set; } = new HashSet<UnitInUnit>();
|
||||
|
||||
public ICollection<Template> Templates { get; set; } = new HashSet<Template>();
|
||||
}
|
||||
|
||||
|
||||
public class BaseFields
|
||||
{
|
||||
public string? IP { get; set; }
|
||||
|
||||
public string? ResponseArea { get; set; }
|
||||
|
||||
public string? WorkGroup { get; set; }
|
||||
|
||||
public string? Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user