Commit 98e4faf6 by wyc

读取表的时候,如果为空就存null

parent 1e701386
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reactive;
using NPOI.SS.UserModel; using NPOI.SS.UserModel;
using Performance.DtoModels; using Performance.DtoModels;
using Performance.Infrastructure; using Performance.Infrastructure;
...@@ -71,6 +72,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -71,6 +72,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue()); var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue());
if (!cellValue.HasValue || cellValue.Value == 0) if (!cellValue.HasValue || cellValue.Value == 0)
continue; continue;
var cell = sheet.GetRow(unit.FactorRow.Value)?.GetCell(athead.PointCell);
PerData data = new PerData PerData data = new PerData
{ {
RowNumber = r, RowNumber = r,
...@@ -81,7 +83,8 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -81,7 +83,8 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
CellValue = cellValue, CellValue = cellValue,
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String, //Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = unit.UnitType, //手动匹配 UnitType = unit.UnitType, //手动匹配
FactorValue = ConvertHelper.ToDecimalOrNull(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell).GetValue()), //FactorValue = ConvertHelper.ToDecimalOrNull(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell).GetValue()),
FactorValue = !string.IsNullOrEmpty(cell?.GetValue()) ? ConvertHelper.ToDecimalOrNull(cell?.GetValue()) : null,
IsFactor = true, IsFactor = true,
}; };
dataList.Add(data); dataList.Add(data);
...@@ -102,6 +105,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -102,6 +105,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
var cellValue = technicianRow.GetCell(athead.PointCell).StringCellValue; var cellValue = technicianRow.GetCell(athead.PointCell).StringCellValue;
if (string.IsNullOrEmpty(cellValue)) if (string.IsNullOrEmpty(cellValue))
continue; continue;
var cell = sheet.GetRow(tunit.FactorRow.Value)?.GetCell(athead.PointCell);
PerData data = new PerData PerData data = new PerData
{ {
RowNumber = rownum, RowNumber = rownum,
...@@ -112,7 +116,8 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -112,7 +116,8 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
CellValue = (dataList.Select(t => (PerData)t)?.Where(t => t.TypeName == athead.CellValue).Sum(t => t.CellValue) ?? 0) / 2, CellValue = (dataList.Select(t => (PerData)t)?.Where(t => t.TypeName == athead.CellValue).Sum(t => t.CellValue) ?? 0) / 2,
//Annotation = technicianRow.GetCell(athead.PointCell)?.CellComment?.String?.String, //Annotation = technicianRow.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = tunit.UnitType, //手动匹配 UnitType = tunit.UnitType, //手动匹配
FactorValue = ConvertHelper.ToDecimalOrNull(sheet.GetRow(tunit.FactorRow.Value).GetCell(athead.PointCell)?.ToString()), //FactorValue = ConvertHelper.ToDecimalOrNull(sheet.GetRow(tunit.FactorRow.Value).GetCell(athead.PointCell)?.ToString()),
FactorValue = !string.IsNullOrEmpty(cell?.GetValue()) ? ConvertHelper.ToDecimalOrNull(cell?.ToString()) : null,
IsFactor = true, IsFactor = true,
}; };
dataList.Add(data); dataList.Add(data);
......
...@@ -58,7 +58,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -58,7 +58,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
CellValue = cellValue, CellValue = cellValue,
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String, //Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = row.GetCell(0)?.ToString(), UnitType = row.GetCell(0)?.ToString(),
FactorValue = 0, FactorValue = null,
IsFactor = false, IsFactor = false,
}; };
......
...@@ -74,6 +74,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -74,6 +74,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue()); var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue());
if (!cellValue.HasValue || cellValue.Value == 0) if (!cellValue.HasValue || cellValue.Value == 0)
continue; continue;
var cell = sheet.GetRow(unit.FactorRow.Value)?.GetCell(athead.PointCell);
PerData data = new PerData PerData data = new PerData
{ {
...@@ -85,7 +86,8 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -85,7 +86,8 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
CellValue = cellValue, CellValue = cellValue,
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String, //Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = unit.UnitType, //手动匹配 UnitType = unit.UnitType, //手动匹配
FactorValue = ConvertHelper.ToDecimalOrNull(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell)?.NumericCellValue), //FactorValue = ConvertHelper.ToDecimalOrNull(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell)?.NumericCellValue),
FactorValue = !string.IsNullOrEmpty(cell?.GetValue()) ? ConvertHelper.ToDecimalOrNull(cell?.NumericCellValue) : null,
IsFactor = true, IsFactor = true,
}; };
var lastcell = vhead.OrderByDescending(t => t.PointCell).First(); var lastcell = vhead.OrderByDescending(t => t.PointCell).First();
......
...@@ -70,6 +70,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -70,6 +70,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue()); var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue());
if (!cellValue.HasValue || cellValue.Value == 0) if (!cellValue.HasValue || cellValue.Value == 0)
continue; continue;
var factorValue = sheet.GetRow(unit.FactorRow.Value)?.GetCell(athead.PointCell)?.GetValue();
PerData data = new PerData PerData data = new PerData
{ {
RowNumber = r, RowNumber = r,
...@@ -80,12 +81,13 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -80,12 +81,13 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
CellValue = cellValue, CellValue = cellValue,
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String, //Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = unit.UnitType, //手动匹配 UnitType = unit.UnitType, //手动匹配
FactorValue = ConvertHelper.ToDecimalOrNull(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell)?.NumericCellValue), FactorValue = !string.IsNullOrEmpty(factorValue) ? ConvertHelper.ToDecimalOrNull(factorValue) : null,
IsFactor = true, IsFactor = true,
}; };
if (string.IsNullOrEmpty(data.AccountingUnit) && string.IsNullOrEmpty(data.Department)) if (string.IsNullOrEmpty(data.AccountingUnit) && string.IsNullOrEmpty(data.Department))
continue; continue;
dataList.Add(data); dataList.Add(data);
} }
} }
} }
......
...@@ -71,7 +71,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -71,7 +71,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue()); var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue());
if (!cellValue.HasValue || cellValue.Value == 0) if (!cellValue.HasValue || cellValue.Value == 0)
continue; continue;
var cell = sheet.GetRow(unit.FactorRow.Value)?.GetCell(athead.PointCell); var cell = sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell);
PerData data = new PerData PerData data = new PerData
{ {
RowNumber = r, RowNumber = r,
...@@ -83,7 +83,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -83,7 +83,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String, //Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = unit.UnitType, //手动匹配 UnitType = unit.UnitType, //手动匹配
//FactorValue = ConvertHelper.ToDecimalOrNull(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell)?.NumericCellValue), //FactorValue = ConvertHelper.ToDecimalOrNull(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell)?.NumericCellValue),
FactorValue = !string.IsNullOrEmpty(cell.GetValue()) ? ConvertHelper.ToDecimalOrNull(cell?.NumericCellValue) : null, FactorValue = !string.IsNullOrEmpty(cell.GetValue()) ? ConvertHelper.ToDecimalOrNull(cell.NumericCellValue) : null,
IsFactor = true, IsFactor = true,
}; };
if (string.IsNullOrEmpty(data.AccountingUnit) && string.IsNullOrEmpty(data.Department)) if (string.IsNullOrEmpty(data.AccountingUnit) && string.IsNullOrEmpty(data.Department))
......
...@@ -49,7 +49,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -49,7 +49,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue()); var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue());
if (!cellValue.HasValue || cellValue.Value == 0) if (!cellValue.HasValue || cellValue.Value == 0)
continue; continue;
//var cell = sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell);
PerData data = new PerData PerData data = new PerData
{ {
RowNumber = r, RowNumber = r,
...@@ -61,6 +61,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -61,6 +61,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String, //Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = unit.UnitType, UnitType = unit.UnitType,
FactorValue = ConvertHelper.ToDecimalOrNull(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell).GetValue()), FactorValue = ConvertHelper.ToDecimalOrNull(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell).GetValue()),
//FactorValue = !string.IsNullOrEmpty(cell.GetValue()) ? ConvertHelper.ToDecimalOrNull(cell.GetValue()) : null,
IsFactor = true, IsFactor = true,
}; };
if (sheet.SheetName.Contains("医生组")) if (sheet.SheetName.Contains("医生组"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment