Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
Z
zhmes-agecal
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
耿迪迪
zhmes-agecal
Commits
9550623c
Commit
9550623c
authored
Sep 17, 2025
by
wanghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 老化柜界面调整及 五分钟巡检任务调整。
parent
389633da
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
20 deletions
+56
-20
NettyUdpServerHandler.java
...om/zehong/system/netty/handler/NettyUdpServerHandler.java
+6
-14
RobotArmCommandServiceImpl.java
...ehong/system/service/impl/RobotArmCommandServiceImpl.java
+25
-1
AgingCabinetBoard.vue
...cal-web/src/views/screen/components/AgingCabinetBoard.vue
+25
-5
No files found.
zhmes-agecal-system/src/main/java/com/zehong/system/netty/handler/NettyUdpServerHandler.java
View file @
9550623c
...
...
@@ -41,11 +41,7 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
// 日期格式器,用于生成文件名和日志时间
private
static
final
SimpleDateFormat
DATE_FORMATTER
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
private
static
final
SimpleDateFormat
TIME_FORMATTER
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
// 添加状态跟踪变量
private
volatile
boolean
isProcessingCommand
=
false
;
private
volatile
long
lastActivityTime
=
System
.
currentTimeMillis
();
private
volatile
long
lastIdleTime
=
System
.
currentTimeMillis
();
/**
* 当前正在处理的指令信息
...
...
@@ -140,20 +136,21 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
// 处理指令完成
if
(
status
.
isFullyIdle
())
{
// 记录详细状态
log
.
debug
(
"机械臂状态: code={}, text={}, position=({},{},{},{})"
,
status
.
getCode
(),
status
.
getText
(),
status
.
getX
(),
status
.
getY
(),
status
.
getZ
(),
status
.
getR
());
CommandExecution
execution
=
currentCommands
.
get
(
"127.0.0.1"
);
if
(
execution
!=
null
)
{
robotArmCommandService
.
completeCommand
(
execution
.
commandId
);
currentCommands
.
remove
(
sender
);
currentCommands
.
remove
(
"127.0.0.1"
);
log
.
info
(
"指令完成: {}"
,
execution
.
commandId
);
}
}
else
{
log
.
info
(
"status.isFullyIdle() = false"
);
}
// 记录详细状态
log
.
debug
(
"机械臂状态: code={}, text={}, position=({},{},{},{})"
,
status
.
getCode
(),
status
.
getText
(),
status
.
getX
(),
status
.
getY
(),
status
.
getZ
(),
status
.
getR
());
}
/**
* 记录当前执行的指令
...
...
@@ -168,9 +165,6 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
private
void
handleFullyIdleState
()
{
// 重置空闲计时
lastIdleTime
=
System
.
currentTimeMillis
();
// 处理待执行指令
robotArmCommandService
.
processPendingCommands
();
}
...
...
@@ -213,8 +207,6 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
long
now
=
System
.
currentTimeMillis
();
long
idleDuration
=
now
-
lastActivityTime
;
log
.
info
(
"UDP通道空闲: {}ms"
,
idleDuration
);
// 如果长时间空闲(>2秒)
if
(
idleDuration
>
20000
)
{
handleLongIdleState
();
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/service/impl/RobotArmCommandServiceImpl.java
View file @
9550623c
...
...
@@ -6,6 +6,10 @@ import java.net.SocketAddress;
import
java.net.UnknownHostException
;
import
java.util.Date
;
import
java.util.List
;
import
com.serotonin.modbus4j.ModbusMaster
;
import
com.serotonin.modbus4j.exception.ModbusInitException
;
import
com.serotonin.modbus4j.exception.ModbusTransportException
;
import
com.zehong.common.utils.DateUtils
;
import
com.zehong.common.utils.StringUtils
;
import
com.zehong.system.domain.TEquipmentInfo
;
...
...
@@ -106,7 +110,7 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
// boolean[] roboticArmExitConveyorData = Modbus4jUtils.getRoboticArmExitConveyorData();
// if(roboticArmExitConveyorData[1]) {
log
.
info
(
"开始处理
上料指令: {}"
,
loadingCommands
.
get
(
0
));
log
.
info
(
"开始处理
下料指令: {}"
,
un
loadingCommands
.
get
(
0
));
sendCommand
(
unloadingCommands
.
get
(
0
),
"UNLOAD"
);
// }
}
...
...
@@ -119,6 +123,26 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
command
.
setStartExecutionTime
(
new
Date
());
robotArmCommandMapper
.
updateRobotArmCommand
(
command
);
// 如果是下料,则 先断电再去下料
if
(
"UNLOAD"
.
equals
(
commandType
))
{
String
trayCode
=
command
.
getTrayCode
();
String
[]
split
=
trayCode
.
split
(
"-"
);
TEquipmentInfo
tEquipmentInfo
=
equipmentInfoMapper
.
selectTEquipmentInfoByCode
(
split
[
0
]);
int
layer
=
Integer
.
parseInt
(
split
[
0
]);
try
{
ModbusMaster
master
=
Modbus4jUtils
.
getMaster
(
tEquipmentInfo
.
getfPowerOutageIp
(),
tEquipmentInfo
.
getfPowerOutagePort
());
Modbus4jUtils
.
writeCoil
(
master
,
1
,
layer
,
false
);
log
.
info
(
"已发送断电指令 - 设备:{} 层:{}"
,
tEquipmentInfo
.
getfEquipmentCode
(),
layer
);
master
.
destroy
();
}
catch
(
ModbusTransportException
|
ModbusInitException
e
)
{
log
.
info
(
"下料发送断电指令失败 - 设备:{} 层:{}"
,
tEquipmentInfo
.
getfEquipmentCode
(),
layer
);
throw
new
RuntimeException
(
e
);
}
}
// 通过WebSocket广播更新
robotArmWebSocketHandler
.
broadcastCommandUpdate
();
...
...
zhmes-agecal-web/src/views/screen/components/AgingCabinetBoard.vue
View file @
9550623c
...
...
@@ -34,7 +34,7 @@
<!-- 每行渲染6个卡片 -->
<el-col
:span=
"4"
v-for=
"
item
in row"
v-for=
"
(item, colIndex)
in row"
:key=
"item.fEquipmentId"
style=
"margin-bottom: 20px; text-align: center;"
>
...
...
@@ -56,7 +56,9 @@
font-weight: bold;"
@
click
.
native=
"handleCardClick(item)"
>
{{
item
.
fEquipmentCode
+
"号柜"
}}
<!--
{{
item
.
fEquipmentCode
+
"号柜"
}}
-->
<!-- 核心:调用方法生成编号,传入总索引 = 行索引*6 + 列索引 -->
{{
getCabinetNumber
(
rowIndex
*
6
+
colIndex
)
}}
</el-card>
</el-tooltip>
</el-col>
...
...
@@ -103,7 +105,19 @@ export default {
this
.
initWebSocket
();
// 初始化WebSocket连接
},
methods
:
{
// 新增:计算柜子编号(北-XX / 南-XX)
getCabinetNumber
(
totalIndex
)
{
if
(
totalIndex
<
15
)
{
// 前15个(索引0-14):北-1 ~ 北-15
return
`北-
${
totalIndex
+
1
}
`
;
}
else
if
(
totalIndex
<
30
)
{
// 16-30个(索引15-29):南-1 ~ 南-15
return
`南-
${
totalIndex
-
15
+
1
}
`
;
// 15对应南-1,29对应南-15
}
else
{
// 超过30个的情况(可选扩展)
return
`其他-
${
totalIndex
+
1
}
`
;
}
},
// 初始化WebSocket连接
initWebSocket
()
{
// 从环境变量获取基础URL,默认使用Nginx代理地址
...
...
@@ -128,7 +142,10 @@ export default {
const
message
=
JSON
.
parse
(
event
.
data
);
// 只处理老化柜数据类型的消息
if
(
message
.
type
===
'aging_cabinet_data'
)
{
this
.
cabinets
=
message
.
data
;
// 更新数据,自动触发cabinetRows重新计算
// 按fEquipmentCode升序排序(假设fEquipmentCode是1~30的数字字符串)
this
.
cabinets
=
message
.
data
.
sort
((
a
,
b
)
=>
{
return
Number
(
a
.
fEquipmentCode
)
-
Number
(
b
.
fEquipmentCode
);
});
console
.
log
(
'收到老化柜更新数据,共'
,
message
.
data
.
length
,
'条'
);
}
}
catch
(
e
)
{
...
...
@@ -168,7 +185,10 @@ export default {
// 开始加载:显示全局loading
this
.
pageLoading
=
true
;
getAllEquipmentList
().
then
(
response
=>
{
this
.
cabinets
=
response
;
// 按fEquipmentCode升序排序(假设fEquipmentCode是1~30的数字字符串)
this
.
cabinets
=
response
.
sort
((
a
,
b
)
=>
{
return
Number
(
a
.
fEquipmentCode
)
-
Number
(
b
.
fEquipmentCode
);
});
this
.
pageLoading
=
false
;
})
},
...
...
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