fix:mr异常处理

This commit is contained in:
zhangzq
2024-08-31 09:13:26 +08:00
parent 83f9f311b7
commit e2bcb37ab6
2 changed files with 28 additions and 15 deletions

View File

@@ -3,6 +3,7 @@ package org.nl.wms.dispatch_manage.task.handler.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.domain.exception.BadRequestException;
@@ -15,7 +16,9 @@ import org.nl.wms.dispatch_manage.task.service.dao.SchBaseTask;
import org.nl.wms.flow_manage.flow.service.execution.IActRuExecutionService;
import org.nl.wms.flow_manage.flow.service.execution.dao.ActRuExecution;
import org.nl.wms.flow_manage.monitor.event.FlowContinueEvent;
import org.nl.wms.flow_manage.monitor.event.FlowStartEvent;
import org.nl.wms.md_manage.vehicleMater.service.IMdPbVehicleMaterService;
import org.nl.wms.md_manage.vehicleMater.service.dao.MdPbVehicleMater;
import org.nl.wms.md_manage.vehicleMater.service.dto.MdPbVehicleMaterVo;
import org.nl.wms.stor_manage.struct.service.IStIvtStructattrService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -62,21 +65,30 @@ public class PalletInStorageTask extends AbstractTask {
//更新载具proc_inst_id
String currentInstId = vehicleMater.getProc_inst_id();
if (StringUtils.isEmpty(currentInstId)){
throw new BadRequestException("申请任务失败:载具"+vehicle_code+"未创建入库流程");
//触发流程
BussEventMulticaster.Publish(
new FlowStartEvent("pallet_in",
(proc_inst_id,empPlace) -> iMdPbVehicleMaterService.update(new UpdateWrapper<MdPbVehicleMater>()
.set("proc_inst_id",proc_inst_id)
.eq("vehicle_code",vehicle_code)
.eq("is_delete",false))
,null)
.build("md_pb_vehicleMater",vehicleMater.getId(),null,null, (JSONObject) JSONObject.toJSON(vehicleMater))
);
}else {
SchBaseTask schBaseTask = iSchBaseTaskService.getOne(new QueryWrapper<SchBaseTask>()
.eq("vehicle_code", vehicle_code).select("task_code")
.lt("status",StatusEnum.FORM_STATUS.code("完成")));
if (schBaseTask!=null){
throw new BadRequestException("申请任务失败:载具"+vehicle_code+"已经存任务"+schBaseTask.getTask_code());
}
ActRuExecution execution = iActRuExecutionService.getById(currentInstId);
if (execution == null){
throw new BadRequestException("申请任务失败:载具"+vehicle_code+"流程信息不存在"+currentInstId);
}
FlowContinueEvent continueEvent = new FlowContinueEvent(currentInstId, null, new JSONObject(MapOf.of("start_point", point_code1)));
BussEventMulticaster.Publish(continueEvent);
}
SchBaseTask schBaseTask = iSchBaseTaskService.getOne(new QueryWrapper<SchBaseTask>()
.eq("vehicle_code", vehicle_code).select("task_code")
.lt("status",StatusEnum.FORM_STATUS.code("完成")));
if (schBaseTask!=null){
throw new BadRequestException("申请任务失败:载具"+vehicle_code+"已经存任务"+schBaseTask.getTask_code());
}
ActRuExecution execution = iActRuExecutionService.getById(currentInstId);
if (execution == null){
throw new BadRequestException("申请任务失败:载具"+vehicle_code+"流程信息不存在"+currentInstId);
}
FlowContinueEvent continueEvent = new FlowContinueEvent(currentInstId, null, new JSONObject(MapOf.of("start_point", point_code1)));
BussEventMulticaster.Publish(continueEvent);
}
return null;
}

View File

@@ -275,7 +275,8 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
.set("point_code2", new_struct_code)
.set("remark", struct_code + "入满异常重新分配货位" + new_struct_code)
.eq("task_code", task_code));
StIvtStructattr struct = iStIvtStructattrService.getOne(new QueryWrapper<StIvtStructattr>().eq("struct_code", struct_code));
StIvtStructattr struct = iStIvtStructattrService.getOne(new QueryWrapper<StIvtStructattr>().eq("struct_code", task.getPoint_code2()));
if (StringUtils.isEmpty(struct.getVehicle_code())){
iStIvtStructattrService.update(new UpdateWrapper<StIvtStructattr>()
.eq("struct_code", struct_code)