Правки по отчету - ртк

1. Изменена шапка отчета
2. Данные отчета - это плоский список
This commit is contained in:
Olga Nemt 2023-04-06 15:18:29 +05:00
parent 40a3d3ab50
commit 93a8a7bd7f
3 changed files with 44 additions and 64 deletions

View File

@ -13,9 +13,9 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
public class ProcessMapReportMakerService : IProcessMapReportMakerService
{
const int firstColumn = 2;
const int lastColumn = 61;
const int lastColumn = 49;
const int headerRowsCount = 8;
const int headerRowsCount = 6;
private readonly IProcessMapReportService processMapService;
@ -89,63 +89,56 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
const int columnRopTime = firstColumn + 3;
const int columnMode = firstColumn + 4;
int rowRotor = row;
int rowSlide = row + 1;
sheet.Cell(row, firstColumn)
.SetVal(interval.DepthStart, "0.0");
sheet.Range(rowRotor, firstColumn, rowSlide, firstColumn)
.Merge();
sheet.Cell(row, columnDepth)
.SetVal(interval.DepthEnd, "0.0");
sheet.Range(rowRotor, columnDepth, rowSlide, columnDepth)
.Merge().FirstCell()
.SetVal(interval.DepthStart, "0.0");
sheet.Range(rowRotor, columnDate, rowSlide, columnDate)
.Merge().FirstCell()
sheet.Cell(row, columnDate)
.SetVal(interval.DateStart);
sheet.Range(rowRotor, columnRopTime, rowSlide, columnRopTime)
.Merge().FirstCell()
sheet.Cell(row, columnRopTime)
.SetVal(interval.MechDrillingHours);
//row = FillIntervalModeData(sheet, "Ротор", interval.Rotor, columnMode, row);
//row = FillIntervalModeData(sheet, "Слайд", interval.Slide, columnMode, row);
row = FillIntervalModeData(sheet, interval, columnMode, row);
return row;
}
//private static int FillIntervalModeData(IXLWorksheet sheet, string modeName, ProcessMapReportRowDto modeData, int column, int row)
//{
// int columnDeltaDepth = column + 1;
// int columnPressure = columnDeltaDepth + 1;
// int columnLoad = columnPressure + 5;
// int columnTorque = columnLoad + 5;
// int columnSpeed = columnTorque + 5;
// int columnUsagePlan = columnSpeed + 5;
// int columnUsageFact = columnUsagePlan + 1;
// int columnRop = columnUsageFact + 12;
private static int FillIntervalModeData(IXLWorksheet sheet, ProcessMapReportDto modeData, int column, int row)
{
int columnDeltaDepth = column + 1;
int columnPressure = columnDeltaDepth + 1;
int columnLoad = columnPressure + 5;
int columnTorque = columnLoad + 5;
int columnSpeed = columnTorque + 5;
int columnUsagePlan = columnSpeed + 5;
int columnUsageFact = columnUsagePlan + 1;
int columnRop = columnUsageFact + 12;
// sheet.Cell(row, column)
// .SetVal(modeName);
sheet.Cell(row, column)
.SetVal(modeData.DrillingMode);
// sheet.Cell(row, columnDeltaDepth)
// .SetVal(modeData.DeltaDepth);
sheet.Cell(row, columnDeltaDepth)
.SetVal(modeData.DeltaDepth);
// FillIntervalModeDataParam(sheet, modeData.PressureDiff, columnPressure, row);
// FillIntervalModeDataParam(sheet, modeData.AxialLoad, columnLoad, row);
// FillIntervalModeDataParam(sheet, modeData.TopDriveTorque, columnTorque, row);
// FillIntervalModeDataSpeed(sheet, modeData.SpeedLimit, columnSpeed, row);
FillIntervalModeDataParam(sheet, modeData.PressureDiff, columnPressure, row);
FillIntervalModeDataParam(sheet, modeData.AxialLoad, columnLoad, row);
FillIntervalModeDataParam(sheet, modeData.TopDriveTorque, columnTorque, row);
FillIntervalModeDataSpeed(sheet, modeData.SpeedLimit, columnSpeed, row);
// sheet.Cell(row, columnUsagePlan)
// .SetVal(100);
sheet.Cell(row, columnUsagePlan)
.SetVal(100);
// sheet.Cell(row, columnUsageFact)
// .SetVal(modeData.Usage);
sheet.Cell(row, columnUsageFact)
.SetVal(modeData.Usage);
// sheet.Cell(row, columnRop)
// .SetVal(modeData.Rop);
sheet.Cell(row, columnRop)
.SetVal(modeData.Rop);
// return row + 1;
//}
return row + 1;
}
private static void FillIntervalModeDataParam(IXLWorksheet sheet, ProcessMapReportParamsDto dataParam, int column, int row)
{

View File

@ -5,27 +5,6 @@ namespace AsbCloudInfrastructure.Services.ProcessMap;
internal static class XLExtentions
{
public static IXLCell SetVal(this IXLCell cell, object value)
{
switch (value)
{
case DateTime dateTime:
cell.SetVal(dateTime);
break;
case IFormattable formattable:
cell.SetVal(formattable);
break;
case string valueString:
cell.SetVal(valueString);
break;
default:
cell.Value = value;
break;
}
return cell;
}
public static IXLCell SetVal(this IXLCell cell, string value, bool adaptRowHeight = false)
{
cell.Value = value;
@ -53,11 +32,19 @@ internal static class XLExtentions
return cell;
}
public static IXLCell SetVal(this IXLCell cell, IFormattable value, string format = "0.00")
public static IXLCell SetVal(this IXLCell cell, int? value, string format = "0.00")
{
cell.Value = value;
cell.DataType = XLDataType.Number;
cell.Style.NumberFormat.Format = format;
return cell;
}
public static IXLCell SetVal(this IXLCell cell, double? value, string format = "0.00")
{
cell.Value = (value is not null && double.IsFinite(value.Value)) ? value : null;
cell.DataType = XLDataType.Number;
cell.Style.NumberFormat.Format = format;
return cell;
}
}