Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit a848ba6a
由
LN
编写于
2023-03-13 16:19:10 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1053: 1.TrayLog, Utilization,ErrorLog增加导出功能。2.状态页面增加横移和移栽状态。
1 个父辈
d8117b5d
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
189 行增加
和
9 行删除
src/main/java/com/neotel/smfcore/common/utils/FileUtil.java
src/main/java/com/neotel/smfcore/core/materialLog/rest/MaterialLogController.java
src/main/java/com/neotel/smfcore/custom/micron1053/controller/MicronReportController.java
src/main/java/com/neotel/smfcore/custom/micron1053/controller/MicronStatusController.java
src/main/java/com/neotel/smfcore/common/utils/FileUtil.java
查看文件 @
a848ba6
...
...
@@ -260,6 +260,9 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
}
excelWriter
.
write
(
data
,
writeSheet
);
page
=
page
.
next
();
if
(
pageable
==
null
){
break
;
}
}
}
}
...
...
src/main/java/com/neotel/smfcore/core/materialLog/rest/MaterialLogController.java
查看文件 @
a848ba6
package
com
.
neotel
.
smfcore
.
core
.
materialLog
.
rest
;
import
com.google.common.collect.Lists
;
import
com.neotel.smfcore.common.base.IExcelDownLoad
;
import
com.neotel.smfcore.common.bean.PageData
;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.core.materialLog.rest.dto.MaterialLogDto
;
import
com.neotel.smfcore.core.materialLog.rest.mapstruct.MaterialLogMapper
;
import
com.neotel.smfcore.core.materialLog.rest.query.MaterialLogCriteria
;
import
com.neotel.smfcore.core.materialLog.service.manager.IMaterialLogManager
;
import
com.neotel.smfcore.core.materialLog.service.po.MaterialLog
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -17,7 +22,14 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Locale
;
@Slf4j
@Api
(
tags
=
"1053:料盘日志"
)
...
...
@@ -41,4 +53,54 @@ public class MaterialLogController {
List
<
MaterialLogDto
>
logDtos
=
materialLogMapper
.
toDto
(
pages
.
getContent
());
return
new
PageData
(
logDtos
,
pages
.
getTotalElements
());
}
@ApiOperation
(
"料盘日志导出"
)
@RequestMapping
(
"/download"
)
@AnonymousAccess
public
void
download
(
MaterialLogCriteria
criteria
,
Pageable
pageable
,
HttpServletRequest
servletRequest
,
HttpServletResponse
response
)
throws
IOException
{
Locale
locale
=
servletRequest
.
getLocale
();
log
.
info
(
"开始导出 ErrorLog "
);
Query
query
=
QueryHelp
.
getQuery
(
criteria
);
FileUtil
.
downloadExcel
(
query
,
pageable
,
response
,
new
IExcelDownLoad
()
{
@Override
public
List
<
List
<
String
>>
getHeader
()
{
List
<
List
<
String
>>
header
=
new
ArrayList
<>();
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getSmfClientMsg
(
"smfclient.trayLog.barcode"
,
locale
,
"条码编号"
)));
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getSmfClientMsg
(
"smfclient.trayLog.posname"
,
locale
,
"库位号"
)));
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getSmfClientMsg
(
"smfclient.trayLog.state"
,
locale
,
"状态"
)));
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getSmfClientMsg
(
"smfclient.trayLog.type"
,
locale
,
"类型"
)));
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getSmfClientMsg
(
"smfclient.trayLog.poMsg"
,
locale
,
"位置信息"
)));
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getSmfClientMsg
(
"smfclient.utilization.updateTime"
,
locale
,
"更新时间"
)));
return
header
;
}
@Override
public
List
<
List
<
Object
>>
getPageData
(
Query
query
,
Pageable
pageable
)
{
List
<
List
<
Object
>>
dataList
=
new
ArrayList
<>();
PageData
<
MaterialLog
>
pages
=
materialLogManager
.
findByPage
(
query
,
pageable
);
DateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
for
(
MaterialLog
msg
:
pages
.
getContent
())
{
String
updateTime
=
dateFormat
.
format
(
msg
.
getUpdateDate
());
List
<
Object
>
data
=
new
ArrayList
<>();
data
.
add
(
msg
.
getBarcode
());
data
.
add
(
msg
.
getPosName
());
data
.
add
(
msg
.
getStatus
());
String
inoutType
=
MessageUtils
.
getSmfClientMsg
(
"smfclient.NeoLight.logType.2"
,
locale
,
"出库"
);
if
(
msg
.
getType
()==
1
){
inoutType
=
MessageUtils
.
getSmfClientMsg
(
"smfclient.NeoLight.logType.1"
,
locale
,
"入库"
);
}
data
.
add
(
inoutType
);
data
.
add
(
msg
.
getLocInfo
());
data
.
add
(
updateTime
);
dataList
.
add
(
data
);
}
return
dataList
;
}
});
log
.
info
(
"ErrorLog 导出完成"
);
}
}
src/main/java/com/neotel/smfcore/custom/micron1053/controller/MicronReportController.java
查看文件 @
a848ba6
package
com
.
neotel
.
smfcore
.
custom
.
micron1053
.
controller
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.google.common.collect.Lists
;
import
com.neotel.smfcore.common.base.IExcelDownLoad
;
import
com.neotel.smfcore.common.bean.PageData
;
import
com.neotel.smfcore.common.init.DataInitManager
;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.util.DataCache
;
...
...
@@ -30,9 +33,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
@Slf4j
@Api
(
tags
=
"1053:报表 trayLog, utilization,errorLog, errorReport, eventLog"
)
...
...
@@ -50,7 +55,10 @@ public class MicronReportController {
@GetMapping
(
"/utilization"
)
@AnonymousAccess
public
List
<
DeviceUtilizationDto
>
utilization
(
HttpServletRequest
servletRequest
)
{
return
getUtilizationList
(
servletRequest
.
getLocale
());
}
private
List
<
DeviceUtilizationDto
>
getUtilizationList
(
Locale
locale
)
{
List
<
DeviceUtilizationDto
>
dtos
=
new
ArrayList
<>();
//获取所有料仓状态
...
...
@@ -72,19 +80,69 @@ public class MicronReportController {
StatusBean
bean
=
DevicesStatusUtil
.
getStatusBean
(
storage
.
getCid
());
if
(
bean
==
null
)
{
//从软件启动开始离线
String
msg
=
MessageUtils
.
getText
(
"smfcore.messages.offline"
,
servletRequest
.
getLocale
()
,
"设备离线"
);
String
msg
=
MessageUtils
.
getText
(
"smfcore.messages.offline"
,
locale
,
"设备离线"
);
DeviceUtilizationDto
dto
=
new
DeviceUtilizationDto
(
message
.
getDeviceName
(),
msg
,
DataInitManager
.
startRunTime
);
dtos
.
add
(
dto
);
continue
;
}
}
DeviceUtilizationDto
dto
=
new
DeviceUtilizationDto
(
message
.
getDeviceName
(),
message
.
getShowMsg
(
servletRequest
.
getLocale
()
),
message
.
getUpdateDate
());
DeviceUtilizationDto
dto
=
new
DeviceUtilizationDto
(
message
.
getDeviceName
(),
message
.
getShowMsg
(
locale
),
message
.
getUpdateDate
());
dtos
.
add
(
dto
);
}
}
Collections
.
sort
(
dtos
,
new
Comparator
<
DeviceUtilizationDto
>()
{
@Override
public
int
compare
(
DeviceUtilizationDto
o1
,
DeviceUtilizationDto
o2
)
{
return
o2
.
getUpdateDate
().
compareTo
(
o1
.
getUpdateDate
());
}
});
return
dtos
;
}
@ApiOperation
(
"utilization:导出"
)
@RequestMapping
(
"/utilization/download"
)
@AnonymousAccess
public
void
utilizationDownload
(
HttpServletRequest
servletRequest
,
HttpServletResponse
response
)
throws
IOException
{
Locale
locale
=
servletRequest
.
getLocale
();
List
<
DeviceUtilizationDto
>
dtos
=
getUtilizationList
(
locale
);
log
.
info
(
"开始导出 utilization "
);
FileUtil
.
downloadExcel
(
null
,
null
,
response
,
new
IExcelDownLoad
()
{
@Override
public
List
<
List
<
String
>>
getHeader
()
{
List
<
List
<
String
>>
header
=
new
ArrayList
<>();
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getSmfClientMsg
(
"smfclient.utilization.deviceName"
,
locale
,
"设备名称"
)));
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getSmfClientMsg
(
"smfclient.utilization.state"
,
locale
,
"状态"
)));
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getSmfClientMsg
(
"smfclient.utilization.updateTime"
,
locale
,
"更新时间"
)));
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getSmfClientMsg
(
"smfclient.utilization.timeToDate"
,
locale
,
"截止到目前的时间(小时)"
)));
return
header
;
}
@Override
public
List
<
List
<
Object
>>
getPageData
(
Query
query
,
Pageable
pageable
)
{
List
<
List
<
Object
>>
dataList
=
new
ArrayList
<>();
DateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
for
(
DeviceUtilizationDto
dto
:
dtos
)
{
String
updateDate
=
dateFormat
.
format
(
dto
.
getUpdateDate
());
long
tTime
=
System
.
currentTimeMillis
()-
dto
.
getUpdateDate
().
getTime
();
String
hour
=
String
.
format
(
"%.1f"
,(
float
)
tTime
/
1000
/
60
/
60
)
;
List
<
Object
>
data
=
new
ArrayList
<>();
data
.
add
(
dto
.
getDeviceName
());
data
.
add
(
dto
.
getState
());
data
.
add
(
updateDate
);
data
.
add
(
hour
);
dataList
.
add
(
data
);
}
return
dataList
;
}
});
log
.
info
(
"utilization 导出完成"
);
}
@ApiOperation
(
"ErrorLog:错误数据列表"
)
@GetMapping
(
"/errorLog"
)
...
...
@@ -103,6 +161,44 @@ public class MicronReportController {
return
new
PageData
(
dtos
,
messagePageData
.
getTotalElements
());
}
@ApiOperation
(
"ErrorLog:导出"
)
@RequestMapping
(
"/errorLog/download"
)
@AnonymousAccess
public
void
errorLogDownload
(
MessageCriteria
criteria
,
Pageable
pageable
,
HttpServletRequest
servletRequest
,
HttpServletResponse
response
)
throws
IOException
{
Locale
locale
=
servletRequest
.
getLocale
();
log
.
info
(
"开始导出 ErrorLog "
);
criteria
.
setType
(
"ERROR"
);
Query
query
=
QueryHelp
.
getQuery
(
criteria
);
FileUtil
.
downloadExcel
(
query
,
pageable
,
response
,
new
IExcelDownLoad
()
{
@Override
public
List
<
List
<
String
>>
getHeader
()
{
List
<
List
<
String
>>
header
=
new
ArrayList
<>();
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getSmfClientMsg
(
"smfclient.utilization.deviceName"
,
locale
,
"设备名称"
)));
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getSmfClientMsg
(
"smfclient.infoFind.mess"
,
locale
,
"消息"
)));
header
.
add
(
Lists
.
newArrayList
(
MessageUtils
.
getSmfClientMsg
(
"smfclient.NeoLight.createDate"
,
locale
,
"创建时间"
)));
return
header
;
}
@Override
public
List
<
List
<
Object
>>
getPageData
(
Query
query
,
Pageable
pageable
)
{
List
<
List
<
Object
>>
dataList
=
new
ArrayList
<>();
PageData
<
Message
>
messagePageData
=
messageManager
.
findByPage
(
query
,
pageable
);
DateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
for
(
Message
msg
:
messagePageData
.
getContent
())
{
String
createDate
=
dateFormat
.
format
(
msg
.
getCreateDate
());
List
<
Object
>
data
=
new
ArrayList
<>();
data
.
add
(
msg
.
getDeviceName
());
data
.
add
(
msg
.
getShowMsg
(
locale
));
data
.
add
(
createDate
);
dataList
.
add
(
data
);
}
return
dataList
;
}
});
log
.
info
(
"ErrorLog 导出完成"
);
}
@ApiOperation
(
"eventLog:事件列表"
)
@GetMapping
(
"/eventLog"
)
...
...
src/main/java/com/neotel/smfcore/custom/micron1053/controller/MicronStatusController.java
查看文件 @
a848ba6
...
...
@@ -61,8 +61,23 @@ public class MicronStatusController {
// ML5,CI,R1,R2,R3
List
<
EquipMsg
>
allMsgList
=
new
ArrayList
<>();
String
[]
names
=
new
String
[]{
"ML5-L"
,
"ML5-R"
,
"CI"
,
"R1"
,
"R2"
,
"R3"
};
// 设备组
// LS1
// LS2
// LS3
// LS4
//
// AMH-SBSH2
// AMH-SBDH2-1
// AMH-SBDH2-2
// AMH-SBSH1
// AMH-SBDH3-1
// AMH-SBDH3-2
// AMH-SBDH1-1
// AMH-SBDH1-2
String
[]
names
=
new
String
[]{
"ML5-L"
,
"ML5-R"
,
"CI"
,
"R1"
,
"R2"
,
"R3"
,
"LS1"
,
"LS2"
,
"LS3"
,
"LS4"
,
"AMH-SBSH1"
,
"AMH-SBSH2"
,
"AMH-SBDH1-1"
,
"AMH-SBDH1-2"
,
"AMH-SBDH2-1"
,
"AMH-SBDH2-2"
,
"AMH-SBDH3-1"
,
"AMH-SBDH3-2"
};
for
(
String
name
:
names
)
{
MicronEquipStatus
s
=
MicronDataCache
.
getStatus
(
name
);
...
...
@@ -82,7 +97,9 @@ public class MicronStatusController {
statuses
)
{
if
(!
s
.
timeOut
())
{
if
(!
dto
.
getStatusMap
().
containsKey
(
s
.
getEquipName
()))
{
dto
.
getStatusMap
().
put
(
s
.
getEquipName
(),
s
.
getStatus
());
if
(
s
.
getStatus
()>
0
)
{
dto
.
getStatusMap
().
put
(
s
.
getEquipName
(),
s
.
getStatus
());
}
}
if
(
s
.
getMsgList
()
!=
null
&&
s
.
getMsgList
().
size
()
>
0
)
{
allMsgList
.
addAll
(
s
.
getMsgList
());
...
...
@@ -113,7 +130,9 @@ public class MicronStatusController {
boxList
)
{
//查找料仓
MicronEquipStatus
s
=
getBoxEquip
(
boxName
,
servletRequest
.
getLocale
());
dto
.
getStatusMap
().
put
(
s
.
getEquipName
().
replace
(
"-"
,
""
),
s
.
getStatus
());
if
(
s
.
getStatus
()
>
0
)
{
dto
.
getStatusMap
().
put
(
s
.
getEquipName
().
replace
(
"-"
,
""
),
s
.
getStatus
());
}
if
(
s
.
getMsgList
()
!=
null
&&
s
.
getMsgList
().
size
()
>
0
)
{
allMsgList
.
addAll
(
s
.
getMsgList
());
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论