|
|
@ -278,6 +278,10 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu |
|
|
|
public void create(Instruction dto) { |
|
|
|
dto = foramte(dto); |
|
|
|
String task_code = dto.getTask_code(); |
|
|
|
List<Instruction> list = this.findByTaskcodeFromCache(task_code); |
|
|
|
if (ObjectUtil.isNotEmpty(list)) { |
|
|
|
throw new BadRequestException("已存在该任务的指令信息"); |
|
|
|
} |
|
|
|
TaskDto task = taskService.findByCodeFromCache(task_code); |
|
|
|
|
|
|
|
String currentUsername = SecurityUtils.getCurrentUsername(); |
|
|
@ -362,14 +366,19 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu |
|
|
|
if (ObjectUtil.isEmpty(route)) { |
|
|
|
throw new BadRequestException("未查询到相关路由!"); |
|
|
|
} |
|
|
|
try { |
|
|
|
if (StrUtil.equals(shortPathsList.get(0).getType(), "1")) { |
|
|
|
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class); |
|
|
|
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
dto.setSend_status("2"); |
|
|
|
e.printStackTrace(); |
|
|
|
log.error(""); |
|
|
|
throw new BadRequestException("下发调度失败,NDC未连接!"); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
throw new BadRequestException(e.getMessage()); |
|
|
|
// dto.setSend_status("2");
|
|
|
|
// e.printStackTrace();
|
|
|
|
// log.error("");
|
|
|
|
} |
|
|
|
|
|
|
|
WQLObject wo = WQLObject.getWQLObject("acs_instruction"); |
|
|
@ -1438,4 +1447,13 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu |
|
|
|
((SiemensConveyorDeviceDriver) startDeviceDriver).writing(list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Instruction> findByTaskcodeFromCache(String task_code) { |
|
|
|
return Optional.ofNullable(this.instructions) |
|
|
|
.orElse(new CopyOnWriteArrayList<>()) |
|
|
|
.stream() |
|
|
|
.filter(instruction -> instruction.getTask_code().equals(task_code)) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|