CF2-104: Added drilling program creation only from approved files

This commit is contained in:
cult 2021-11-02 13:44:45 +05:00
parent a53d557f2a
commit e396066a68
2 changed files with 10 additions and 4 deletions

View File

@ -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);

View File

@ -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));