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
973cb17c
Commit
973cb17c
authored
Nov 10, 2025
by
wanghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 上下料优先级调整
parent
aba8c3ce
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
140 additions
and
18 deletions
+140
-18
RobotArmCommandController.java
...g/web/controller/equipment/RobotArmCommandController.java
+10
-0
IRobotArmCommandService.java
...va/com/zehong/system/service/IRobotArmCommandService.java
+2
-0
RobotArmCommandServiceImpl.java
...ehong/system/service/impl/RobotArmCommandServiceImpl.java
+27
-6
robotArmCommand.js
zhmes-agecal-web/src/api/robotArm/robotArmCommand.js
+7
-0
RoboticArm.vue
zhmes-agecal-web/src/views/screen/components/RoboticArm.vue
+94
-12
No files found.
zhmes-agecal-admin/src/main/java/com/zehong/web/controller/equipment/RobotArmCommandController.java
View file @
973cb17c
...
...
@@ -111,6 +111,8 @@ public class RobotArmCommandController extends BaseController
}
/**
* 修改机械臂指令
*/
...
...
@@ -120,6 +122,14 @@ public class RobotArmCommandController extends BaseController
return
toAjax
(
robotArmCommandService
.
updateRobotArmCommand
(
robotArmCommand
));
}
/**
* 修改指令执行优先级
*/
@GetMapping
(
"/updateInstructionExecutionPriority/{priority}"
)
public
AjaxResult
updateInstructionExecutionPriority
(
@PathVariable
(
"priority"
)
String
priority
)
{
return
toAjax
(
robotArmCommandService
.
updateInstructionExecutionPriority
(
priority
));
}
/**
* 删除机械臂指令
*/
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/service/IRobotArmCommandService.java
View file @
973cb17c
...
...
@@ -59,6 +59,8 @@ public interface IRobotArmCommandService
*/
public
int
updateRobotArmCommand
(
RobotArmCommand
robotArmCommand
);
public
int
updateInstructionExecutionPriority
(
String
priority
);
/**
* 批量删除机械臂指令
*
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/service/impl/RobotArmCommandServiceImpl.java
View file @
973cb17c
...
...
@@ -11,6 +11,7 @@ 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.core.redis.RedisCache
;
import
com.zehong.common.utils.DateUtils
;
import
com.zehong.common.utils.StringUtils
;
import
com.zehong.system.domain.TEquipmentInfo
;
...
...
@@ -25,6 +26,7 @@ import com.zehong.system.task.PowerOffCommandEvent;
import
com.zehong.system.udp.UdpCommandSender
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.stereotype.Service
;
...
...
@@ -75,6 +77,8 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
@Resource
private
PalletDeviceBindingMapper
palletDeviceBindingMapper
;
@Resource
private
RedisCache
redisCache
;
private
SocketAddress
getRobotAddress
()
{
try
{
return
new
InetSocketAddress
(
...
...
@@ -87,11 +91,17 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
@Override
@Transactional
public
void
processPendingCommands
()
{
Object
cacheObject
=
redisCache
.
getCacheObject
(
"sys_config:robotArmPriority"
);
String
priority
=
"loading"
;
if
(
cacheObject
!=
null
)
{
priority
=
(
String
)
cacheObject
;
}
// 1. 处理待执行的上料指令
List
<
RobotArmCommand
>
loadingCommands
=
robotArmCommandMapper
.
selectPendingLoadingCommands
();
if
(!
loadingCommands
.
isEmpty
())
{
// 传送带检测先去掉
if
(!
loadingCommands
.
isEmpty
()
&&
"priority"
.
equals
(
priority
)
)
{
// 传送带检测先去掉
boolean
[]
roboticArmEntryConveyorData
=
Modbus4jUtils
.
getRoboticArmEntryConveyorData
();
log
.
info
(
"机械臂入口 conveyor 0状态: "
+
roboticArmEntryConveyorData
[
0
]);
log
.
info
(
"机械臂入口 conveyor 1状态: "
+
roboticArmEntryConveyorData
[
1
]);
...
...
@@ -99,15 +109,12 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
sendCommand
(
loadingCommands
.
get
(
0
),
"LOAD"
);
return
;
}
// log.info("开始处理上料指令: {}", loadingCommands.get(0));
// sendCommand(loadingCommands.get(0), "LOAD");
}
// 2. 处理待执行的下料指令
List
<
RobotArmCommand
>
unloadingCommands
=
robotArmCommandMapper
.
selectPendingUnloadingCommands
();
if
(!
unloadingCommands
.
isEmpty
())
{
if
(!
unloadingCommands
.
isEmpty
()
&&
"unloading"
.
equals
(
priority
))
{
boolean
[]
roboticArmExitConveyorData
=
Modbus4jUtils
.
getRoboticArmExitConveyorData
();
if
(
roboticArmExitConveyorData
[
1
])
{
log
.
info
(
"开始处理下料指令: {}"
,
unloadingCommands
.
get
(
0
));
...
...
@@ -525,6 +532,20 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
return
i
;
}
/**
* 修改指令执行优先级
*
* @param priority 优先级
* @return 结果
*/
@Override
public
int
updateInstructionExecutionPriority
(
String
priority
)
{
redisCache
.
setCacheObject
(
"sys_config:robotArmPriority"
,
priority
);
return
1
;
}
/**
* 批量删除机械臂指令
*
...
...
zhmes-agecal-web/src/api/robotArm/robotArmCommand.js
View file @
973cb17c
...
...
@@ -80,6 +80,13 @@ export function sureCompletedCommand(commandId) {
})
}
export
function
updateInstructionExecutionPriority
(
priority
)
{
return
request
({
url
:
'/robotArm/command/updateInstructionExecutionPriority/'
+
priority
,
method
:
'get'
})
}
// 修改机械臂指令
export
function
updateCommand
(
data
)
{
return
request
({
...
...
zhmes-agecal-web/src/views/screen/components/RoboticArm.vue
View file @
973cb17c
...
...
@@ -79,6 +79,14 @@
<!-- 中间:机械臂主体 -->
<div
class=
"arm-center-wrapper"
>
<!-- 优先级控制区域 -->
<div
class=
"priority-control"
>
<div
class=
"priority-display"
>
{{
priorityDisplayText
}}
</div>
<button
class=
"priority-toggle-btn"
@
click=
"togglePriority"
>
{{
priorityToggleText
}}
</button>
</div>
<div
class=
"robotic-arm-container"
>
<div
class=
"robotic-arm"
>
<!-- 机械臂各部件 -->
...
...
@@ -127,7 +135,6 @@
</div>
</div>
<!-- 上电对话框 -->
<div
class=
"dialog-mask"
v-if=
"showPowerOnDialog"
@
click
.
self=
"closePowerOnDialog"
>
<div
class=
"dialog-container"
>
...
...
@@ -171,8 +178,7 @@
</
template
>
<
script
>
import
{
addCommand
,
powerOnCommand
,
sendHomeCommand
,
sendStopCommand
,
sureCompletedCommand
}
from
"@/api/robotArm/robotArmCommand"
import
{
addCommand
,
powerOnCommand
,
sendHomeCommand
,
sendStopCommand
,
sureCompletedCommand
,
updateInstructionExecutionPriority
}
from
"@/api/robotArm/robotArmCommand"
export
default
{
name
:
'RoboticArm'
,
...
...
@@ -181,15 +187,14 @@ export default {
status
:
'idle'
,
// idle, running, error
showAddDialog
:
false
,
trayCode
:
''
,
loadingCommands
:
[
],
unloadingCommands
:
[
],
loadingCommands
:
[],
unloadingCommands
:
[],
websocket
:
null
,
reconnectInterval
:
null
,
showPowerOnDialog
:
false
,
showSureCompleteDialog
:
false
,
selectedCommand
:
null
selectedCommand
:
null
,
priority
:
'loading'
// loading: 上料优先, unloading: 下料优先
};
},
computed
:
{
...
...
@@ -208,6 +213,12 @@ export default {
'error'
:
'故障'
,
'unknown'
:
'未知'
}[
this
.
status
];
},
priorityDisplayText
()
{
return
this
.
priority
===
'loading'
?
'上料优先中'
:
'下料优先中'
;
},
priorityToggleText
()
{
return
this
.
priority
===
'loading'
?
'下料优先'
:
'上料优先'
;
}
},
mounted
()
{
...
...
@@ -432,6 +443,20 @@ export default {
this
.
msgError
(
"上电操作失败"
);
});
},
// 切换优先级
togglePriority
()
{
this
.
priority
=
this
.
priority
===
'loading'
?
'unloading'
:
'loading'
;
updateInstructionExecutionPriority
(
this
.
priority
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
this
.
msgSuccess
(
"优先级设置成功"
);
}
else
{
this
.
msgError
(
"优先级设置失败"
);
}
})
// 这里可以添加发送优先级设置到后端的逻辑
console
.
log
(
`优先级已切换为:
${
this
.
priorityDisplayText
}
: this.priority:
${
this
.
priority
}
`
);
}
}
};
</
script
>
...
...
@@ -457,7 +482,7 @@ export default {
.title-with-status
{
display
:
flex
;
align-items
:
center
;
/* 垂直居中对齐 */
gap
:
1
5px
;
/* 标题与状态指示灯之间的间距 */
gap
:
5px
;
/* 标题与状态指示灯之间的间距 */
}
.title-left
{
...
...
@@ -466,7 +491,7 @@ export default {
}
.title-text
{
font-size
:
2
2
px
;
font-size
:
2
0
px
;
font-weight
:
bold
;
color
:
#ffffff
;
letter-spacing
:
1px
;
...
...
@@ -475,7 +500,7 @@ export default {
.title-line
{
height
:
3px
;
width
:
10
0px
;
width
:
7
0px
;
background
:
linear-gradient
(
to
right
,
#409EFF
,
transparent
);
margin-top
:
8px
;
border-radius
:
2px
;
...
...
@@ -752,11 +777,52 @@ export default {
flex
:
1
;
min-width
:
0
;
display
:
flex
;
justify-content
:
center
;
flex-direction
:
column
;
justify-content
:
flex-start
;
align-items
:
center
;
padding
:
10px
0
;
}
/* 优先级控制区域样式 */
.priority-control
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
margin-bottom
:
20px
;
/*background: rgba(0, 30, 60, 0.5);*/
/*border-radius: 8px;*/
padding
:
12px
20px
;
/*border: 1px solid rgba(64, 158, 255, 0.3);*/
min-width
:
200px
;
}
.priority-display
{
font-size
:
16px
;
font-weight
:
bold
;
color
:
#64c8ff
;
margin-bottom
:
8px
;
text-align
:
center
;
}
.priority-toggle-btn
{
background
:
linear-gradient
(
to
right
,
#409EFF
,
#64c8ff
);
color
:
white
;
border
:
none
;
padding
:
6px
16px
;
border-radius
:
4px
;
cursor
:
pointer
;
font-size
:
14px
;
font-weight
:
bold
;
transition
:
all
0.3s
;
box-shadow
:
0
2px
6px
rgba
(
0
,
0
,
0
,
0.3
);
}
.priority-toggle-btn
:hover
{
background
:
linear-gradient
(
to
right
,
#64c8ff
,
#409EFF
);
transform
:
translateY
(
-2px
);
box-shadow
:
0
4px
8px
rgba
(
0
,
0
,
0
,
0.4
);
}
.robotic-arm-container
{
width
:
100%
;
height
:
100%
;
...
...
@@ -1018,6 +1084,7 @@ export default {
.arm-center-wrapper
{
width
:
100%
;
min-height
:
350px
;
order
:
-1
;
/* 在移动设备上将机械臂区域放在最上面 */
}
.loading-command
,
.unloading-command
{
...
...
@@ -1072,6 +1139,21 @@ export default {
.dialog-container
{
width
:
90%
;
}
/* 小屏幕下优先级控制区域调整 */
.priority-control
{
padding
:
8px
15px
;
min-width
:
180px
;
}
.priority-display
{
font-size
:
14px
;
}
.priority-toggle-btn
{
padding
:
5px
12px
;
font-size
:
12px
;
}
}
@media
(
max-width
:
300px
)
{
...
...
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