任务状态修改

This commit is contained in:
funny 2026-05-11 16:03:20 +08:00
parent 5a64ef0308
commit dc779f5b12
2 changed files with 33 additions and 5 deletions

View File

@ -224,7 +224,12 @@ public class QmsIssueTicketControllerService {
throw new NflgException(STATE.BusinessError, "PDI检测任务记录不存在");
}
// 2. 校验是否已存在工单
// 2. 校验任务状态必须为3待流转
if (!Objects.equals(taskRecord.getInspectionEnable(), 3)) {
throw new NflgException(STATE.BusinessError, "只有待流转状态的任务才能创建工单,当前状态:" + taskRecord.getInspectionEnable());
}
// 3. 校验是否已存在工单
QmsIssueTicket existingTicket = issueTicketService.lambdaQuery()
.eq(QmsIssueTicket::getSourceType, (short) 1)
.eq(QmsIssueTicket::getSourceId, request.getTaskRecordId())
@ -309,6 +314,12 @@ public class QmsIssueTicketControllerService {
issueTicketService.save(entity);
// 创建工单成功后将任务状态从3待流转改为2已完成
pdiTaskRecordService.lambdaUpdate()
.eq(QmsPdiTaskRecord::getId, taskRecord.getId())
.set(QmsPdiTaskRecord::getInspectionEnable, 2)
.update();
// 9. 查询该任务的不合格检测项
List<QmsPdiInspectionResultVO> unqualifiedItems = initiatePdiTicket(request.getTaskRecordId());
@ -682,6 +693,11 @@ public class QmsIssueTicketControllerService {
throw new NflgException(STATE.BusinessError, "PDI检测任务记录不存在");
}
// 校验任务状态必须为3待流转
if (!Objects.equals(taskRecord.getInspectionEnable(), 3)) {
throw new NflgException(STATE.BusinessError, "只有待流转状态的任务才能创建工单,当前状态:" + taskRecord.getInspectionEnable());
}
// 校验是否已存在工单同一taskRecordId只能创建一次工单
QmsIssueTicket existingTicket = issueTicketService.lambdaQuery()
.eq(QmsIssueTicket::getSourceType, (short) 1)
@ -763,6 +779,12 @@ public class QmsIssueTicketControllerService {
issueTicketService.save(entity);
// 创建工单成功后将任务状态从3待流转改为2已完成
pdiTaskRecordService.lambdaUpdate()
.eq(QmsPdiTaskRecord::getId, taskRecord.getId())
.set(QmsPdiTaskRecord::getInspectionEnable, 2)
.update();
// 按处理人分组异步新增工单处理记录并推送待办
Map<Long, List<Long>> handlerToResultsMap = request.getHandlers().stream()
.collect(Collectors.groupingBy(

View File

@ -188,14 +188,17 @@ public class QmsPdiTaskRecordControllerService {
vo.setComponentsDes(si.getComponentsDes());
vo.setInspectionContent(si.getInspectionContent());
// inspectionImage 是文件ID需要转换为URL
String inspectionImageUrl = "";
if (si.getInspectionImage() != null && !si.getInspectionImage().isEmpty()) {
try {
Long imageId = Long.parseLong(si.getInspectionImage());
vo.setInspectionImage(finalImageUrlMap.get(imageId));
String url = finalImageUrlMap.get(imageId);
inspectionImageUrl = url != null ? url : "";
} catch (NumberFormatException e) {
vo.setInspectionImage(null);
inspectionImageUrl = "";
}
}
vo.setInspectionImage(inspectionImageUrl);
}
// 现场图已经是List<FileDetailVO>无需转换在下一步处理
vo.setInspectionItemImage(convertImageIdsToVO(r.getInspectionItemImage()));
@ -263,14 +266,17 @@ public class QmsPdiTaskRecordControllerService {
vo.setComponentsDes(si.getComponentsDes());
vo.setInspectionContent(si.getInspectionContent());
// inspectionImage 是文件ID需要转换为URL
String inspectionImageUrl = "";
if (si.getInspectionImage() != null && !si.getInspectionImage().isEmpty()) {
try {
Long imageId = Long.parseLong(si.getInspectionImage());
vo.setInspectionImage(finalImageUrlMap.get(imageId));
String url = finalImageUrlMap.get(imageId);
inspectionImageUrl = url != null ? url : "";
} catch (NumberFormatException e) {
vo.setInspectionImage(null);
inspectionImageUrl = "";
}
}
vo.setInspectionImage(inspectionImageUrl);
}
vo.setInspectionItemImage(convertImageIdsToVO(r.getInspectionItemImage()));
vo.setInspectionBy(r.getInspectionBy());