Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 13d6993a
由
LN
编写于
2024-01-09 13:35:50 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
多料仓面板修改
1 个父辈
679effab
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
303 行增加
和
5 行删除
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/first/ElecKanbanBoxStatusDto.java
src/main/java/com/neotel/smfcore/core/dashboard/box/SmdBoxController.java
src/main/java/com/neotel/smfcore/core/dashboard/mimo/SmdBoxMimoController.java
src/main/java/com/neotel/smfcore/core/device/bean/StatusBean.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/DUOBoxHandler.java
src/main/java/com/neotel/smfcore/core/device/rest/DeviceController.java
src/main/java/com/neotel/smfcore/core/equipment/rest/EquipViewController.java
src/main/java/com/neotel/smfcore/core/message/enums/MessageType.java
src/main/java/com/neotel/smfcore/core/msd/rest/MSDController.java
src/main/java/com/neotel/smfcore/core/storage/service/po/Storage.java
src/main/java/com/neotel/smfcore/core/dashboard/bean/dto/first/ElecKanbanBoxStatusDto.java
查看文件 @
13d6993
package
com
.
neotel
.
smfcore
.
core
.
dashboard
.
bean
.
dto
.
first
;
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
;
/**
* 设备名称
*/
...
...
@@ -51,4 +55,19 @@ public class ElecKanbanBoxStatusDto {
private
List
<
DataLog
>
taskList
=
new
ArrayList
<>();
@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
=
new
HashMap
<>();
}
src/main/java/com/neotel/smfcore/core/dashboard/box/SmdBoxController.java
0 → 100644
查看文件 @
13d6993
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.StringUtils
;
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.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
())
{
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
());
}
else
if
(
storage
.
isSmdDuo
()){
if
(
cid
.
equals
(
"line-ac-05"
))
{
cids
.
add
(
"line-ac-04"
);
}
else
{
cids
.
add
(
"line-ac-05"
);
}
}
}
}
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
(
cid
);
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
.
getShowMsg
(
servletRequest
.
getLocale
()));
dto
.
setData
(
statusBean
.
getData
());
}
}
}
Storage
storage
=
dataCache
.
getStorage
(
cid
);
if
(
storage
.
isNLShelf
()
||
storage
.
isNLPShelf
()
||
storage
.
isNLMShelf
()
||
storage
.
isShelf
())
{
dto
.
setType
(
0
);
}
else
{
dto
.
setType
(
1
);
}
int
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
());
Collection
<
DataLog
>
queueTasks
=
taskService
.
getQueueTasks
(
cid
);
if
(
queueTasks
!=
null
){
dto
.
setTaskList
((
List
<
DataLog
>)
queueTasks
);
}
else
{
dto
.
setTaskList
(
new
ArrayList
<>());
}
dto
.
setMinHumidity
(
msdSettiings
.
getMinHumidity
());
dto
.
setMaxHumidity
(
msdSettiings
.
getMaxHumidity
());
dto
.
setMinTemperature
(
msdSettiings
.
getMinTemperature
());
dto
.
setMaxTemperature
(
msdSettiings
.
getMaxTemperature
());
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/mimo/SmdBoxMimoController.java
查看文件 @
13d6993
...
...
@@ -198,7 +198,7 @@ public class SmdBoxMimoController {
@ApiOperation
(
"设备状态"
)
@RequestMapping
(
"/getBoxStatusDto"
)
@AnonymousAccess
public
List
<
ElecKanbanBoxStatusDto
>
getElecKanbanBoxStatusDto
(
String
cid
)
throws
ParseException
{
public
List
<
ElecKanbanBoxStatusDto
>
getElecKanbanBoxStatusDto
(
String
cid
,
HttpServletRequest
servletRequest
)
throws
ParseException
{
List
<
ElecKanbanBoxStatusDto
>
resultList
=
new
ArrayList
<>();
if
(
StringUtils
.
isBlank
(
cid
))
{
Storage
storage
=
getDefaultBox
();
...
...
@@ -219,6 +219,8 @@ public class SmdBoxMimoController {
dto
.
setHumidity
(
boxStatusBean
.
getHumidity
());
dto
.
setTemperature
(
boxStatusBean
.
getTemperature
());
dto
.
setStatus
(
boxStatusBean
.
getStatus
());
dto
.
setMsg
(
statusBean
.
getShowMsg
(
servletRequest
.
getLocale
()));
dto
.
setData
(
statusBean
.
getData
());
}
}
}
...
...
@@ -236,6 +238,7 @@ public class SmdBoxMimoController {
dto
.
setTodayInCount
(
inCount
);
dto
.
setTodayOutCount
(
outCount
);
dto
.
setName
(
storage
.
getName
());
dto
.
setId
(
storage
.
getId
());
Collection
<
DataLog
>
queueTasks
=
taskService
.
getQueueTasks
(
cid
);
if
(
queueTasks
!=
null
){
dto
.
setTaskList
((
List
<
DataLog
>)
queueTasks
);
...
...
src/main/java/com/neotel/smfcore/core/device/bean/StatusBean.java
查看文件 @
13d6993
...
...
@@ -41,6 +41,10 @@ public class StatusBean {
*客户端IP
*/
private
String
clientIp
;
/**
* 附属CID
*/
private
String
appendCid
;
/// <summary>
/// 操作相关数据,
/// op=1时,客户端发送 code 二维码给服务器,服务器返回时有:posId库位编号,plateW:料盘宽度,plateH:料盘高度
...
...
@@ -49,6 +53,15 @@ public class StatusBean {
//数据还放入data那个map里面,客户端收到服务器openLock为doit时,执行打开门锁动作;startBatchIn为doit时,执行开始批量入库动作;closeLock为doit时,执行关闭门锁;takeOutReel为doit时,执行取出出库料盘动作;confirmReelOut为doit时,执行门口料盘已取出;
//当服务器收到客户端:doorStatus为门锁状态(如开门中,或关闭中);openLock为enable时,此按钮状态为可用;startBatchIn为enable时此按钮状态为可用;closeLock为enable时此按钮状态为可用;takeOutReel为enable时此按钮状态为可用;confirmReelOut为enable时此按钮状态为可用;
//服务器默认这些按钮都为不可用状态,只有收到对应的enable时,按钮才可以进行点击
// 多料仓 doorStatus open/close
// shelfStatus ,表示料串状态:
// IDLE=空闲;
// LOADING=入库中;
// UNLOADING=出库中;
// NEED_EMPTY=需要空料串出库;
// EMPTY_OUT=空料串需要取走
// FULL_OUT=满料串需要取走
//料串类型 shelfType smallReel, bigReel, tray
private
Map
<
String
,
String
>
data
=
new
HashMap
<>();
/**
...
...
src/main/java/com/neotel/smfcore/core/device/handler/impl/DUOBoxHandler.java
0 → 100644
查看文件 @
13d6993
package
com
.
neotel
.
smfcore
.
core
.
device
.
handler
.
impl
;
import
com.neotel.smfcore.core.storage.enums.DeviceType
;
import
io.swagger.annotations.Api
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.RestController
;
@Api
(
tags
=
"DUO料仓"
)
@RestController
@Slf4j
public
class
DUOBoxHandler
extends
XLRBoxHandler
{
@Override
public
DeviceType
getDeviceType
()
{
return
DeviceType
.
SMD_DUO
;
}
}
src/main/java/com/neotel/smfcore/core/device/rest/DeviceController.java
查看文件 @
13d6993
...
...
@@ -25,6 +25,7 @@ import com.neotel.smfcore.core.device.bean.PosInfo;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.message.util.DeviceMessageUtil
;
import
com.neotel.smfcore.core.order.service.po.LiteOrder
;
import
com.neotel.smfcore.core.storage.service.manager.IStorageManager
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.system.service.dao.IAlarmInfoDao
;
...
...
@@ -70,6 +71,9 @@ public class DeviceController {
private
IStoragePosManager
storagePosManager
;
@Autowired
private
IStorageManager
storageManager
;
@Autowired
private
IComponentManager
componentManager
;
@Autowired
...
...
@@ -102,6 +106,27 @@ public class DeviceController {
log
.
error
(
"料仓cid: ["
+
cid
+
"]不存在"
);
return
null
;
}
try
{
//判断是否需要更改附属CID
if
(
ObjectUtil
.
isNotEmpty
(
statusBean
.
getAppendCid
())){
boolean
needsave
=
false
;
if
(
ObjectUtil
.
isEmpty
(
storage
.
getAppendCid
())
){
needsave
=
true
;
log
.
info
(
"料仓["
+
cid
+
"] 更改 appendCid ="
+
statusBean
.
getAppendCid
());
}
else
if
(
!(
storage
.
getAppendCid
().
equals
(
statusBean
.
getAppendCid
()))){
needsave
=
true
;
log
.
info
(
"料仓["
+
cid
+
"] 更改 appendCid ="
+
statusBean
.
getAppendCid
()+
", 原来 appendCid ="
+
storage
.
getAppendCid
());
}
if
(
needsave
)
{
storage
.
setAppendCid
(
statusBean
.
getAppendCid
());
storageManager
.
save
(
storage
);
dataCache
.
reloadStorage
(
storage
,
storage
.
getCid
());
}
}
}
catch
(
Exception
ex
){
log
.
error
(
"更改cid=的appendId出错:"
+
ex
.
toString
());
}
synchronized
(
storage
)
{
String
deviceType
=
storage
.
getType
();
IDeviceHandler
deviceHandler
=
handlerMap
.
get
(
deviceType
);
...
...
src/main/java/com/neotel/smfcore/core/equipment/rest/EquipViewController.java
查看文件 @
13d6993
...
...
@@ -65,6 +65,9 @@ public class EquipViewController {
if
(
showMsg
==
null
){
showMsg
=
bean
.
getMsgByType
(
MessageType
.
INFO
.
name
());
}
if
(
showMsg
==
null
){
showMsg
=
bean
.
getMsgByType
(
MessageType
.
SHOW
.
name
());
}
if
(
showMsg
!=
null
){
dto
.
setMsg
(
showMsg
.
getShowMsg
(
locale
));
}
...
...
src/main/java/com/neotel/smfcore/core/message/enums/MessageType.java
查看文件 @
13d6993
...
...
@@ -21,4 +21,8 @@ public enum MessageType {
* 3 设备操作数据
*/
DATA
,
/**
* 4 显示数据,仅显示不保存
*/
SHOW
,
}
src/main/java/com/neotel/smfcore/core/msd/rest/MSDController.java
查看文件 @
13d6993
...
...
@@ -87,6 +87,30 @@ public class MSDController {
@GetMapping
(
"/settings"
)
@PreAuthorize
(
"@el.check('msd')"
)
public
MSDSettiingsDto
getSysSettings
()
{
// MSDSettiings msdSettiings = dataCache.getCache(Constants.CACHE_msdSetting);
// if(msdSettiings==null){
// msdSettiings=new MSDSettiings() ;
// String[] levels=new String[]{"1","2","2a","3","4","5","5a","6"};
// List<MSLSetInfo> list=new ArrayList<>();
// for (String level :
// levels) {
// MSLSetInfo setInfo=new MSLSetInfo() ;
// setInfo.setMsl(level);
// setInfo.setThickness("1");
// setInfo.setTimeHour(48);
// list.add(setInfo);
//
// }
// msdSettiings.setMslSetList(list);
// dataCache.updateCache(Constants.CACHE_msdSetting, msdSettiings);
// log.info("默认MSD:CACHE_msdSetting=" + msdSettiings.toString());
// }
MSDSettiings
msdSettiings
=
getSetting
();
MSDSettiingsDto
dto
=
msdSettingsMapper
.
toDto
(
msdSettiings
);
return
dto
;
}
private
MSDSettiings
getSetting
(){
MSDSettiings
msdSettiings
=
dataCache
.
getCache
(
Constants
.
CACHE_msdSetting
);
if
(
msdSettiings
==
null
){
msdSettiings
=
new
MSDSettiings
()
;
...
...
@@ -105,8 +129,7 @@ public class MSDController {
dataCache
.
updateCache
(
Constants
.
CACHE_msdSetting
,
msdSettiings
);
log
.
info
(
"默认MSD:CACHE_msdSetting="
+
msdSettiings
.
toString
());
}
MSDSettiingsDto
dto
=
msdSettingsMapper
.
toDto
(
msdSettiings
);
return
dto
;
return
msdSettiings
;
}
@ApiOperation
(
"修改MSD设置信息"
)
...
...
@@ -116,11 +139,11 @@ public class MSDController {
MSDSettiings
settiings
=
msdSettingsMapper
.
toEntity
(
msdSettiingsDto
);
if
(
settiings
.
getMaxHumidity
()
<=
settiings
.
getMinHumidity
())
{
throw
new
ValidateException
(
"smfcore.
humidityValueError"
,
"温
度范围数据错误"
);
throw
new
ValidateException
(
"smfcore.
temperatureValueError"
,
"湿
度范围数据错误"
);
}
if
(
settiings
.
getMaxTemperature
()
<=
settiings
.
getMinTemperature
())
{
throw
new
ValidateException
(
"smfcore.
temperatureValueError"
,
"湿
度范围数据错误"
);
throw
new
ValidateException
(
"smfcore.
humidityValueError"
,
"温
度范围数据错误"
);
}
dataCache
.
updateCache
(
Constants
.
CACHE_msdSetting
,
settiings
);
log
.
info
(
"更改MSD:CACHE_msdSetting="
+
settiings
.
toString
());
...
...
@@ -128,6 +151,35 @@ public class MSDController {
}
@ApiOperation
(
"修改MSD设置预警湿度信息"
)
@PutMapping
(
"/settings/maxHumidity"
)
@PreAuthorize
(
"@el.check('msd')"
)
public
ResultBean
updateMaxHumidity
(
float
maxHumidity
)
{
MSDSettiings
settiings
=
getSetting
();
settiings
.
setMaxHumidity
(
maxHumidity
);
if
(
settiings
.
getMaxHumidity
()
<=
settiings
.
getMinHumidity
())
{
throw
new
ValidateException
(
"smfcore.temperatureValueError"
,
"湿度范围数据错误"
);
}
dataCache
.
updateCache
(
Constants
.
CACHE_msdSetting
,
settiings
);
log
.
info
(
"更改MSD maxHumidity:CACHE_msdSetting="
+
settiings
.
toString
());
return
ResultBean
.
newOkResult
(
"保存成功"
);
}
@ApiOperation
(
"修改MSD设置预警溫度信息"
)
@PutMapping
(
"/settings/maxTemperature"
)
@PreAuthorize
(
"@el.check('msd')"
)
public
ResultBean
updateMaxTemperature
(
float
maxTemperature
)
{
MSDSettiings
settiings
=
getSetting
();
settiings
.
setMaxTemperature
(
maxTemperature
);
if
(
settiings
.
getMaxTemperature
()
<=
settiings
.
getMinTemperature
())
{
throw
new
ValidateException
(
"smfcore.humidityValueError"
,
"温度范围数据错误"
);
}
dataCache
.
updateCache
(
Constants
.
CACHE_msdSetting
,
settiings
);
log
.
info
(
"更改MSD maxTemperature:CACHE_msdSetting="
+
settiings
.
toString
());
return
ResultBean
.
newOkResult
(
"保存成功"
);
}
@ApiOperation
(
"MSD库存数据查询"
)
@GetMapping
(
"/query"
)
@PreAuthorize
(
"@el.check('msd')"
)
...
...
src/main/java/com/neotel/smfcore/core/storage/service/po/Storage.java
查看文件 @
13d6993
...
...
@@ -24,6 +24,10 @@ public class Storage extends BasePo implements Serializable {
*/
private
String
sourcePath
;
private
String
cid
;
/**
* 附属CID
*/
private
String
appendCid
;
private
int
totalSlots
;
private
int
emptySlots
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论