| | |
| | | return ""; |
| | | } |
| | | |
| | | public static List<(double Q, double H, double P, double E)> ParsePumpExcel(string fileName) |
| | | public static string ParsePumpExcel(string fileName, out List<Yw.Geometry.Point2d> qh, out List<Yw.Geometry.Point2d> qe, out List<Yw.Geometry.Point2d> qp) |
| | | { |
| | | qh = new List<Geometry.Point2d>(); |
| | | qe = new List<Geometry.Point2d>(); |
| | | qp = new List<Geometry.Point2d>(); |
| | | |
| | | if (!File.Exists(fileName)) |
| | | return default; |
| | | return "文件不存在"; |
| | | int line = 0; |
| | | |
| | | //初始化文件 |
| | |
| | | { |
| | | sheet1 = theBook.GetSheetAt(0); |
| | | if (sheet1 == null) |
| | | throw new Exception("无Sheet数据"); |
| | | return ("无Sheet数据"); |
| | | } |
| | | |
| | | //标题行 |
| | |
| | | var row_title = sheet1.GetRow(title_line_index); |
| | | if (row_title == null) |
| | | { |
| | | throw new Exception("第一行第一列不能空"); |
| | | return ("第一行第一列不能空"); |
| | | } |
| | | |
| | | //开始读取的行 |
| | |
| | | var cell_0 = row_title.GetCell(0); |
| | | if (cell_0 == null) |
| | | { |
| | | throw new Exception("无法读取表头文件"); |
| | | return ("无法读取表头文件"); |
| | | } |
| | | else if (cell_0.StringCellValue.Contains("序号")) |
| | | { |
| | |
| | | throw new Exception("效率大于100%"); |
| | | } |
| | | |
| | | list.Add(new(flow, head, eff, power)); |
| | | |
| | | qh.Add(new Geometry.Point2d(flow, head)); |
| | | qe.Add(new Geometry.Point2d(flow, eff)); |
| | | qp.Add(new Geometry.Point2d(flow, power)); |
| | | } |
| | | |
| | | return list; |
| | | return ""; |
| | | } |
| | | |
| | | private static bool ParseCellValue(NPOI.SS.UserModel.ICell cell, out double cell_value) |