diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java b/wcs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java index 51068f13..795b3810 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java +++ b/wcs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java @@ -187,7 +187,15 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { dos.write(b); dos.flush(); } catch (IOException e) { - throw new BadRequestException(e.getMessage()); + try { + log.info("再次下发agv数据:" + Bytes2HexString(b)); + System.out.println("再次下发agv数据:" + Bytes2HexString(b)); + dos.write(b); + dos.flush(); + }catch (IOException e1){ + throw new BadRequestException(e1.getMessage()); + } + } } diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/wcs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 3f7df84e..dd9bb8aa 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/wcs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -41,6 +41,8 @@ import org.nl.acs.task.service.dto.TaskDto; import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.utils.FileUtil; import org.nl.modules.common.utils.SecurityUtils; +import org.nl.modules.lucene.service.LuceneExecuteLogService; +import org.nl.modules.lucene.service.dto.LuceneLogDto; import org.nl.modules.system.service.ParamService; import org.nl.modules.system.util.CodeUtil; import org.nl.modules.wql.WQL; @@ -84,7 +86,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu private TaskService taskService; @Autowired AcsToLiKuService acsToLiKuService; - +// private LuceneExecuteLogService lucene = SpringContextHolder.getBean(LuceneExecuteLogService.class); @Override public void autoInitial() { this.reload(); @@ -354,7 +356,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu * 7 不去称重平台称重PS20 agvtype:2 * 8 RT20 agvtype:3 */ - if(StrUtil.equals(task.getTask_type(),"10")){ + if(StrUtil.equals(task.getTask_type(),"18")){ CreateRequest createRequest = new CreateRequest(); List list = new ArrayList(); AcsToLiKuService acsToLiKuService = SpringContextHolder.getBean(AcsToLiKuService.class); @@ -457,7 +459,20 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu } } } catch (Exception e) { - dto.setSend_status("2"); + try { + Thread.sleep(5000L); + if (StrUtil.equals("1", dto.getAgv_system_type())) { + ndcAgvService.sendAgvTwoInstToNDC(dto, null); + } else if (StrUtil.equals("2", dto.getAgv_system_type())) { + ndcAgvService.sendAgvOneInstToNDC(dto); + } + dto.setSend_status("1"); + } catch (InterruptedException ex) { + ex.printStackTrace(); + } catch (Exception exception) { + dto.setSend_status("2"); + exception.printStackTrace(); + } e.printStackTrace(); } @@ -863,6 +878,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu jo.put("batch", ""); jo.put("islock", "0"); deviceService.changeDeviceStatus(jo); +// lucene.deviceExecuteLog(new LuceneLogDto(id,"指令更新状态为:"+entity.getInstruction_status())); + log.info("{}指令更新状态为:{}",id,entity.getInstruction_status()); this.update(entity); JSONObject taskjson = taskwo.query("task_id ='" + insttaskid + "'").uniqueResult(0); TaskDto obj = taskjson.toJavaObject(TaskDto.class); @@ -880,7 +897,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu @Transactional public void finishByLinkNum(String linkNum) { List insts = this.findByLinkNum(linkNum); - if (insts != null) { + if (insts != null && insts.size() > 0) { insts.stream().forEach(inst -> { try { this.finish(inst.getInstruction_id()); @@ -1039,7 +1056,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu }else { ndcAgvService.deleteAgvInstToNDC(entity); } - + flag = true; } else { flag = true; } @@ -1053,7 +1070,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu } if (flag) { - if (StrUtil.equals(entity.getInstruction_type(), "10")) { + if (StrUtil.equals(entity.getInstruction_type(), AgvTypeEnum.HAIROU_TYPE_1.getTaskType())) { CancelRequest cancelRequest = new CancelRequest(); cancelRequest.setTaskCodes(new ArrayList(Collections.singleton(entity.getInstruction_id()))); acsToLiKuService.cancel(cancelRequest);