Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
b264cfe8
Commit
b264cfe8
authored
Jan 07, 2022
by
lcx
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'hotfix/提取工作簿修改'
parents
eac2d6e9
5f554e53
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
23 deletions
+28
-23
performance/Performance.Services/ExtractExcelService/ExtractHelper/WriteDataHelper.cs
+28
-23
No files found.
performance/Performance.Services/ExtractExcelService/ExtractHelper/WriteDataHelper.cs
View file @
b264cfe8
...
...
@@ -46,17 +46,21 @@ public static void WriteSheetHeader(ISheet sheet, PerSheetPoint point, SheetType
var
category
=
columnHeader
.
GetCell
(
index
).
GetDecodeEscapes
();
if
(
string
.
IsNullOrEmpty
(
category
))
continue
;
if
(
index
>
headerFirstCellNum
)
headerFirstCellNum
=
index
;
var
column
=
columns
.
FirstOrDefault
(
t
=>
t
.
ColumnName
.
NoBlank
()
==
category
);
if
(
sheetType
==
SheetType
.
Income
)
if
(
sheetType
!=
SheetType
.
Income
)
{
WriteFactor
(
doctorFactor
,
index
,
column
?.
DoctorFactor
,
factorStyle
);
WriteFactor
(
nurseFactor
,
index
,
column
?.
NurseFactor
,
factorStyle
);
WriteFactor
(
technicianFactor
,
index
,
column
?.
TechnicianFactor
,
factorStyle
);
if
(
index
>
headerFirstCellNum
)
headerFirstCellNum
=
index
;
columns
.
RemoveAll
(
t
=>
t
.
ColumnName
.
NoBlank
()
==
category
);
}
else
{
var
rows
=
new
IRow
[]
{
nurseFactor
,
doctorFactor
,
technicianFactor
,
columnHeader
};
foreach
(
var
item
in
rows
)
{
var
cell
=
item
.
GetCell
(
index
);
if
(
cell
!=
null
)
item
.
RemoveCell
(
cell
);
}
}
columns
.
RemoveAll
(
t
=>
t
.
ColumnName
.
NoBlank
()
==
category
);
}
if
(
headerFirstCellNum
>
point
.
DataFirstCellNum
.
Value
)
headerFirstCellNum
+=
1
;
...
...
@@ -171,17 +175,14 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var
column
=
columnHeader
.
GetOrCreate
(
cellIndex
).
GetDecodeEscapes
();
var
cell
=
row
.
GetOrCreate
(
cellIndex
);
if
(
string
.
IsNullOrEmpty
(
column
))
continue
;
var
value
=
deptData
.
FirstOrDefault
(
t
=>
t
.
Category
.
NoBlank
()
==
column
)?.
Value
;
//数据为空,且单元格值不为空,不写入数据(保留原始值)
var
notWrite
=
!
value
.
HasValue
&&
!
string
.
IsNullOrEmpty
(
cell
.
ToString
());
if
(
/*cell.CellType != CellType.Formula && */
!
notWrite
)
{
if
(
value
.
HasValue
&&
value
!=
0
)
cell
.
SetCellValue
<
decimal
>(
value
);
if
(
headers
!=
null
&&
headers
.
Contains
(
column
))
{
cell
.
CellStyle
=
cellStyle
;
}
}
if
(
headers
!=
null
&&
headers
.
Contains
(
column
))
cell
.
CellStyle
=
cellStyle
;
}
#
endregion
...
...
@@ -189,7 +190,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
data
.
RemoveAll
(
t
=>
t
.
Department
==
department
);
}
if
(
point
.
DataFirstRowNum
.
Value
<
dataFirstRowNum
)
dataFirstRowNum
+=
1
;
//
if (point.DataFirstRowNum.Value < dataFirstRowNum) dataFirstRowNum += 1;
}
private
static
void
WriteSheetDataNonexistent
(
ISheet
sheet
,
IRow
columnHeader
,
PerSheetPoint
point
,
SheetType
sheetType
,
ExcelStyle
style
,
...
...
@@ -236,7 +237,8 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
else
if
(
sheetType
==
SheetType
.
Income
||
(
headers
!=
null
&&
headers
.
Contains
(
column
)))
{
var
value
=
deptData
.
FirstOrDefault
(
t
=>
t
.
Category
.
NoBlank
()
==
column
)?.
Value
;
cell
.
SetCellValue
<
decimal
>(
value
);
if
(
value
.
HasValue
&&
value
!=
0
)
cell
.
SetCellValue
<
decimal
>(
value
);
cell
.
CellStyle
=
cellStyle
;
}
}
...
...
@@ -288,11 +290,14 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var
cell
=
row
.
GetOrCreate
(
cellIndex
);
var
value
=
deptData
.
FirstOrDefault
(
t
=>
t
.
Category
.
NoBlank
()
==
column
)?.
Value
;
if
(
cell
.
CellType
!=
CellType
.
Formula
)
{
//if (cell.CellType != CellType.Formula)
//{
// cell.SetCellValue<decimal>(value);
// cell.CellStyle = cellStyle;
//}
if
(
value
.
HasValue
&&
value
!=
0
)
cell
.
SetCellValue
<
decimal
>(
value
);
cell
.
CellStyle
=
cellStyle
;
}
cell
.
CellStyle
=
cellStyle
;
}
dataFirstRowNum
++;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment