This commit is contained in:
砂糖
2026-03-02 10:50:52 +08:00

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)