opt: 1.解决手动创建指令时,内存中任务信息为NULL导致空指针。
This commit is contained in:
@@ -594,6 +594,10 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
dto = foramte(dto);
|
||||
String task_code = dto.getTask_code();
|
||||
TaskDto task = taskService.findByCodeFromCache(task_code);
|
||||
if (ObjectUtil.isEmpty(task) && StrUtil.isNotBlank(dto.getTask_id())){
|
||||
//从数据库查找
|
||||
task = taskService.findById(dto.getTask_id());
|
||||
}
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
|
||||
@@ -641,15 +645,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
if (ObjectUtil.isNotEmpty(task.getTask_type())) {
|
||||
dto.setInstruction_type(task.getTask_type());
|
||||
}
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
Device startdevice = appService.findDeviceByCode(dto.getStart_device_code());
|
||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
|
||||
|
||||
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
|
||||
hongXiangConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
|
||||
}
|
||||
|
||||
try {
|
||||
// String start_device_code = dto.getStart_device_code();
|
||||
|
||||
@@ -1319,6 +1319,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
instructionservice.create2(instdto);
|
||||
} catch (Exception e) {
|
||||
log.error("手动创建指令失败!任务id为:{},指令号为:{},失败原因{}", acsTask.getTask_id(), instdto.getInstruction_code(), e.getMessage());
|
||||
throw new BadRequestException("手动创建指令失败,失败原因:"+e.getMessage());
|
||||
}
|
||||
return instdto;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user