紧急任务修改

This commit is contained in:
秦鸿展
2026-07-17 15:27:17 +08:00
parent 914957e683
commit 2373be59e6
5 changed files with 89 additions and 1 deletions
@@ -290,6 +290,17 @@ public class ShiftManageApplicationService {
return shiftManageDomainService.taskDistribution(shiftManageDO);
}
/**
* @description 撤回审核
* @author gen
* @date 2026/7/17
* @param shiftManageDO
* @return Boolean
*/
public Boolean revokeAudit(ShiftManageDO shiftManageDO) {
return shiftManageDomainService.revokeAudit(shiftManageDO);
}
/**
* 物料移位(PDA),与收货、上架一致:支持 getInfoByApp 的 parent_copy 结构及分批移位
* 按单移位:PDA 仅传 shiftManageId、updateTime 时,自动从库中带出该单下所有待移位明细,默认 shiftQuantity=quantity
@@ -3,6 +3,7 @@ package com.mhd.wms.domain.shiftManage.service;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.mhd.common.core.domain.po.UserPo;
import com.mhd.common.core.exception.ServiceException;
@@ -14,6 +15,7 @@ import com.mhd.system.api.domain.MaterialInventoryOmsParamDO;
import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO;
import com.mhd.system.api.domain.cache.SystemServiceCacheUtil;
import com.mhd.system.api.model.LoginUser;
import com.mhd.wms.domain.deliveTask.entity.DeliveTask;
import com.mhd.wms.domain.deliveTask.repository.facade.IDeliveTaskService;
import com.mhd.wms.domain.deliveTask.repository.todo.DeliveTaskDO;
import com.mhd.wms.domain.inventoryStandingDetail.repository.facade.IInventoryStandingDetailService;
@@ -484,6 +486,48 @@ public class ShiftManageDomainService {
return shiftManageService.taskDistribution(shiftManageDO);
}
/**
* @description 撤回移位(待移位 → 已创建)
* @author gen
* @date 2026/7/17
* @param shiftManageDO
* @return Boolean
*/
@Transactional(rollbackFor = Exception.class)
public Boolean revokeAudit(ShiftManageDO shiftManageDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
List<Long> shiftManageIds = shiftManageDO.getShiftManageIds();
if (CollectionUtils.isEmpty(shiftManageIds)) {
throw new ServiceException("移位单id不能为空");
}
List<ShiftManage> shiftManageList = shiftManageService.listByIds(shiftManageIds);
if (CollectionUtils.isEmpty(shiftManageList)) {
throw new ServiceException("移位单不存在");
}
for (ShiftManage shiftManage : shiftManageList) {
if (!Integer.valueOf(2).equals(shiftManage.getShiftStatus())) {
throw new ServiceException("移位单【" + shiftManage.getShiftNumber() + "】状态不为待移位,不可撤回");
}
}
// 删除生成的配送任务(taskType=5trackingNumber=shiftNumber
List<String> shiftNumbers = shiftManageList.stream()
.map(ShiftManage::getShiftNumber)
.collect(Collectors.toList());
deliveTaskService.remove(new QueryWrapper<DeliveTask>().lambda()
.in(DeliveTask::getTrackingNumber, shiftNumbers)
.eq(DeliveTask::getTaskType, 5));
// 回退:shiftStatus=1(已创建),taskDistribution=2(未下发),auditStatus=1(未审核)
shiftManageService.update(null, new UpdateWrapper<ShiftManage>().lambda()
.set(ShiftManage::getShiftStatus, 1)
.set(ShiftManage::getTaskDistribution, 2)
.set(ShiftManage::getAuditStatus, 1)
.set(ShiftManage::getUpdateBy, loginUser.getUserid())
.set(ShiftManage::getUpdateByName, loginUser.getUsername())
.set(ShiftManage::getUpdateTime, new Date())
.in(ShiftManage::getShiftManageId, shiftManageIds));
return true;
}
/**
* 物料移位
*/
@@ -120,4 +120,14 @@ public class ShiftManageApi extends BaseController {
return AjaxResult.success(shiftManageApplicationService.taskDistribution(shiftManageDO));
}
/**
* 撤回审核
*/
@ApiOperation("撤回审核")
@PostMapping(value = "/revokeAudit")
public AjaxResult revokeAudit(@RequestBody ShiftManageDTO shiftManageDTO) {
ShiftManageDO shiftManageDO = shiftManageAssembler.toDO(shiftManageDTO);
return AjaxResult.success(shiftManageApplicationService.revokeAudit(shiftManageDO));
}
}