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

View File

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