From e396066a6837e8e56fbe64cea151cad12a8b5d4a Mon Sep 17 00:00:00 2001 From: cult Date: Tue, 2 Nov 2021 13:44:45 +0500 Subject: [PATCH] CF2-104: Added drilling program creation only from approved files --- .../Services/DrillingProgramService.cs | 4 +++- AsbCloudInfrastructure/Services/FileService.cs | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/AsbCloudInfrastructure/Services/DrillingProgramService.cs b/AsbCloudInfrastructure/Services/DrillingProgramService.cs index a5350e90..cfa8c162 100644 --- a/AsbCloudInfrastructure/Services/DrillingProgramService.cs +++ b/AsbCloudInfrastructure/Services/DrillingProgramService.cs @@ -56,7 +56,9 @@ namespace AsbCloudInfrastructure.Services var resultFileName = $"Программа бурения {well.Cluster} {well.Caption}.xlsx"; var fileNames = filesInfos - .Where(f => f.Name != resultFileName) + .Where(f => f.Name != resultFileName && + f.FileMarks != null && + f.FileMarks.Any(file => file.IdMark == 0)) .Select(f => fileService.GetUrl(f)); var tempResultFilePath = Path.Combine(Path.GetTempPath(), "drillingProgram", resultFileName); diff --git a/AsbCloudInfrastructure/Services/FileService.cs b/AsbCloudInfrastructure/Services/FileService.cs index 51b7a961..918253fe 100644 --- a/AsbCloudInfrastructure/Services/FileService.cs +++ b/AsbCloudInfrastructure/Services/FileService.cs @@ -120,6 +120,7 @@ namespace AsbCloudInfrastructure.Services int idCategory, CancellationToken token = default) { var entities = await dbSetConfigured + .Include(f => f.FileMarks) .Where(e => e.IdWell == idWell && e.IdCategory == idCategory && e.IsDeleted == false) .AsNoTracking() .ToListAsync(token) @@ -134,14 +135,17 @@ namespace AsbCloudInfrastructure.Services DateTime end = default, int skip = 0, int take = 32, CancellationToken token = default) { var query = dbSetConfigured - .Where(e => e.IdWell == idWell && - e.IdCategory == idCategory); + .Where(e => e.IdWell == idWell && + e.IdCategory == idCategory); query = query.Where(e => !e.IsDeleted); + + if (idCategory == 13) + query = query.Include(f => f.FileMarks); if (!string.IsNullOrEmpty(companyName)) query = query - .Include(file => file.Author) + .Include(file => file.Author) .ThenInclude(a => a.Company) .Where(e => (e.Author == null) || (e.Author.Company == null) || e.Author.Company.Caption.Contains(companyName));