Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mes
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ximai
mes
Commits
0c95606f
Commit
0c95606f
authored
Jan 18, 2025
by
温志超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日产能报表导出
parent
e191dd30
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
157 additions
and
46 deletions
+157
-46
DailyProductionReportController.java
...es/report/controller/DailyProductionReportController.java
+52
-0
DailyProductionReportServiceImp.java
.../report/service/impl/DailyProductionReportServiceImp.java
+105
-46
No files found.
mes/src/main/java/com/ximai/mes/report/controller/DailyProductionReportController.java
View file @
0c95606f
...
@@ -75,6 +75,17 @@ public class DailyProductionReportController extends BaseController {
...
@@ -75,6 +75,17 @@ public class DailyProductionReportController extends BaseController {
return
AjaxResult
.
success
(
data
);
return
AjaxResult
.
success
(
data
);
}
}
/**
* 日产能对比统计:统计方式车间导出
*/
@PreAuthorize
(
"@ss.hasPermi('pro:materialReturn:export')"
)
@Log
(
title
=
"日产能对比统计:统计方式车间导出"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/getListByWorkshop/export"
)
public
void
getListByWorkshopExport
(
HttpServletResponse
response
,
DailyProductionReportRequest
dailyProductionReportRequest
)
{
List
data
=
dailyProductionReportService
.
getListByWorkshop
(
dailyProductionReportRequest
);
dailyProductionReportService
.
export
(
response
,
data
,
"日产能对比统计-统计方式车间导出"
,
"车间名称"
,
"车间编码"
,
"车间"
,
dailyProductionReportRequest
);
}
@ApiOperation
(
"日产能对比统计:统计方式工作中心"
)
@ApiOperation
(
"日产能对比统计:统计方式工作中心"
)
@PreAuthorize
(
"@ss.hasPermi('mes:pro:dailyProductionReport:get')"
)
@PreAuthorize
(
"@ss.hasPermi('mes:pro:dailyProductionReport:get')"
)
...
@@ -84,6 +95,21 @@ public class DailyProductionReportController extends BaseController {
...
@@ -84,6 +95,21 @@ public class DailyProductionReportController extends BaseController {
List
data
=
dailyProductionReportService
.
getListByWorkstation
(
dailyProductionReportRequest
);
List
data
=
dailyProductionReportService
.
getListByWorkstation
(
dailyProductionReportRequest
);
return
AjaxResult
.
success
(
data
);
return
AjaxResult
.
success
(
data
);
}
}
/**
* 日产能对比统计:统计方式工作中心导出
*/
@PreAuthorize
(
"@ss.hasPermi('pro:materialReturn:export')"
)
@Log
(
title
=
"日产能对比统计:统计方式工作中心导出"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/getListByWorkstation/export"
)
public
void
getListByWorkstationExport
(
HttpServletResponse
response
,
DailyProductionReportRequest
dailyProductionReportRequest
)
{
List
data
=
dailyProductionReportService
.
getListByWorkstation
(
dailyProductionReportRequest
);
dailyProductionReportService
.
export
(
response
,
data
,
"日产能对比统计-统计方式工作中心导出"
,
"工作中心名称"
,
"工作中心编码"
,
"工作中心"
,
dailyProductionReportRequest
);
}
@ApiOperation
(
"日产能对比统计:统计方式工作单元"
)
@ApiOperation
(
"日产能对比统计:统计方式工作单元"
)
@PreAuthorize
(
"@ss.hasPermi('mes:pro:dailyProductionReport:get')"
)
@PreAuthorize
(
"@ss.hasPermi('mes:pro:dailyProductionReport:get')"
)
@Log
(
title
=
"日产能对比统计:统计方式工作单元"
,
businessType
=
BusinessType
.
QUERY
)
@Log
(
title
=
"日产能对比统计:统计方式工作单元"
,
businessType
=
BusinessType
.
QUERY
)
...
@@ -93,6 +119,21 @@ public class DailyProductionReportController extends BaseController {
...
@@ -93,6 +119,21 @@ public class DailyProductionReportController extends BaseController {
return
AjaxResult
.
success
(
data
);
return
AjaxResult
.
success
(
data
);
}
}
/**
* 日产能对比统计:统计方式工作中心导出
*/
@PreAuthorize
(
"@ss.hasPermi('pro:materialReturn:export')"
)
@Log
(
title
=
"日产能对比统计:统计方式工作单元导出"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/getListByWorkunit/export"
)
public
void
getListByWorkunitExport
(
HttpServletResponse
response
,
DailyProductionReportRequest
dailyProductionReportRequest
)
{
List
data
=
dailyProductionReportService
.
getListByWorkunit
(
dailyProductionReportRequest
);
dailyProductionReportService
.
export
(
response
,
data
,
"日产能对比统计-统计方式工作单元导出"
,
"工作单元名称"
,
"工作单元编码"
,
"工作单元"
,
dailyProductionReportRequest
);
}
@ApiOperation
(
"日产能对比统计:统计方式报工人员"
)
@ApiOperation
(
"日产能对比统计:统计方式报工人员"
)
@PreAuthorize
(
"@ss.hasPermi('mes:pro:dailyProductionReport:get')"
)
@PreAuthorize
(
"@ss.hasPermi('mes:pro:dailyProductionReport:get')"
)
@Log
(
title
=
"日产能对比统计:统计方式报工人员"
,
businessType
=
BusinessType
.
QUERY
)
@Log
(
title
=
"日产能对比统计:统计方式报工人员"
,
businessType
=
BusinessType
.
QUERY
)
...
@@ -102,4 +143,15 @@ public class DailyProductionReportController extends BaseController {
...
@@ -102,4 +143,15 @@ public class DailyProductionReportController extends BaseController {
return
AjaxResult
.
success
(
data
);
return
AjaxResult
.
success
(
data
);
}
}
/**
* 日产能对比统计:统计方式工作中心导出
*/
@PreAuthorize
(
"@ss.hasPermi('pro:materialReturn:export')"
)
@Log
(
title
=
"日产能对比统计:统计方式工作单元导出"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/getListByUser/export"
)
public
void
getListByUserExport
(
HttpServletResponse
response
,
DailyProductionReportRequest
dailyProductionReportRequest
)
{
List
data
=
dailyProductionReportService
.
getListByUser
(
dailyProductionReportRequest
);
dailyProductionReportService
.
export
(
response
,
data
,
"日产能对比统计-统计方式工作单元导出"
,
"报工人员名称"
,
"报工人员编码"
,
"报工人员"
,
dailyProductionReportRequest
);
}
}
}
mes/src/main/java/com/ximai/mes/report/service/impl/DailyProductionReportServiceImp.java
View file @
0c95606f
...
@@ -2,6 +2,7 @@ package com.ximai.mes.report.service.impl;
...
@@ -2,6 +2,7 @@ package com.ximai.mes.report.service.impl;
import
com.ximai.common.utils.MessageUtils
;
import
com.ximai.common.utils.MessageUtils
;
import
com.ximai.common.utils.data.ExceptionUtil
;
import
com.ximai.common.utils.data.ExceptionUtil
;
import
com.ximai.common.utils.data.StringUtils
;
import
com.ximai.mes.report.mapper.DailyProductionReportMapper
;
import
com.ximai.mes.report.mapper.DailyProductionReportMapper
;
import
com.ximai.mes.report.request.DailyProductionReportRequest
;
import
com.ximai.mes.report.request.DailyProductionReportRequest
;
import
com.ximai.mes.report.service.DailyProductionReportService
;
import
com.ximai.mes.report.service.DailyProductionReportService
;
...
@@ -175,6 +176,15 @@ public class DailyProductionReportServiceImp implements DailyProductionReportSer
...
@@ -175,6 +176,15 @@ public class DailyProductionReportServiceImp implements DailyProductionReportSer
//用于统计最后一行的日期综合统计性数据
//用于统计最后一行的日期综合统计性数据
Map
<
String
,
List
<
Map
>>
dateDataMap
=
processDataList
.
stream
().
collect
(
Collectors
.
groupingBy
(
map
->
(
String
)
map
.
get
(
"报工日期"
)));
Map
<
String
,
List
<
Map
>>
dateDataMap
=
processDataList
.
stream
().
collect
(
Collectors
.
groupingBy
(
map
->
(
String
)
map
.
get
(
"报工日期"
)));
HashMap
dateHashMap
=
new
HashMap
();
HashMap
dateHashMap
=
new
HashMap
();
dateHashMap
.
put
(
key
+
"统计合格数量"
,
new
Double
(
0
));
dateHashMap
.
put
(
key
+
"统计不合格数量"
,
new
Double
(
0
));
dateHashMap
.
put
(
key
+
"统计报工数量"
,
new
Double
(
0
));
for
(
Map
data
:
returnList
){
dateHashMap
.
put
(
key
+
"统计合格数量"
,
(
Double
)
dateHashMap
.
get
(
key
+
"统计合格数量"
)
+
(
Double
)
data
.
get
(
key
+
"统计合格数量"
));
dateHashMap
.
put
(
key
+
"统计不合格数量"
,
(
Double
)
dateHashMap
.
get
(
key
+
"统计不合格数量"
)
+
(
Double
)
data
.
get
(
key
+
"统计不合格数量"
));
dateHashMap
.
put
(
key
+
"统计报工数量"
,
(
Double
)
dateHashMap
.
get
(
key
+
"统计报工数量"
)
+
(
Double
)
data
.
get
(
key
+
"统计报工数量"
));
}
dateHashMap
.
put
(
key
+
"统计合格率"
,(
new
BigDecimal
((
Double
)
dateHashMap
.
get
(
key
+
"统计合格数量"
)).
multiply
(
new
BigDecimal
(
100
))).
divide
(
new
BigDecimal
((
Double
)
dateHashMap
.
get
(
key
+
"统计报工数量"
)),
2
,
RoundingMode
.
HALF_UP
));
returnList
.
add
(
dateHashMap
);
returnList
.
add
(
dateHashMap
);
for
(
String
date
:
dateList
){
for
(
String
date
:
dateList
){
HashMap
dateStatisticsHashMap
=
new
HashMap
();
HashMap
dateStatisticsHashMap
=
new
HashMap
();
...
@@ -192,8 +202,6 @@ public class DailyProductionReportServiceImp implements DailyProductionReportSer
...
@@ -192,8 +202,6 @@ public class DailyProductionReportServiceImp implements DailyProductionReportSer
if
(((
Double
)
dateStatisticsHashMap
.
get
(
"日期统计报工数量"
))
>
0
){
if
(((
Double
)
dateStatisticsHashMap
.
get
(
"日期统计报工数量"
))
>
0
){
dateStatisticsHashMap
.
put
(
"日期统计合格率"
,
dateStatisticsHashMap
.
put
(
"日期统计合格率"
,
new
BigDecimal
((
Double
)
dateStatisticsHashMap
.
get
(
"日期统计合格数量"
)).
multiply
(
new
BigDecimal
(
100
)).
divide
(
new
BigDecimal
((
Double
)
dateStatisticsHashMap
.
get
(
"日期统计报工数量"
)),
2
,
RoundingMode
.
HALF_UP
));
new
BigDecimal
((
Double
)
dateStatisticsHashMap
.
get
(
"日期统计合格数量"
)).
multiply
(
new
BigDecimal
(
100
)).
divide
(
new
BigDecimal
((
Double
)
dateStatisticsHashMap
.
get
(
"日期统计报工数量"
)),
2
,
RoundingMode
.
HALF_UP
));
}
else
{
}
else
{
dateStatisticsHashMap
.
put
(
"日期统计合格率"
,
BigDecimal
.
ZERO
);
dateStatisticsHashMap
.
put
(
"日期统计合格率"
,
BigDecimal
.
ZERO
);
...
@@ -264,56 +272,17 @@ public class DailyProductionReportServiceImp implements DailyProductionReportSer
...
@@ -264,56 +272,17 @@ public class DailyProductionReportServiceImp implements DailyProductionReportSer
r0i
.
setCellStyle
(
headerStyle
);
r0i
.
setCellStyle
(
headerStyle
);
//设置日期下的字段
//设置日期下的字段
XSSFCell
r1i
=
row1
.
createCell
(
i
);
XSSFCell
r1i
=
row1
.
createCell
(
i
);
r1i
.
setCellValue
(
"报工数量"
);
r1i
.
setCellValue
(
"
统计
报工数量"
);
r1i
.
setCellStyle
(
headerStyle
);
r1i
.
setCellStyle
(
headerStyle
);
XSSFCell
r1i1
=
row1
.
createCell
(
i
+
1
);
XSSFCell
r1i1
=
row1
.
createCell
(
i
+
1
);
r1i1
.
setCellValue
(
"合格数量"
);
r1i1
.
setCellValue
(
"
统计
合格数量"
);
r1i1
.
setCellStyle
(
headerStyle
);
r1i1
.
setCellStyle
(
headerStyle
);
XSSFCell
r1i2
=
row1
.
createCell
(
i
+
2
);
XSSFCell
r1i2
=
row1
.
createCell
(
i
+
2
);
r1i2
.
setCellValue
(
"不合格数量"
);
r1i2
.
setCellValue
(
"
统计
不合格数量"
);
r1i2
.
setCellStyle
(
headerStyle
);
r1i2
.
setCellStyle
(
headerStyle
);
XSSFCell
r1i3
=
row1
.
createCell
(
i
+
3
);
XSSFCell
r1i3
=
row1
.
createCell
(
i
+
3
);
r1i3
.
setCellValue
(
"合格率"
);
r1i3
.
setCellValue
(
"
统计
合格率"
);
r1i3
.
setCellStyle
(
headerStyle
);
r1i3
.
setCellStyle
(
headerStyle
);
for
(
int
t
=
0
;
t
<
returnList
.
size
()
;
t
++){
Map
rowData
=
returnList
.
get
(
t
);
XSSFRow
rt
=
sheet
.
createRow
(
2
+
t
);
if
(
rowData
!=
null
){
Map
dataMap
=
(
Map
)
rowData
.
get
(
date
);
if
(
dataMap
.
keySet
().
size
()
>
0
){
Double
feedback
=
(
Double
)
dataMap
.
get
(
"报工数量"
);
Double
unqualify
=
(
Double
)
dataMap
.
get
(
"不合格数量"
);
Double
qualify
=
(
Double
)
dataMap
.
get
(
"合格数量"
);
BigDecimal
fee
=
(
BigDecimal
)
dataMap
.
get
(
"合格率"
);
if
(
feedback
==
null
){
feedback
=
(
Double
)
dataMap
.
get
(
"日期统计报工数量"
);
unqualify
=
(
Double
)
dataMap
.
get
(
"日期统计不合格数量"
);
qualify
=
(
Double
)
dataMap
.
get
(
"日期统计合格数量"
);
fee
=
(
BigDecimal
)
dataMap
.
get
(
"日期统计合格率"
);
}
XSSFCell
ri
=
rt
.
createCell
(
i
);
ri
.
setCellValue
(
"a"
);
//ri.setCellStyle(contentStyle);
XSSFCell
ri1
=
rt
.
createCell
(
i
+
1
);
ri1
.
setCellValue
(
qualify
.
doubleValue
());
//ri1.setCellStyle(contentStyle);
XSSFCell
ri2
=
rt
.
createCell
(
i
+
2
);
ri2
.
setCellValue
(
unqualify
.
doubleValue
());
//ri2.setCellStyle(contentStyle);
XSSFCell
ri3
=
rt
.
createCell
(
i
+
3
);
ri3
.
setCellValue
(
fee
.
doubleValue
());
//ri3.setCellStyle(contentStyle);
}
XSSFCell
ri0
=
rt
.
createCell
(
0
);
ri0
.
setCellValue
((
String
)
rowData
.
get
(
code
));
XSSFCell
ri1
=
rt
.
createCell
(
1
);
ri1
.
setCellValue
((
String
)
rowData
.
get
(
name
));
XSSFCell
ri
=
rt
.
createCell
(
i
);
ri
.
setCellValue
(
"a"
);
}
}
i
=
i
+
4
;
i
=
i
+
4
;
//末尾累加统计
//末尾累加统计
if
(
dataList
.
size
()
==
x
){
if
(
dataList
.
size
()
==
x
){
...
@@ -334,13 +303,103 @@ public class DailyProductionReportServiceImp implements DailyProductionReportSer
...
@@ -334,13 +303,103 @@ public class DailyProductionReportServiceImp implements DailyProductionReportSer
r1i2Over
.
setCellValue
(
"不合格数量"
);
r1i2Over
.
setCellValue
(
"不合格数量"
);
r1i2Over
.
setCellStyle
(
headerStyle
);
r1i2Over
.
setCellStyle
(
headerStyle
);
XSSFCell
r1i3Over
=
row1
.
createCell
(
i
+
3
);
XSSFCell
r1i3Over
=
row1
.
createCell
(
i
+
3
);
r1i3Over
.
setCellValue
(
"合格率"
);
r1i3Over
.
setCellValue
(
"合格率
%
"
);
r1i3Over
.
setCellStyle
(
headerStyle
);
r1i3Over
.
setCellStyle
(
headerStyle
);
}
}
}
}
for
(
int
t
=
0
;
t
<
returnList
.
size
()
;
t
++){
Map
rowData
=
returnList
.
get
(
t
);
//处理头部两列
XSSFRow
rt
=
sheet
.
createRow
(
2
+
t
);
XSSFCell
ri0
=
rt
.
createCell
(
0
);
XSSFCell
ri1
=
rt
.
createCell
(
1
);
ri0
.
setCellStyle
(
contentStyle
);
ri1
.
setCellStyle
(
contentStyle
);
String
rowDataCode
=
(
String
)
rowData
.
get
(
code
);
if
(
StringUtils
.
isEmpty
(
rowDataCode
)){
ri0
.
setCellValue
(
"合计"
);
}
else
{
ri0
.
setCellValue
((
String
)
rowData
.
get
(
code
));
ri1
.
setCellValue
((
String
)
rowData
.
get
(
name
));
}
//处理尾部四列
XSSFCell
rtSize2
=
rt
.
createCell
((
dataList
.
size
()
*
4
)+
2
);
rtSize2
.
setCellValue
((
Double
)
rowData
.
get
(
key
+
"统计报工数量"
));
rtSize2
.
setCellStyle
(
contentStyle
);
XSSFCell
rtSize3
=
rt
.
createCell
((
dataList
.
size
()
*
4
)+
3
);
rtSize3
.
setCellValue
((
Double
)
rowData
.
get
(
key
+
"统计合格数量"
));
rtSize3
.
setCellStyle
(
contentStyle
);
XSSFCell
rtSize4
=
rt
.
createCell
((
dataList
.
size
()
*
4
)+
4
);
rtSize4
.
setCellValue
((
Double
)
rowData
.
get
(
key
+
"统计不合格数量"
));
rtSize4
.
setCellStyle
(
contentStyle
);
XSSFCell
rtSize5
=
rt
.
createCell
((
dataList
.
size
()
*
4
)+
5
);
rtSize5
.
setCellValue
(((
BigDecimal
)
rowData
.
get
(
key
+
"统计合格率"
)).
doubleValue
());
rtSize5
.
setCellStyle
(
contentStyle
);
//处理中间
for
(
int
size
=
0
;
size
<
dataList
.
size
()
;
size
++){
String
date
=
dataList
.
get
(
size
);
int
updateSize
=
updateSize
=
size
*
4
;
XSSFCell
rti2
=
rt
.
createCell
(
updateSize
+
2
);
rti2
.
setCellStyle
(
contentStyle
);
XSSFCell
rti3
=
rt
.
createCell
(
updateSize
+
3
);
rti3
.
setCellStyle
(
contentStyle
);
XSSFCell
rti4
=
rt
.
createCell
(
updateSize
+
4
);
rti4
.
setCellStyle
(
contentStyle
);
XSSFCell
rti5
=
rt
.
createCell
(
updateSize
+
5
);
rti5
.
setCellStyle
(
contentStyle
);
Map
dateData
=
(
Map
)
rowData
.
get
(
date
);
if
(
dateData
.
isEmpty
()){
rti2
.
setCellValue
(
0
);
rti3
.
setCellValue
(
0
);
rti4
.
setCellValue
(
0
);
rti5
.
setCellValue
(
0
);
}
else
{
//
Double
feedback
=
(
Double
)
dateData
.
get
(
"报工数量"
);
Double
unqualify
=
(
Double
)
dateData
.
get
(
"不合格数量"
);
Double
qualify
=
(
Double
)
dateData
.
get
(
"合格数量"
);
BigDecimal
fee
=
(
BigDecimal
)
dateData
.
get
(
"合格率"
);
if
(
feedback
==
null
){
feedback
=
(
Double
)
dateData
.
get
(
"日期统计报工数量"
);
unqualify
=
(
Double
)
dateData
.
get
(
"日期统计不合格数量"
);
qualify
=
(
Double
)
dateData
.
get
(
"日期统计合格数量"
);
fee
=
(
BigDecimal
)
dateData
.
get
(
"日期统计合格率"
);
}
rti2
.
setCellValue
(
feedback
);
rti3
.
setCellValue
(
qualify
);
rti4
.
setCellValue
(
unqualify
);
rti5
.
setCellValue
(
fee
.
doubleValue
());
}
}
// XSSFCell rti = rt.createCell(i);
// rti.setCellValue(i);
// rti.setCellStyle(contentStyle);
// XSSFCell rti1 = rt.createCell(i+1);
// rti1.setCellValue(i+1);
// rti1.setCellStyle(contentStyle);
// XSSFCell rti2 = rt.createCell(i+2);
// rti2.setCellValue(i+2);
// rti2.setCellStyle(contentStyle);
// XSSFCell rti3 = rt.createCell(i+3);
// rti3.setCellValue(i+3);
// rti3.setCellStyle(contentStyle);
}
}
}
buildExcelDocument
(
filename
+
".xlsx"
,
wb
,
response
);
buildExcelDocument
(
filename
+
".xlsx"
,
wb
,
response
);
}
}
/**
/**
...
...
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