feat(dal,api): добавлены таблицы исключений расписания еспп.
This commit is contained in:
@@ -5,6 +5,7 @@ using PARR.DAL.Contracts;
|
||||
using PARR.DAL.Extensions;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Models.Job;
|
||||
using PARR.DAL.Models.Schedule;
|
||||
using PARR.DAL.Models.Unit;
|
||||
|
||||
namespace PARR.DAL.Context
|
||||
@@ -42,12 +43,19 @@ namespace PARR.DAL.Context
|
||||
public DbSet<RobotConfiguration> RobotConfigurations { get; set; }
|
||||
public DbSet<RobotHistory> RobotHistories { get; set; }
|
||||
|
||||
#region Schedule
|
||||
|
||||
public DbSet<EsppSchType> EsppSchTypes { get; set; }
|
||||
public DbSet<EsppSchTypeValue> EsppSchTypeValues { get; set; }
|
||||
public DbSet<EsppSchTypeConfig> EsppSchTypeConfigs { get; set; }
|
||||
public DbSet<EsppSchTypeSchedule> EsppSchTypeSchedules { get; set; }
|
||||
public DbSet<EsppSchValue> EsppSchValues { get; set; }
|
||||
|
||||
public DbSet<ScheduleExcludeTypeCalendar> ScheduleExcludeTypeCalendars { get; set; }
|
||||
public DbSet<ScheduleExcludeType> ScheduleExcludeTypes { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public DbSet<AgentHistory> AgentHistories { get; set; }
|
||||
public DbSet<AgentHistoryLevel> AgentHistoryLevels { get; set; }
|
||||
|
||||
@@ -179,8 +187,8 @@ namespace PARR.DAL.Context
|
||||
new { Name = nameof(SettingsFromDb.RobotAttemptsNumber), Description = "Количество попыток выполнения задания роботом", Value = "3" },
|
||||
new { Name = nameof(SettingsFromDb.RobotWaitTime), Description = "Время ожидания выполнения роботом задания", Value = "00:15:00" },
|
||||
new { Name = nameof(SettingsFromDb.ScheduleTimezone), Description = "Расписание регламентной работы - В каком часовом поясе", Value = "MSK" },
|
||||
new { Name = nameof(SettingsFromDb.ScheduleExcludeType), Description = "Расписание регламентной работы - Тип исключения", Value = "Выполнить ТОЛЬКО В указанном календаре" },
|
||||
new { Name = nameof(SettingsFromDb.ScheduleExcludeCalendar), Description = "Расписание регламентной работы - Календарь", Value = "8x5 (8.00-17.00)" },
|
||||
//new { Name = nameof(SettingsFromDb.ScheduleExcludeType), Description = "Расписание регламентной работы - Тип исключения", Value = "Выполнить ТОЛЬКО В указанном календаре" },
|
||||
//new { Name = nameof(SettingsFromDb.ScheduleExcludeCalendar), Description = "Расписание регламентной работы - Календарь", Value = "8x5 (8.00-17.00)" },
|
||||
new { Name = nameof(SettingsFromDb.ScheduleRepeatRange), Description = "Расписание регламентной работы - Диапазн повторов", Value = "Отсутствует дата завершения" },
|
||||
new { Name = nameof(SettingsFromDb.OrderSearchDeltaDate), Description = "Промежуток времени для поиска нарядов в ЕСПП", Value = new TimeSpan(1, 30, 0).ToString() },
|
||||
new { Name = nameof(SettingsFromDb.EsppRobotAccountTimeZoneHour), Description = "Таймзона УЗ роботов в ЕСПП, в часах (может быть положительная и отрицательная)", Value = "3" },
|
||||
@@ -195,7 +203,7 @@ namespace PARR.DAL.Context
|
||||
new TemplateNameConstantPart { Name = "П-2", Value = "ПАРР" }
|
||||
}.ToJson()
|
||||
},
|
||||
new { Name = nameof(SettingsFromDb.EsppUnitTag), Description = "Префикс тега в поле ЭК \"Дополнительная информация\"", Value = "ПАРР-" }
|
||||
new { Name = nameof(SettingsFromDb.EsppUnitTag), Description = "Префикс тега в поле ЭК \"Дополнительная информация\"", Value = "ПАРР_" }
|
||||
);
|
||||
});
|
||||
#endregion
|
||||
@@ -514,6 +522,31 @@ namespace PARR.DAL.Context
|
||||
|
||||
#endregion
|
||||
|
||||
#region ScheduleExcludeType
|
||||
|
||||
modelBuilder.Entity<ScheduleExcludeType>(f =>
|
||||
{
|
||||
f.HasData(
|
||||
new() { Id = new Guid("0595B8E0-F322-4661-B5E3-064AF8FBE7CD"), DateCreated = dateCreated, Title = "Нет исключений", EsppName = "Нет исключений", EsppValue = "NONE", Code = ScheduleExcludeTypeEnum.None.ToString() },
|
||||
new() { Id = new Guid("2B7A4356-9AAF-4E00-B444-42F0B5010E25"), DateCreated = dateCreated, Title = "Выполнить ТОЛЬКО В указанном календаре", EsppName = "Выполнить ТОЛЬКО В указанном календаре", EsppValue = "ONLY", Code = ScheduleExcludeTypeEnum.Only.ToString() },
|
||||
new() { Id = new Guid("38CD9E64-27C1-4672-A805-2211952A48BD"), DateCreated = dateCreated, Title = "Выполнить везде, КРОМЕ указанного календаря", EsppName = "Выполнить везде, КРОМЕ указанного календаря", EsppValue = "EXCEPT", Code = ScheduleExcludeTypeEnum.Except.ToString() }
|
||||
);
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
#region ScheduleExcludeTypeCalendar
|
||||
|
||||
modelBuilder.Entity<ScheduleExcludeTypeCalendar>(f =>
|
||||
{
|
||||
f.HasData(
|
||||
new() { Id = new Guid("A26EDB88-0267-4FBF-B7EC-D172B0A86C9C"), DateCreated = dateCreated, Title = "24x5", EsppName = "24x5", EsppValue = "24x5", Code = "24x5" },
|
||||
new() { Id = new Guid("6834F1D5-AC51-43D5-974E-4C759D7BBF9F"), DateCreated = dateCreated, Title = "24x7", EsppName = "24x7", EsppValue = "24x7", Code = "24x7" }
|
||||
);
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
//protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
|
||||
@@ -13,5 +13,10 @@
|
||||
/// </summary>
|
||||
public const string Job = "job";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Расписание регламентных работ
|
||||
/// </summary>
|
||||
public const string Schedule = "schedule";
|
||||
}
|
||||
}
|
||||
|
||||
23
PARR.DAL/Contracts/ScheduleExcludeTypeEnum.cs
Normal file
23
PARR.DAL/Contracts/ScheduleExcludeTypeEnum.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace PARR.DAL.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Расписание регламентной работы - Тип исключения
|
||||
/// </summary>
|
||||
public enum ScheduleExcludeTypeEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// Нет исключений
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Выполнить ТОЛЬКО В указанном календаре
|
||||
/// </summary>
|
||||
Only = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Выполнить везде, КРОМЕ указанного календаря
|
||||
/// </summary>
|
||||
Except = 2
|
||||
}
|
||||
}
|
||||
@@ -82,15 +82,15 @@ namespace PARR.DAL.Contracts
|
||||
/// </summary>
|
||||
public string ScheduleTimezone { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Расписание регламентной работы - Тип исключения
|
||||
/// </summary>
|
||||
public string ScheduleExcludeType { get; set; } = string.Empty;
|
||||
///// <summary>
|
||||
///// Расписание регламентной работы - Тип исключения
|
||||
///// </summary>
|
||||
//public string ScheduleExcludeType { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Расписание регламентной работы - Календарь
|
||||
/// </summary>
|
||||
public string ScheduleExcludeCalendar { get; set; } = string.Empty;
|
||||
///// <summary>
|
||||
///// Расписание регламентной работы - Календарь
|
||||
///// </summary>
|
||||
//public string ScheduleExcludeCalendar { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Расписание регламентной работы - Диапазн повторов
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.DAL.Models.Job;
|
||||
using PARR.DAL.Models.Schedule;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PARR.DAL.Models
|
||||
@@ -21,6 +22,7 @@ namespace PARR.DAL.Models
|
||||
|
||||
public Guid JobGroupId { get; set; }
|
||||
|
||||
|
||||
//[ForeignKey(nameof(ApplicationsInWorkId))]
|
||||
//public ApplicationsInWork? ApplicationsInWork { get; set; }
|
||||
|
||||
|
||||
@@ -24,6 +24,11 @@ namespace PARR.DAL.Models.Job
|
||||
|
||||
public required string ValueMask { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Отсутствует
|
||||
/// </summary>
|
||||
public bool IsInverse { get; set; } = false;
|
||||
|
||||
|
||||
[ForeignKey(nameof(FieldId))]
|
||||
public UnitField? UnitField { get; set; }
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Models.Base;
|
||||
using PARR.DAL.Models.Schedule;
|
||||
using PARR.DAL.Models.Unit;
|
||||
using PARR.DAL.Settings;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
@@ -128,6 +129,19 @@ namespace PARR.DAL.Models.Job
|
||||
/// </summary>
|
||||
public Guid? GroupingUnitFieldId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Расписание регламентной работы - Тип исключения
|
||||
/// </summary>
|
||||
public Guid ScheduleExcludeTypeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Расписание регламентной работы, исключение - Календарь
|
||||
/// </summary>
|
||||
public Guid? ScheduleExcludeTypeCalendarId { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Поле по которому группируется (!!!отключено каскадное удаление!!!)
|
||||
/// </summary>
|
||||
@@ -140,5 +154,11 @@ namespace PARR.DAL.Models.Job
|
||||
public ICollection<Job> Jobs { get; set; } = new HashSet<Job>();
|
||||
|
||||
public ICollection<EsppSchValue> EsppSchValues { get; set; } = new HashSet<EsppSchValue>();
|
||||
|
||||
[ForeignKey(nameof(ScheduleExcludeTypeId))]
|
||||
public ScheduleExcludeType? ScheduleExcludeType { get; set; }
|
||||
|
||||
[ForeignKey(nameof(ScheduleExcludeTypeCalendarId))]
|
||||
public ScheduleExcludeTypeCalendar? ScheduleExcludeTypeCalendar { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
38
PARR.DAL/Models/Schedule/ScheduleExcludeType.cs
Normal file
38
PARR.DAL/Models/Schedule/ScheduleExcludeType.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
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.Schedule
|
||||
{
|
||||
/// <summary>
|
||||
/// Расписание регламентной работы - Тип исключения
|
||||
/// </summary>
|
||||
[Table("ExcludeTypes", Schema = DataContextSettings.Schedule)]
|
||||
[Comment("Расписание регламентной работы - Тип исключения")]
|
||||
public class ScheduleExcludeType : IBase
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public DateTimeOffset DateCreated { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public DateTimeOffset? DateModified { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Название в ПАРР
|
||||
/// </summary>
|
||||
public required string Title { get; set; }
|
||||
|
||||
public required string EsppName { get; set; }
|
||||
|
||||
public required string EsppValue { get; set; }
|
||||
|
||||
public required string Code { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
36
PARR.DAL/Models/Schedule/ScheduleExcludeTypeCalendar.cs
Normal file
36
PARR.DAL/Models/Schedule/ScheduleExcludeTypeCalendar.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
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.Schedule
|
||||
{
|
||||
/// <summary>
|
||||
/// Расписание регламентной работы, исключение - Календарь
|
||||
/// </summary>
|
||||
[Table("ExcludeTypeCalendars", Schema = DataContextSettings.Schedule)]
|
||||
[Comment("Расписание регламентной работы, исключение - Календарь")]
|
||||
public class ScheduleExcludeTypeCalendar : IBase
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public DateTimeOffset DateCreated { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public DateTimeOffset? DateModified { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Название в ПАРР
|
||||
/// </summary>
|
||||
public required string Title { get; set; }
|
||||
|
||||
public required string EsppName { get; set; }
|
||||
|
||||
public required string EsppValue { get; set; }
|
||||
|
||||
public required string Code { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -12,9 +12,11 @@ using PARR.DAL.InfluxDbServices;
|
||||
using PARR.DAL.Services.Implementation;
|
||||
using PARR.DAL.Services.Implementations;
|
||||
using PARR.DAL.Services.Implementations.Job;
|
||||
using PARR.DAL.Services.Implementations.Schedule;
|
||||
using PARR.DAL.Services.Implementations.Unit;
|
||||
using PARR.DAL.Services.Interfaces;
|
||||
using PARR.DAL.Services.Interfaces.Job;
|
||||
using PARR.DAL.Services.Interfaces.Schedule;
|
||||
using PARR.DAL.Services.Interfaces.Unit;
|
||||
using PARR.DAL.Settings;
|
||||
using PARR.DAL.TransformServices;
|
||||
@@ -99,6 +101,13 @@ namespace PARR.DAL
|
||||
services.AddTransient<IParrComponentService, ParrComponentService>();
|
||||
services.AddTransient<ITemplateStatusTypeService, TemplateStatusTypeService>();
|
||||
|
||||
#region Schedule
|
||||
|
||||
services.AddTransient<IScheduleExcludeTypeService, ScheduleExcludeTypeService>();
|
||||
services.AddTransient<IScheduleExcludeTypeCalendarService, ScheduleExcludeTypeCalendarService>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Unit
|
||||
|
||||
services.AddTransient<IUnitService, UnitService>();
|
||||
|
||||
@@ -60,7 +60,8 @@ namespace PARR.DAL.Services.Implementations
|
||||
Order = t.Order,
|
||||
Type = t.Type,
|
||||
Value = t.Value
|
||||
}).ToList()
|
||||
}
|
||||
).ToList()
|
||||
};
|
||||
|
||||
return dto;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Models.Schedule;
|
||||
using PARR.DAL.Services.Abstracts;
|
||||
using PARR.DAL.Services.Interfaces.Schedule;
|
||||
|
||||
namespace PARR.DAL.Services.Implementations.Schedule
|
||||
{
|
||||
internal class ScheduleExcludeTypeCalendarService : BaseService<ScheduleExcludeTypeCalendar>, IScheduleExcludeTypeCalendarService
|
||||
{
|
||||
private readonly DataContext dataContext;
|
||||
|
||||
protected override DbSet<ScheduleExcludeTypeCalendar> EntitySet => dataContext.ScheduleExcludeTypeCalendars;
|
||||
|
||||
protected override DataContext EntitiContext => dataContext;
|
||||
|
||||
public ScheduleExcludeTypeCalendarService(DataContext dataContext, ILogger<ScheduleExcludeTypeCalendarService> logger) : base(logger)
|
||||
{
|
||||
this.dataContext = dataContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Models.Schedule;
|
||||
using PARR.DAL.Services.Abstracts;
|
||||
using PARR.DAL.Services.Interfaces.Schedule;
|
||||
|
||||
namespace PARR.DAL.Services.Implementations.Schedule
|
||||
{
|
||||
internal class ScheduleExcludeTypeService : BaseService<ScheduleExcludeType>, IScheduleExcludeTypeService
|
||||
{
|
||||
private readonly DataContext dataContext;
|
||||
|
||||
protected override DbSet<ScheduleExcludeType> EntitySet => dataContext.ScheduleExcludeTypes;
|
||||
|
||||
protected override DataContext EntitiContext => dataContext;
|
||||
|
||||
public ScheduleExcludeTypeService(DataContext dataContext, ILogger<ScheduleExcludeTypeService> logger) : base(logger)
|
||||
{
|
||||
this.dataContext = dataContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using PARR.DAL.Models.Schedule;
|
||||
using PARR.DAL.Services.Interfaces.Base;
|
||||
|
||||
namespace PARR.DAL.Services.Interfaces.Schedule
|
||||
{
|
||||
public interface IScheduleExcludeTypeCalendarService: IBaseService<ScheduleExcludeTypeCalendar>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using PARR.DAL.Models.Schedule;
|
||||
using PARR.DAL.Services.Interfaces.Base;
|
||||
|
||||
namespace PARR.DAL.Services.Interfaces.Schedule
|
||||
{
|
||||
public interface IScheduleExcludeTypeService : IBaseService<ScheduleExcludeType>
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user