forked from ddrilling/AsbCloudServer
Фикс в логике сервиса
Не трубуется обязательно сопоставление факта с планом в режимах бурения
This commit is contained in:
parent
60800d10ed
commit
05d3a9d7b7
Binary file not shown.
@ -129,7 +129,8 @@ public class WellReportService : IWellReportService
|
|||||||
|
|
||||||
private async Task<IEnumerable<SectionReportDto>> GetSectionReportsAsync(int idWell, CancellationToken token)
|
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);
|
var processMapPlanRequest = new ProcessMapPlanBaseRequestWithWell(idWell);
|
||||||
|
|
||||||
@ -145,32 +146,39 @@ public class WellReportService : IWellReportService
|
|||||||
.GroupBy(x => x.IdWellSectionType)
|
.GroupBy(x => x.IdWellSectionType)
|
||||||
.ToDictionary(x => x.Key, x => x.AsEnumerable());
|
.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 sectionReports = new List<SectionReportDto>();
|
||||||
{
|
|
||||||
var subsystemRequest = new SubsystemRequest
|
|
||||||
{
|
|
||||||
IdWell = idWell,
|
|
||||||
GeDepth = group.Min(y => y.DepthStart),
|
|
||||||
LeDepth = group.Max(y => y.DepthEnd)
|
|
||||||
};
|
|
||||||
|
|
||||||
var sectionReport = new SectionReportDto
|
foreach (var idSection in idsSection)
|
||||||
{
|
{
|
||||||
IdSection = group.Key,
|
var sectionReport = new SectionReportDto
|
||||||
SubsystemsStat = await subsystemService.GetStatAsync(subsystemRequest, token),
|
{
|
||||||
OperatingMode = new PlanFactDto<OperatingModeDto>
|
IdSection = idSection,
|
||||||
{
|
OperatingMode = new PlanFactDto<OperatingModeDto>()
|
||||||
Fact = new OperatingModeDto
|
};
|
||||||
{
|
|
||||||
DepthStart = group.Min(w => w.DepthStart),
|
|
||||||
DepthEnd = group.Max(w => w.DepthEnd)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
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
|
sectionReport.OperatingMode.Plan = new OperatingModeDto
|
||||||
{
|
{
|
||||||
DepthStart = processMapPlanRotor.Min(p => p.DepthStart),
|
DepthStart = processMapPlanRotor.Min(p => p.DepthStart),
|
||||||
@ -191,7 +199,7 @@ public class WellReportService : IWellReportService
|
|||||||
FrowRateMax = processMapPlanRotor.Max(p => p.FlowRateMax)
|
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
|
sectionReport.DrillingBySetpoints = new DrillingBySetpointsDto
|
||||||
{
|
{
|
||||||
MetersByPressure = processMapReport.Sum(x => x.DeltaDepth * x.PressureDiff.SetpointUsage / 100),
|
MetersByPressure = processMapReport.Sum(x => x.DeltaDepth * x.PressureDiff.SetpointUsage / 100),
|
||||||
|
Loading…
Reference in New Issue
Block a user