ProcessMapReport. Add some todos.

This commit is contained in:
ngfrolov 2023-01-17 10:00:08 +05:00
parent f7f0f02c34
commit e398beaaa1
Signed by: ng.frolov
GPG Key ID: E99907A0357B29A7
2 changed files with 17 additions and 13 deletions

View File

@ -13,6 +13,8 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
public class ProcessMapReportService : IProcessMapReportService
{
const int firstColumn = 2;
const int lastColumn = 27;
const int headerRowsCount = 3;
private readonly IProcessMapService processMapService;
@ -59,12 +61,11 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
private static int FillSection(IXLWorksheet sheet, IGrouping<int, ProcessMapReportDto> sectionData, int row)
{
var rowStart = row;
const int lastHeaderColumn = 27;
var sectionName = sectionData.FirstOrDefault()?.WellSectionTypeName
?? sectionData.Key.ToString();
sheet.Range(row, firstColumn, row, lastHeaderColumn)
sheet.Range(row, firstColumn, row, lastColumn)
.Merge()
.FirstCell()
.SetVal(sectionName);
@ -74,7 +75,7 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
foreach (var interval in sectionData)
row = FillIntervalData(sheet, interval, row);
var sectionStyle = sheet.Range(rowStart, firstColumn, row - 1, lastHeaderColumn).Style;
var sectionStyle = sheet.Range(rowStart, firstColumn, row - 1, lastColumn).Style;
SetBorders(sectionStyle);
return row;
}

View File

@ -13,8 +13,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudDb.Model.Subsystems;
using System.Reflection.Metadata.Ecma335;
using AsbCloudInfrastructure.Services.Subsystems;
namespace AsbCloudInfrastructure.Services.ProcessMap
@ -126,6 +124,7 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
DepthStart = depthInterval.min
};
// TODO: trim items by detpth intervals. Use linear interpolation.
var intervalOperations = sectionOperations.Where(o => o.DepthEnd >= depthInterval.min && o.DepthStart <= depthInterval.max);
var intervalProcessMap = sectionProcessMap.Where(map => map.DepthEnd >= depthInterval.min && map.DepthStart <= depthInterval.max);
var intervalTelemetryDataStat = CalcIntervalTelemetryDataStat(depthInterval, telemetryDataStat);
@ -142,6 +141,7 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
dto.MechDrillingHours = CalcHours(depthInterval, intervalOperations);
}
// TODO: Разделить интервальные коллекции на ротор и слайд. Пока нет готовой методики.
var slideOperations = intervalOperations.Where(o => o.IdCategory == WellOperationCategory.IdSlide);
var rotorOperations = intervalOperations.Where(o => o.IdCategory == WellOperationCategory.IdRotor);
@ -261,17 +261,20 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
var totalDepth = intervalLimitingParametrsStat
.Sum(s => s.SumDepth);
dto.AxialLoad.PercDrillingSetpoint = intervalLimitingParametrsStat
.FirstOrDefault(s => s.IdLimParam == idLimParamAxialLoad)?.SumDepth / totalDepth;
if (totalDepth > 0)
{
dto.AxialLoad.PercDrillingSetpoint = intervalLimitingParametrsStat
.FirstOrDefault(s => s.IdLimParam == idLimParamAxialLoad)?.SumDepth / totalDepth;
dto.PressureDiff.PercDrillingSetpoint = intervalLimitingParametrsStat
.FirstOrDefault(s => s.IdLimParam == idLimParamPressure)?.SumDepth / totalDepth;
dto.PressureDiff.PercDrillingSetpoint = intervalLimitingParametrsStat
.FirstOrDefault(s => s.IdLimParam == idLimParamPressure)?.SumDepth / totalDepth;
dto.TopDriveTorque.PercDrillingSetpoint = intervalLimitingParametrsStat
.FirstOrDefault(s => s.IdLimParam == idLimParamTorque)?.SumDepth / totalDepth;
dto.TopDriveTorque.PercDrillingSetpoint = intervalLimitingParametrsStat
.FirstOrDefault(s => s.IdLimParam == idLimParamTorque)?.SumDepth / totalDepth;
dto.SpeedLimit.PercDrillingSetpoint = intervalLimitingParametrsStat
.FirstOrDefault(s => s.IdLimParam == idLimParamRop)?.SumDepth / totalDepth;
dto.SpeedLimit.PercDrillingSetpoint = intervalLimitingParametrsStat
.FirstOrDefault(s => s.IdLimParam == idLimParamRop)?.SumDepth / totalDepth;
}
}
if (intervalSubsystemsOperationTime.Any() && dto.DeltaDepth > 0)