From a5828449c741475eb7ecb8cbdf7ced7f36be41a0 Mon Sep 17 00:00:00 2001 From: loujf Date: Wed, 7 Dec 2022 14:09:33 +0800 Subject: [PATCH] =?UTF-8?q?ndc=E4=BA=A4=E4=BA=92=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agv/server/impl/NDCAgvServiceImpl.java | 5 +- .../service/impl/InstructionServiceImpl.java | 2 +- .../auto/run/NDCSocketConnectionAutoRun.java | 98 ++++++++++++++----- 3 files changed, 78 insertions(+), 27 deletions(-) diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java index 3ad9c4e..b434a02 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java @@ -22,6 +22,7 @@ import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppServiceImpl; import org.nl.acs.opc.DeviceType; import org.nl.exception.BadRequestException; +import org.nl.start.auto.run.NDCSocketConnectionAutoRun; import org.nl.utils.SpringContextHolder; import org.slf4j.MDC; import org.springframework.stereotype.Service; @@ -73,7 +74,7 @@ public class NDCAgvServiceImpl implements NDCAgvService { }; log.info("下发删除AGV指令--{}", Bytes2HexString(b)); -// NDCSocketConnectionAutoRun.write(b); + NDCSocketConnectionAutoRun.write(b); System.out.println("下发删除agv指令数据:" + Bytes2HexString(b)); } } finally { @@ -182,7 +183,7 @@ public class NDCAgvServiceImpl implements NDCAgvService { }; log.info("下发AGV作业指令--{}", str1); -// NDCSocketConnectionAutoRun.write(b); + NDCSocketConnectionAutoRun.write(b); System.out.println("下发agv指令数据:" + Bytes2HexString(b)); } } finally { diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 8e37fcf..182f879 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -430,7 +430,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu @Transactional(rollbackFor = Exception.class) public void update(Instruction dto) { Instruction entity = this.findById(dto.getInstruction_id()); - //if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); + if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); String currentUsername = SecurityUtils.getCurrentUsername(); String now = DateUtil.now(); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java b/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java index f9f142f..bfb8a9a 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java @@ -195,7 +195,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { // 到达取货点请求取货 else if (phase == 0x03) { if (ObjectUtil.isEmpty(inst)) { - logServer.deviceExecuteLog("未找到指令号对应的指令:", "","",String.valueOf(ikey)); + logServer.deviceExecuteLog("ndc", "","","未找到指令号对应的指令:" + ikey); break; } //检测站点 @@ -207,7 +207,19 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - logServer.deviceExecuteLog(device_code,"","", "AGV请求取货设备{}无货,无法反馈"); + logServer.deviceExecuteLog("ndc","","", "AGV请求取货设备{}无货,无法反馈"); + } + } + //嘉耐缓存货架 + if (device.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) { + lnshLaminatingMachineDeviceDriver = (LnshLaminatingMachineDeviceDriver) device.getDeviceDriver(); + if (lnshLaminatingMachineDeviceDriver.getMove() != 0) { + inst.setExecute_status("1"); + instructionService.update(inst); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + } else { + logServer.deviceExecuteLog("ndc","","", "AGV请求取货设备{}无货,无法反馈"); } } //嘉耐工位模板 @@ -221,7 +233,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - logServer.deviceExecuteLog(device_code,"","","AGV请求取货设备{}无货,无法反馈"); + logServer.deviceExecuteLog("ndc","","","AGV请求取货设备{}无货,无法反馈"); } } //嘉耐码垛机械手工位 @@ -235,7 +247,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - logServer.deviceExecuteLog(device_code,"","","AGV请求取货设备{}无货,无法反馈"); + logServer.deviceExecuteLog("ndc","","","AGV请求取货设备{}无货,无法反馈"); } } //嘉耐音来码垛机械手工位 @@ -249,7 +261,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - logServer.deviceExecuteLog(device_code,"","","AGV请求取货设备{}无货,无法反馈"); + logServer.deviceExecuteLog("ndc","","","AGV请求取货设备{}无货,无法反馈"); } } //普通站点 @@ -267,7 +279,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - logServer.deviceExecuteLog(device_code,"","","AGV请求取货设备{}无货,无法反馈"); + logServer.deviceExecuteLog("ndc","","","AGV请求取货设备{}无货,无法反馈"); } } } @@ -275,7 +287,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { // 取货完成请求离开 else if (phase == 0x05) { if (ObjectUtil.isEmpty(inst)) { - logServer.deviceExecuteLog("未找到指令号对应的指令:", "","",String.valueOf(ikey)); + logServer.deviceExecuteLog("ndc", "","","未找到指令号对应的指令:" + ikey); break; } if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { @@ -286,7 +298,19 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - logServer.deviceExecuteLog(device_code,"","","AGV取货完成请求离开设备{}有货,无法反馈"); + logServer.deviceExecuteLog("ndc","","","AGV取货完成请求离开设备{}有货,无法反馈"); + } + } + //嘉耐缓存货架 + if (device.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) { + lnshLaminatingMachineDeviceDriver = (LnshLaminatingMachineDeviceDriver) device.getDeviceDriver(); + if (lnshLaminatingMachineDeviceDriver.getMove() == 0) { + inst.setExecute_status("5"); + instructionService.update(inst); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + } else { + logServer.deviceExecuteLog("ndc","","","AGV取货完成请求离开设备{}有货,无法反馈"); } } //嘉耐工位模板 @@ -299,7 +323,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - logServer.deviceExecuteLog(device_code,"","","AGV取货完成请求离开设备{}有货,无法反馈"); + logServer.deviceExecuteLog("ndc","","","AGV取货完成请求离开设备{}有货,无法反馈"); } } //嘉耐码垛机械手工位 @@ -312,7 +336,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - logServer.deviceExecuteLog(device_code,"","","AGV取货完成请求离开设备{}有货,无法反馈"); + logServer.deviceExecuteLog("ndc","","","AGV取货完成请求离开设备{}有货,无法反馈"); } } @@ -326,7 +350,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - logServer.deviceExecuteLog(device_code,"","","AGV取货完成请求离开设备{}有货,无法反馈"); + logServer.deviceExecuteLog("ndc","","","AGV取货完成请求离开设备{}有货,无法反馈"); } } @@ -348,9 +372,10 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { // 到达扫码点 else if (phase == 0x06) { if (ObjectUtil.isEmpty(inst)) { - logServer.deviceExecuteLog("未找到指令号对应的指令:", "","",String.valueOf(ikey)); + logServer.deviceExecuteLog("ndc", "","","未找到指令号对应的指令:" + ikey); break; } + logServer.deviceExecuteLog("ndc","","","phase==0x06," + "指令号:" + ikey + ",address:" + device_code); //检测站点 if (device.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) { lnshLaminatingMachineDeviceDriver = (LnshLaminatingMachineDeviceDriver) device.getDeviceDriver(); @@ -375,7 +400,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { //请求放货 else if (phase == 0x07) { if (ObjectUtil.isEmpty(inst)) { - logServer.deviceExecuteLog("未找到指令号对应的指令:", "","",String.valueOf(ikey)); + logServer.deviceExecuteLog("ndc", "","","未找到指令号对应的指令:" + ikey); break; } if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { @@ -386,7 +411,19 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - logServer.deviceExecuteLog(device_code,"","","AGV请求放货设备{}有货,无法反馈"); + logServer.deviceExecuteLog("ndc","","","AGV请求放货设备{}有货,无法反馈"); + } + } + //嘉耐缓存货架 + if (device.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) { + lnshLaminatingMachineDeviceDriver = (LnshLaminatingMachineDeviceDriver) device.getDeviceDriver(); + if (lnshLaminatingMachineDeviceDriver.getMove() == 0) { + inst.setExecute_status("3"); + instructionService.update(inst); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + } else { + logServer.deviceExecuteLog("ndc","","","AGV请求放货设备{}有货,无法反馈"); } } //嘉耐工位模板 @@ -401,7 +438,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - logServer.deviceExecuteLog(device_code,"","","AGV请求放货设备{}有货,无法反馈"); + logServer.deviceExecuteLog("ndc","","","AGV请求放货设备{}有货,无法反馈"); } } //嘉耐码垛机械手工位 @@ -415,7 +452,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - logServer.deviceExecuteLog(device_code,"","","AGV请求放货设备{}有货,无法反馈"); + logServer.deviceExecuteLog("ndc","","","AGV请求放货设备{}有货,无法反馈"); } } //嘉耐音来码垛机械手工位 @@ -429,14 +466,14 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - logServer.deviceExecuteLog(device_code,"","","AGV请求放货设备{}有货,无法反馈"); + logServer.deviceExecuteLog("ndc","","","AGV请求放货设备{}有货,无法反馈"); } } } // 放货完成请求离开 else if (phase == 0x09) { if (ObjectUtil.isEmpty(inst)) { - logServer.deviceExecuteLog("未找到指令号对应的指令:", "","",String.valueOf(ikey)); + logServer.deviceExecuteLog("ndc", "","","未找到指令号对应的指令:" + ikey); break; } if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { @@ -447,7 +484,19 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - logServer.deviceExecuteLog(device_code,"","","AGV放货完成请求离开设备{}无货,无法反馈"); + logServer.deviceExecuteLog("ndc","","","AGV放货完成请求离开设备{}无货,无法反馈"); + } + } + //嘉耐缓存货架 + if (device.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) { + lnshLaminatingMachineDeviceDriver = (LnshLaminatingMachineDeviceDriver) device.getDeviceDriver(); + if (lnshLaminatingMachineDeviceDriver.getMove() != 0) { + inst.setExecute_status("6"); + instructionService.update(inst); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + } else { + logServer.deviceExecuteLog("ndc","","","AGV放货完成请求离开设备{}无货,无法反馈"); } } //嘉耐工位模板 @@ -461,7 +510,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - logServer.deviceExecuteLog(device_code,"","","AGV放货完成请求离开设备{}无货,无法反馈"); + logServer.deviceExecuteLog("ndc","","","AGV放货完成请求离开设备{}无货,无法反馈"); } } @@ -476,7 +525,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - logServer.deviceExecuteLog(device_code,"","","AGV放货完成请求离开设备{}无货,无法反馈"); + logServer.deviceExecuteLog("ndc","","","AGV放货完成请求离开设备{}无货,无法反馈"); } } @@ -491,7 +540,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - logServer.deviceExecuteLog(device_code,"","","AGV放货完成请求离开设备{}无货,无法反馈"); + logServer.deviceExecuteLog("ndc","","","AGV放货完成请求离开设备{}无货,无法反馈"); } } @@ -575,7 +624,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { dto.setName(String.valueOf(carno)); if (arr[18] * 256 + arr[19] == 0) { dto.setState("IDLE"); - acsToWmsService.feedbackAgvStatus(String.valueOf(carno), "0", ""); +// acsToWmsService.feedbackAgvStatus(String.valueOf(carno), "0", ""); } else { StringBuffer errbs = new StringBuffer(); for (int i = 0; i < ERROR.length; i++) { @@ -584,7 +633,8 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { //反馈故障 } dto.setState("ERROR"); - acsToWmsService.feedbackAgvStatus(String.valueOf(carno), "1", "error"); +// logServer.deviceExecuteLog("ndc","","",String.valueOf(errbs)); +// acsToWmsService.feedbackAgvStatus(String.valueOf(carno), "1", "error"); } } //X坐标