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
81db12e6
Commit
81db12e6
authored
Mar 13, 2026
by
wanghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 功能模块 清理数据实现
parent
754d5d57
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
209 additions
and
24 deletions
+209
-24
PalletDeviceBindingController.java
...b/controller/equipment/PalletDeviceBindingController.java
+10
-0
PalletDeviceBindingMapper.java
...a/com/zehong/system/mapper/PalletDeviceBindingMapper.java
+0
-1
RobotArmCommandMapper.java
.../java/com/zehong/system/mapper/RobotArmCommandMapper.java
+12
-8
TTrayInfoMapper.java
...c/main/java/com/zehong/system/mapper/TTrayInfoMapper.java
+10
-8
IPalletDeviceBindingService.java
...om/zehong/system/service/IPalletDeviceBindingService.java
+2
-0
PalletDeviceBindingServiceImpl.java
...g/system/service/impl/PalletDeviceBindingServiceImpl.java
+62
-3
RobotArmCommandMapper.xml
...rc/main/resources/mapper/system/RobotArmCommandMapper.xml
+16
-4
TTrayInfoMapper.xml
...stem/src/main/resources/mapper/system/TTrayInfoMapper.xml
+8
-0
binding.js
zhmes-agecal-web/src/api/palletDeviceBinding/binding.js
+8
-0
index.vue
...s-agecal-web/src/views/functionModule/clearData/index.vue
+81
-0
No files found.
zhmes-agecal-admin/src/main/java/com/zehong/web/controller/equipment/PalletDeviceBindingController.java
View file @
81db12e6
...
...
@@ -163,6 +163,16 @@ public class PalletDeviceBindingController extends BaseController
return
palletDeviceBindingService
.
unbindAllDeviceNoUploadMes
(
trayId
);
}
/**
* 根据托盘编号清理数据
* @param trayCode s
* @return l
*/
@GetMapping
(
"/clearDataByTrayCode/{trayCode}"
)
public
AjaxResult
clearDataByTrayCode
(
@PathVariable
(
"trayCode"
)
String
trayCode
)
{
return
palletDeviceBindingService
.
clearDataByTrayCode
(
trayCode
);
}
/**
* 删除托盘绑定的设备列
*/
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/mapper/PalletDeviceBindingMapper.java
View file @
81db12e6
...
...
@@ -30,7 +30,6 @@ public interface PalletDeviceBindingMapper
public
void
updateStoreCodeByTrayId
(
@Param
(
"fTrayId"
)
Long
fTrayId
,
@Param
(
"storeCode"
)
String
storeCode
,
@Param
(
"productStandardInspectionNumber"
)
String
productStandardInspectionNumber
);
/**
* 查询托盘绑定的设备列列表
*
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/mapper/RobotArmCommandMapper.java
View file @
81db12e6
...
...
@@ -6,15 +6,15 @@ import org.apache.ibatis.annotations.Param;
/**
* 机械臂指令Mapper接口
*
*
* @author zehong
* @date 2025-08-04
*/
public
interface
RobotArmCommandMapper
public
interface
RobotArmCommandMapper
{
/**
* 查询机械臂指令
*
*
* @param robotArmCommandId 机械臂指令ID
* @return 机械臂指令
*/
...
...
@@ -29,7 +29,7 @@ public interface RobotArmCommandMapper
public
RobotArmCommand
findByTrayAndStatus
(
@Param
(
"trayCode"
)
String
trayCode
,
@Param
(
"status"
)
String
status
);
/**
* 查询机械臂指令列表
*
*
* @param robotArmCommand 机械臂指令
* @return 机械臂指令集合
*/
...
...
@@ -41,9 +41,11 @@ public interface RobotArmCommandMapper
public
List
<
RobotArmCommand
>
findByType
(
String
type
);
public
List
<
RobotArmCommand
>
selectIsRunningCommandByTrayCode
(
String
trayCode
);
/**
* 新增机械臂指令
*
*
* @param robotArmCommand 机械臂指令
* @return 结果
*/
...
...
@@ -51,12 +53,14 @@ public interface RobotArmCommandMapper
/**
* 修改机械臂指令
*
*
* @param robotArmCommand 机械臂指令
* @return 结果
*/
public
int
updateRobotArmCommand
(
RobotArmCommand
robotArmCommand
);
public
int
batchUpdateStatus
(
@Param
(
"status"
)
String
status
,
@Param
(
"list"
)
List
<
Long
>
ids
);
/**
* 更新执行中状态为完成状态
...
...
@@ -80,7 +84,7 @@ public interface RobotArmCommandMapper
List
<
RobotArmCommand
>
selectPendingLoadUnloadCommands
();
/**
* 删除机械臂指令
*
*
* @param robotArmCommandId 机械臂指令ID
* @return 结果
*/
...
...
@@ -88,7 +92,7 @@ public interface RobotArmCommandMapper
/**
* 批量删除机械臂指令
*
*
* @param robotArmCommandIds 需要删除的数据ID
* @return 结果
*/
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/mapper/TTrayInfoMapper.java
View file @
81db12e6
...
...
@@ -5,15 +5,15 @@ import com.zehong.system.domain.TTrayInfo;
/**
* 托盘信息Mapper接口
*
*
* @author zehong
* @date 2025-06-06
*/
public
interface
TTrayInfoMapper
public
interface
TTrayInfoMapper
{
/**
* 查询托盘信息
*
*
* @param fTrayId 托盘信息ID
* @return 托盘信息
*/
...
...
@@ -27,9 +27,11 @@ public interface TTrayInfoMapper
public
int
initStatusByTrayId
(
Long
trayId
);
public
int
clearStoreyCodeByTrayId
(
Long
trayId
);
/**
* 查询托盘信息列表
*
*
* @param tTrayInfo 托盘信息
* @return 托盘信息集合
*/
...
...
@@ -37,7 +39,7 @@ public interface TTrayInfoMapper
/**
* 新增托盘信息
*
*
* @param tTrayInfo 托盘信息
* @return 结果
*/
...
...
@@ -47,7 +49,7 @@ public interface TTrayInfoMapper
/**
* 修改托盘信息
*
*
* @param tTrayInfo 托盘信息
* @return 结果
*/
...
...
@@ -64,7 +66,7 @@ public interface TTrayInfoMapper
public
int
unbindByCode
(
TTrayInfo
tTrayInfo
);
/**
* 删除托盘信息
*
*
* @param fTrayId 托盘信息ID
* @return 结果
*/
...
...
@@ -72,7 +74,7 @@ public interface TTrayInfoMapper
/**
* 批量删除托盘信息
*
*
* @param fTrayIds 需要删除的数据ID
* @return 结果
*/
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/service/IPalletDeviceBindingService.java
View file @
81db12e6
...
...
@@ -65,6 +65,8 @@ public interface IPalletDeviceBindingService
public
AjaxResult
unbindAllDeviceNoUploadMes
(
Long
trayId
);
public
AjaxResult
clearDataByTrayCode
(
String
trayCode
);
/**
* 批量删除托盘绑定的设备列
*
...
...
zhmes-agecal-system/src/main/java/com/zehong/system/service/impl/PalletDeviceBindingServiceImpl.java
View file @
81db12e6
...
...
@@ -9,10 +9,10 @@ import com.zehong.common.utils.DateUtils;
import
com.zehong.common.utils.StringUtils
;
import
com.zehong.common.utils.http.HttpUtils
;
import
com.zehong.system.domain.*
;
import
com.zehong.system.mapper.PalletDeviceBindingMapper
;
import
com.zehong.system.mapper.ProductStandardInspectionMapper
;
import
com.zehong.system.mapper.TTrayInfoMapper
;
import
com.zehong.system.mapper.*
;
import
com.zehong.system.service.*
;
import
com.zehong.system.task.DeviceTaskScheduler
;
import
org.quartz.SchedulerException
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -47,6 +47,15 @@ public class PalletDeviceBindingServiceImpl implements IPalletDeviceBindingServi
@Resource
private
TTrayInfoMapper
tTrayInfoMapper
;
@Resource
private
TStoreyInfoMapper
tStoreyInfoMapper
;
@Resource
private
DeviceTaskScheduler
deviceTaskScheduler
;
@Resource
private
RobotArmCommandMapper
robotArmCommandMapper
;
@Resource
private
ProductStandardInspectionMapper
productStandardInspectionMapper
;
...
...
@@ -251,6 +260,56 @@ public class PalletDeviceBindingServiceImpl implements IPalletDeviceBindingServi
return
palletDeviceBindingMapper
.
deletePalletDeviceBindingById
(
palletDeviceBindingId
);
}
/**
* 清理数据
*
* @param trayCode 托盘编号
* @return 结果
*/
@Override
public
AjaxResult
clearDataByTrayCode
(
String
trayCode
)
{
if
(
StringUtils
.
isBlank
(
trayCode
)){
return
AjaxResult
.
error
(
"参数错误"
);
}
TTrayInfo
tTrayInfo
=
tTrayInfoMapper
.
selectTTrayInfoByCode
(
trayCode
);
if
(
tTrayInfo
==
null
){
return
AjaxResult
.
error
(
"无此托盘"
);
}
if
(
"0"
.
equals
(
tTrayInfo
.
getfStatus
())
||
"3"
.
equals
(
tTrayInfo
.
getfStatus
()))
{
return
AjaxResult
.
error
(
"空闲 或 标定完成 状态不许清理数据"
);
}
List
<
RobotArmCommand
>
robotArmCommands
=
robotArmCommandMapper
.
selectIsRunningCommandByTrayCode
(
trayCode
);
if
(
robotArmCommands
.
size
()
!=
0
)
{
List
<
Long
>
collect
=
robotArmCommands
.
stream
().
map
(
RobotArmCommand:
:
getRobotArmCommandId
).
collect
(
Collectors
.
toList
());
robotArmCommandMapper
.
batchUpdateStatus
(
"4"
,
collect
);
}
String
storeyCode
=
tTrayInfo
.
getfStoreyCode
();
if
(
StringUtils
.
isNotBlank
(
storeyCode
))
{
TStoreyInfo
tStoreyInfo
=
tStoreyInfoMapper
.
selectTStoreyInfoByCode
(
storeyCode
);
try
{
deviceTaskScheduler
.
cleanExistingTasks
(
tStoreyInfo
.
getfStoreyId
());
}
catch
(
SchedulerException
e
)
{
throw
new
RuntimeException
(
e
);
}
tStoreyInfoMapper
.
unbindByCode
(
trayCode
);
}
// 解绑设备
palletDeviceBindingMapper
.
unbindAllDevice
(
tTrayInfo
.
getfTrayId
());
// 初始托盘状态
tTrayInfoMapper
.
clearStoreyCodeByTrayId
(
tTrayInfo
.
getfTrayId
());
return
AjaxResult
.
success
();
}
/**
* 批量解绑所有设备(不处理上传数据)
*
...
...
zhmes-agecal-system/src/main/resources/mapper/system/RobotArmCommandMapper.xml
View file @
81db12e6
...
...
@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.zehong.system.mapper.RobotArmCommandMapper"
>
<resultMap
type=
"RobotArmCommand"
id=
"RobotArmCommandResult"
>
<result
property=
"robotArmCommandId"
column=
"f_robot_arm_command_id"
/>
<result
property=
"trayCode"
column=
"f_tray_code"
/>
...
...
@@ -33,10 +33,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include
refid=
"selectRobotArmCommandVo"
/>
where f_type = #{type} and f_status != '4'
</select>
<select
id=
"selectIsRunningCommandByTrayCode"
parameterType=
"string"
resultMap=
"RobotArmCommandResult"
>
<include
refid=
"selectRobotArmCommandVo"
/>
where f_tray_code = #{trayCode} and f_status != '4'
</select>
<select
id=
"selectRobotArmCommandList"
parameterType=
"RobotArmCommand"
resultMap=
"RobotArmCommandResult"
>
<include
refid=
"selectRobotArmCommandVo"
/>
<where>
<where>
<if
test=
"trayCode != null and trayCode != ''"
>
and f_tray_code = #{trayCode}
</if>
<if
test=
"storeyCode != null and storeyCode != ''"
>
and f_storey_code = #{storeyCode}
</if>
<if
test=
"type != null and type != ''"
>
and f_type = #{type}
</if>
...
...
@@ -136,6 +140,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SET f_status = '2'
WHERE f_status = '1' and f_end_execution_time IS NOT NULL
</update>
<update
id=
"batchUpdateStatus"
>
UPDATE t_robot_arm_command
SET f_status = #{status}
WHERE f_robot_arm_command_id IN
<foreach
item=
"item"
collection=
"list"
separator=
","
open=
"("
close=
")"
>
#{item}
</foreach>
</update>
<!-- 获取待执行的上料指令 -->
<select
id=
"selectPendingLoadingCommands"
resultMap=
"RobotArmCommandResult"
>
...
...
@@ -175,9 +187,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete
id=
"deleteRobotArmCommandByIds"
parameterType=
"String"
>
delete from t_robot_arm_command where f_robot_arm_command_id in
delete from t_robot_arm_command where f_robot_arm_command_id in
<foreach
item=
"robotArmCommandId"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{robotArmCommandId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
</mapper>
zhmes-agecal-system/src/main/resources/mapper/system/TTrayInfoMapper.xml
View file @
81db12e6
...
...
@@ -116,6 +116,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
set f_status = '0'
where f_tray_id = #{fTrayId}
</update>
<update
id=
"clearStoreyCodeByTrayId"
parameterType=
"long"
>
update t_tray_info
set f_storey_code = null,
f_status = '0',
f_unbinding_time = null,
f_binding_time = null
where f_tray_id = #{fTrayId}
</update>
<update
id=
"updateTTrayInfo"
parameterType=
"TTrayInfo"
>
update t_tray_info
<trim
prefix=
"SET"
suffixOverrides=
","
>
...
...
zhmes-agecal-web/src/api/palletDeviceBinding/binding.js
View file @
81db12e6
...
...
@@ -99,6 +99,14 @@ export function batchUpdateDeviceCodeAndUnbindingTime(data) {
})
}
export
function
clearDataByTrayCode
(
trayCode
){
return
request
({
url
:
'/palletDevice/binding/clearDataByTrayCode/'
+
trayCode
,
method
:
'get'
})
}
// 删除托盘绑定的设备列
export
function
delBinding
(
palletDeviceBindingId
)
{
return
request
({
...
...
zhmes-agecal-web/src/views/functionModule/clearData/index.vue
0 → 100644
View file @
81db12e6
<
template
>
<el-card
class=
"clean-data-card"
shadow=
"hover"
>
<div
class=
"clean-data-container"
>
<el-input
v-model=
"trayCode"
placeholder=
"请输入托盘编号"
clearable
class=
"input-tray"
/>
<el-button
type=
"primary"
@
click=
"handleClean"
:loading=
"loading"
>
清理数据
</el-button>
</div>
</el-card>
</
template
>
<
script
>
import
{
clearDataByTrayCode
}
from
"@/api/palletDeviceBinding/binding"
export
default
{
name
:
'CleanData'
,
data
()
{
return
{
trayCode
:
''
,
// 绑定的托盘编号
loading
:
false
// 按钮 loading 状态
};
},
methods
:
{
// 点击清理按钮
handleClean
()
{
if
(
!
this
.
trayCode
.
trim
())
{
this
.
$message
.
warning
(
'请输入托盘编号'
);
return
;
}
// 弹出确认框
this
.
$confirm
(
`确认清理托盘
${
this
.
trayCode
}
的数据?`
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
// 用户点击确定,开始清理
this
.
loading
=
true
;
clearDataByTrayCode
(
this
.
trayCode
)
.
then
(()
=>
{
this
.
$message
.
success
(
'数据清理成功'
);
// 可选:清理成功后重置输入框
// this.trayCode = '';
})
.
finally
(()
=>
{
this
.
loading
=
false
;
});
}).
catch
(()
=>
{
// 用户点击取消
this
.
$message
.
info
(
'已取消清理'
);
});
},
}
};
</
script
>
<
style
scoped
>
.clean-data-card
{
width
:
500px
;
/* 固定卡片宽度 */
margin
:
20px
auto
;
/* 水平居中,上下留一点边距 */
}
.clean-data-container
{
display
:
flex
;
align-items
:
center
;
gap
:
12px
;
}
.input-tray
{
flex
:
1
;
}
</
style
>
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