feat(wms): 添加钢卷回滚后的操作记录清理功能

- 在删除钢卷后自动清理相关的待处理操作记录
- 实现查询并删除最晚一条非401-405范围内的操作记录
- 添加对最新操作记录的条件筛选和删除逻辑
This commit is contained in:
2026-03-02 10:47:51 +08:00
parent 07108f845e
commit 11793d3ff2

View File

@@ -3036,6 +3036,20 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
// 9.2 删除当前钢卷
baseMapper.deleteById(currentCoilId);
// 删除操作记录删除最晚的一条且actionType不在401-405范围内并且coilId等于historyCoilId
LambdaQueryWrapper<WmsCoilPendingAction> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(WmsCoilPendingAction::getCoilId, historyCoilId)
.notIn(WmsCoilPendingAction::getActionType, Arrays.asList(401, 402, 403, 404, 405))
.eq(WmsCoilPendingAction::getDelFlag, 0)
.eq(WmsCoilPendingAction::getActionStatus, 2)
.orderByDesc(WmsCoilPendingAction::getCreateTime)
.last("LIMIT 1");
WmsCoilPendingAction latestAction = coilPendingActionMapper.selectOne(queryWrapper);
if (latestAction != null) {
coilPendingActionMapper.deleteById(latestAction.getActionId());
}
// 9.3 恢复历史钢卷为当前数据
LambdaUpdateWrapper<WmsMaterialCoil> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(WmsMaterialCoil::getCoilId, historyCoilId)