forked from ddrilling/AsbCloudServer
Merge pull request 'Фиксы формирования отчёта' (#320) from fix/well_report into dev
Reviewed-on: https://test.digitaldrilling.ru:8443/DDrilling/AsbCloudServer/pulls/320
This commit is contained in:
commit
c81b558c4c
Binary file not shown.
@ -129,7 +129,8 @@ public class WellReportService : IWellReportService
|
||||
|
||||
private async Task<IEnumerable<SectionReportDto>> GetSectionReportsAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
var factWellOperationsBySection = factWellOperations.GroupBy(x => x.IdWellSectionType);
|
||||
var factWellOperationsBySection = factWellOperations.GroupBy(x => x.IdWellSectionType)
|
||||
.ToDictionary(x => x.Key, x => x.AsEnumerable());
|
||||
|
||||
var processMapPlanRequest = new ProcessMapPlanBaseRequestWithWell(idWell);
|
||||
|
||||
@ -145,32 +146,39 @@ public class WellReportService : IWellReportService
|
||||
.GroupBy(x => x.IdWellSectionType)
|
||||
.ToDictionary(x => x.Key, x => x.AsEnumerable());
|
||||
|
||||
var sectionReports = new List<SectionReportDto>();
|
||||
var idsSection = factWellOperationsBySection.Keys
|
||||
.Concat(processMapPlanRotorBySection.Keys)
|
||||
.Concat(processMapReportBySection.Keys)
|
||||
.Distinct();
|
||||
|
||||
foreach (var group in factWellOperationsBySection)
|
||||
{
|
||||
var subsystemRequest = new SubsystemRequest
|
||||
{
|
||||
IdWell = idWell,
|
||||
GeDepth = group.Min(y => y.DepthStart),
|
||||
LeDepth = group.Max(y => y.DepthEnd)
|
||||
};
|
||||
var sectionReports = new List<SectionReportDto>();
|
||||
|
||||
var sectionReport = new SectionReportDto
|
||||
{
|
||||
IdSection = group.Key,
|
||||
SubsystemsStat = await subsystemService.GetStatAsync(subsystemRequest, token),
|
||||
OperatingMode = new PlanFactDto<OperatingModeDto>
|
||||
{
|
||||
Fact = new OperatingModeDto
|
||||
{
|
||||
DepthStart = group.Min(w => w.DepthStart),
|
||||
DepthEnd = group.Max(w => w.DepthEnd)
|
||||
}
|
||||
}
|
||||
};
|
||||
foreach (var idSection in idsSection)
|
||||
{
|
||||
var sectionReport = new SectionReportDto
|
||||
{
|
||||
IdSection = idSection,
|
||||
OperatingMode = new PlanFactDto<OperatingModeDto>()
|
||||
};
|
||||
|
||||
if (processMapPlanRotorBySection.TryGetValue(group.Key, out var processMapPlanRotor))
|
||||
if (factWellOperationsBySection.TryGetValue(idSection, out var factOperations))
|
||||
{
|
||||
var subsystemRequest = new SubsystemRequest
|
||||
{
|
||||
IdWell = idWell,
|
||||
GeDepth = factOperations.Min(y => y.DepthStart),
|
||||
LeDepth = factOperations.Max(y => y.DepthEnd)
|
||||
};
|
||||
|
||||
sectionReport.SubsystemsStat = await subsystemService.GetStatAsync(subsystemRequest, token);
|
||||
sectionReport.OperatingMode.Fact = new OperatingModeDto
|
||||
{
|
||||
DepthStart = factOperations.Min(w => w.DepthStart),
|
||||
DepthEnd = factOperations.Max(w => w.DepthEnd)
|
||||
};
|
||||
}
|
||||
|
||||
if (processMapPlanRotorBySection.TryGetValue(idSection, out var processMapPlanRotor))
|
||||
sectionReport.OperatingMode.Plan = new OperatingModeDto
|
||||
{
|
||||
DepthStart = processMapPlanRotor.Min(p => p.DepthStart),
|
||||
@ -191,7 +199,7 @@ public class WellReportService : IWellReportService
|
||||
FrowRateMax = processMapPlanRotor.Max(p => p.FlowRateMax)
|
||||
};
|
||||
|
||||
if (processMapReportBySection.TryGetValue(group.Key, out var processMapReport))
|
||||
if (processMapReportBySection.TryGetValue(idSection, out var processMapReport))
|
||||
sectionReport.DrillingBySetpoints = new DrillingBySetpointsDto
|
||||
{
|
||||
MetersByPressure = processMapReport.Sum(x => x.DeltaDepth * x.PressureDiff.SetpointUsage / 100),
|
||||
|
Loading…
Reference in New Issue
Block a user