Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit b35a9306
由
zshaohui
编写于
2024-01-04 14:11:20 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.增加忽略流水线检查配置
2.流水线 增加errorCode 黑灯工厂
1 个父辈
3c64092e
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
131 行增加
和
51 行删除
src/main/java/com/neotel/smfcore/common/utils/Constants.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/SisoBoxHandler.java
src/main/java/com/neotel/smfcore/core/equipment/bean/EquipMsg.java
src/main/java/com/neotel/smfcore/core/equipment/bean/EquipStatus.java
src/main/java/com/neotel/smfcore/core/equipment/bean/EquipStatusBean.java
src/main/java/com/neotel/smfcore/core/system/rest/SettingsController.java
src/main/java/com/neotel/smfcore/core/system/rest/bean/dto/SysSettingsDto.java
src/main/java/com/neotel/smfcore/custom/lizhen/kafka/config/KafkaConfig.java
src/main/java/com/neotel/smfcore/custom/lizhen/kafka/service/KafkaService.java
src/main/java/com/neotel/smfcore/common/utils/Constants.java
查看文件 @
b35a930
...
...
@@ -185,4 +185,9 @@ public class Constants {
* 迈征配置分钟
*/
public
static
final
String
CACHE_maiZhengMinute
=
"maiZhengMinute"
;
/**
* 是否忽略流水线检查
*/
public
static
final
String
CACHE_ignoreLineCheck
=
"ignoreLineCheck"
;
}
src/main/java/com/neotel/smfcore/core/device/handler/impl/SisoBoxHandler.java
查看文件 @
b35a930
package
com
.
neotel
.
smfcore
.
core
.
device
.
handler
.
impl
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.enums.OP
;
import
com.neotel.smfcore.core.storage.enums.DeviceType
;
...
...
@@ -39,6 +40,12 @@ public class SisoBoxHandler extends BaseDeviceHandler {
statusBean
=
taskService
.
checkOut
(
storage
,
statusBean
);
}
Boolean
ignoreLineCheck
=
dataCache
.
getCache
(
Constants
.
CACHE_ignoreLineCheck
);
if
(
ignoreLineCheck
==
null
){
ignoreLineCheck
=
false
;
}
statusBean
.
addData
(
"ignoreLineCheck"
,
ignoreLineCheck
.
toString
());
return
statusBean
;
}
@Override
...
...
src/main/java/com/neotel/smfcore/core/equipment/bean/EquipMsg.java
查看文件 @
b35a930
...
...
@@ -27,6 +27,12 @@ public class EquipMsg {
* 消息内容
*/
private
String
msg
;
/**
* 错误码
*/
private
String
errorCode
;
/**
* 参数
*/
...
...
src/main/java/com/neotel/smfcore/core/equipment/bean/EquipStatus.java
0 → 100644
查看文件 @
b35a930
package
com
.
neotel
.
smfcore
.
core
.
equipment
.
bean
;
import
lombok.Data
;
@Data
public
class
EquipStatus
{
private
String
module
;
private
int
status
;
}
src/main/java/com/neotel/smfcore/core/equipment/bean/EquipStatusBean.java
查看文件 @
b35a930
...
...
@@ -39,6 +39,8 @@ public class EquipStatusBean implements Serializable {
private
List
<
EquipMsg
>
msgList
=
new
ArrayList
<>();
private
List
<
EquipStatus
>
statusList
=
new
ArrayList
<>();
/**
* 发上来的数据
*/
...
...
src/main/java/com/neotel/smfcore/core/system/rest/SettingsController.java
查看文件 @
b35a930
...
...
@@ -79,6 +79,11 @@ public class SettingsController {
Integer
preGenerateTaskTimes
=
dataCache
.
getCache
(
Constants
.
CACHE_preGenerateTask_Times
);
List
<
LineConfig
>
lineConfigList
=
dataCache
.
getCache
(
Constants
.
CACHE_lineConfigList
);
Integer
maiZhengMinute
=
dataCache
.
getCache
(
Constants
.
CACHE_maiZhengMinute
);
Boolean
ignoreLineCheck
=
dataCache
.
getCache
(
Constants
.
CACHE_ignoreLineCheck
);
if
(
ignoreLineCheck
==
null
){
ignoreLineCheck
=
false
;
dataCache
.
updateCache
(
Constants
.
CACHE_ignoreLineCheck
,
ignoreLineCheck
);
}
SysSettingsDto
dto
=
new
SysSettingsDto
();
dto
.
setStartJob
(
startJob
);
...
...
@@ -90,6 +95,7 @@ public class SettingsController {
dto
.
setPreGenerateTaskTimes
(
preGenerateTaskTimes
);
dto
.
setLineConfigList
(
lineConfigList
);
dto
.
setMaiZhengMinute
(
maiZhengMinute
);
dto
.
setIgnoreLineCheck
(
ignoreLineCheck
);
return
dto
;
}
...
...
@@ -114,6 +120,9 @@ public class SettingsController {
if
(
sysSettingsDto
.
getMaiZhengMinute
()
!=
null
)
{
dataCache
.
updateCache
(
Constants
.
CACHE_maiZhengMinute
,
sysSettingsDto
.
getMaiZhengMinute
());
}
dataCache
.
updateCache
(
Constants
.
CACHE_ignoreLineCheck
,
sysSettingsDto
.
isIgnoreLineCheck
());
log
.
info
(
"更改系统设置:stopout="
+
sysSettingsDto
.
isStopOut
()
+
",stopjob="
+
sysSettingsDto
.
isStartJob
()
+
",backUpMonth="
+
sysSettingsDto
.
getBackUpMonth
()
+
",preGenerateTask="
+
sysSettingsDto
.
getPreGenerateTask
()
...
...
@@ -122,6 +131,7 @@ public class SettingsController {
+
",preGenerateTaskTimes="
+
sysSettingsDto
.
getPreGenerateTaskTimes
()
+
",lineConfigList="
+
sysSettingsDto
.
getLineConfigList
()
+
",maiZhengMinute="
+
sysSettingsDto
.
getMaiZhengMinute
()
+
",ignoreLineCheck="
+
sysSettingsDto
.
isIgnoreLineCheck
()
);
return
ResultBean
.
newOkResult
(
"保存成功"
);
}
...
...
src/main/java/com/neotel/smfcore/core/system/rest/bean/dto/SysSettingsDto.java
查看文件 @
b35a930
...
...
@@ -40,6 +40,9 @@ public class SysSettingsDto implements Serializable {
@ApiModelProperty
(
"迈征配置时间"
)
private
Integer
maiZhengMinute
;
@ApiModelProperty
(
"是否忽略流水线检查"
)
private
boolean
ignoreLineCheck
=
false
;
}
src/main/java/com/neotel/smfcore/custom/lizhen/kafka/config/KafkaConfig.java
查看文件 @
b35a930
...
...
@@ -16,4 +16,8 @@ public class KafkaConfig {
* MachineParameter
*/
public
static
final
String
MACHINEPARAMETER_TOPIC
=
"MachineParameter"
;
public
static
final
String
LINE_CID
=
"line"
;
}
src/main/java/com/neotel/smfcore/custom/lizhen/kafka/service/KafkaService.java
查看文件 @
b35a930
...
...
@@ -10,9 +10,13 @@ import com.neotel.smfcore.core.device.enums.BOX_STATUS;
import
com.neotel.smfcore.core.device.enums.OP
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.equipment.bean.EquipMsg
;
import
com.neotel.smfcore.core.equipment.bean.EquipStatus
;
import
com.neotel.smfcore.core.equipment.bean.EquipStatusBean
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.system.service.manager.IDataLogManager
;
import
com.neotel.smfcore.core.system.util.DevicesStatusUtil
;
import
com.neotel.smfcore.core.system.util.EquipStatusUtil
;
import
com.neotel.smfcore.custom.lizhen.innerBox.bean.StorageExport
;
import
com.neotel.smfcore.custom.lizhen.innerBox.util.StorageExportUtil
;
import
com.neotel.smfcore.custom.lizhen.kafka.bean.Heartbeat
;
...
...
@@ -202,35 +206,64 @@ public class KafkaService {
@Scheduled
(
fixedRate
=
1000
*
60
*
1
)
public
void
setStorageExportStatus
()
{
log
.
info
(
"发送出料口信息开始"
);
for
(
Map
.
Entry
<
String
,
StorageExport
>
exportEntry
:
StorageExportUtil
.
exportMap
.
entrySet
())
{
if
(
exportEntry
.
getKey
().
contains
(
StorageExportUtil
.
OUT_STATION
))
{
continue
;
}
//默认是等待中2,禁用是故障3,有任务是运行1
String
currentStatus
=
"2"
;
StorageExport
export
=
exportEntry
.
getValue
();
if
(
export
.
isDisable
())
{
currentStatus
=
"3"
;
}
else
{
if
(
StringUtils
.
isNotBlank
(
export
.
getHSerial
()))
{
currentStatus
=
"1"
;
EquipStatusBean
statusBean
=
EquipStatusUtil
.
getStatusBean
(
KafkaConfig
.
LINE_CID
);
List
<
EquipStatus
>
statusList
=
statusBean
.
getStatusList
();
List
<
EquipMsg
>
msgList
=
statusBean
.
getMsgList
();
if
(
statusList
!=
null
&&
!
statusList
.
isEmpty
())
{
for
(
EquipStatus
equipStatus
:
statusList
)
{
int
status
=
equipStatus
.
getStatus
();
//状态
String
module
=
equipStatus
.
getModule
();
//出口
String
currentStatus
=
"1"
;
//正常
if
(
2
==
status
||
3
==
status
)
{
currentStatus
=
"3"
;
//故障
}
if
(
0
==
status
)
{
currentStatus
=
"5"
;
}
}
MachineStatus
status
=
new
MachineStatus
();
String
dateStr
=
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss.SSS"
);
status
.
setOccurrenceTime
(
dateStr
);
status
.
setMachineID
(
StorageExportConfig
.
getMachineId
(
exportEntry
.
getKey
()));
status
.
setTopicType
(
KafkaConfig
.
MACHINESTATUS_TOPIC
);
status
.
setCurrentStatus
(
currentStatus
);
status
.
setErrorCode
(
""
);
status
.
setErrorMsg
(
""
);
status
.
setClientIP
(
""
);
String
statusStr
=
JSON
.
toJSONString
(
status
);
log
.
info
(
"出料口主题为:"
+
KafkaConfig
.
MACHINESTATUS_TOPIC
+
"内容为:"
+
statusStr
);
ListenableFuture
future
=
kafkaTemplate
.
send
(
KafkaConfig
.
MACHINESTATUS_TOPIC
,
statusStr
);
log
.
info
(
"出料口返回结果为:"
+
JSON
.
toJSONString
(
future
));
List
<
EquipMsg
>
equipMsgList
=
new
ArrayList
<>();
if
(
msgList
!=
null
&&
!
msgList
.
isEmpty
())
{
for
(
EquipMsg
equipMsg
:
msgList
)
{
if
(
module
.
equals
(
equipMsg
.
getModule
()))
{
equipMsgList
.
add
(
equipMsg
);
}
}
}
if
(
equipMsgList
!=
null
&&
!
equipMsgList
.
isEmpty
())
{
for
(
EquipMsg
equipMsg
:
equipMsgList
)
{
MachineStatus
machineStatus
=
new
MachineStatus
();
String
dateStr
=
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss.SSS"
);
machineStatus
.
setOccurrenceTime
(
dateStr
);
machineStatus
.
setMachineID
(
StorageExportConfig
.
getMachineId
(
module
));
machineStatus
.
setTopicType
(
KafkaConfig
.
MACHINESTATUS_TOPIC
);
machineStatus
.
setCurrentStatus
(
currentStatus
);
machineStatus
.
setErrorCode
(
equipMsg
.
getErrorCode
());
machineStatus
.
setErrorMsg
(
equipMsg
.
getMsg
());
machineStatus
.
setClientIP
(
""
);
String
statusStr
=
JSON
.
toJSONString
(
machineStatus
);
log
.
info
(
"出料口主题为:"
+
KafkaConfig
.
MACHINESTATUS_TOPIC
+
"内容为:"
+
statusStr
);
ListenableFuture
future
=
kafkaTemplate
.
send
(
KafkaConfig
.
MACHINESTATUS_TOPIC
,
statusStr
);
log
.
info
(
"出料口返回结果为:"
+
JSON
.
toJSONString
(
future
));
}
}
else
{
MachineStatus
machineStatus
=
new
MachineStatus
();
String
dateStr
=
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss.SSS"
);
machineStatus
.
setOccurrenceTime
(
dateStr
);
machineStatus
.
setMachineID
(
StorageExportConfig
.
getMachineId
(
module
));
machineStatus
.
setTopicType
(
KafkaConfig
.
MACHINESTATUS_TOPIC
);
machineStatus
.
setCurrentStatus
(
currentStatus
);
machineStatus
.
setErrorCode
(
""
);
machineStatus
.
setErrorMsg
(
""
);
machineStatus
.
setClientIP
(
""
);
String
statusStr
=
JSON
.
toJSONString
(
machineStatus
);
log
.
info
(
"出料口主题为:"
+
KafkaConfig
.
MACHINESTATUS_TOPIC
+
"内容为:"
+
statusStr
);
ListenableFuture
future
=
kafkaTemplate
.
send
(
KafkaConfig
.
MACHINESTATUS_TOPIC
,
statusStr
);
log
.
info
(
"出料口返回结果为:"
+
JSON
.
toJSONString
(
future
));
}
}
}
log
.
info
(
"发送出料口信息结束"
);
}
...
...
@@ -242,32 +275,30 @@ public class KafkaService {
@Scheduled
(
fixedRate
=
1000
*
60
*
5
)
public
void
setStorageHeartbeat
()
{
log
.
info
(
"发送出料口心跳开始"
);
for
(
Map
.
Entry
<
String
,
StorageExport
>
exportEntry
:
StorageExportUtil
.
exportMap
.
entrySet
())
{
if
(
exportEntry
.
getKey
().
contains
(
StorageExportUtil
.
OUT_STATION
))
{
continue
;
}
//默认是等待中2,禁用是故障3,有任务是运行1
String
currentStatus
=
"2"
;
StorageExport
export
=
exportEntry
.
getValue
();
if
(
export
.
isDisable
())
{
currentStatus
=
"3"
;
}
else
{
if
(
StringUtils
.
isNotBlank
(
export
.
getHSerial
()))
{
currentStatus
=
"1"
;
EquipStatusBean
statusBean
=
EquipStatusUtil
.
getStatusBean
(
KafkaConfig
.
LINE_CID
);
List
<
EquipStatus
>
statusList
=
statusBean
.
getStatusList
();
if
(
statusList
!=
null
&&
!
statusList
.
isEmpty
())
{
for
(
EquipStatus
equipStatus
:
statusList
)
{
int
status
=
equipStatus
.
getStatus
();
//状态
String
module
=
equipStatus
.
getModule
();
//出口
String
currentStatus
=
"1"
;
//正常
if
(
2
==
status
||
3
==
status
)
{
currentStatus
=
"3"
;
//故障
}
if
(
0
==
status
)
{
currentStatus
=
"5"
;
//离线
}
if
(
"1"
.
equals
(
currentStatus
))
{
Heartbeat
heartbeat
=
new
Heartbeat
();
String
dateStr
=
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss.SSS"
);
heartbeat
.
setOccurrenceTime
(
dateStr
);
heartbeat
.
setMachineID
(
StorageExportConfig
.
getMachineId
(
module
));
heartbeat
.
setTopicType
(
KafkaConfig
.
HEARTBEAT_TOPIC
);
String
statusStr
=
JSON
.
toJSONString
(
heartbeat
);
log
.
info
(
"出料口主题为:"
+
KafkaConfig
.
HEARTBEAT_TOPIC
+
"内容为:"
+
statusStr
);
ListenableFuture
future
=
kafkaTemplate
.
send
(
KafkaConfig
.
HEARTBEAT_TOPIC
,
statusStr
);
log
.
info
(
"出料口返回结果为:"
+
JSON
.
toJSONString
(
future
));
}
}
if
(!
"3"
.
equals
(
currentStatus
))
{
Heartbeat
heartbeat
=
new
Heartbeat
();
String
dateStr
=
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss.SSS"
);
heartbeat
.
setOccurrenceTime
(
dateStr
);
heartbeat
.
setMachineID
(
StorageExportConfig
.
getMachineId
(
exportEntry
.
getKey
()));
heartbeat
.
setTopicType
(
KafkaConfig
.
HEARTBEAT_TOPIC
);
String
statusStr
=
JSON
.
toJSONString
(
heartbeat
);
log
.
info
(
"出料口主题为:"
+
KafkaConfig
.
HEARTBEAT_TOPIC
+
"内容为:"
+
statusStr
);
ListenableFuture
future
=
kafkaTemplate
.
send
(
KafkaConfig
.
HEARTBEAT_TOPIC
,
statusStr
);
log
.
info
(
"出料口返回结果为:"
+
JSON
.
toJSONString
(
future
));
}
}
log
.
info
(
"发送出料口心跳结束"
);
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论