整理代码

This commit is contained in:
GG Z
2025-04-24 20:56:10 +08:00
parent 4d798e5d99
commit 155cef46f8
532 changed files with 1018 additions and 854 deletions

View File

@@ -0,0 +1,56 @@
using OfficeOpenXml;
namespace ShrlAlgo.RvKits.RvIndependent.NetworkCreator
{
public class ExcelData
{
public ExcelData(ExcelWorksheet sheet)
{
DataRows = [];
var lastColumn = sheet.Dimension.End.Column;
var lastRow = sheet.Dimension.End.Row;
//不计算所有末行首列为空的行
while (sheet.Cells[lastRow, 3].Value == null)
{
lastRow--;
}
System = sheet.Cells[2, 3].Value?.ToString().Split(':').Last();
for (var i = 5; i <= lastRow; i++)
{
var edr = new ExcelDataRow
{
StartId = sheet.Cells[i, 1].Value?.ToString(), //起点节点号
Number = sheet.Cells[i, 2].Value?.ToString(), //管线点号
EndId = sheet.Cells[i, 3].Value?.ToString(), //连接点号
LayingMode = sheet.Cells[i, 4].Value?.ToString(), //埋设方式
Material = sheet.Cells[i, 5].Value?.ToString(), //管材
Size = sheet.Cells[i, 6].Value?.ToString(), //截面尺寸
Feature = sheet.Cells[i, 7].Value?.ToString(), //特征
AccessoryType = sheet.Cells[i, 8].Value?.ToString(), //节点类型
X = Convert.ToDouble(sheet.Cells[i, 9].Value),//坐标Y
Y = Convert.ToDouble(sheet.Cells[i, 10].Value),//坐标X
GroundElev = Convert.ToDouble(sheet.Cells[i, 11].Value), //地面高程
Top = Convert.ToDouble(sheet.Cells[i, 12].Value), //管顶
InnerBottom = Convert.ToDouble(sheet.Cells[i, 13].Value), //管内底
Depth = Convert.ToDouble(sheet.Cells[i, 14].Value), //埋深=地面高程-管顶/管内底groundElev-top/innerBottom
NumberOfCablesOrHoles = sheet.Cells[i, 15].Value?.ToString(), //电缆根数或总孔数/已用孔数
ArrangementOfHoles = sheet.Cells[i, 16].Value?.ToString(), //管孔排列(行X列)
VoltageorPressure = sheet.Cells[i, 17].Value?.ToString(), //电力电压(KV)/压力
Remarks = sheet.Cells[i, 18].Value?.ToString() //备注
};
if (edr.StartId == null)
{
edr.StartId = DataRows.Last().StartId;
edr.HasManHole = false;
}
DataRows.Add(edr);
}
}
public List<ExcelDataRow> DataRows;
public string System { get; set; }
}
}