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
5c639228
Commit
5c639228
authored
Dec 11, 2024
by
温志超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新报表
parent
ccb3425e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
334 additions
and
32 deletions
+334
-32
MonthlyProductionReportController.java
.../report/controller/MonthlyProductionReportController.java
+16
-16
WeeklyProductionReportController.java
...s/report/controller/WeeklyProductionReportController.java
+62
-0
WeeklyProductionReportMapper.java
...ximai/mes/report/mapper/WeeklyProductionReportMapper.java
+14
-0
MonthlyProductionReportRequest.java
...ai/mes/report/request/MonthlyProductionReportRequest.java
+1
-1
WeeklyProductionReportRequest.java
...mai/mes/report/request/WeeklyProductionReportRequest.java
+65
-0
WeeklyProductionReportService.java
...mai/mes/report/service/WeeklyProductionReportService.java
+13
-0
WeeklyProductionReportServiceImp.java
...report/service/impl/WeeklyProductionReportServiceImp.java
+148
-0
WeeklyProductionReportMapper.xml
.../resources/mapper/report/WeeklyProductionReportMapper.xml
+15
-15
No files found.
mes/src/main/java/com/ximai/mes/report/controller/MonthlyProductionReportController.java
View file @
5c639228
...
@@ -35,39 +35,39 @@ public class MonthlyProductionReportController {
...
@@ -35,39 +35,39 @@ public class MonthlyProductionReportController {
@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
)
@GetMapping
(
"/getListByWorkshop"
)
@GetMapping
(
"/getListByWorkshop"
)
public
AjaxResult
<
List
>
getListByWorkshop
(
MonthlyProductionReportRequest
dai
lyProductionReportRequest
)
{
public
AjaxResult
<
List
>
getListByWorkshop
(
MonthlyProductionReportRequest
month
lyProductionReportRequest
)
{
List
data
=
monthlyProductionReportService
.
getListByWorkshop
(
dai
lyProductionReportRequest
);
List
data
=
monthlyProductionReportService
.
getListByWorkshop
(
month
lyProductionReportRequest
);
return
AjaxResult
.
success
(
data
);
return
AjaxResult
.
success
(
data
);
}
}
@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
)
@GetMapping
(
"/getListByWorkstation"
)
@GetMapping
(
"/getListByWorkstation"
)
public
AjaxResult
<
List
>
getListByWorkstation
(
MonthlyProductionReportRequest
dai
lyProductionReportRequest
)
{
public
AjaxResult
<
List
>
getListByWorkstation
(
MonthlyProductionReportRequest
month
lyProductionReportRequest
)
{
List
data
=
monthlyProductionReportService
.
getListByWorkstation
(
dai
lyProductionReportRequest
);
List
data
=
monthlyProductionReportService
.
getListByWorkstation
(
month
lyProductionReportRequest
);
return
AjaxResult
.
success
(
data
);
return
AjaxResult
.
success
(
data
);
}
}
@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
)
@GetMapping
(
"/getListByWorkunit"
)
@GetMapping
(
"/getListByWorkunit"
)
public
AjaxResult
<
List
>
getListByWorkunit
(
MonthlyProductionReportRequest
dai
lyProductionReportRequest
)
{
public
AjaxResult
<
List
>
getListByWorkunit
(
MonthlyProductionReportRequest
month
lyProductionReportRequest
)
{
List
data
=
monthlyProductionReportService
.
getListByWorkunit
(
dai
lyProductionReportRequest
);
List
data
=
monthlyProductionReportService
.
getListByWorkunit
(
month
lyProductionReportRequest
);
return
AjaxResult
.
success
(
data
);
return
AjaxResult
.
success
(
data
);
}
}
@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
)
@GetMapping
(
"/getListByUser"
)
@GetMapping
(
"/getListByUser"
)
public
AjaxResult
<
List
>
getListByUser
(
MonthlyProductionReportRequest
dai
lyProductionReportRequest
)
{
public
AjaxResult
<
List
>
getListByUser
(
MonthlyProductionReportRequest
month
lyProductionReportRequest
)
{
List
data
=
monthlyProductionReportService
.
getListByUser
(
dai
lyProductionReportRequest
);
List
data
=
monthlyProductionReportService
.
getListByUser
(
month
lyProductionReportRequest
);
return
AjaxResult
.
success
(
data
);
return
AjaxResult
.
success
(
data
);
}
}
...
...
mes/src/main/java/com/ximai/mes/report/controller/WeeklyProductionReportController.java
View file @
5c639228
package
com
.
ximai
.
mes
.
report
.
controller
;
package
com
.
ximai
.
mes
.
report
.
controller
;
import
com.ximai.common.annotation.Log
;
import
com.ximai.common.core.domain.AjaxResult
;
import
com.ximai.common.enums.BusinessType
;
import
com.ximai.mes.report.request.WeeklyProductionReportRequest
;
import
com.ximai.mes.report.service.MonthlyProductionReportService
;
import
com.ximai.mes.report.service.WeeklyProductionReportService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
@Api
(
"周产能对比统计"
)
@Api
(
"周产能对比统计"
)
@RestController
@RestController
@RequestMapping
(
"/weeklyProductionReport"
)
@RequestMapping
(
"/weeklyProductionReport"
)
public
class
WeeklyProductionReportController
{
public
class
WeeklyProductionReportController
{
@Autowired
WeeklyProductionReportService
weeklyProductionReportService
;
@ApiOperation
(
"周产能对比统计:统计方式工序"
)
@PreAuthorize
(
"@ss.hasPermi('mes:pro:dailyProductionReport:get')"
)
@Log
(
title
=
"周产能对比统计:统计方式工序"
,
businessType
=
BusinessType
.
QUERY
)
@GetMapping
(
"/getListByProcess"
)
public
AjaxResult
<
List
>
getListByProcess
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
)
{
List
data
=
weeklyProductionReportService
.
getListByProcess
(
weeklyProductionReportRequest
);
return
AjaxResult
.
success
(
data
);
}
@ApiOperation
(
"周产能对比统计:统计方式车间"
)
@PreAuthorize
(
"@ss.hasPermi('mes:pro:dailyProductionReport:get')"
)
@Log
(
title
=
"周产能对比统计:统计方式车间"
,
businessType
=
BusinessType
.
QUERY
)
@GetMapping
(
"/getListByWorkshop"
)
public
AjaxResult
<
List
>
getListByWorkshop
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
)
{
List
data
=
weeklyProductionReportService
.
getListByWorkshop
(
weeklyProductionReportRequest
);
return
AjaxResult
.
success
(
data
);
}
@ApiOperation
(
"周产能对比统计:统计方式工作中心"
)
@PreAuthorize
(
"@ss.hasPermi('mes:pro:dailyProductionReport:get')"
)
@Log
(
title
=
"周产能对比统计:统计方式工作中心"
,
businessType
=
BusinessType
.
QUERY
)
@GetMapping
(
"/getListByWorkstation"
)
public
AjaxResult
<
List
>
getListByWorkstation
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
)
{
List
data
=
weeklyProductionReportService
.
getListByWorkstation
(
weeklyProductionReportRequest
);
return
AjaxResult
.
success
(
data
);
}
@ApiOperation
(
"周产能对比统计:统计方式工作单元"
)
@PreAuthorize
(
"@ss.hasPermi('mes:pro:dailyProductionReport:get')"
)
@Log
(
title
=
"周产能对比统计:统计方式工作单元"
,
businessType
=
BusinessType
.
QUERY
)
@GetMapping
(
"/getListByWorkunit"
)
public
AjaxResult
<
List
>
getListByWorkunit
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
)
{
List
data
=
weeklyProductionReportService
.
getListByWorkunit
(
weeklyProductionReportRequest
);
return
AjaxResult
.
success
(
data
);
}
@ApiOperation
(
"周产能对比统计:统计方式报工人员"
)
@PreAuthorize
(
"@ss.hasPermi('mes:pro:dailyProductionReport:get')"
)
@Log
(
title
=
"周产能对比统计:统计方式报工人员"
,
businessType
=
BusinessType
.
QUERY
)
@GetMapping
(
"/getListByUser"
)
public
AjaxResult
<
List
>
getListByUser
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
)
{
List
data
=
weeklyProductionReportService
.
getListByUser
(
weeklyProductionReportRequest
);
return
AjaxResult
.
success
(
data
);
}
}
}
mes/src/main/java/com/ximai/mes/report/mapper/WeeklyProductionReportMapper.java
View file @
5c639228
package
com
.
ximai
.
mes
.
report
.
mapper
;
package
com
.
ximai
.
mes
.
report
.
mapper
;
import
com.ximai.mes.report.request.WeeklyProductionReportRequest
;
import
java.util.List
;
import
java.util.Map
;
public
interface
WeeklyProductionReportMapper
{
public
interface
WeeklyProductionReportMapper
{
List
<
Map
>
getListByProcess
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
);
List
<
Map
>
getListByWorkshop
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
);
List
<
Map
>
getListByWorkstation
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
);
List
<
Map
>
getListByWorkunit
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
);
List
<
Map
>
getListByUser
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
);
}
}
mes/src/main/java/com/ximai/mes/report/request/MonthlyProductionReportRequest.java
View file @
5c639228
...
@@ -7,7 +7,7 @@ import lombok.Data;
...
@@ -7,7 +7,7 @@ import lombok.Data;
import
java.util.Date
;
import
java.util.Date
;
@Data
@Data
public
class
MonthlyProductionReportRequest
{
public
class
MonthlyProductionReportRequest
{
@ApiModelProperty
(
"年份"
)
@ApiModelProperty
(
"年份
比如: 2024
"
)
private
String
dateYear
;
private
String
dateYear
;
/**
/**
...
...
mes/src/main/java/com/ximai/mes/report/request/WeeklyProductionReportRequest.java
View file @
5c639228
package
com
.
ximai
.
mes
.
report
.
request
;
package
com
.
ximai
.
mes
.
report
.
request
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
@Data
@Data
public
class
WeeklyProductionReportRequest
{
public
class
WeeklyProductionReportRequest
{
@ApiModelProperty
(
"年月份 比如:2024-01"
)
private
String
dateWeekly
;
/**
* 工序ID
*/
@ApiModelProperty
(
"工序ID"
)
private
Long
processId
;
/**
* 工序编码
*/
@ApiModelProperty
(
"工序编码"
)
private
String
processCode
;
/**
* 工序编码
*/
@ApiModelProperty
(
"工序名称"
)
private
String
processName
;
/**
* 车间ID
*/
@ApiModelProperty
(
"车间ID"
)
private
Long
workshopId
;
@ApiModelProperty
(
"车间名称"
)
private
String
workshopName
;
/**
* 工作中心ID
*/
@ApiModelProperty
(
"工作中心ID"
)
private
Long
workstationId
;
/**
* 工作中心名称
*/
@ApiModelProperty
(
"工作中心名称"
)
private
String
workstationName
;
/**
*
*/
@ApiModelProperty
(
"工作单元ID"
)
private
Long
workunitId
;
@ApiModelProperty
(
"作业单元名称"
)
private
String
workunitName
;
@ApiModelProperty
(
"报工人员名称"
)
private
String
userName
;
@ApiModelProperty
(
"报工人员昵称"
)
private
String
nickName
;
}
}
mes/src/main/java/com/ximai/mes/report/service/WeeklyProductionReportService.java
View file @
5c639228
package
com
.
ximai
.
mes
.
report
.
service
;
package
com
.
ximai
.
mes
.
report
.
service
;
import
com.ximai.mes.report.request.WeeklyProductionReportRequest
;
import
java.util.List
;
public
interface
WeeklyProductionReportService
{
public
interface
WeeklyProductionReportService
{
List
getListByProcess
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
);
List
getListByWorkshop
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
);
List
getListByWorkstation
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
);
List
getListByWorkunit
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
);
List
getListByUser
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
);
}
}
mes/src/main/java/com/ximai/mes/report/service/impl/WeeklyProductionReportServiceImp.java
View file @
5c639228
package
com
.
ximai
.
mes
.
report
.
service
.
impl
;
package
com
.
ximai
.
mes
.
report
.
service
.
impl
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
com.ximai.common.utils.data.ExceptionUtil
;
import
com.ximai.mes.report.mapper.MonthlyProductionReportMapper
;
import
com.ximai.mes.report.mapper.WeeklyProductionReportMapper
;
import
com.ximai.mes.report.request.WeeklyProductionReportRequest
;
import
com.ximai.mes.report.service.WeeklyProductionReportService
;
import
com.ximai.mes.report.service.WeeklyProductionReportService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.temporal.TemporalAdjusters
;
import
java.util.*
;
@Service
public
class
WeeklyProductionReportServiceImp
implements
WeeklyProductionReportService
{
public
class
WeeklyProductionReportServiceImp
implements
WeeklyProductionReportService
{
// private List<String> dateList =new ArrayList<String>(
// Arrays.asList( "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"));
@Autowired
DailyProductionReportServiceImp
dailyProductionReportServiceImp
;
@Autowired
WeeklyProductionReportMapper
weeklyProductionReportMapper
;
@Override
public
List
getListByProcess
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
)
{
ExceptionUtil
.
checkTrueThrowException
(
weeklyProductionReportRequest
.
getDateWeekly
()
==
null
,
"请传入年月份"
);
List
<
Map
>
processDataList
=
weeklyProductionReportMapper
.
getListByProcess
(
weeklyProductionReportRequest
);
List
<
String
>
dateList
=
getWeeks
(
new
Integer
(
weeklyProductionReportRequest
.
getDateWeekly
().
split
(
"-"
)[
0
]),
new
Integer
(
weeklyProductionReportRequest
.
getDateWeekly
().
split
(
"-"
)[
1
]));
List
<
Map
>
returnList
=
dailyProductionReportServiceImp
.
groupList
(
processDataList
,
"工序名称"
,
"工序编码"
,
"工序"
,
dateList
);
return
returnList
;
}
@Override
public
List
getListByWorkshop
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
)
{
ExceptionUtil
.
checkTrueThrowException
(
weeklyProductionReportRequest
.
getDateWeekly
()
==
null
,
"请传入年月份"
);
List
<
Map
>
processDataList
=
weeklyProductionReportMapper
.
getListByWorkshop
(
weeklyProductionReportRequest
);
List
<
String
>
dateList
=
getWeeks
(
new
Integer
(
weeklyProductionReportRequest
.
getDateWeekly
().
split
(
"-"
)[
0
]),
new
Integer
(
weeklyProductionReportRequest
.
getDateWeekly
().
split
(
"-"
)[
1
]));
List
<
Map
>
returnList
=
dailyProductionReportServiceImp
.
groupList
(
processDataList
,
"车间名称"
,
"车间编码"
,
"车间"
,
dateList
);
return
returnList
;
}
@Override
public
List
getListByWorkstation
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
)
{
ExceptionUtil
.
checkTrueThrowException
(
weeklyProductionReportRequest
.
getDateWeekly
()
==
null
,
"请传入年月份"
);
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
List
<
Map
>
processDataList
=
weeklyProductionReportMapper
.
getListByWorkstation
(
weeklyProductionReportRequest
);
List
<
String
>
dateList
=
getWeeks
(
new
Integer
(
weeklyProductionReportRequest
.
getDateWeekly
().
split
(
"-"
)[
0
]),
new
Integer
(
weeklyProductionReportRequest
.
getDateWeekly
().
split
(
"-"
)[
1
]));
List
<
Map
>
returnList
=
dailyProductionReportServiceImp
.
groupList
(
processDataList
,
"工作中心名称"
,
"工作中心编码"
,
"工作中心"
,
dateList
);
return
returnList
;
}
@Override
public
List
getListByWorkunit
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
)
{
ExceptionUtil
.
checkTrueThrowException
(
weeklyProductionReportRequest
.
getDateWeekly
()
==
null
,
"请传入年月份"
);
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
List
<
Map
>
processDataList
=
weeklyProductionReportMapper
.
getListByWorkunit
(
weeklyProductionReportRequest
);
List
<
String
>
dateList
=
getWeeks
(
new
Integer
(
weeklyProductionReportRequest
.
getDateWeekly
().
split
(
"-"
)[
0
]),
new
Integer
(
weeklyProductionReportRequest
.
getDateWeekly
().
split
(
"-"
)[
1
]));
List
<
Map
>
returnList
=
dailyProductionReportServiceImp
.
groupList
(
processDataList
,
"工作单元名称"
,
"工作单元编码"
,
"工作单元"
,
dateList
);
return
returnList
;
}
@Override
public
List
getListByUser
(
WeeklyProductionReportRequest
weeklyProductionReportRequest
)
{
ExceptionUtil
.
checkTrueThrowException
(
weeklyProductionReportRequest
.
getDateWeekly
()
==
null
,
"请传入年月份"
);
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
List
<
Map
>
processDataList
=
weeklyProductionReportMapper
.
getListByUser
(
weeklyProductionReportRequest
);
List
<
String
>
dateList
=
getWeeks
(
new
Integer
(
weeklyProductionReportRequest
.
getDateWeekly
().
split
(
"-"
)[
0
]),
new
Integer
(
weeklyProductionReportRequest
.
getDateWeekly
().
split
(
"-"
)[
1
]));
List
<
Map
>
returnList
=
dailyProductionReportServiceImp
.
groupList
(
processDataList
,
"报工人员名称"
,
"报工人员编码"
,
"报工人员"
,
dateList
);
return
returnList
;
}
public
static
List
<
String
>
getWeeksInMonth
(
String
dateWeekly
)
{
dateWeekly
=
dateWeekly
+
"-01"
;
LocalDate
date
=
LocalDate
.
parse
(
dateWeekly
);
LocalDate
firstDayOfMonth
=
date
.
with
(
TemporalAdjusters
.
firstDayOfMonth
());
LocalDate
firstDayOfNextMonth
=
date
.
with
(
TemporalAdjusters
.
firstDayOfNextMonth
());
LocalDate
lastDayOfMonth
=
firstDayOfNextMonth
.
minusDays
(
1
);
// 如果月份的第一个星期一之前有足够的天数构成一周,则总周数加一
if
(
firstDayOfMonth
.
getDayOfWeek
().
getValue
()
<=
firstDayOfMonth
.
getDayOfMonth
())
{
List
<
String
>
data
=
new
ArrayList
<>();
int
x
=
(
int
)
((
lastDayOfMonth
.
getDayOfMonth
()
-
firstDayOfMonth
.
getDayOfMonth
())
/
7
)
+
1
;
for
(
int
i
=
1
;
i
<=
x
;
i
++){
data
.
add
(
""
+
i
);
}
return
data
;
}
else
{
int
x
=
(
int
)
((
lastDayOfMonth
.
getDayOfMonth
()
-
firstDayOfMonth
.
getDayOfMonth
())
/
7
);
List
<
String
>
data
=
new
ArrayList
<>();
for
(
int
i
=
1
;
i
<=
x
;
i
++){
data
.
add
(
""
+
i
);
}
return
data
;
}
}
private
List
<
String
>
getWeeks
(
Integer
year
,
Integer
month
)
{
//天数
Calendar
c
=
Calendar
.
getInstance
();
c
.
set
(
Calendar
.
YEAR
,
year
);
c
.
set
(
Calendar
.
MONTH
,
month
-
1
);
System
.
out
.
println
(
"天数:"
+
c
.
getActualMaximum
(
Calendar
.
DAY_OF_MONTH
));
int
days
=
c
.
getActualMaximum
(
Calendar
.
DAY_OF_MONTH
);
//月起止时间
DateTime
startTime
=
null
;
try
{
startTime
=
DateUtil
.
beginOfMonth
(
new
SimpleDateFormat
(
"yyyy-MM"
).
parse
(
year
+
"-"
+
month
));
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
int
i
=
DateUtil
.
dayOfWeek
(
startTime
);
int
firstWeek
=
0
;
switch
(
i
){
case
1
:
firstWeek
=
1
;
break
;
case
2
:
firstWeek
=
7
;
break
;
case
3
:
firstWeek
=
6
;
break
;
case
4
:
firstWeek
=
5
;
break
;
case
5
:
firstWeek
=
4
;
break
;
case
6
:
firstWeek
=
3
;
break
;
case
7
:
firstWeek
=
2
;
break
;
}
int
remainingDays
=
days
-
firstWeek
;
int
weeks
=
(
int
)
Math
.
ceil
((
double
)
remainingDays
/
7
)
+
1
;
List
<
String
>
data
=
new
ArrayList
<>();
for
(
int
x
=
1
;
x
<=
weeks
;
x
++){
data
.
add
(
""
+
x
);
}
return
data
;
}
}
}
mes/src/main/resources/mapper/report/WeeklyProductionReportMapper.xml
View file @
5c639228
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
SELECT
SELECT
process.process_code AS "工序编码",
process.process_code AS "工序编码",
process.process_name AS "工序名称",
process.process_name AS "工序名称",
DATE_FORMAT( f.feedback_time, '%m'
) AS "报工日期",
CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR
) AS "报工日期",
sum( f.quantity ) AS quantity,
sum( f.quantity ) AS quantity,
sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_unqualify ) AS '不合格数量',
sum( f.quantity_unqualify ) AS '不合格数量',
...
@@ -20,18 +20,18 @@
...
@@ -20,18 +20,18 @@
<where>
<where>
<if
test=
" processId != null "
>
and process.process_id = #{processId}
</if>
<if
test=
" processId != null "
>
and process.process_id = #{processId}
</if>
<if
test=
" processName != null and processName != '' "
>
and process.process_name like '%${processName}%'
</if>
<if
test=
" processName != null and processName != '' "
>
and process.process_name like '%${processName}%'
</if>
<if
test=
"date
Year != null"
>
and DATE_FORMAT(f.feedback_time, '%Y') = #{dateYear
}
</if>
<if
test=
"date
Weekly != null"
>
and DATE_FORMAT(f.feedback_time, '%Y-%m') = #{dateWeekly
}
</if>
</where>
</where>
GROUP BY
GROUP BY
process.process_code,
process.process_code,
process.process_name,
process.process_name,
DATE_FORMAT( f.feedback_time, '%m'
)
CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR
)
</select>
</select>
<select
id=
"getListByWorkshop"
resultType=
"java.util.Map"
>
<select
id=
"getListByWorkshop"
resultType=
"java.util.Map"
>
SELECT
SELECT
workstation.workshop_code as '车间编码',
workstation.workshop_code as '车间编码',
workstation.workshop_name as '车间名称',
workstation.workshop_name as '车间名称',
DATE_FORMAT( f.feedback_time, '%m' )
AS "报工日期",
CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR)
AS "报工日期",
sum( f.quantity ) AS quantity,
sum( f.quantity ) AS quantity,
sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_unqualify ) AS '不合格数量',
sum( f.quantity_unqualify ) AS '不合格数量',
...
@@ -48,18 +48,18 @@
...
@@ -48,18 +48,18 @@
<where>
<where>
<if
test=
" workshopId != null"
>
and workstation.workshop_Id = #{workshopId}
</if>
<if
test=
" workshopId != null"
>
and workstation.workshop_Id = #{workshopId}
</if>
<if
test=
" workshopName != null and workshopName != '' "
>
and workstation.workshop_name like '%${workshopName}%'
</if>
<if
test=
" workshopName != null and workshopName != '' "
>
and workstation.workshop_name like '%${workshopName}%'
</if>
<if
test=
"date
Year != null"
>
and DATE_FORMAT(f.feedback_time, '%Y') = #{dateYear
}
</if>
<if
test=
"date
Weekly != null"
>
and DATE_FORMAT(f.feedback_time, '%Y-%m') = #{dateWeekly
}
</if>
</where>
</where>
group by
group by
workstation.workshop_code,
workstation.workshop_code,
workstation.workshop_name,
workstation.workshop_name,
DATE_FORMAT( f.feedback_time, '%m'
)
CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR
)
</select>
</select>
<select
id=
"getListByWorkstation"
resultType=
"java.util.Map"
>
<select
id=
"getListByWorkstation"
resultType=
"java.util.Map"
>
SELECT
SELECT
workstation.workstation_code AS "工作中心编码",
workstation.workstation_code AS "工作中心编码",
workstation.workstation_name AS "工作中心名称",
workstation.workstation_name AS "工作中心名称",
DATE_FORMAT( f.feedback_time, '%m' )
AS "报工日期",
CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR)
AS "报工日期",
sum( f.quantity ) AS quantity,
sum( f.quantity ) AS quantity,
sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_unqualify ) AS '不合格数量',
sum( f.quantity_unqualify ) AS '不合格数量',
...
@@ -76,18 +76,18 @@
...
@@ -76,18 +76,18 @@
<where>
<where>
<if
test=
" workstationId != null"
>
and workstation.workstation_id = #{workstationId}
</if>
<if
test=
" workstationId != null"
>
and workstation.workstation_id = #{workstationId}
</if>
<if
test=
" workstationName != null and workstationName != '' "
>
and workstation.workstation_name like '%${workstationName}%'
</if>
<if
test=
" workstationName != null and workstationName != '' "
>
and workstation.workstation_name like '%${workstationName}%'
</if>
<if
test=
"date
Year != null"
>
and DATE_FORMAT(f.feedback_time, '%Y') = #{dateYear
}
</if>
<if
test=
"date
Weekly != null"
>
and DATE_FORMAT(f.feedback_time, '%Y-%m') = #{dateWeekly
}
</if>
</where>
</where>
group by
group by
workstation.workstation_code,
workstation.workstation_code,
workstation.workstation_name,
workstation.workstation_name,
DATE_FORMAT( f.feedback_time, '%m'
)
CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR
)
</select>
</select>
<select
id=
"getListByWorkunit"
resultType=
"java.util.Map"
>
<select
id=
"getListByWorkunit"
resultType=
"java.util.Map"
>
SELECT
SELECT
mw.workunit_code AS "工作单元编码",
mw.workunit_code AS "工作单元编码",
mw.workunit_name AS "工作单元名称",
mw.workunit_name AS "工作单元名称",
DATE_FORMAT( f.feedback_time, '%m' )
AS "报工日期",
CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR)
AS "报工日期",
sum( f.quantity ) AS quantity,
sum( f.quantity ) AS quantity,
sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_unqualify ) AS '不合格数量',
sum( f.quantity_unqualify ) AS '不合格数量',
...
@@ -104,18 +104,18 @@
...
@@ -104,18 +104,18 @@
<where>
<where>
<if
test=
" workunitId != null"
>
and workunit.workunit_id = #{workunitId}
</if>
<if
test=
" workunitId != null"
>
and workunit.workunit_id = #{workunitId}
</if>
<if
test=
" workunitName != null and workunitName != '' "
>
and mw.workunit_name like '%${workunitName}%'
</if>
<if
test=
" workunitName != null and workunitName != '' "
>
and mw.workunit_name like '%${workunitName}%'
</if>
<if
test=
"date
Year != null"
>
and DATE_FORMAT(f.feedback_time, '%Y') = #{dateYear
}
</if>
<if
test=
"date
Weekly != null"
>
and DATE_FORMAT(f.feedback_time, '%Y-%m') = #{dateWeekly
}
</if>
</where>
</where>
group by
group by
mw.workunit_code,
mw.workunit_code,
mw.workunit_name,
mw.workunit_name,
DATE_FORMAT( f.feedback_time, '%m'
)
CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR
)
</select>
</select>
<select
id=
"getListByUser"
resultType=
"java.util.Map"
>
<select
id=
"getListByUser"
resultType=
"java.util.Map"
>
SELECT
SELECT
IFNULL(f.user_name,'无') AS "报工人员编码",
IFNULL(f.user_name,'无') AS "报工人员编码",
f.nick_name AS "报工人员名称",
f.nick_name AS "报工人员名称",
DATE_FORMAT( f.feedback_time, '%m' )
AS "报工日期",
CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR)
AS "报工日期",
sum( f.quantity ) AS quantity,
sum( f.quantity ) AS quantity,
sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_qualify ) AS '合格数量',
sum( f.quantity_unqualify ) AS '不合格数量',
sum( f.quantity_unqualify ) AS '不合格数量',
...
@@ -132,11 +132,11 @@
...
@@ -132,11 +132,11 @@
<where>
<where>
<if
test=
"userName != null and userName != ''"
>
and f.user_name like concat('%', #{userName}, '%')
</if>
<if
test=
"userName != null and userName != ''"
>
and f.user_name like concat('%', #{userName}, '%')
</if>
<if
test=
" nickName != null and nickName != '' "
>
and f.nick_Name like '%${nickName}%'
</if>
<if
test=
" nickName != null and nickName != '' "
>
and f.nick_Name like '%${nickName}%'
</if>
<if
test=
"date
Year != null"
>
and DATE_FORMAT(f.feedback_time, '%Y') = #{dateYear
}
</if>
<if
test=
"date
Weekly != null"
>
and DATE_FORMAT(f.feedback_time, '%Y-%m') = #{dateWeekly
}
</if>
</where>
</where>
group by
group by
IFNULL(f.user_name,'无'),
IFNULL(f.user_name,'无'),
f.nick_name,
f.nick_name,
DATE_FORMAT( f.feedback_time, '%m'
)
CAST( WEEK ( f.feedback_time, 1 ) - WEEK ( DATE_FORMAT( f.feedback_time, '%Y-%m-01' ), 1 ) + 1 AS CHAR
)
</select>
</select>
</mapper>
</mapper>
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