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
2d47c04f
Commit
2d47c04f
authored
Sep 24, 2025
by
wanghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 指令指令完成,但是 没有检测到机械臂完成。
parent
3214dfa3
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
115 additions
and
2 deletions
+115
-2
RobotArmCommandController.java
...g/web/controller/equipment/RobotArmCommandController.java
+6
-0
NettyUdpServerHandler.java
...om/zehong/system/netty/handler/NettyUdpServerHandler.java
+22
-0
IRobotArmCommandService.java
...va/com/zehong/system/service/IRobotArmCommandService.java
+9
-0
RobotArmCommandServiceImpl.java
...ehong/system/service/impl/RobotArmCommandServiceImpl.java
+29
-1
robotArmCommand.js
zhmes-agecal-web/src/api/robotArm/robotArmCommand.js
+7
-0
RoboticArm.vue
zhmes-agecal-web/src/views/screen/components/RoboticArm.vue
+42
-1
No files found.
zhmes-agecal-admin/src/main/java/com/zehong/web/controller/equipment/RobotArmCommandController.java
View file @
2d47c04f
...
...
@@ -105,6 +105,12 @@ public class RobotArmCommandController extends BaseController
return
AjaxResult
.
success
(
"上电操作成功"
);
}
@GetMapping
(
"/sureCompletedCommand/{robotArmCommandId}"
)
public
AjaxResult
sureCompletedCommand
(
@PathVariable
(
"robotArmCommandId"
)
Long
robotArmCommandId
)
{
return
robotArmCommandService
.
sureCompletedCommand
(
robotArmCommandId
);
}
/**
* 修改机械臂指令
*/
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/netty/handler/NettyUdpServerHandler.java
View file @
2d47c04f
...
...
@@ -125,6 +125,28 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<DatagramP
}
}
/**
* 仅处理已完成的指令
*/
public
void
onlyCompleted
()
{
CommandExecution
execution
=
currentCommands
.
get
(
"127.0.0.1"
);
// 如果指令追踪为空,则可能是 刚启动,再去 查一下有没有正在执行的任务
if
(
execution
==
null
)
{
List
<
RobotArmCommand
>
robotArmCommands
=
robotArmCommandService
.
selectTopRunningRobotArmCommands
();
if
(
robotArmCommands
!=
null
&&
!
robotArmCommands
.
isEmpty
())
{
// 注册指令跟踪
execution
=
new
CommandExecution
();
execution
.
commandId
=
robotArmCommands
.
get
(
0
).
getRobotArmCommandId
();
}
}
if
(
execution
!=
null
)
{
robotArmCommandService
.
completeCommand
(
execution
.
commandId
);
currentCommands
.
remove
(
"127.0.0.1"
);
log
.
info
(
"指令完成: {}"
,
execution
.
commandId
);
}
}
private
void
processStatusMessage
(
RobotArmMessageParser
.
RobotArmStatus
status
,
SocketAddress
sender
)
{
// 更新前端状态
if
(
status
.
isBusy
())
{
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/service/IRobotArmCommandService.java
View file @
2d47c04f
package
com
.
zehong
.
system
.
service
;
import
java.util.List
;
import
com.zehong.common.core.domain.AjaxResult
;
import
com.zehong.system.domain.RobotArmCommand
;
/**
...
...
@@ -42,6 +44,13 @@ public interface IRobotArmCommandService
public
int
insertRobotArmCommand
(
RobotArmCommand
robotArmCommand
);
public
void
powerOnCommand
(
Long
commandId
);
/**
* 确认完成指令
* @param commandId c
* @return r
*/
public
AjaxResult
sureCompletedCommand
(
Long
commandId
);
/**
* 修改机械臂指令
*
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/service/impl/RobotArmCommandServiceImpl.java
View file @
2d47c04f
...
...
@@ -10,6 +10,7 @@ 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.core.domain.AjaxResult
;
import
com.zehong.common.utils.DateUtils
;
import
com.zehong.common.utils.StringUtils
;
import
com.zehong.system.domain.TEquipmentInfo
;
...
...
@@ -71,7 +72,6 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
@Value
(
"${robot.arm.udp.port}"
)
private
int
robotArmPort
;
@Resource
private
ApplicationEventPublisher
eventPublisher
;
// 新增事件发布器
...
...
@@ -383,6 +383,34 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
return
i
;
}
/**
* 修改机械臂指令
*
* @param commandId 机械臂指令
* @return 结果
*/
@Override
public
AjaxResult
sureCompletedCommand
(
Long
commandId
)
{
if
(
commandId
==
null
)
{
return
AjaxResult
.
error
(
"参数错误"
);
}
RobotArmCommand
command
=
robotArmCommandMapper
.
selectRobotArmCommandById
(
commandId
);
if
(
command
==
null
)
{
return
AjaxResult
.
error
(
"指令不存在"
);
}
if
(!
"1"
.
equals
(
command
.
getStatus
()))
{
return
AjaxResult
.
error
(
"只有待执行状态的指令才能确认完成"
);
}
try
{
nettyUdpServerHandler
.
onlyCompleted
();
}
catch
(
Exception
e
)
{
return
AjaxResult
.
error
(
"执行确认完成指令时发生异常: "
+
e
.
getMessage
());
}
return
AjaxResult
.
success
();
}
@Override
@Transactional
public
void
powerOnCommand
(
Long
commandId
)
{
...
...
zhmes-agecal-web/src/api/robotArm/robotArmCommand.js
View file @
2d47c04f
...
...
@@ -62,6 +62,13 @@ export function powerOnCommand(commandId) {
})
}
export
function
sureCompletedCommand
(
commandId
)
{
return
request
({
url
:
'/robotArm/command/sureCompletedCommand/'
+
commandId
,
method
:
'get'
})
}
// 修改机械臂指令
export
function
updateCommand
(
data
)
{
return
request
({
...
...
zhmes-agecal-web/src/views/screen/components/RoboticArm.vue
View file @
2d47c04f
...
...
@@ -147,12 +147,32 @@
</div>
</div>
</div>
<!-- 确认执行完成对话框 -->
<div
class=
"dialog-mask"
v-if=
"showSureCompleteDialog"
@
click
.
self=
"closePowerOnDialog"
>
<div
class=
"dialog-container"
>
<div
class=
"dialog-header"
>
确认执行完成
</div>
<div
class=
"dialog-body"
>
<div
class=
"dialog-content"
>
<div
class=
"scan-prompt"
>
确认此条指令执行完成?
</div>
<div
class=
"power-on-info"
>
<div><span
class=
"label"
>
托盘编号:
</span>
{{
selectedCommand
.
trayCode
}}
</div>
<div><span
class=
"label"
>
位置:
</span>
{{
selectedCommand
.
position
}}
</div>
</div>
</div>
</div>
<div
class=
"dialog-footer"
>
<button
class=
"cancel-button"
@
click=
"closeSureCompleteDialog"
>
取消
</button>
<button
class=
"confirm-button"
@
click=
"confirmSureComplete"
>
确认上电
</button>
</div>
</div>
</div>
</div>
</
template
>
<
script
>
import
{
addCommand
,
powerOnCommand
,
sendHomeCommand
,
sendStopCommand
}
from
"@/api/robotArm/robotArmCommand"
import
{
addCommand
,
powerOnCommand
,
sendHomeCommand
,
sendStopCommand
,
sureCompletedCommand
}
from
"@/api/robotArm/robotArmCommand"
export
default
{
name
:
'RoboticArm'
,
...
...
@@ -168,6 +188,7 @@ export default {
websocket
:
null
,
reconnectInterval
:
null
,
showPowerOnDialog
:
false
,
showSureCompleteDialog
:
false
,
selectedCommand
:
null
};
},
...
...
@@ -368,14 +389,34 @@ export default {
if
(
cmd
.
status
===
'3'
)
{
this
.
selectedCommand
=
cmd
;
this
.
showPowerOnDialog
=
true
;
}
else
if
(
cmd
.
status
===
'2'
)
{
this
.
selectedCommand
=
cmd
;
this
.
showSureCompleteDialog
=
true
;
}
},
closeSureCompleteDialog
()
{
this
.
showSureCompleteDialog
=
false
;
this
.
selectedCommand
=
null
;
},
closePowerOnDialog
()
{
this
.
showPowerOnDialog
=
false
;
this
.
selectedCommand
=
null
;
},
confirmSureComplete
()
{
if
(
!
this
.
selectedCommand
)
return
;
sureCompletedCommand
(
this
.
selectedCommand
.
robotArmCommandId
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
this
.
msgSuccess
(
"确认完成成功"
);
this
.
closeSureCompleteDialog
();
}
else
{
this
.
msgError
(
"确认完成失败"
);
}
}).
catch
(
err
=>
{
this
.
msgError
(
"确认完成失败"
);
})
},
confirmPowerOn
()
{
if
(
!
this
.
selectedCommand
)
return
;
...
...
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