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
8a4b5ea4
Commit
8a4b5ea4
authored
Jun 05, 2023
by
ruyun.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
科室详情下载
parent
b2fcc28e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
39 deletions
+66
-39
performance/Performance.Services/ComputeService.UniteDeptDetail.cs
+66
-39
No files found.
performance/Performance.Services/ComputeService.UniteDeptDetail.cs
View file @
8a4b5ea4
...
...
@@ -85,7 +85,7 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s
{
"绩效合计"
,
ValueFormating
(
item
.
PerforTotal
,
UniteDept
.
Format
.
两位小数
.
ToString
())
},
});
}
detailItems
.
Add
(
new
DeptDetailItem
{
Title
=
"行政工勤"
,
Total
=
account
.
PerforTotal
??
0
,
Items
=
items
});
detailItems
.
Add
(
new
DeptDetailItem
{
Title
=
"行政工勤"
,
Total
=
account
.
PerforTotal
??
0
,
TotalFormat
=
ValueFormating
(
account
.
PerforTotal
??
0
,
""
),
Items
=
items
});
}
#
endregion
...
...
@@ -112,7 +112,8 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s
row
.
AddOrUpdate
(
"合计"
,
ValueFormating
(
amount
,
""
),
ValueFormating
(
amount
,
""
));
items
.
Add
(
row
);
}
detailItems
.
Add
(
new
DeptDetailItem
{
Title
=
"岗位系数"
,
Total
=
0
,
Items
=
items
});
var
totalValue
=
basicData
.
Where
(
t
=>
t
.
SheetID
==
postSheet
.
ID
&&
t
.
UnitType
==
(
int
)
SheetType
.
PersonPostCoefficient
&&
t
.
IsTotal
==
1
)?.
Sum
(
t
=>
t
.
CellValue
)
??
0
;
detailItems
.
Add
(
new
DeptDetailItem
{
Title
=
"岗位系数"
,
Total
=
totalValue
,
TotalFormat
=
ValueFormating
(
totalValue
,
""
),
Items
=
items
});
}
}
#
endregion
...
...
@@ -146,7 +147,7 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s
});
}
detailItems
.
Add
(
new
DeptDetailItem
{
Title
=
"量化考核"
,
Total
=
special
.
First
().
ResultsTotalFee
??
0
,
Items
=
items
});
detailItems
.
Add
(
new
DeptDetailItem
{
Title
=
"量化考核"
,
Total
=
special
.
First
().
ResultsTotalFee
??
0
,
TotalFormat
=
ValueFormating
(
special
.
First
().
ResultsTotalFee
??
0
,
""
),
Items
=
items
});
}
#
endregion
...
...
@@ -207,7 +208,7 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s
#
endregion
var
amount
=
basicData
.
Where
(
t
=>
t
.
SheetID
==
sheet
.
ID
&&
t
.
UnitType
==
(
int
)
type
&&
t
.
IsTotal
!=
1
)?.
Sum
(
t
=>
t
.
IsFactor
==
1
?
t
.
CellValue
*
(
t
.
FactorValue
??
0
)
:
t
.
CellValue
)
??
0
;
detailItems
.
Add
(
new
DeptDetailItem
{
Title
=
sheetName
,
Total
=
amount
,
Items
=
items
});
detailItems
.
Add
(
new
DeptDetailItem
{
Title
=
sheetName
,
Total
=
amount
,
TotalFormat
=
ValueFormating
(
amount
,
""
),
Items
=
items
});
}
}
}
...
...
@@ -277,7 +278,7 @@ public UniteDeptDetailResponse UniteDeptDetail(int allotId, UnitType unitType, s
DeleteBlankColumn
(
items
);
var
amount
=
basicData
.
Where
(
t
=>
t
.
SheetID
==
sheet
.
ID
&&
t
.
UnitType
==
(
int
)
type
&&
t
.
IsTotal
!=
1
)?.
Sum
(
t
=>
t
.
IsFactor
==
1
?
t
.
CellValue
*
(
t
.
FactorValue
??
0
)
:
t
.
CellValue
)
??
0
;
detailItemWorkloads
.
Add
(
new
DeptDetailItem
{
Title
=
sheetName
,
Total
=
amount
,
Items
=
items
});
detailItemWorkloads
.
Add
(
new
DeptDetailItem
{
Title
=
sheetName
,
Total
=
amount
,
TotalFormat
=
ValueFormating
(
amount
,
""
),
Items
=
items
});
}
}
#
endregion
...
...
@@ -616,53 +617,41 @@ public string ExcelDownload(UniteDeptDetailResponse uniteDeptDetail, string name
using
(
FileStream
fs
=
new
FileStream
(
filepath
,
FileMode
.
OpenOrCreate
))
using
(
ExcelPackage
package
=
new
ExcelPackage
(
fs
))
{
var
maxColIndex
=
10
;
var
worksheet
=
package
.
Workbook
.
Worksheets
.
Add
(
name
);
var
maxColIndex
=
GetMaxColumnIndex
(
0
,
uniteDeptDetail
.
DetailItems
);
worksheet
.
SetValue
(
1
,
1
,
uniteDeptDetail
.
Title
);
worksheet
.
Cells
[
1
,
1
,
1
,
maxColIndex
].
Merge
=
true
;
worksheet
.
Cells
[
1
,
1
,
1
,
maxColIndex
].
Style
.
Font
.
Bold
=
true
;
worksheet
.
Cells
[
1
,
1
,
1
,
maxColIndex
].
Style
.
Font
.
Size
=
20
;
worksheet
.
Cells
[
1
,
1
,
1
,
maxColIndex
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Cells
[
1
,
1
,
1
,
maxColIndex
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
worksheet
.
Cells
[
1
,
1
,
1
,
maxColIndex
].
Style
.
HorizontalAlignment
=
ExcelHorizontalAlignment
.
Center
;
var
rowIndex
=
1
;
xx
(
worksheet
,
maxColIndex
,
rowIndex
,
uniteDeptDetail
.
DetailItems
);
//#region 样式设置
//for (int row = worksheet.Dimension.Start.Row; row <= worksheet.Dimension.End.Row; row++)
//{
// worksheet.Row(row).Height = 20;
// for (int col = worksheet.Dimension.Start.Column; col <= worksheet.Dimension.End.Column; col++)
// {
// worksheet.Cells[row, col].Style.Border.BorderAround(ExcelBorderStyle.Thin);
// worksheet.Cells[row, col].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
// worksheet.Cells[row, col].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
// }
//}
////worksheet.Cells[1, 1, 1, headList.Count].Merge = true;
////worksheet.Cells[1, 1, 1, headList.Count].Style.Font.Bold = true;
////worksheet.Cells[1, 1, 1, headList.Count].Style.Font.Size = 16;
////worksheet.Row(1).Height = 24;
////worksheet.Cells[2, 1, 2, headList.Count].Style.Font.Bold = true;
//worksheet.Cells.AutoFitColumns();
//for (int col = worksheet.Dimension.Start.Column; col <= worksheet.Dimension.End.Column; col++)
//{
// worksheet.Column(col).Width = worksheet.Column(col).Width > 20 ? 20 : worksheet.Column(col).Width;
//}
//#endregion
var
rowIndex
=
2
;
WriteSheetCells
(
worksheet
,
maxColIndex
,
rowIndex
,
uniteDeptDetail
.
DetailItems
);
package
.
Save
();
}
return
filepath
;
}
void
xx
(
ExcelWorksheet
worksheet
,
int
maxColIndex
,
int
rowIndex
,
List
<
DeptDetailItem
>
detailItems
)
int
WriteSheetCells
(
ExcelWorksheet
worksheet
,
int
maxColIndex
,
int
rowIndex
,
List
<
DeptDetailItem
>
detailItems
)
{
foreach
(
var
item
in
detailItems
)
{
rowIndex
=
rowIndex
+
1
;
worksheet
.
SetValue
(
rowIndex
,
1
,
$"
{
item
.
Title
}
:
{
item
.
TotalFormat
}
"
);
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Merge
=
true
;
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
Font
.
Bold
=
true
;
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
Font
.
Size
=
18
;
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Cells
[
rowIndex
,
1
,
rowIndex
,
maxColIndex
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
if
(
item
.
Children
?.
Any
()
==
true
)
{
xx
(
worksheet
,
maxColIndex
,
rowIndex
,
item
.
Children
);
rowIndex
=
rowIndex
+
1
;
rowIndex
=
WriteSheetCells
(
worksheet
,
maxColIndex
,
rowIndex
,
item
.
Children
);
}
else
if
(
item
.
Items
?.
Any
()
==
true
)
{
...
...
@@ -671,22 +660,60 @@ void xx(ExcelWorksheet worksheet, int maxColIndex, int rowIndex, List<DeptDetail
for
(
int
colIndex
=
0
;
colIndex
<
headers
.
Count
();
colIndex
++)
{
worksheet
.
SetValue
(
rowIndex
,
colIndex
+
1
,
headers
.
ElementAt
(
colIndex
));
if
(
colIndex
+
1
==
headers
.
Count
())
worksheet
.
Cells
[
rowIndex
,
colIndex
,
rowIndex
,
maxColIndex
].
Merge
=
true
;
var
toCol
=
colIndex
+
1
==
headers
.
Count
()
?
colIndex
:
maxColIndex
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
toCol
+
1
].
Merge
=
colIndex
+
1
==
headers
.
Count
();
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
toCol
+
1
].
Style
.
Font
.
Bold
=
true
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
toCol
+
1
].
Style
.
Font
.
Size
=
16
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
toCol
+
1
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
toCol
+
1
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
toCol
+
1
].
Style
.
HorizontalAlignment
=
ExcelHorizontalAlignment
.
Center
;
}
rowIndex
=
rowIndex
+
1
;
foreach
(
var
row
in
item
.
Items
)
{
rowIndex
=
rowIndex
+
1
;
for
(
int
colIndex
=
0
;
colIndex
<
headers
.
Count
();
colIndex
++)
{
worksheet
.
SetValue
(
rowIndex
,
colIndex
+
1
,
row
[
headers
.
ElementAt
(
colIndex
)]);
if
(
colIndex
+
1
==
headers
.
Count
())
worksheet
.
Cells
[
rowIndex
,
colIndex
,
rowIndex
,
maxColIndex
].
Merge
=
true
;
var
toCol
=
colIndex
+
1
==
headers
.
Count
()
?
colIndex
:
maxColIndex
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
toCol
+
1
].
Merge
=
colIndex
+
1
==
headers
.
Count
();
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
toCol
+
1
].
Style
.
Font
.
Size
=
16
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
toCol
+
1
].
Style
.
Border
.
BorderAround
(
ExcelBorderStyle
.
Thin
);
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
toCol
+
1
].
Style
.
VerticalAlignment
=
ExcelVerticalAlignment
.
Center
;
worksheet
.
Cells
[
rowIndex
,
colIndex
+
1
,
rowIndex
,
toCol
+
1
].
Style
.
HorizontalAlignment
=
ExcelHorizontalAlignment
.
Center
;
}
}
}
}
return
rowIndex
;
}
int
GetMaxColumnIndex
(
int
maxColIndex
,
List
<
DeptDetailItem
>
detailItems
)
{
foreach
(
var
item
in
detailItems
)
{
if
(
item
.
Children
?.
Any
()
==
true
)
{
var
tempMaxColIndex
=
GetMaxColumnIndex
(
maxColIndex
,
item
.
Children
);
if
(
tempMaxColIndex
>
maxColIndex
)
{
maxColIndex
=
tempMaxColIndex
;
}
}
else
if
(
item
.
Items
?.
Any
()
==
true
)
{
var
tempMaxColIndex
=
item
.
Items
.
SelectMany
(
dict
=>
dict
.
Keys
).
Distinct
().
Count
();
if
(
tempMaxColIndex
>
maxColIndex
)
{
maxColIndex
=
tempMaxColIndex
;
}
}
}
return
maxColIndex
;
}
...
...
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