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
ee9a8ec3
Commit
ee9a8ec3
authored
Nov 21, 2025
by
wanghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 设置 直接 发下料指令
2 增加 接受 标定的 udp 消息的方法,
parent
ae08d61e
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
127 additions
and
27 deletions
+127
-27
TStoreyInfoController.java
...ehong/web/controller/equipment/TStoreyInfoController.java
+8
-0
application.yml
zhmes-agecal-admin/src/main/resources/application.yml
+1
-1
NettyUdpServerHandler.java
...om/zehong/system/netty/handler/NettyUdpServerHandler.java
+71
-19
ITStoreyInfoService.java
...n/java/com/zehong/system/service/ITStoreyInfoService.java
+2
-0
TStoreyInfoServiceImpl.java
...om/zehong/system/service/impl/TStoreyInfoServiceImpl.java
+12
-0
storey.js
zhmes-agecal-web/src/api/storey/storey.js
+7
-0
index.vue
zhmes-agecal-web/src/views/storey/index.vue
+26
-7
No files found.
zhmes-agecal-admin/src/main/java/com/zehong/web/controller/equipment/TStoreyInfoController.java
View file @
ee9a8ec3
...
...
@@ -96,6 +96,14 @@ public class TStoreyInfoController extends BaseController
return
tStoreyInfoService
.
handleBlanking
(
command
);
}
/**
* 处理直接消 blanking
*/
@GetMapping
(
value
=
"/handleDirectBlanking/{command}"
)
public
AjaxResult
handleDirectBlanking
(
@PathVariable
(
"command"
)
String
command
)
{
return
tStoreyInfoService
.
handleDirectBlanking
(
command
);
}
/**
* 批量读取老化柜状态
*/
...
...
zhmes-agecal-admin/src/main/resources/application.yml
View file @
ee9a8ec3
...
...
@@ -26,7 +26,7 @@ spring:
# 国际化资源文件路径
basename
:
i18n/messages
profiles
:
active
:
dev
active
:
test
# 文件上传
servlet
:
multipart
:
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/netty/handler/NettyUdpServerHandler.java
View file @
ee9a8ec3
...
...
@@ -97,10 +97,54 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
// 记录最后活动时间
lastActivityTime
=
System
.
currentTimeMillis
();
// 判断消息类型并进行相应处理
if
(
correctMessage
.
startsWith
(
"calibration"
))
{
// 处理校准消息
handleCalibrationMessage
(
ctx
,
packet
,
correctMessage
);
}
else
{
// 处理普通状态消息(原有逻辑)
handleNormalMessage
(
ctx
,
packet
,
correctMessage
);
}
// // 解析消息
// RobotArmMessageParser.RobotArmStatus status =
// RobotArmMessageParser.parseMessage(correctMessage);
//
// if (status != null) {
// // 处理状态消息
// processStatusMessage(status);
//
// // 检查是否为完全空闲状态
// if (status.isFullyIdle()) {
// handleFullyIdleState();
// }
// }
//
// // 回复客户端
// byte[] responseBytes = response.getBytes(StandardCharsets.UTF_8);
// ctx.writeAndFlush(new DatagramPacket(
// io.netty.buffer.Unpooled.copiedBuffer(responseBytes),
// packet.sender()));
}
catch
(
Exception
e
)
{
log
.
error
(
"处理UDP消息异常"
,
e
);
// 出现异常时发送故障状态
sendStatusToWebSocket
(
"error"
);
}
}
/**
* 处理普通状态消息(原有逻辑)
*/
private
void
handleNormalMessage
(
ChannelHandlerContext
ctx
,
DatagramPacket
packet
,
String
message
)
{
// 回复客户端
String
response
=
"服务器已收到UDP消息:"
+
message
;
byte
[]
responseBytes
=
response
.
getBytes
(
StandardCharsets
.
UTF_8
);
ctx
.
writeAndFlush
(
new
DatagramPacket
(
io
.
netty
.
buffer
.
Unpooled
.
copiedBuffer
(
responseBytes
),
packet
.
sender
()));
// 解析消息
RobotArmMessageParser
.
RobotArmStatus
status
=
RobotArmMessageParser
.
parseMessage
(
correctM
essage
);
RobotArmMessageParser
.
parseMessage
(
m
essage
);
if
(
status
!=
null
)
{
// 处理状态消息
...
...
@@ -111,20 +155,28 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
handleFullyIdleState
();
}
}
}
// 回复客户端
/**
* 处理校准消息
*/
private
void
handleCalibrationMessage
(
ChannelHandlerContext
ctx
,
DatagramPacket
packet
,
String
message
)
{
// TODO: 实现校准消息的具体处理逻辑
log
.
info
(
"收到校准消息: {}"
,
message
);
// 示例:解析校准数据
// String calibrationData = message.substring("calibration".length()).trim();
// 示例:回复校准确认
String
response
=
"校准消息已接收"
;
byte
[]
responseBytes
=
response
.
getBytes
(
StandardCharsets
.
UTF_8
);
ctx
.
writeAndFlush
(
new
DatagramPacket
(
io
.
netty
.
buffer
.
Unpooled
.
copiedBuffer
(
responseBytes
),
packet
.
sender
()));
}
catch
(
Exception
e
)
{
log
.
error
(
"处理UDP消息异常"
,
e
);
// 出现异常时发送故障状态
sendStatusToWebSocket
(
"error"
);
}
// TODO: 添加具体的校准业务逻辑
// 例如:更新校准状态、保存校准数据、通知前端等
}
/**
* 仅处理已完成的指令
*/
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/service/ITStoreyInfoService.java
View file @
ee9a8ec3
...
...
@@ -60,6 +60,8 @@ public interface ITStoreyInfoService
public
AjaxResult
handleBlanking
(
String
command
);
public
AjaxResult
handleDirectBlanking
(
String
command
);
/**
* 新增老化层信息
*
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/service/impl/TStoreyInfoServiceImpl.java
View file @
ee9a8ec3
...
...
@@ -548,6 +548,18 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
return
AjaxResult
.
success
();
}
/**
* 批量处理
* @param command c
* @return r
*/
@Override
public
AjaxResult
handleDirectBlanking
(
String
command
)
{
// 发送UDP指令
robotArmCommandService
.
sendCommand
(
command
);
return
AjaxResult
.
success
();
}
/**
* 发送下料指令
* @return r
...
...
zhmes-agecal-web/src/api/storey/storey.js
View file @
ee9a8ec3
...
...
@@ -90,6 +90,13 @@ export function blanking(command) {
})
}
export
function
directBlanking
(
command
)
{
return
request
({
url
:
'/storey/handleDirectBlanking/'
+
command
,
method
:
'get'
})
}
export
function
batchReadingCabinetStatus
(
fEquipmentCode
)
{
return
request
({
url
:
'/storey/batchReadingCabinetStatus/'
+
fEquipmentCode
,
...
...
zhmes-agecal-web/src/views/storey/index.vue
View file @
ee9a8ec3
...
...
@@ -128,13 +128,11 @@
<
el
-
button
size
=
"mini"
type
=
"text"
icon
=
"el-icon-delete"
@
click
=
"handlePowerOn(scope.row)"
>
上电
<
/el-button
>
<
el
-
button
size
=
"mini"
type
=
"text"
icon
=
"el-icon-delete"
@
click
=
"handlePowerOutage(scope.row)"
>
断电
<
/el-button
>
...
...
@@ -147,9 +145,13 @@
<
el
-
button
size
=
"mini"
type
=
"text"
icon
=
"el-icon-delete"
@
click
=
"handleBlanking(scope.row)"
>
下料
<
/el-button
>
>
生成下料命令
<
/el-button
>
<
el
-
button
size
=
"mini"
type
=
"text"
@
click
=
"handleDirectBlanking(scope.row)"
>
直接下料
<
/el-button
>
<
/template
>
<
/el-table-column
>
<
/el-table
>
...
...
@@ -211,9 +213,11 @@
<
/template
>
<
script
>
import
{
listStorey
,
getStorey
,
delStorey
,
addStorey
,
updateStorey
,
exportStorey
,
PowerOn
,
PowerOutage
,
feeding
,
blanking
}
from
"@/api/storey/storey"
;
import
{
listStorey
,
getStorey
,
delStorey
,
addStorey
,
updateStorey
,
exportStorey
,
PowerOn
,
PowerOutage
,
feeding
,
blanking
,
directBlanking
}
from
"@/api/storey/storey"
;
import
{
sendHomeCommand
,
sendStopCommand
}
from
"@/api/robotArm/robotArmCommand"
;
export
default
{
...
...
@@ -391,6 +395,21 @@ export default {
this
.
msgSuccess
(
"上电成功"
);
}
).
catch
(()
=>
{
}
);
}
,
// 直接下料
handleDirectBlanking
(
row
){
const
fIp
=
row
.
fIp
;
this
.
$confirm
(
'是否确认给设备IP为"'
+
fIp
+
'"的设备下料?'
,
"警告"
,
{
confirmButtonText
:
"确定"
,
cancelButtonText
:
"取消"
,
type
:
"warning"
}
).
then
(
function
()
{
return
directBlanking
(
row
.
blankingCommand
);
}
).
then
(()
=>
{
this
.
getList
();
this
.
msgSuccess
(
"下料成功"
);
}
).
catch
(()
=>
{
}
);
}
,
// 下料
handleBlanking
(
row
)
{
const
fIp
=
row
.
fIp
;
...
...
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