保存后提交无法撤回问题解决

This commit is contained in:
Ledo 2025-01-18 15:04:07 +08:00
parent b1cb96d392
commit 3975d8885a
2 changed files with 6 additions and 11 deletions

View File

@ -51,7 +51,6 @@ public class TaskDispatchDetailDO extends BaseDO {
/** /**
* 派工数量 * 派工数量
*/ */
@TableField(exist = false)
private Integer beforeAmount; private Integer beforeAmount;
/** /**
* 工序要点 * 工序要点

View File

@ -127,7 +127,6 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
throw exception(PROCESS_BOM_DETAIL_NOT_EXISTS); throw exception(PROCESS_BOM_DETAIL_NOT_EXISTS);
} }
} }
// 更新 // 更新
TaskDispatchDO updateObj = BeanUtils.toBean(updateReqVO, TaskDispatchDO.class); TaskDispatchDO updateObj = BeanUtils.toBean(updateReqVO, TaskDispatchDO.class);
if(!updateObj.canOperate(operateTypeEnum)){ if(!updateObj.canOperate(operateTypeEnum)){
@ -136,11 +135,9 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
// 明细工序状态更新 // 明细工序状态更新
if(operateTypeEnum == OperateTypeEnum.SUBMIT){ if(operateTypeEnum == OperateTypeEnum.SUBMIT){
updateReqVO.getTaskDispatchDetails().forEach(taskDispatchDetailDO -> { updateReqVO.getTaskDispatchDetails().forEach(taskDispatchDetailDO -> {
if(taskDispatchDetailDO.getProcedureStatus().intValue() == 0|| if(taskDispatchDetailDO.getProcedureStatus().intValue() == 0||taskDispatchDetailDO.getBeforeAmount()!=taskDispatchDetailDO.getAmount()
(taskDispatchDetailDO.getBeforeAmount()!=null && taskDispatchDetailDO.getAmount()!=null && taskDispatchDetailDO.getAmount() != taskDispatchDetailDO.getBeforeAmount())
|| (taskDispatchDetailDO.getBeforeAmount() == null && taskDispatchDetailDO.getAmount() != null)
|| (taskDispatchDetailDO.getBeforeAmount() != null && taskDispatchDetailDO.getAmount() == null)
){ ){
taskDispatchDetailDO.setBeforeAmount(taskDispatchDetailDO.getAmount());
taskDispatchDetailDO.setProcedureStatus(TaskDispatchProcedureStatusEnum.SUBMITTED.getCode()); taskDispatchDetailDO.setProcedureStatus(TaskDispatchProcedureStatusEnum.SUBMITTED.getCode());
} }
}); });
@ -155,7 +152,7 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
taskDispatchDetailDO.setProcedureStatus(TaskDispatchProcedureStatusEnum.DEFAULT.getCode()); taskDispatchDetailDO.setProcedureStatus(TaskDispatchProcedureStatusEnum.DEFAULT.getCode());
} }
}); });
} }
updateObj.setDispatchStatus(TaskDispatchStatusEnum.valueOf(updateReqVO.getActive()).getCode()); updateObj.setDispatchStatus(TaskDispatchStatusEnum.valueOf(updateReqVO.getActive()).getCode());
taskDispatchMapper.updateById(updateObj); taskDispatchMapper.updateById(updateObj);
@ -320,10 +317,6 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
List<TaskDispatchDetailDO> taskDispatchDetailDOS = taskDispatchDetailMapper.selectListByDispatchId(dispatchId); List<TaskDispatchDetailDO> taskDispatchDetailDOS = taskDispatchDetailMapper.selectListByDispatchId(dispatchId);
for (TaskDispatchDetailDO taskDispatchDetailDO : taskDispatchDetailDOS) { for (TaskDispatchDetailDO taskDispatchDetailDO : taskDispatchDetailDOS) {
taskDispatchDetailDO.setBeginProduce(taskReportMapper.hasReport(taskDispatchDetailDO.getId())) ; taskDispatchDetailDO.setBeginProduce(taskReportMapper.hasReport(taskDispatchDetailDO.getId())) ;
if (taskDispatchDetailDO.getAmount()!=null){
taskDispatchDetailDO.setBeforeAmount(taskDispatchDetailDO.getAmount());
}
} }
return taskDispatchDetailDOS; return taskDispatchDetailDOS;
} }
@ -630,6 +623,9 @@ public class TaskDispatchServiceImpl implements TaskDispatchService {
taskDispatchDetailMapper.updateBatch(updateList); taskDispatchDetailMapper.updateBatch(updateList);
} }
if(!insertList.isEmpty()) { if(!insertList.isEmpty()) {
for (TaskDispatchDetailDO taskDispatchDetailDO : insertList) {
taskDispatchDetailDO.setBeforeAmount(taskDispatchDetailDO.getAmount());
}
taskDispatchDetailMapper.insertBatch(insertList); taskDispatchDetailMapper.insertBatch(insertList);
//如果插入不为空区分是按人还是按岗位 //如果插入不为空区分是按人还是按岗位
// Map<Long, List<TaskDispatchDetailDO>> groupedByType = insertList.stream().collect(Collectors.groupingBy(vo -> vo.getDispatchType() == null ? 0: vo.getDispatchType())); // Map<Long, List<TaskDispatchDetailDO>> groupedByType = insertList.stream().collect(Collectors.groupingBy(vo -> vo.getDispatchType() == null ? 0: vo.getDispatchType()));