feat(dal,domain): Таблицы роботов перенесены в схему robot. Создана таблица TemplateRenamePendings - Шаблоны находящиеся в процессе переименования
This commit is contained in:
24
PARR.Domain/Entities/RobotEntities/Robot.cs
Normal file
24
PARR.Domain/Entities/RobotEntities/Robot.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.Domain.Constants;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PARR.Domain.Entities.RobotEntities
|
||||
{
|
||||
[Table("Robots", Schema = DatabaseSchemas.Robot)]
|
||||
[Index(nameof(Name), IsUnique = true)]
|
||||
public class Robot
|
||||
{
|
||||
[Key]
|
||||
public int Code { get; set; }
|
||||
|
||||
public required string Name { get; set; }
|
||||
|
||||
public required string Description { get; set; }
|
||||
|
||||
|
||||
public ICollection<RobotConfiguration> RobotConfigurations { get; set; } = new HashSet<RobotConfiguration>();
|
||||
|
||||
public ICollection<RobotConfigurationSnapshot> ConfigurationSnapshots { get; set; } = new HashSet<RobotConfigurationSnapshot>();
|
||||
}
|
||||
}
|
||||
62
PARR.Domain/Entities/RobotEntities/RobotHistory.cs
Normal file
62
PARR.Domain/Entities/RobotEntities/RobotHistory.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.Domain.Constants;
|
||||
using PARR.Domain.Entities.Base;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PARR.Domain.Entities.RobotEntities
|
||||
{
|
||||
//[Table("RobotHistories", Schema = DatabaseSchemas.Robot)]
|
||||
[Table("Histories", Schema = DatabaseSchemas.Robot)]
|
||||
[Index(nameof(HistoryLevel), nameof(DateCreated), IsDescending = new[] { false, true })]
|
||||
[Index(nameof(RobotConfigurationId), nameof(DateCreated))]
|
||||
[Index(nameof(DateCreated))]
|
||||
public class RobotHistory : IBaseEntity
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public DateTimeOffset DateCreated { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public DateTimeOffset? DateModified { get; set; }
|
||||
|
||||
public int HistoryLevel { get; set; }
|
||||
|
||||
public string? RobotMessage { get; set; }
|
||||
|
||||
public string? EsppMessage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Статус. Что нужно было сделать роботу
|
||||
/// </summary>
|
||||
public int TaskStatusCode { get; set; }
|
||||
|
||||
public Guid RobotConfigurationId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IP адрес робота
|
||||
/// </summary>
|
||||
public string? RobotIp { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// Уникальный идентификатор серии выполнения, нужен для сопоставления истории
|
||||
///// </summary>
|
||||
//public Guid IdSeries { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Идентификатор робота.
|
||||
/// Форматы: H20-R1-T, H20-R1-S, H20-R1-ET, H20-R1-ES
|
||||
/// </summary>
|
||||
[Comment("Идентификатор робота. Форматы: H20-R1-T, H20-R1-S, H20-R1-ET, H20-R1-ES.")]
|
||||
public string? RobotId { get; set; }
|
||||
|
||||
|
||||
[ForeignKey(nameof(HistoryLevel))]
|
||||
public RobotHistoryLevel? RobotHistoryLevel { get; set; }
|
||||
|
||||
[ForeignKey(nameof(RobotConfigurationId))]
|
||||
public RobotConfiguration? RobotConfiguration { get; set; }
|
||||
|
||||
[ForeignKey(nameof(TaskStatusCode))]
|
||||
public TaskStatus? StatusTask { get; set; }
|
||||
}
|
||||
}
|
||||
24
PARR.Domain/Entities/RobotEntities/RobotHistoryLevel.cs
Normal file
24
PARR.Domain/Entities/RobotEntities/RobotHistoryLevel.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using PARR.Domain.Constants;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PARR.Domain.Entities.RobotEntities
|
||||
{
|
||||
/// <summary>
|
||||
/// Уровень логов работы робота
|
||||
/// </summary>
|
||||
//[Table("RobotHistoryLevels", Schema = DatabaseSchemas.Robot)]
|
||||
[Table("HistoryLevels", Schema = DatabaseSchemas.Robot)]
|
||||
public class RobotHistoryLevel
|
||||
{
|
||||
[Key]
|
||||
public int Level { get; set; }
|
||||
|
||||
public required string Name { get; set; }
|
||||
|
||||
public required string Description { get; set; }
|
||||
|
||||
|
||||
public ICollection<RobotHistory> RobotHistories { get; set; } = new HashSet<RobotHistory>();
|
||||
}
|
||||
}
|
||||
26
PARR.Domain/Entities/RobotEntities/RobotStatus.cs
Normal file
26
PARR.Domain/Entities/RobotEntities/RobotStatus.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using PARR.Domain.Constants;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PARR.Domain.Entities.RobotEntities
|
||||
{
|
||||
/// <summary>
|
||||
/// Статус работы робота
|
||||
/// </summary>
|
||||
[Table("RobotStatuses", Schema = DatabaseSchemas.Robot)]
|
||||
public class RobotStatus
|
||||
{
|
||||
[Key]
|
||||
public int Code { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
public ICollection<RobotConfiguration> RobotConfigurations { get; set; } = new HashSet<RobotConfiguration>();
|
||||
|
||||
public ICollection<RobotConfigurationSnapshot> ConfigurationSnapshots { get; set; } = new HashSet<RobotConfigurationSnapshot>();
|
||||
}
|
||||
}
|
||||
28
PARR.Domain/Entities/RobotEntities/TaskStatus.cs
Normal file
28
PARR.Domain/Entities/RobotEntities/TaskStatus.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using PARR.Domain.Constants;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PARR.Domain.Entities.RobotEntities
|
||||
{
|
||||
/// <summary>
|
||||
/// Статус шаблона. Что нужно сделать роботу в ЕСПП
|
||||
/// </summary>
|
||||
[Table("TaskStatuses", Schema = DatabaseSchemas.Robot)]
|
||||
public class TaskStatus
|
||||
{
|
||||
[Key]
|
||||
public int Code { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
public ICollection<RobotConfiguration> RobotConfigurations { get; set; } = new HashSet<RobotConfiguration>();
|
||||
|
||||
public ICollection<RobotHistory> RobotHistories { get; set; } = new HashSet<RobotHistory>();
|
||||
|
||||
public ICollection<RobotConfigurationSnapshot> ConfigurationSnapshots { get; set; } = new HashSet<RobotConfigurationSnapshot>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user