Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 4d927bb1
由
LN
编写于
2026-03-26 20:05:21 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
通用版本kanban功能合入
1 个父辈
94e5fd95
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
892 行增加
和
1 行删除
src/main/java/com/neotel/smfcore/common/utils/DateUtil.java
src/main/java/com/neotel/smfcore/core/agv/bean/AgvInfo.java
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/box/MesInfoDto.java
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/first/ElecKanbanBoxStatusDto.java
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/first/ExpireDto.java
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/first/InOutDataDto.java
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/first/SluggishDto.java
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/second/MachineStatusDto.java
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/second/StorageCapacityDto.java
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/second/UpcomingExpirationsDto.java
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/sp/SpBoxStatusDto.java
src/main/java/com/neotel/smfcore/core/dashboard/box/SmdBoxController.java
src/main/java/com/neotel/smfcore/core/dashboard/first/FirstDashboardController.java
src/main/java/com/neotel/smfcore/core/dashboard/second/SecondDashboardController.java
src/main/java/com/neotel/smfcore/core/storage/service/po/Storage.java
src/main/java/com/neotel/smfcore/core/system/util/DevicesStatusUtil.java
src/main/java/com/neotel/smfcore/common/utils/DateUtil.java
查看文件 @
4d927bb
...
...
@@ -207,6 +207,12 @@ public class DateUtil {
return
days
;
}
public
static
Date
getCurrentDate
(
String
aMask
)
throws
ParseException
{
SimpleDateFormat
df
=
new
SimpleDateFormat
(
aMask
);
Date
date
=
new
Date
();
String
dateStr
=
df
.
format
(
date
);
return
df
.
parse
(
dateStr
);
}
public
static
class
Req
{
private
String
seq
;
...
...
src/main/java/com/neotel/smfcore/core/agv/bean/AgvInfo.java
0 → 100644
查看文件 @
4d927bb
package
com
.
neotel
.
smfcore
.
core
.
agv
.
bean
;
import
lombok.Data
;
@Data
public
class
AgvInfo
{
/**
* 小车名称
*/
private
String
name
;
/**
* 小车电量
*/
private
String
elec
;
/**
* 小车位置
*/
private
String
loc
;
/**
* 状态
*/
private
int
status
;
}
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/box/MesInfoDto.java
0 → 100644
查看文件 @
4d927bb
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
bean
.
dto
.
box
;
import
cn.hutool.core.date.DateTime
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
MesInfoDto
implements
Serializable
{
private
String
status
=
"OK"
;
private
DateTime
time
;
private
String
request
=
""
;
private
String
response
=
""
;
}
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/first/ElecKanbanBoxStatusDto.java
0 → 100644
查看文件 @
4d927bb
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
bean
.
dto
.
first
;
import
com.neotel.smfcore.core.storage.bean.UsageItem
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Data
public
class
ElecKanbanBoxStatusDto
{
private
String
id
;
private
String
cid
;
/**
* 设备名称
*/
private
String
name
;
/**
* 状态
*/
private
int
status
;
/**
* 今日入库
*/
private
int
todayInCount
;
/**
* 今日出库
*/
private
int
todayOutCount
;
/**
* 库位使用率
*/
private
int
usage
;
/**
* 0料架 1是料仓
*/
private
int
type
=
1
;
/**
* 温度
*/
public
String
temperature
=
""
;
/**
* 湿度
*/
public
String
humidity
=
""
;
private
List
<
DataLog
>
taskList
=
new
ArrayList
<>();
@ApiModelProperty
(
"异常任务数,>0表示有异常"
)
private
int
abnormalTasks
=
0
;
@ApiModelProperty
(
"消息"
)
public
String
msg
=
""
;
@ApiModelProperty
(
"最低温度"
)
private
float
minTemperature
=
22.0
F
;
@ApiModelProperty
(
"最高温度"
)
private
float
maxTemperature
=
38.0
F
;
@ApiModelProperty
(
"最低湿度值"
)
private
float
minHumidity
=
0.0
F
;
@ApiModelProperty
(
"最大湿度值"
)
private
float
maxHumidity
=
100.0
F
;
@ApiModelProperty
(
"客户端上传数据,closeLock为enable时此按钮状态为可用,openLock为enable时,此按钮状态为可用"
+
"客户端收到服务器openLock为doit时,执行打开门锁动作,closeLock为doit时,执行关闭门锁"
)
private
Map
<
String
,
String
>
data
=
null
;
@ApiModelProperty
(
"使用情况"
)
private
Map
<
String
,
UsageItem
>
usageMap
=
null
;
}
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/first/ExpireDto.java
0 → 100644
查看文件 @
4d927bb
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
bean
.
dto
.
first
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
ExpireDto
{
@ApiModelProperty
(
"过期物料数量"
)
private
int
expire
=
0
;
@ApiModelProperty
(
"0-7天过期数量"
)
private
int
zeroToSevenExpire
=
0
;
@ApiModelProperty
(
"7到30天过期"
)
private
int
sevenToThirtyExpire
=
0
;
}
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/first/InOutDataDto.java
0 → 100644
查看文件 @
4d927bb
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
bean
.
dto
.
first
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
InOutDataDto
{
@ApiModelProperty
(
"日期集合"
)
private
List
<
String
>
dateStrList
;
@ApiModelProperty
(
"入库数据集合"
)
private
List
<
Integer
>
inDataList
;
@ApiModelProperty
(
"出库数据集合"
)
private
List
<
Integer
>
outDataList
;
@ApiModelProperty
(
"今日入库总数"
)
private
Integer
todayInDataCount
=
0
;
@ApiModelProperty
(
"今日出库总数"
)
private
Integer
todayOutDataCount
=
0
;
@ApiModelProperty
(
"入库总数"
)
private
Integer
inDataCount
=
0
;
@ApiModelProperty
(
"出库总数"
)
private
Integer
outDataCount
=
0
;
}
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/first/SluggishDto.java
0 → 100644
查看文件 @
4d927bb
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
bean
.
dto
.
first
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
SluggishDto
{
@ApiModelProperty
(
"7到30天呆滞"
)
private
int
sevenToThirtySluggish
=
0
;
@ApiModelProperty
(
"超过30天呆滞"
)
private
int
moreThenThirtySluggish
=
0
;
}
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/second/MachineStatusDto.java
0 → 100644
查看文件 @
4d927bb
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
bean
.
dto
.
second
;
import
lombok.Data
;
@Data
public
class
MachineStatusDto
{
/**
* 温度/回温温度
*/
private
String
temperature
=
""
;
/**
* 冷藏温度
*/
private
String
codeTemperature
=
""
;
/**
* 湿度
*/
private
String
humidity
=
""
;
}
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/second/StorageCapacityDto.java
0 → 100644
查看文件 @
4d927bb
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
bean
.
dto
.
second
;
import
lombok.Data
;
@Data
public
class
StorageCapacityDto
{
/**
*百分比容量(SP:冷藏区使用百分比)
*/
private
int
capacity
;
/**
* 百分比容量(SP:冷藏区总容量)
*/
private
int
perCapacity
;
/**
* SP:回温区使用百分比
*/
private
int
warmCapacity
;
/**
* SP:回温区总容量
*/
private
int
warmPerCapacity
;
}
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/second/UpcomingExpirationsDto.java
0 → 100644
查看文件 @
4d927bb
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
bean
.
dto
.
second
;
import
lombok.Data
;
@Data
public
class
UpcomingExpirationsDto
{
/**
* 0到7天
*/
private
int
zeroToSeven
=
0
;
/**
* 7到30天
*/
private
int
sevenToThirty
=
0
;
/**
* 已过期
*/
private
int
expirated
=
0
;
}
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/sp/SpBoxStatusDto.java
0 → 100644
查看文件 @
4d927bb
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
bean
.
dto
.
sp
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
SpBoxStatusDto
implements
Serializable
{
@ApiModelProperty
(
"单台BOX状态,0=离线,1=正常运行中, 2=急停,3=故障,4=警告,5=调试中,6入库执行中,7入仓位完成,8入库失败, 9出库执行中,10出仓位完成,11出库失败,12移栽出库,13 重置中,14 扫码入库失败 "
)
private
int
status
=
0
;
@ApiModelProperty
(
"出库队列数量 "
)
private
int
outJobCount
=
0
;
}
src/main/java/com/neotel/smfcore/core/dashboard/box/SmdBoxController.java
0 → 100644
查看文件 @
4d927bb
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
box
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.JsonUtil
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.dashboard.bean.dto.box.MesInfoDto
;
import
com.neotel.smfcore.core.dashboard.bean.dto.first.ElecKanbanBoxStatusDto
;
import
com.neotel.smfcore.core.device.bean.BoxStatusBean
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.inout.service.manager.IInOutDataManager
;
import
com.neotel.smfcore.core.inout.service.po.InOutData
;
import
com.neotel.smfcore.core.message.rest.bean.mapstruct.MessageMapper
;
import
com.neotel.smfcore.core.message.service.manager.IMessageManager
;
import
com.neotel.smfcore.core.msd.bean.MSDSettiings
;
import
com.neotel.smfcore.core.storage.service.manager.IStorageManager
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.util.DevicesStatusUtil
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
java.text.ParseException
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@RestController
@RequestMapping
(
"/smdBox"
)
public
class
SmdBoxController
{
@Autowired
DataCache
dataCache
;
@Autowired
IInOutDataManager
inOutDataManager
;
@Autowired
IMessageManager
messageManager
;
@Autowired
MessageMapper
messageMapper
;
@Autowired
TaskService
taskService
;
private
Storage
storage
;
private
Storage
getDefaultBox
()
{
if
(
storage
!=
null
)
{
return
storage
;
}
for
(
Storage
stor
:
dataCache
.
getAllStorage
().
values
())
{
if
(
stor
.
isBatchStorage
()||
stor
.
isMimoG2
())
{
storage
=
stor
;
return
storage
;
}
}
return
null
;
}
@ApiOperation
(
"设备状态"
)
@RequestMapping
(
"/boxStatus"
)
@AnonymousAccess
public
List
<
ElecKanbanBoxStatusDto
>
getElecKanbanBoxStatusDto
(
String
cid
,
HttpServletRequest
servletRequest
)
throws
ParseException
{
List
<
ElecKanbanBoxStatusDto
>
resultList
=
new
ArrayList
<>();
if
(
StringUtils
.
isBlank
(
cid
))
{
Storage
storage
=
getDefaultBox
();
if
(
storage
!=
null
)
{
cid
=
storage
.
getCid
();
}
}
MSDSettiings
msdSettiings
=
dataCache
.
getCache
(
Constants
.
CACHE_msdSetting
);
if
(
msdSettiings
==
null
)
{
msdSettiings
=
new
MSDSettiings
();
}
List
<
String
>
cids
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotBlank
(
cid
)){
Storage
storage
=
dataCache
.
getStorage
(
cid
);
if
(
storage
!=
null
){
cids
.
add
(
cid
);
if
(
ObjectUtil
.
isNotEmpty
(
storage
.
getAppendCid
())){
cids
.
add
(
storage
.
getAppendCid
());
}
}
}
Collections
.
sort
(
cids
);
for
(
String
theCid
:
cids
)
{
Date
currentDate
=
com
.
neotel
.
smfcore
.
common
.
utils
.
DateUtil
.
getCurrentDate
(
"yyyy-MM-dd"
);
List
<
InOutData
>
inOutDataList
=
inOutDataManager
.
findByDate
(
currentDate
,
com
.
neotel
.
smfcore
.
common
.
utils
.
DateUtil
.
addDays
(
currentDate
,
1
),
null
);
ElecKanbanBoxStatusDto
dto
=
new
ElecKanbanBoxStatusDto
();
StatusBean
statusBean
=
DevicesStatusUtil
.
getStatusBean
(
theCid
);
if
(
statusBean
!=
null
)
{
//dto.setStatus(statusBean.getStatus());
Collection
<
BoxStatusBean
>
boxStatusBeans
=
statusBean
.
getBoxStatus
().
values
();
if
(
boxStatusBeans
!=
null
&&
!
boxStatusBeans
.
isEmpty
())
{
for
(
BoxStatusBean
boxStatusBean
:
boxStatusBeans
)
{
dto
.
setHumidity
(
boxStatusBean
.
getHumidity
());
dto
.
setTemperature
(
boxStatusBean
.
getTemperature
());
dto
.
setStatus
(
boxStatusBean
.
getStatus
());
dto
.
setMsg
(
statusBean
.
getErrorMsg
(
servletRequest
.
getLocale
()));
dto
.
setData
(
statusBean
.
getData
());
}
}
}
Storage
storage
=
dataCache
.
getStorage
(
theCid
);
if
(
storage
.
isNLShelf
()
||
storage
.
isNLPShelf
()
||
storage
.
isNLMShelf
()
||
storage
.
isShelf
())
{
dto
.
setType
(
0
);
}
else
{
dto
.
setType
(
1
);
}
int
usage
=
0
;
if
(
storage
.
getTotalSlots
()>
0
){
usage
=
(
storage
.
getTotalSlots
()
-
storage
.
getEmptySlots
())
*
100
/
storage
.
getTotalSlots
();
}
dto
.
setUsage
(
usage
);
int
inCount
=
getTodayInOutCount
(
storage
.
getId
(),
inOutDataList
,
true
);
int
outCount
=
getTodayInOutCount
(
storage
.
getId
(),
inOutDataList
,
false
);
dto
.
setTodayInCount
(
inCount
);
dto
.
setTodayOutCount
(
outCount
);
dto
.
setName
(
storage
.
getName
());
dto
.
setId
(
storage
.
getId
());
dto
.
setCid
(
storage
.
getCid
());
int
abnormalTasks
=
0
;
Collection
<
DataLog
>
queueTasks
=
taskService
.
getQueueTasks
(
theCid
);
if
(
queueTasks
!=
null
){
for
(
DataLog
log
:
queueTasks
)
{
if
(
log
.
isAbnormal
()){
abnormalTasks
+=
1
;
}
}
dto
.
setTaskList
((
List
<
DataLog
>)
queueTasks
);
}
else
{
dto
.
setTaskList
(
new
ArrayList
<>());
}
dto
.
setAbnormalTasks
(
abnormalTasks
);
dto
.
setMinHumidity
(
msdSettiings
.
getMinHumidity
());
dto
.
setMaxHumidity
(
msdSettiings
.
getMaxHumidity
());
dto
.
setMinTemperature
(
msdSettiings
.
getMinTemperature
());
dto
.
setMaxTemperature
(
msdSettiings
.
getMaxTemperature
());
dto
.
setUsageMap
(
storage
.
getUsageMap
());
MesInfoDto
mesInfoDto
=
DevicesStatusUtil
.
getLastAgvInfo
(
theCid
);
if
(
mesInfoDto
!=
null
){
dto
.
getData
().
put
(
"AGV"
,
JsonUtil
.
toJsonStr
(
mesInfoDto
));
}
resultList
.
add
(
dto
);
}
return
resultList
;
}
private
int
getTodayInOutCount
(
String
storageId
,
List
<
InOutData
>
inOutDataList
,
boolean
isInCount
)
{
if
(
inOutDataList
==
null
||
inOutDataList
.
isEmpty
()){
return
0
;
}
if
(
isInCount
){
return
inOutDataList
.
stream
().
filter
(
inOutData
->
inOutData
.
getStorageId
().
equals
(
storageId
)).
collect
(
Collectors
.
summingInt
(
InOutData
::
getInCount
)).
intValue
();
}
else
{
return
inOutDataList
.
stream
().
filter
(
inOutData
->
inOutData
.
getStorageId
().
equals
(
storageId
)).
collect
(
Collectors
.
summingInt
(
InOutData
::
getOutCount
)).
intValue
();
}
}
}
src/main/java/com/neotel/smfcore/core/dashboard/first/FirstDashboardController.java
0 → 100644
查看文件 @
4d927bb
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
first
;
import
com.neotel.smfcore.common.utils.DateUtil
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.device.bean.BoxStatusBean
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.dashboard.bean.dto.first.ElecKanbanBoxStatusDto
;
import
com.neotel.smfcore.core.dashboard.bean.dto.first.SluggishDto
;
import
com.neotel.smfcore.core.inout.service.manager.IInOutDataManager
;
import
com.neotel.smfcore.core.inout.service.po.InOutData
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.dashboard.bean.dto.first.ExpireDto
;
import
com.neotel.smfcore.core.system.util.DevicesStatusUtil
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Slf4j
@RestController
@RequiredArgsConstructor
@Api
(
tags
=
"仪表盘"
)
@RequestMapping
(
"/elecKanban"
)
public
class
FirstDashboardController
{
@Autowired
private
IStoragePosManager
storagePosManager
;
@Autowired
private
DataCache
dataCache
;
@Autowired
private
IInOutDataManager
inOutDataManager
;
@ApiOperation
(
"过期信息"
)
@RequestMapping
(
"/getExpiredInfo"
)
@AnonymousAccess
public
ExpireDto
getExpiredInfo
()
{
ExpireDto
dto
=
new
ExpireDto
();
int
expire
=
0
;
int
zeroToSevenExpire
=
0
;
int
sevenToThirtyExpire
=
0
;
Date
currentDate
=
new
Date
();
List
<
StoragePos
>
expStoragePosList
=
storagePosManager
.
findExpiredOrSluggishBarcode
(
currentDate
,
0
);
if
(
expStoragePosList
!=
null
&&
!
expStoragePosList
.
isEmpty
())
{
expire
=
expStoragePosList
.
size
();
for
(
StoragePos
storagePos
:
expStoragePosList
)
{
Barcode
barcode
=
storagePos
.
getBarcode
();
if
(
barcode
!=
null
)
{
Date
expireDate
=
barcode
.
getExpireDate
();
int
days
=
DateUtil
.
differentDaysByMillisecond
(
expireDate
,
currentDate
);
if
(
0
<=
days
&&
days
<
7
)
{
zeroToSevenExpire
++;
}
else
if
(
7
<=
days
&&
days
<
30
)
{
sevenToThirtyExpire
++;
}
}
}
}
dto
.
setExpire
(
expire
);
dto
.
setSevenToThirtyExpire
(
sevenToThirtyExpire
);
dto
.
setZeroToSevenExpire
(
zeroToSevenExpire
);
return
dto
;
}
@ApiOperation
(
"呆滞信息"
)
@RequestMapping
(
"/getSluggishInfo"
)
@AnonymousAccess
public
SluggishDto
getSluggishInfo
()
{
SluggishDto
dto
=
new
SluggishDto
();
int
sevenToThirtySluggish
=
0
;
int
moreThenThirtySluggish
=
0
;
Date
currentDate
=
new
Date
();
List
<
StoragePos
>
sluStoragePosList
=
storagePosManager
.
findExpiredOrSluggishBarcode
(
currentDate
,
1
);
if
(
sluStoragePosList
!=
null
&&
!
sluStoragePosList
.
isEmpty
())
{
for
(
StoragePos
storagePos
:
sluStoragePosList
)
{
Barcode
barcode
=
storagePos
.
getBarcode
();
if
(
barcode
!=
null
)
{
Date
putInDate
=
barcode
.
getPutInDate
();
int
days
=
DateUtil
.
differentDaysByMillisecond
(
putInDate
,
currentDate
);
if
(
7
<=
days
&&
days
<
30
)
{
sevenToThirtySluggish
++;
}
else
if
(
days
>=
30
)
{
moreThenThirtySluggish
++;
}
}
}
}
dto
.
setSevenToThirtySluggish
(
sevenToThirtySluggish
);
dto
.
setMoreThenThirtySluggish
(
moreThenThirtySluggish
);
return
dto
;
}
@ApiOperation
(
"库位使用率"
)
@RequestMapping
(
"/getPosUsage"
)
@AnonymousAccess
public
int
getPosUsage
()
{
int
usage
=
0
;
int
totalSlots
=
0
;
int
emptySlots
=
0
;
Collection
<
Storage
>
storages
=
dataCache
.
getAllStorage
().
values
();
for
(
Storage
storage
:
storages
)
{
totalSlots
=
totalSlots
+
storage
.
getTotalSlots
();
emptySlots
=
emptySlots
+
storage
.
getEmptySlots
();
}
if
(
totalSlots
!=
0
)
{
usage
=
(
totalSlots
-
emptySlots
)*
100
/
totalSlots
;
}
return
usage
;
}
@ApiOperation
(
"设备状态"
)
@RequestMapping
(
"/getElecKanbanBoxStatusDto"
)
@AnonymousAccess
public
List
<
ElecKanbanBoxStatusDto
>
getElecKanbanBoxStatusDto
()
throws
ParseException
{
List
<
ElecKanbanBoxStatusDto
>
resultList
=
new
ArrayList
<>();
Date
currentDate
=
DateUtil
.
getCurrentDate
(
"yyyy-MM-dd"
);
List
<
InOutData
>
inOutDataList
=
inOutDataManager
.
findByDate
(
currentDate
,
DateUtil
.
addDays
(
currentDate
,
1
),
null
);
//List<InOutData> inOutDataList = inOutDataManager.findByDate(DateUtil.addDays(currentDate,-5), DateUtil.addDays(currentDate, 1), null);
for
(
Storage
storage
:
dataCache
.
getAllStorage
().
values
())
{
ElecKanbanBoxStatusDto
dto
=
new
ElecKanbanBoxStatusDto
();
StatusBean
statusBean
=
DevicesStatusUtil
.
getStatusBean
(
storage
.
getCid
());
if
(
statusBean
!=
null
){
dto
.
setStatus
(
statusBean
.
getStatus
());
Collection
<
BoxStatusBean
>
boxStatusBeans
=
statusBean
.
getBoxStatus
().
values
();
if
(
boxStatusBeans
!=
null
&&
!
boxStatusBeans
.
isEmpty
()){
for
(
BoxStatusBean
boxStatusBean
:
boxStatusBeans
)
{
dto
.
setHumidity
(
boxStatusBean
.
getHumidity
());
dto
.
setTemperature
(
boxStatusBean
.
getTemperature
());
}
}
}
if
(
storage
.
isNLShelf
()
||
storage
.
isNLPShelf
()
||
storage
.
isNLMShelf
()
||
storage
.
isShelf
()){
dto
.
setType
(
0
);
}
else
{
dto
.
setType
(
1
);
}
int
v
=
storage
.
getTotalSlots
();
if
(
v
==
0
){
v
=
1
;
}
int
usage
=
(
storage
.
getTotalSlots
()
-
storage
.
getEmptySlots
())
*
100
/
v
;
dto
.
setUsage
(
usage
);
int
inCount
=
getTodayInOutCount
(
storage
.
getId
(),
inOutDataList
,
true
);
int
outCount
=
getTodayInOutCount
(
storage
.
getId
(),
inOutDataList
,
false
);
dto
.
setTodayInCount
(
inCount
);
dto
.
setTodayOutCount
(
outCount
);
dto
.
setName
(
storage
.
getName
());
resultList
.
add
(
dto
);
}
return
resultList
;
}
private
int
getTodayInOutCount
(
String
storageId
,
List
<
InOutData
>
inOutDataList
,
boolean
isInCount
)
{
if
(
inOutDataList
==
null
||
inOutDataList
.
isEmpty
()){
return
0
;
}
if
(
isInCount
){
return
inOutDataList
.
stream
().
filter
(
inOutData
->
inOutData
.
getStorageId
().
equals
(
storageId
)).
collect
(
Collectors
.
summingInt
(
InOutData
::
getInCount
)).
intValue
();
}
else
{
return
inOutDataList
.
stream
().
filter
(
inOutData
->
inOutData
.
getStorageId
().
equals
(
storageId
)).
collect
(
Collectors
.
summingInt
(
InOutData
::
getOutCount
)).
intValue
();
}
}
}
src/main/java/com/neotel/smfcore/core/dashboard/second/SecondDashboardController.java
0 → 100644
查看文件 @
4d927bb
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
second
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUtil
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.core.agv.bean.AgvInfo
;
import
com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.dashboard.bean.dto.second.MachineStatusDto
;
import
com.neotel.smfcore.core.dashboard.bean.dto.second.StorageCapacityDto
;
import
com.neotel.smfcore.core.dashboard.bean.dto.second.UpcomingExpirationsDto
;
import
com.neotel.smfcore.core.dashboard.bean.dto.sp.SpBoxStatusDto
;
import
com.neotel.smfcore.core.device.bean.BoxStatusBean
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.equipment.bean.EquipStatusBean
;
import
com.neotel.smfcore.core.equipment.enums.EquipmentType
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.system.util.DevicesStatusUtil
;
import
com.neotel.smfcore.core.system.util.EquipStatusUtil
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.List
;
@Slf4j
@RestController
@RequiredArgsConstructor
@Api
(
tags
=
"仪表盘(新)"
)
@RequestMapping
(
"/dashboard"
)
public
class
SecondDashboardController
{
@Autowired
private
DataCache
dataCache
;
@Autowired
private
IStoragePosManager
storagePosManager
;
@ApiOperation
(
"MachineStatus"
)
@RequestMapping
(
"/machineStatus"
)
@AnonymousAccess
public
ResultBean
machineStatus
(
@RequestParam
(
"storageId"
)
String
storageId
)
{
MachineStatusDto
dto
=
new
MachineStatusDto
();
//获取到设备的状态 温度湿度信息
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
if
(
storage
!=
null
)
{
StatusBean
statusBean
=
DevicesStatusUtil
.
getStatusBean
(
storage
.
getCid
());
if
(
statusBean
!=
null
)
{
Collection
<
BoxStatusBean
>
boxStatusBeans
=
statusBean
.
getBoxStatus
().
values
();
if
(
boxStatusBeans
!=
null
&&
!
boxStatusBeans
.
isEmpty
())
{
for
(
BoxStatusBean
boxStatusBean
:
boxStatusBeans
)
{
dto
.
setHumidity
(
boxStatusBean
.
getHumidity
());
dto
.
setTemperature
(
boxStatusBean
.
getTemperature
());
dto
.
setCodeTemperature
(
boxStatusBean
.
getCodeAirTemp
());
}
}
}
}
return
ResultBean
.
newOkResult
(
dto
);
}
@ApiOperation
(
"StorageCapacity"
)
@RequestMapping
(
"/storageCapacity"
)
@AnonymousAccess
public
ResultBean
storageCapacity
(
@RequestParam
(
"storageId"
)
String
storageId
)
{
StorageCapacityDto
dto
=
new
StorageCapacityDto
();
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
if
(
storage
!=
null
)
{
int
totalSlots
=
storage
.
getTotalSlots
();
if
(
totalSlots
!=
0
)
{
int
emptySlots
=
storage
.
getEmptySlots
();
int
capacity
=
totalSlots
-
emptySlots
;
int
perCapacity
=
(
capacity
*
100
)/
totalSlots
;
int
warmCapacity
=
0
;
int
warmPerCapacity
=
0
;
// if(storage.isSolderPaste()) {
//
// warmPerCapacity = dataCache.getSpUsePosCount(storage.getCid(), DataCache.warmPosCount);
// perCapacity = dataCache.getSpUsePosCount(storage.getCid(), DataCache.coldingPosCount);
//
// Integer warmUseCount = dataCache.getSpUsePosCount(storage.getCid(), DataCache.warmPosUseCount);
// Integer coldingUseCount = dataCache.getSpUsePosCount(storage.getCid(), DataCache.coldingPosUseCount);
// if(coldingUseCount<=0||perCapacity<=0){
// perCapacity=0;
// }else {
// perCapacity = (coldingUseCount * 100) / perCapacity;
// }
// if(warmUseCount<=0||warmPerCapacity<=0){
// warmCapacity=0;
// }else{
// warmCapacity = (warmUseCount * 100) / warmPerCapacity;
// }
// }
dto
.
setWarmPerCapacity
(
warmPerCapacity
);
dto
.
setWarmCapacity
(
warmCapacity
);
dto
.
setCapacity
(
capacity
);
dto
.
setPerCapacity
(
perCapacity
);
}
}
return
ResultBean
.
newOkResult
(
dto
);
}
@ApiOperation
(
"Upcoming Expirations"
)
@RequestMapping
(
"/upcomingExpirations"
)
@AnonymousAccess
public
ResultBean
upcomingExpirations
(
@RequestParam
(
"storageId"
)
String
storageId
)
{
UpcomingExpirationsDto
dto
=
new
UpcomingExpirationsDto
();
List
<
StoragePos
>
storagePosList
=
storagePosManager
.
findNotEmptyByStorageId
(
storageId
);
if
(
storagePosList
!=
null
&&
!
storagePosList
.
isEmpty
())
{
int
zeroToSeven
=
0
;
int
sevenToThirty
=
0
;
int
expirated
=
0
;
for
(
StoragePos
storagePos
:
storagePosList
)
{
Barcode
barcode
=
storagePos
.
getBarcode
();
Date
expireDate
=
barcode
.
getExpireDate
();
//判断过期时间.相差天数
if
(
expireDate
!=
null
)
{
long
between
=
DateUtil
.
between
(
new
Date
(),
expireDate
,
DateUnit
.
DAY
,
false
);
if
(
between
<
0
)
{
expirated
=
expirated
+
1
;
}
else
if
(
between
>=
0
&&
between
<
7
)
{
zeroToSeven
=
zeroToSeven
+
1
;
}
else
if
(
between
>=
7
&&
between
<
30
)
{
sevenToThirty
=
sevenToThirty
+
1
;
}
}
}
dto
.
setZeroToSeven
(
zeroToSeven
);
dto
.
setSevenToThirty
(
sevenToThirty
);
dto
.
setExpirated
(
expirated
);
}
return
ResultBean
.
newOkResult
(
dto
);
}
@ApiOperation
(
"AGV"
)
@RequestMapping
(
"agv"
)
@AnonymousAccess
public
ResultBean
agv
()
{
List
<
AgvInfo
>
agvCacheList
=
new
ArrayList
<>();
Collection
<
EquipStatusBean
>
allStatusBean
=
EquipStatusUtil
.
getAllStatusBean
();
if
(
allStatusBean
!=
null
&&
!
allStatusBean
.
isEmpty
())
{
for
(
EquipStatusBean
statusBean
:
allStatusBean
)
{
if
(
statusBean
.
getType
().
equals
(
EquipmentType
.
AGV
.
name
())){
AgvInfo
agvInfo
=
new
AgvInfo
();
agvInfo
.
setName
(
statusBean
.
getName
());
if
(
statusBean
.
timeOut
()){
agvInfo
.
setStatus
(
0
);
}
else
{
agvInfo
.
setStatus
(
statusBean
.
getStatus
());
}
agvInfo
.
setElec
(
statusBean
.
getData
().
get
(
"elec"
).
toString
());
agvCacheList
.
add
(
agvInfo
);
}
}
}
return
ResultBean
.
newOkResult
(
agvCacheList
);
}
@ApiOperation
(
"sp看板状态"
)
@RequestMapping
(
"/spInfo"
)
@AnonymousAccess
public
ResultBean
spInfo
(
@RequestParam
(
"storageId"
)
String
storageId
)
{
SpBoxStatusDto
dto
=
new
SpBoxStatusDto
();
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
if
(
storage
!=
null
)
{
StatusBean
statusBean
=
DevicesStatusUtil
.
getStatusBean
(
storage
.
getCid
());
if
(
statusBean
!=
null
)
{
if
(
statusBean
.
timeOut
())
{
dto
.
setStatus
(
0
);
}
else
{
dto
.
setStatus
(
statusBean
.
getStatus
());
}
}
if
(
storage
.
isSolderPaste
())
{
Criteria
c
=
Criteria
.
where
(
"storageId"
).
is
(
storageId
)
.
and
(
"enabled"
).
is
(
true
)
.
and
(
"used"
).
is
(
true
)
.
and
(
"barcode.solderStatus"
).
nin
(
null
,
""
,
SOLDER_STATUS
.
NONE
.
name
(),
SOLDER_STATUS
.
UNDER_REFRIGERATION
.
name
(),
SOLDER_STATUS
.
RETREAT_STORAGE
.
name
());
List
<
StoragePos
>
taskPosList
=
storagePosManager
.
findByQuery
(
new
Query
(
c
));
dto
.
setOutJobCount
(
taskPosList
.
size
());
}
}
return
ResultBean
.
newOkResult
(
dto
);
}
}
src/main/java/com/neotel/smfcore/core/storage/service/po/Storage.java
查看文件 @
4d927bb
...
...
@@ -23,6 +23,10 @@ public class Storage extends BasePo implements Serializable {
*/
private
String
sourcePath
;
private
String
cid
;
/**
* 附属CID
*/
private
String
appendCid
;
private
int
totalSlots
;
private
int
emptySlots
;
//存储的满料的数量
...
...
@@ -88,7 +92,15 @@ public class Storage extends BasePo implements Serializable {
public
boolean
isBatchStorage
(){
return
DeviceType
.
BATCH
.
name
().
equals
(
type
);
}
/**
* 是否是MimoG2
* @return
*/
public
boolean
isMimoG2
(){
//MIMOG2和G3统一处理
// return (DeviceType.SMD_MIMO_G2.name().equals(type))||(DeviceType.SMD_MIMO_G3.name().equals(type));
return
false
;
}
/**
* 是否是单台自动仓
*/
...
...
src/main/java/com/neotel/smfcore/core/system/util/DevicesStatusUtil.java
查看文件 @
4d927bb
package
com
.
neotel
.
smfcore
.
core
.
system
.
util
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.google.common.collect.Maps
;
import
com.neotel.smfcore.common.enlog.EnLog
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.core.dashboard.bean.dto.box.MesInfoDto
;
import
com.neotel.smfcore.core.device.bean.MsgInfo
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.enums.BOX_STATUS
;
...
...
@@ -14,6 +16,7 @@ import com.neotel.smfcore.core.message.util.DeviceMessageUtil;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
...
...
@@ -266,4 +269,22 @@ public class DevicesStatusUtil {
EnLog
.
error
(
"Device status timer error: "
+
ex
.
toString
());
}
}
private
static
Map
<
String
,
MesInfoDto
>
lastAgvMesMap
=
new
HashMap
<>();
public
static
void
UpdateAgvInfo
(
String
key
,
String
request
,
String
response
,
String
status
){
MesInfoDto
mesInfo
=
new
MesInfoDto
(
status
,
DateTime
.
now
(),
request
,
response
);
if
(
ObjectUtil
.
isEmpty
(
key
)){
key
=
""
;
}
lastAgvMesMap
.
put
(
key
,
mesInfo
);
}
public
static
MesInfoDto
getLastAgvInfo
(
String
key
)
{
if
(
lastAgvMesMap
.
containsKey
(
key
))
{
return
lastAgvMesMap
.
get
(
key
);
}
return
lastAgvMesMap
.
get
(
""
);
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论