feat(dal): создана таблица GroupDistributionConfigs

This commit is contained in:
Mikhail Trubnikov
2026-01-20 16:17:09 +10:00
parent 5faa43e2d6
commit eb5bed5614
10 changed files with 5097 additions and 94 deletions

View File

@@ -1,5 +1,7 @@
using PARR.Constants;
using PARR.DAL.Context;
using PARR.DAL.Models.Base;
using PARR.DAL.Models.Job;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -8,7 +10,7 @@ namespace PARR.DAL.Models
/// <summary>
/// Период автоматического распеделения РР
/// </summary>
[Table("DistributionPeriods")]
[Table("DistributionPeriods", Schema = DataContextSettings.Schedule)]
public class DistributionPeriod : IBase
{
[Key]
@@ -58,7 +60,9 @@ namespace PARR.DAL.Models
[ForeignKey(nameof(Type))]
public DistributionPeriodType? DistributionPeriodType { get; set; }
public ICollection<EsppSchTypeValue> EsppSchTypeValues { get; set; } = new HashSet<EsppSchTypeValue>();
public ICollection<JobGroupDistributionConfig> GroupDistributionConfig { get; set; } = new HashSet<JobGroupDistributionConfig>();
//public ICollection<EsppSchTypeValue> EsppSchTypeValues { get; set; } = new HashSet<EsppSchTypeValue>();

View File

@@ -1,9 +1,10 @@
using System.ComponentModel.DataAnnotations;
using PARR.DAL.Context;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("DistributionPeriodTypes")]
[Table("DistributionPeriodTypes", Schema = DataContextSettings.Schedule)]
public class DistributionPeriodType
{
[Key]

View File

@@ -37,14 +37,14 @@ namespace PARR.DAL.Models
public int Order { get; set; }
/// <summary>
/// Если есть связь с периодом, то есть функция автораспределения
/// </summary>
public Guid? DistributionPeriodId { get; set; }
///// <summary>
///// Если есть связь с периодом, то есть функция автораспределения
///// </summary>
//public Guid? DistributionPeriodId { get; set; }
[ForeignKey(nameof(DistributionPeriodId))]
public DistributionPeriod? DistributionPeriod { get; set; }
//[ForeignKey(nameof(DistributionPeriodId))]
//public DistributionPeriod? DistributionPeriod { get; set; }
[ForeignKey(nameof(TypeId))]

View File

@@ -160,5 +160,7 @@ namespace PARR.DAL.Models.Job
[ForeignKey(nameof(ScheduleExcludeTypeCalendarId))]
public ScheduleExcludeTypeCalendar? ScheduleExcludeTypeCalendar { get; set; }
public JobGroupDistributionConfig? DistributionConfig { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Job
{
/// <summary>
/// Настройки автораспределения для JobGroup
/// </summary>
[Table("GroupDistributionConfigs", Schema = DataContextSettings.Job)]
[Comment("Настройки автораспределения для группы работ")]
public class JobGroupDistributionConfig
{
[Key]
public Guid GroupId { get; set; }
public Guid DistributionPeriodId { get; set; }
/// <summary>
/// Исключать выходные и праздничные дни
/// </summary>
public bool IsExcludeWeekends { get; set; }
/// <summary>
/// Группировать по рабочей группе
/// </summary>
public bool IsGroupingByWorkGroup { get; set; }
[ForeignKey(nameof(GroupId))]
public JobGroup? Group { get; set; }
[ForeignKey(nameof(DistributionPeriodId))]
public DistributionPeriod? DistributionPeriod { get; set; }
}
}

View File

@@ -1,11 +1,12 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.DAL.Models.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("WeekendDays")]
[Table("WeekendDays", Schema = DataContextSettings.Schedule)]
[Index(nameof(Date), IsUnique = true)]
public class WeekendDay : IBase
{