From 063096e236ef69f0e8f3291da1ceeedc87a0713b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=9E=D0=BB=D1=8F=20=D0=91=D0=B8=D0=B7=D1=8E=D0=BA=D0=BE?=
 =?UTF-8?q?=D0=B2=D0=B0?= <user2@kaidev.ru>
Date: Mon, 27 May 2024 15:37:33 +0500
Subject: [PATCH 1/3] =?UTF-8?q?=D0=9E=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=BA?=
 =?UTF-8?q?=D0=B0=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BE=D0=B1=20?=
 =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B5,=20=D0=B5=D1=81=D0=BB?=
 =?UTF-8?q?=D0=B8=20=D1=84=D0=B0=D0=B9=D0=BB=20=D0=BF=D0=BE=20=D0=BA=D0=B0?=
 =?UTF-8?q?=D0=BA=D0=BE=D0=B9-=D1=82=D0=BE=20=D0=BF=D1=80=D0=B8=D1=87?=
 =?UTF-8?q?=D0=B8=D0=BD=D0=B5=20=D0=BD=D0=B5=20=D1=81=D1=84=D0=BE=D1=80?=
 =?UTF-8?q?=D0=BC=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../Data/Progress/ProgressExceptionDto.cs     | 12 +----------
 .../Data/Progress/ReportProgressDto.cs        |  2 +-
 .../Services/ReportService.cs                 | 20 +++++++++++++++++--
 3 files changed, 20 insertions(+), 14 deletions(-)

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;
 /// <summary>
 /// DTO прогресса с ошибкой
 /// </summary>
-public class ProgressExceptionDto
+public class ProgressExceptionDto : ProgressDto
 {
-    /// <summary>
-    /// прогресс 0 - 100%
-    /// </summary>
-    public float Progress { get; set; }
-
-    /// <summary>
-    /// название текущей операции генерации
-    /// </summary>
-    public string? Operation { get; set; }
-
     /// <summary>
     /// Отображаемый текст ошибки
     /// </summary>
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
     /// <summary>
     /// файл
     /// </summary>
-    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..c5df7c7c 100644
--- a/AsbCloudInfrastructure/Services/ReportService.cs
+++ b/AsbCloudInfrastructure/Services/ReportService.cs
@@ -54,13 +54,15 @@ 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 +155,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 = 0f,
+                Message = "Не удалось сгенерировать файл отчёта",
+                Exception = new FileNotFoundException(),
+            };
+            progressHandler(state, workId);
+
+            return;
+        }
+
         progressHandler(new ReportProgressFinalDto()
         {
             Operation = "done",

From 188060fcaaa8af1fa9cb8c7f5e6b456754e42a84 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=9E=D0=BB=D1=8F=20=D0=91=D0=B8=D0=B7=D1=8E=D0=BA=D0=BE?=
 =?UTF-8?q?=D0=B2=D0=B0?= <user2@kaidev.ru>
Date: Mon, 27 May 2024 15:40:07 +0500
Subject: [PATCH 2/3] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B0?=
 =?UTF-8?q?=20=D0=BB=D0=B8=D1=88=D0=BD=D1=8F=D1=8F=20=D0=BF=D1=83=D1=81?=
 =?UTF-8?q?=D1=82=D0=B0=D1=8F=20=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 AsbCloudInfrastructure/Services/ReportService.cs | 1 -
 1 file changed, 1 deletion(-)

diff --git a/AsbCloudInfrastructure/Services/ReportService.cs b/AsbCloudInfrastructure/Services/ReportService.cs
index c5df7c7c..6a57ef48 100644
--- a/AsbCloudInfrastructure/Services/ReportService.cs
+++ b/AsbCloudInfrastructure/Services/ReportService.cs
@@ -61,7 +61,6 @@ public class ReportService : IReportService
         }, work.Id);
 
         backgroundWorkerService.Enqueue(work);
-
        
         return work.Id;
     }

From 72e65f272cc91046764633fbc6e44914cb3e5757 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=9E=D0=BB=D1=8F=20=D0=91=D0=B8=D0=B7=D1=8E=D0=BA=D0=BE?=
 =?UTF-8?q?=D0=B2=D0=B0?= <user2@kaidev.ru>
Date: Mon, 27 May 2024 15:41:29 +0500
Subject: [PATCH 3/3] =?UTF-8?q?=D0=A1=D1=82=D0=B0=D1=82=D1=83=D1=81=20?=
 =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B3=D1=80=D0=B5=D1=81=D1=81=D0=B0:=20100?=
 =?UTF-8?q?=20(=D0=BF=D1=80=D0=B8=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B5)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 AsbCloudInfrastructure/Services/ReportService.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/AsbCloudInfrastructure/Services/ReportService.cs b/AsbCloudInfrastructure/Services/ReportService.cs
index 6a57ef48..cf533310 100644
--- a/AsbCloudInfrastructure/Services/ReportService.cs
+++ b/AsbCloudInfrastructure/Services/ReportService.cs
@@ -159,7 +159,7 @@ public class ReportService : IReportService
             var state = new ProgressExceptionDto
             {
                 Operation = "error",
-                Progress = 0f,
+                Progress = 100f,
                 Message = "Не удалось сгенерировать файл отчёта",
                 Exception = new FileNotFoundException(),
             };