feat(dal): Таблицы для расписания ЕСПП

This commit is contained in:
Mikhail Trubnikov
2023-10-10 15:52:34 +10:00
parent 08a2903755
commit e60e0ec9c7
15 changed files with 6533 additions and 1 deletions

View File

@@ -28,6 +28,16 @@ namespace PARR.DAL.Models
public required string Solution { get; set; }
/// <summary>
/// Расписание: Время создания наряда (чч:мм:сс)
/// </summary>
public TimeSpan ScheduleGenerationTime { get; set; }
/// <summary>
/// Расписание: Следующее срабатывание
/// </summary>
public DateOnly ScheduleStartDate { get; set; }
[ForeignKey(nameof(WorkId))]
public Work? Work { get; set; }
@@ -35,5 +45,7 @@ namespace PARR.DAL.Models
public Application? Application { get; set; }
public ICollection<Template> Templates { get; set; } = new HashSet<Template>();
public ICollection<EsppSchValue> EsppSchValues { get; set; } = new HashSet<EsppSchValue>();
}
}

View File

@@ -0,0 +1,24 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
/// <summary>
/// Расписание ЕСПП: типы повторений
/// </summary>
[Table("EsppSchTypes")]
public class EsppSchType
{
[Key]
public int Id { get; set; }
public required string Name { get; set; }
public required string Description { get; set; }
public ICollection<EsppSchTypeValue> EsppSchTypeValues { get; set; } = new HashSet<EsppSchTypeValue>();
public ICollection<EsppSchTypeConfig> EsppSchTypeConfigs { get; set; } = new HashSet<EsppSchTypeConfig>();
}
}

View File

@@ -0,0 +1,37 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
/// <summary>
/// Расписание ЕСПП: Конфигурация типов
/// </summary>
[Table("EsppSchTypeConfigs")]
[Index(nameof(TypeScheduleId), nameof(TypeId), IsUnique = true)]
public class EsppSchTypeConfig : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public int TypeScheduleId { get; set; }
public int TypeId { get; set; }
public int Order { get; set; }
[ForeignKey(nameof(TypeId))]
public EsppSchType? EsppSchType { get; set; }
[ForeignKey(nameof(TypeScheduleId))]
public EsppSchTypeSchedule? EsppSchTypeSchedule { get; set; }
public ICollection<EsppSchValue> EsppSchValues { get; set; } = new HashSet<EsppSchValue>();
}
}

View File

@@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
/// <summary>
/// Расписание ЕСПП: Повторять задачу
/// </summary>
[Table("EsppSchTypeSchedules")]
public class EsppSchTypeSchedule
{
[Key]
public int Id { get; set; }
public required string Name { get; set; }
public required string Description { get; set; }
public ICollection<EsppSchTypeConfig> EsppSchTypeConfigs { get; set; } = new HashSet<EsppSchTypeConfig>();
}
}

View File

@@ -0,0 +1,30 @@
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
/// <summary>
/// Расписание ЕСПП: значения типов повторений
/// </summary>
[Table("EsppSchTypeValues")]
public class EsppSchTypeValue : IBase
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
public required string Value { get; set; }
public int TypeId { get; set; }
[ForeignKey(nameof(TypeId))]
public EsppSchType? EsppSchType { get; set; }
public ICollection<EsppSchValue> EsppSchValues { get; set; } = new HashSet<EsppSchValue>();
}
}

View File

@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
/// <summary>
/// Расписание ЕСПП: значения заданий для ApplicationsInWorks
/// </summary>
[Table("EsppSchValues")]
//[Index(nameof(ApplicationsInWorkId), nameof(TypeValueId), nameof(TypeConfigId), IsUnique = true)]
[PrimaryKey(nameof(ApplicationsInWorkId), nameof(TypeValueId), nameof(TypeConfigId))]
public class EsppSchValue
{
public Guid ApplicationsInWorkId { get; set; }
public Guid TypeValueId { get; set; }
public Guid TypeConfigId { 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; }
}
}