feat(dal,api): добавлены таблицы исключений расписания еспп.

This commit is contained in:
Mikhail Trubnikov
2025-12-25 17:01:42 +10:00
parent c7fdf9f97d
commit eb57f4b3cd
21 changed files with 343 additions and 52 deletions

View File

@@ -104,8 +104,8 @@ namespace PARR.EsppScheduleSync
//WorkGroup = template.Host!.WorkGroup!.Name,//TODO Migration to job
//Мы решили, что для всех расписаний "Нет исключений", если что-то поменяется, тут нужно переделать
//TypeV60calendar = settingsFromDb.ScheduleExcludeType == "Нет исключений" ? "NONE" : "",
TypeV60calendar = GetTypeV60calendar(),
V60calendar = settingsFromDb.ScheduleExcludeCalendar,
TypeV60calendar = GetTypeV60calendar(template),
V60calendar = GetV60calendar(template),
//Scheduled = EsppScheduleHelpers.GetNextRun(template.NextRun),
//Scheduled = EsppScheduleHelpers.GetNextRun(nextRunModifierService.GetNextRunByAccountRobotTimeZone(template.NextRun)),
//BasisTime = EsppScheduleHelpers.GetGenerationTime(nextRunModifierService.GetNextRunByAccountRobotTimeZone(template.NextRun)),
@@ -122,22 +122,61 @@ namespace PARR.EsppScheduleSync
}
/// <summary>
/// Получить исключение - Календарь
/// </summary>
/// <param name="template"></param>
/// <returns></returns>
private string GetV60calendar(Template template)
{
// мы знаем, что у нас точно в шаблоне есть инклуды до ScheduleExcludeType и ScheduleExcludeTypeCalendar
if (template.Job?.Group?.ScheduleExcludeTypeCalendar == null)
{
logger.LogDebug("Для шаблона шаблона {templte}, {templateId} нет исключений календаря", template.Name, template.Id);
//TODO:!!!!!!!!!!! Вот тут null или string.Empty??? Спросить у Андрея что он нам вернет!
return string.Empty;
}
logger.LogDebug("Для шаблона шаблона {templte}, {templateId} установлено исключений календаря \"{name}\", EsppValue: {esppValue}", template.Name, template.Id, template.Job.Group.ScheduleExcludeTypeCalendar.Name, template.Job.Group.ScheduleExcludeTypeCalendar.EsppValue);
return template.Job.Group.ScheduleExcludeTypeCalendar.EsppValue;
}
/// <summary>
/// Получить тип календаря
/// </summary>
/// <returns></returns>
private string GetTypeV60calendar()
private string GetTypeV60calendar(Template template)
{
// Это костыль, нужно придумать как это хранить в БД.
switch (settingsFromDb.ScheduleExcludeType.ToLower())
// мы знаем, что у нас точно в шаблоне есть инклуды до ScheduleExcludeType и ScheduleExcludeTypeCalendar
// на всякий конечно же проверим
if (template.Job?.Group?.ScheduleExcludeType == null)
{
case ("нет исключений"):
return "NONE";
case ("выполнить только в указанном календаре"):
return "ONLY";
default:
return "";
logger.LogError("Для шаблона {templte}, {templateId} не смог получить тип исключения, установил значение по умолчанию \"Без исключения\"", template.Name, template.Id);
return "NONE";
}
logger.LogDebug("Для шаблона шаблона {templte}, {templateId} тип исключения \"{name}\", EsppValue: {esppValue}", template.Name, template.Id, template.Job.Group.ScheduleExcludeType.Name, template.Job.Group.ScheduleExcludeType.EsppValue);
return template.Job.Group.ScheduleExcludeType.EsppValue;
#region old logic
//// Это костыль, нужно придумать как это хранить в БД.
//switch (settingsFromDb.ScheduleExcludeType.ToLower())
//{
// case ("нет исключений"):
// return "NONE";
// case ("выполнить только в указанном календаре"):
// return "ONLY";
// default:
// return "";
//}
#endregion
}