diff --git a/AsbCloudApp/Data/Progress/ProgressExceptionDto.cs b/AsbCloudApp/Data/Progress/ProgressExceptionDto.cs index cb264178..a8eb4fdd 100644 --- a/AsbCloudApp/Data/Progress/ProgressExceptionDto.cs +++ b/AsbCloudApp/Data/Progress/ProgressExceptionDto.cs @@ -5,18 +5,8 @@ namespace AsbCloudApp.Data.Progress; /// /// DTO прогресса с ошибкой /// -public class ProgressExceptionDto +public class ProgressExceptionDto : ProgressDto { - /// - /// прогресс 0 - 100% - /// - public float Progress { get; set; } - - /// - /// название текущей операции генерации - /// - public string? Operation { get; set; } - /// /// Отображаемый текст ошибки /// diff --git a/AsbCloudApp/Data/Progress/ReportProgressDto.cs b/AsbCloudApp/Data/Progress/ReportProgressDto.cs index 400b6c9f..8bfb07d2 100644 --- a/AsbCloudApp/Data/Progress/ReportProgressDto.cs +++ b/AsbCloudApp/Data/Progress/ReportProgressDto.cs @@ -8,5 +8,5 @@ public class ReportProgressFinalDto : ReportProgressDto /// /// файл /// - public FileInfoDto? file { get; set; } + public FileInfoDto file { get; set; } = null!; } diff --git a/AsbCloudInfrastructure/Services/ReportService.cs b/AsbCloudInfrastructure/Services/ReportService.cs index 4d321525..cf533310 100644 --- a/AsbCloudInfrastructure/Services/ReportService.cs +++ b/AsbCloudInfrastructure/Services/ReportService.cs @@ -54,13 +54,14 @@ public class ReportService : IReportService progressHandler.Invoke(state, work.Id); }, token); - backgroundWorkerService.Enqueue(work); - progressHandler.Invoke(new ReportProgressDto { Operation = "Ожидает начала в очереди.", Progress = 0f, }, work.Id); + + backgroundWorkerService.Enqueue(work); + return work.Id; } @@ -153,6 +154,20 @@ public class ReportService : IReportService var fileInfo = (await fileService.MoveAsync(idWell, idUser, ReportCategoryId, reportFileName, reportFileName, token))!; + if (fileInfo == null) + { + var state = new ProgressExceptionDto + { + Operation = "error", + Progress = 100f, + Message = "Не удалось сгенерировать файл отчёта", + Exception = new FileNotFoundException(), + }; + progressHandler(state, workId); + + return; + } + progressHandler(new ReportProgressFinalDto() { Operation = "done",