forked from ddrilling/AsbCloudServer
Merge branch 'master' into dev
This commit is contained in:
commit
b4390a1f16
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 105 KiB |
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()
|
public AnalyzeResult Analyze()
|
||||||
{
|
{
|
||||||
var messagesQuery = from item in context.TelemetryMessages
|
var messagesStat = (from item in context.TelemetryMessages
|
||||||
where item.IdTelemetry == idTelemetry
|
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 dataStat = (from item in context.TelemetryDataSaub
|
||||||
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
|
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() })
|
||||||
var dataMinDate = dataQuery.Min(e => e.Date);
|
.FirstOrDefault();
|
||||||
var dataMaxDate = dataQuery.Max(e => e.Date);
|
|
||||||
|
|
||||||
var result = new AnalyzeResult
|
var result = new AnalyzeResult
|
||||||
{
|
{
|
||||||
MaxDate = dataMinDate < messagesMinDate ? dataMinDate : messagesMinDate,
|
MinDate = dataStat?.max ?? messagesStat?.min ?? default,
|
||||||
MinDate = dataMaxDate > messagesMaxDate ? dataMaxDate : messagesMaxDate,
|
MaxDate = dataStat?.max ?? messagesStat?.min ?? default,
|
||||||
MessagesCount = messagesCount,
|
MessagesCount = messagesStat?.count ?? 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -50,10 +50,13 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
{
|
{
|
||||||
var generator = GetReportGenerator(idWell, begin, end, stepSeconds, format, context);
|
var generator = GetReportGenerator(idWell, begin, end, stepSeconds, format, context);
|
||||||
generator.OnProgress += (s, e) => progressHandler.Invoke(e.progress, e.operation, id);
|
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);
|
reportNameHandler.Invoke(shorReportName, id);
|
||||||
|
|
||||||
var newReportFile = new AsbCloudDb.Model.FileInfo
|
var newReportFile = new AsbCloudDb.Model.FileInfo
|
||||||
@ -61,12 +64,11 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
IdWell = idWell,
|
IdWell = idWell,
|
||||||
IdAuthor = idUser,
|
IdAuthor = idUser,
|
||||||
IdCategory = ReportCategoryId,
|
IdCategory = ReportCategoryId,
|
||||||
Name = newReportName,
|
Name = reportFileName,
|
||||||
UploadDate = DateTime.Now,
|
UploadDate = DateTime.Now,
|
||||||
};
|
};
|
||||||
|
|
||||||
context.Files.Add(newReportFile);
|
context.Files.Add(newReportFile);
|
||||||
context.SaveChanges();
|
|
||||||
|
|
||||||
var newReportProperties = new ReportProperty
|
var newReportProperties = new ReportProperty
|
||||||
{
|
{
|
||||||
@ -85,6 +87,13 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
return newReportId;
|
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)
|
public int GetReportPagesCount(int idWell, DateTime begin, DateTime end, int stepSeconds, int format)
|
||||||
{
|
{
|
||||||
var generator = GetReportGenerator(idWell, begin, end, stepSeconds, format, (AsbCloudDbContext)db);
|
var generator = GetReportGenerator(idWell, begin, end, stepSeconds, format, (AsbCloudDbContext)db);
|
||||||
@ -180,7 +189,6 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
generator.ReportDirectory = Path.Combine(fileService.RootPath, $"{idWell}", $"{ReportCategoryId}");
|
|
||||||
generator.Begin = begin;
|
generator.Begin = begin;
|
||||||
generator.End = end;
|
generator.End = end;
|
||||||
generator.Step = TimeSpan.FromSeconds(stepSeconds);
|
generator.Step = TimeSpan.FromSeconds(stepSeconds);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ConnectionStrings": {
|
"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",
|
"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"
|
"LocalConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user