forked from ddrilling/AsbCloudServer
fix reports.
This commit is contained in:
parent
711dfa681d
commit
38e7f624b1
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
AsbCloudInfrastructure/CommonLibs/ref/AsbSaubReportLas.dll
Normal file
BIN
AsbCloudInfrastructure/CommonLibs/ref/AsbSaubReportLas.dll
Normal file
Binary file not shown.
Binary file not shown.
@ -59,26 +59,23 @@ namespace AsbSaubReport
|
||||
|
||||
public AnalyzeResult Analyze()
|
||||
{
|
||||
var messagesQuery = from item in context.TelemetryMessages
|
||||
var messagesStat = (from item in context.TelemetryMessages
|
||||
where item.IdTelemetry == idTelemetry
|
||||
select item;
|
||||
group item.Date by item.IdTelemetry into g
|
||||
select new { min = g.Min(), max = g.Max(), count = g.Count()})
|
||||
.FirstOrDefault();
|
||||
|
||||
var messagesCount = messagesQuery.Count();
|
||||
var messagesMinDate = messagesQuery.Min(e => e.Date);
|
||||
var messagesMaxDate = messagesQuery.Max(e => e.Date);
|
||||
|
||||
var dataQuery = from item in context.TelemetryDataSaub
|
||||
where item.IdTelemetry == idTelemetry
|
||||
select item;
|
||||
|
||||
var dataMinDate = dataQuery.Min(e => e.Date);
|
||||
var dataMaxDate = dataQuery.Max(e => e.Date);
|
||||
var dataStat = (from item in context.TelemetryDataSaub
|
||||
where item.IdTelemetry == idTelemetry
|
||||
group item.Date by item.IdTelemetry into g
|
||||
select new { min = g.Min(), max = g.Max(), count = g.Count() })
|
||||
.FirstOrDefault();
|
||||
|
||||
var result = new AnalyzeResult
|
||||
{
|
||||
MaxDate = dataMinDate < messagesMinDate ? dataMinDate : messagesMinDate,
|
||||
MinDate = dataMaxDate > messagesMaxDate ? dataMaxDate : messagesMaxDate,
|
||||
MessagesCount = messagesCount,
|
||||
MinDate = dataStat?.max ?? messagesStat?.min ?? default,
|
||||
MaxDate = dataStat?.max ?? messagesStat?.min ?? default,
|
||||
MessagesCount = messagesStat?.count ?? 0,
|
||||
};
|
||||
|
||||
return result;
|
||||
|
@ -50,10 +50,13 @@ namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
var generator = GetReportGenerator(idWell, begin, end, stepSeconds, format, context);
|
||||
generator.OnProgress += (s, e) => progressHandler.Invoke(e.progress, e.operation, id);
|
||||
var newReportName = generator.Make();
|
||||
if (newReportName is not null)
|
||||
|
||||
var reportFileName = GetReportFileName(context, idWell);
|
||||
|
||||
generator.Make(reportFileName);
|
||||
if (reportFileName is not null)
|
||||
{
|
||||
var shorReportName = Path.GetFileName(newReportName);
|
||||
var shorReportName = Path.GetFileName(reportFileName);
|
||||
reportNameHandler.Invoke(shorReportName, id);
|
||||
|
||||
var newReportFile = new AsbCloudDb.Model.FileInfo
|
||||
@ -61,12 +64,11 @@ namespace AsbCloudInfrastructure.Services
|
||||
IdWell = idWell,
|
||||
IdAuthor = idUser,
|
||||
IdCategory = ReportCategoryId,
|
||||
Name = newReportName,
|
||||
Name = reportFileName,
|
||||
UploadDate = DateTime.Now,
|
||||
};
|
||||
|
||||
context.Files.Add(newReportFile);
|
||||
context.SaveChanges();
|
||||
|
||||
var newReportProperties = new ReportProperty
|
||||
{
|
||||
@ -85,6 +87,13 @@ namespace AsbCloudInfrastructure.Services
|
||||
return newReportId;
|
||||
}
|
||||
|
||||
private string GetReportFileName(AsbCloudDbContext context, int idWell)
|
||||
{
|
||||
var well = context.Wells.Include(w => w.Cluster).FirstOrDefault(w => w.Id == idWell);
|
||||
var fileName = Path.Combine(fileService.RootPath, $"{idWell}", $"{ReportCategoryId}", $"Рапорт куст{well?.Cluster?.Caption} скв{well.Caption}.pdf") ;
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public int GetReportPagesCount(int idWell, DateTime begin, DateTime end, int stepSeconds, int format)
|
||||
{
|
||||
var generator = GetReportGenerator(idWell, begin, end, stepSeconds, format, (AsbCloudDbContext)db);
|
||||
@ -180,7 +189,6 @@ namespace AsbCloudInfrastructure.Services
|
||||
break;
|
||||
}
|
||||
|
||||
generator.ReportDirectory = Path.Combine(fileService.RootPath, $"{idWell}", $"{ReportCategoryId}");
|
||||
generator.Begin = begin;
|
||||
generator.End = end;
|
||||
generator.Step = TimeSpan.FromSeconds(stepSeconds);
|
||||
|
@ -7,7 +7,7 @@
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True",
|
||||
"DefaultConnection": "Host=192.168.1.70;Database=postgres;Username=postgres;Password=q;Persist Security Info=True",
|
||||
"ServerConnection": "Host=192.168.1.70;Database=postgres;Username=postgres;Password=q;Persist Security Info=True",
|
||||
"LocalConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user