feat(templateActivator): добавлена возможность деактивации всех расписаний, у которых шаблоны синхронизированы с ошибкой
This commit is contained in:
@@ -73,6 +73,15 @@ internal class TemplateActivator : ITemplateActivator
|
|||||||
query = query.Where(t => !t.IsActiveTemplate && t.IsActiveSchedule);
|
query = query.Where(t => !t.IsActiveTemplate && t.IsActiveSchedule);
|
||||||
changes = await UpdateScheduleStateAsync(query, false);
|
changes = await UpdateScheduleStateAsync(query, false);
|
||||||
break;
|
break;
|
||||||
|
case TemplateActivatorActionsEnum.DeactivateSchedulesWithTemplateSyncErrors:
|
||||||
|
logger.LogInformation($"Получен запрос на деактивацию всех расписаний, у которых шаблоны синхронизированы с ошибкой");
|
||||||
|
query = query.Where(t => !t.IsActiveTemplate &&
|
||||||
|
t.RobotConfigurations.Any(t =>
|
||||||
|
t.RobotCode == (int) RobotsEnum.TemplateOrder &&
|
||||||
|
t.RobotStatusCode == (int)RobotStatusEnum.Error)
|
||||||
|
);
|
||||||
|
changes = await UpdateScheduleStateAsync(query, false);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,4 +21,16 @@ public static class TemplateActivatorInstaller
|
|||||||
services.AddTransient<IMqTemplateActivator, MqTemplateActivator>();
|
services.AddTransient<IMqTemplateActivator, MqTemplateActivator>();
|
||||||
services.AddTransient<IValidatorService, ValidatorService>();
|
services.AddTransient<IValidatorService, ValidatorService>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IConfigurationBuilder AddTemplateActivatorConfigurations(this IConfigurationBuilder builder, IServiceCollection services)
|
||||||
|
{
|
||||||
|
builder.AddDalConfigurations(services);
|
||||||
|
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AddTemplateActivatorSettings(this IServiceCollection services, IConfiguration configuration)
|
||||||
|
{
|
||||||
|
services.AddDallSettings(configuration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ builder.Services.AddLogging(config =>
|
|||||||
});
|
});
|
||||||
|
|
||||||
builder.Services.InstallTemplateActivatorSerivces(builder.Configuration);
|
builder.Services.InstallTemplateActivatorSerivces(builder.Configuration);
|
||||||
|
builder.Configuration.AddTemplateActivatorConfigurations(builder.Services);
|
||||||
|
builder.Services.AddTemplateActivatorSettings(builder.Configuration);
|
||||||
|
|
||||||
builder.Services.AddHostedService<Worker>();
|
builder.Services.AddHostedService<Worker>();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user