Commit 98e4faf6 by wyc

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

parent 1e701386
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive;
using NPOI.SS.UserModel;
using Performance.DtoModels;
using Performance.Infrastructure;
......@@ -71,6 +72,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue());
if (!cellValue.HasValue || cellValue.Value == 0)
continue;
var cell = sheet.GetRow(unit.FactorRow.Value)?.GetCell(athead.PointCell);
PerData data = new PerData
{
RowNumber = r,
......@@ -81,7 +83,8 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
CellValue = cellValue,
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
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,
};
dataList.Add(data);
......@@ -102,6 +105,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
var cellValue = technicianRow.GetCell(athead.PointCell).StringCellValue;
if (string.IsNullOrEmpty(cellValue))
continue;
var cell = sheet.GetRow(tunit.FactorRow.Value)?.GetCell(athead.PointCell);
PerData data = new PerData
{
RowNumber = rownum,
......@@ -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,
//Annotation = technicianRow.GetCell(athead.PointCell)?.CellComment?.String?.String,
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,
};
dataList.Add(data);
......
......@@ -58,7 +58,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
CellValue = cellValue,
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = row.GetCell(0)?.ToString(),
FactorValue = 0,
FactorValue = null,
IsFactor = false,
};
......
......@@ -74,6 +74,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue());
if (!cellValue.HasValue || cellValue.Value == 0)
continue;
var cell = sheet.GetRow(unit.FactorRow.Value)?.GetCell(athead.PointCell);
PerData data = new PerData
{
......@@ -85,7 +86,8 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
CellValue = cellValue,
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
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,
};
var lastcell = vhead.OrderByDescending(t => t.PointCell).First();
......
......@@ -70,6 +70,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue());
if (!cellValue.HasValue || cellValue.Value == 0)
continue;
var factorValue = sheet.GetRow(unit.FactorRow.Value)?.GetCell(athead.PointCell)?.GetValue();
PerData data = new PerData
{
RowNumber = r,
......@@ -80,12 +81,13 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
CellValue = cellValue,
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
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,
};
if (string.IsNullOrEmpty(data.AccountingUnit) && string.IsNullOrEmpty(data.Department))
continue;
dataList.Add(data);
}
}
}
......
......@@ -71,7 +71,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue());
if (!cellValue.HasValue || cellValue.Value == 0)
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
{
RowNumber = r,
......@@ -83,7 +83,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = unit.UnitType, //手动匹配
//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,
};
if (string.IsNullOrEmpty(data.AccountingUnit) && string.IsNullOrEmpty(data.Department))
......
......@@ -49,7 +49,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
var cellValue = ConvertHelper.ToDecimalOrNull(row.GetCell(athead.PointCell).GetValue());
if (!cellValue.HasValue || cellValue.Value == 0)
continue;
//var cell = sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell);
PerData data = new PerData
{
RowNumber = r,
......@@ -61,6 +61,7 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
//Annotation = row.GetCell(athead.PointCell)?.CellComment?.String?.String,
UnitType = unit.UnitType,
FactorValue = ConvertHelper.ToDecimalOrNull(sheet.GetRow(unit.FactorRow.Value).GetCell(athead.PointCell).GetValue()),
//FactorValue = !string.IsNullOrEmpty(cell.GetValue()) ? ConvertHelper.ToDecimalOrNull(cell.GetValue()) : null,
IsFactor = true,
};
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