From 039ea2579a40982d2d77d8b97def15848a07c70a Mon Sep 17 00:00:00 2001 From: tuqiang <437016993@qq.com> Date: Thu, 10 Apr 2025 20:56:50 +0800 Subject: [PATCH] =?UTF-8?q?add=EF=BC=9A=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/nl/acs/agv/AgvWaitUtil.java | 28 ++- .../run/TwoNDCSocketConnectionAutoRun.java | 4 +- .../agv/ndctwo/AgvNdcTwoDeviceDriver.java | 174 ++++++++++++------ .../FoldDiscSiteDeviceDriver.java | 55 +++--- ...ConveyorWithScannerWeightDeviceDriver.java | 65 +++---- ...pedManipulatorManipulatorDeviceDriver.java | 2 +- .../paper_tube_pick_site/ItemProtocol.java | 28 +++ .../PaperTubePickSiteDeviceDriver.java | 27 +++ .../OvenGantryManipulatorDeviceDriver.java | 8 +- .../PlugPullDeviceSiteDeviceDriver.java | 61 +++--- .../PullHeadManipulatorDeviceDriver.java | 57 ++++-- .../PullTailManipulatorDeviceDriver.java | 8 +- .../SlitTwoManipulatorDeviceDriver.java | 10 +- .../wms/service/impl/WmsToAcsServiceImpl.java | 58 ++++-- .../service/impl/InstructionServiceImpl.java | 22 ++- .../task/service/impl/TaskServiceImpl.java | 2 +- 16 files changed, 413 insertions(+), 196 deletions(-) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java index 6ab6b5b78..bf370064e 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java @@ -69,8 +69,8 @@ public class AgvWaitUtil { return map; } else { LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(inst.getCarno()) - .content("agv诺宝对接位行架不允许取货:" + inst.getCarno() + "点位号" + manipulatorAgvStationDeviceDriver.getDevice_code()) + .device_code(manipulatorAgvStationDeviceDriver.getDevice_code()) + .content("未给agv进入信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -138,6 +138,16 @@ public class AgvWaitUtil { if (manipulatorAgvStationDeviceDriver.getTo_command() != 3) { manipulatorAgvStationDeviceDriver.writing(3); } + if (manipulatorAgvStationDeviceDriver.getAction() != 0) { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(manipulatorAgvStationDeviceDriver.getDevice_code()) + .content("未给agv离开信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为0") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + log.info("不允许仙工AGV取货,对接位有报警,设备号 - {}", startDeviceCode); + throw new BadRequestException("上位系统不允许agv离开"); + } } } @@ -194,8 +204,8 @@ public class AgvWaitUtil { } if (manipulatorAgvStationDeviceDriver.getAction() != 1) { LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(inst.getCarno()) - .content("agv诺宝对接位行架不允许放货:" + inst.getCarno() + "点位号" + manipulatorAgvStationDeviceDriver.getDevice_code()) + .device_code(manipulatorAgvStationDeviceDriver.getDevice_code()) + .content("未给agv进入信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -228,6 +238,16 @@ public class AgvWaitUtil { if (manipulatorAgvStationDeviceDriver.getTo_command() != 5) { manipulatorAgvStationDeviceDriver.writing(5); } + if (manipulatorAgvStationDeviceDriver.getAction() != 0) { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(manipulatorAgvStationDeviceDriver.getDevice_code()) + .content("未给agv离开信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为0") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + log.info("不允许仙工AGV取货,对接位有报警,设备号 - {}", endDeviceCode); + throw new BadRequestException("上位系统不允许agv离开"); + } } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java index c835021a0..6bd87f5a7 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java @@ -108,7 +108,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { byte[] b = new byte[1024]; socket = new Socket(); - socket.connect(socketAddress, 2 * 1000); + socket.connect(socketAddress, 5 * 1000); socket.setKeepAlive(true);//长链接 socket.setSoTimeout(30000);//读取超时时间 dos = new DataOutputStream(socket.getOutputStream()); @@ -117,7 +117,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { while (socket.isConnected()) { System.out.println("当前socket状态:"+socket.isConnected()); int count = dis.read(b); - System.out.println("当前count值:"+count); +// System.out.println("当前count值:"+count); if (count == -1) { log.error("agv连接出现异常:服务端被关闭"); if (ObjectUtil.isNotEmpty(socket)) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java index 34d807071..8d82b02e2 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java @@ -321,7 +321,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", manipulatorAgvStationDeviceDriver.getDeviceCode(), manipulatorAgvStationDeviceDriver.getAction(), ikey); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") + .content("未给agv进入信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -563,25 +563,34 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } catch (Exception e) { e.printStackTrace(); } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - String task_code = inst.getTask_code(); - if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms")) - && StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("task_code", task_code); - LuceneLogDto logDto1 = LuceneLogDto.builder() - .device_code(manipulatorAgvStationDeviceDriver.getDevice_code()) - .content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + manipulatorAgvStationDeviceDriver.getDeviceCode()) + if (manipulatorAgvStationDeviceDriver.getAction() == 0) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(this.getDeviceCode()) + .content("agvphase:" + phase + "反馈:" + data) .build(); - logDto1.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto1); - acsToWmsService.actionFinishRequest2(jsonObject); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + String task_code = inst.getTask_code(); + if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms")) + && StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("task_code", task_code); + LuceneLogDto logDto1 = LuceneLogDto.builder() + .device_code(manipulatorAgvStationDeviceDriver.getDevice_code()) + .content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + manipulatorAgvStationDeviceDriver.getDeviceCode()) + .build(); + logDto1.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto1); + acsToWmsService.actionFinishRequest2(jsonObject); + } + } else { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(manipulatorAgvStationDeviceDriver.getDevice_code()) + .content("未给agv离开信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为0") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); @@ -800,8 +809,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } else { message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(manipulatorAgvStationDeviceDriver.getDevice_code()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") + .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) + .content("未给agv进入信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -1005,7 +1014,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; LuceneLogDto logDto = LuceneLogDto.builder() .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") + .content("未给agv进入信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -1032,7 +1041,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; LuceneLogDto logDto = LuceneLogDto.builder() .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") + .content("未给agv进入信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -1058,8 +1067,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } else { message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") + .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) + .content("未给agv进入信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -1086,7 +1095,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic message = "设备号:" + manipulatorAgvStationDeviceDriver.getDevice_code() + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; LuceneLogDto logDto = LuceneLogDto.builder() .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") + .content("未给agv进入信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -1213,25 +1222,34 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } catch (Exception e) { e.printStackTrace(); } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - String task_code = inst.getTask_code(); - if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms")) - && StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("task_code", task_code); - LuceneLogDto logDto1 = LuceneLogDto.builder() - .device_code(manipulatorAgvStationDeviceDriver.getDevice_code()) - .content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + manipulatorAgvStationDeviceDriver.getDeviceCode()) + if (manipulatorAgvStationDeviceDriver.getAction() == 0) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(this.getDeviceCode()) + .content("agvphase:" + phase + "反馈:" + data) .build(); - logDto1.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto1); - acsToWmsService.actionFinishRequest2(jsonObject); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + String task_code = inst.getTask_code(); + if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms")) + && StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("task_code", task_code); + LuceneLogDto logDto1 = LuceneLogDto.builder() + .device_code(manipulatorAgvStationDeviceDriver.getDevice_code()) + .content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + manipulatorAgvStationDeviceDriver.getDeviceCode()) + .build(); + logDto1.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto1); + acsToWmsService.actionFinishRequest2(jsonObject); + } + } else { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(manipulatorAgvStationDeviceDriver.getDevice_code()) + .content("未给agv离开信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为0") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); @@ -1429,7 +1447,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") + .content("未给agv进入信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -1643,13 +1661,22 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } catch (Exception e) { e.printStackTrace(); } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + if (manipulatorAgvStationDeviceDriver.getAction() == 0) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(this.getDeviceCode()) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } else { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(manipulatorAgvStationDeviceDriver.getDevice_code()) + .content("未给agv离开信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为0") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); try { @@ -1687,10 +1714,28 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic String to_material = jsonObject.getString("to_material"); String to_spec = jsonObject.getString("to_spec"); String to_qty = jsonObject.getString("to_qty"); + String to_material1 = jsonObject.getString("to_material1"); + String to_spec1 = jsonObject.getString("to_spec1"); + String to_qty1 = jsonObject.getString("to_qty1"); map.put("to_command", 5); map.put("to_material", to_material); map.put("to_spec", to_spec); map.put("to_qty", to_qty); +// if ("BH_17".equals(device_code)) { +// map.put("to_material1", to_material1); +// map.put("to_spec1", to_spec1); +// map.put("to_qty1", to_qty1); +// } +// if ("BH_18".equals(device_code)) { +// map.put("to_material2", to_material1); +// map.put("to_spec2", to_spec1); +// map.put("to_qty2", to_qty1); +// } +// if ("BH_19".equals(device_code)) { +// map.put("to_material3", to_material1); +// map.put("to_spec3", to_spec1); +// map.put("to_qty3", to_qty1); +// } paperTubePickSiteDeviceDriver.writing(map); } else { map.put("to_command", 5); @@ -1856,7 +1901,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") + .content("未给agv进入信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -2053,13 +2098,22 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } catch (Exception e) { e.printStackTrace(); } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + if (manipulatorAgvStationDeviceDriver.getAction() == 0) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(this.getDeviceCode()) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + }else { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(manipulatorAgvStationDeviceDriver.getDevice_code()) + .content("未给agv离开信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为0") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); try { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java index 28353d701..6aa4ad423 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java @@ -191,9 +191,7 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements container_type = this.itemProtocol.getContainer_type(); carrier_direction = this.itemProtocol.getCarrier_direction(); if (mode != last_mode) { - requireSucess = false; - } // 更新指令状态 if (move != 0 && task > 0) { @@ -383,15 +381,20 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements map3.put("value", "1"); list.add(map3); this.writing(list); - requireSucess = true; - while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() + try { + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + if (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() , inst.getInstruction_code())) { this.writing(list); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - e.printStackTrace(); - } + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(device_code + "电气的指令号:" + this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() + "与系统下发的指令:+" + inst.getInstruction_code() + "不一致,再次下发电气信号") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); if (ObjectUtil.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) { requireSucess = false; return false; @@ -504,7 +507,6 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements //创建指令后修改任务状态 taskdto.setTask_status(TaskStatusEnum.BUSY.getIndex()); taskserver.update(taskdto); - requireSucess = true; String next_addr = nextDevice.getExtraValue().get("address").toString(); List list = new ArrayList(); @@ -521,26 +523,27 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements map3.put("value", "1"); list.add(map3); this.writing(list); - requireSucess = true; - while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() + try { + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + if (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() , instdto.getInstruction_code())) { this.writing(list); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content(device_code + instdto.getInstruction_code() + "再次下发电气信号") .build(); - logDto.setLog_level(3); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } + if (ObjectUtil.isEmpty(taskserver.findByCode(taskdto.getTask_code()))) { requireSucess = false; return false; } } + requireSucess = true; } else { //如果不存在则直接找对应指令 Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code); @@ -565,26 +568,26 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements map3.put("value", "1"); list.add(map3); this.writing(list); - requireSucess = true; - while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() + try { + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + if (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() , inst.getInstruction_code())) { this.writing(list); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content(device_code + inst.getInstruction_code() + "再次下发电气信号") .build(); - logDto.setLog_level(3); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - e.printStackTrace(); - } if (ObjectUtil.isEmpty(instructionService.findByDeviceCodeFromCache(this.device_code))) { requireSucess = false; return false; } } + requireSucess = true; } return true; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java index 7453ed0c3..bbe2ed067 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java @@ -248,7 +248,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv barcode = this.itemProtocol.getBarcode(); material_barcode = this.itemProtocol.getMaterialBarcode(); to_height_level = this.itemProtocol.getTo_height_level(); - }catch (Exception e){ + } catch (Exception e) { this.iserror = true; String extracted = DeviceErrorUtil.extracted(e); LuceneLogDto logDto = LuceneLogDto.builder() @@ -953,26 +953,26 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv map3.put("value", "1"); list.add(map3); this.writing(list); - requireSucess = true; - while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() + try { + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + if (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() , inst.getInstruction_code())) { this.writing(list); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content(device_code + inst.getInstruction_code() + "再次下发电气信号") + .content(device_code + "电气的指令号:" + this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() + "与系统下发的指令:+" + inst.getInstruction_code() + "不一致,再次下发电气信号") .build(); - logDto.setLog_level(3); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - e.printStackTrace(); - } if (ObjectUtil.isEmpty(instructionService.findByDeviceCodeFromCache(this.device_code))) { requireSucess = false; return true; } } + requireSucess = true; return false; } @@ -1090,40 +1090,41 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv map4.put("value", "1"); list2.add(map4); this.writing(list2); - led_message = getLedMessage(instdto); - List deviceCodes = this.getExtraDeviceCodes("link_device_code"); - String device = null; - if (ObjectUtil.isNotEmpty(deviceCodes)) { - for (String deviceCode : deviceCodes) { - Device linkDevice = deviceAppService.findDeviceByCode(deviceCode); - if (ObjectUtil.isEmpty(linkDevice)) { - throw new BadRequestException("设备:" + device_code + "关联设备->" + deviceCode + "为空!"); - } - if (linkDevice.getDeviceDriver() instanceof LedScreenDeviceDriver) { - device = deviceCode; - } - } +// led_message = getLedMessage(instdto); +// List deviceCodes = this.getExtraDeviceCodes("link_device_code"); +// String device = null; +// if (ObjectUtil.isNotEmpty(deviceCodes)) { +// for (String deviceCode : deviceCodes) { +// Device linkDevice = deviceAppService.findDeviceByCode(deviceCode); +// if (ObjectUtil.isEmpty(linkDevice)) { +// throw new BadRequestException("设备:" + device_code + "关联设备->" + deviceCode + "为空!"); +// } +// if (linkDevice.getDeviceDriver() instanceof LedScreenDeviceDriver) { +// device = deviceCode; +// } +// } +// } +// taskScreenService.getLedMessage(device); + try { + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); } - taskScreenService.getLedMessage(device); - requireSucess = true; - while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() + if (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() , instdto.getInstruction_code())) { this.writing(list); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content(device_code + instdto.getInstruction_code() + "再次下发电气信号") + .content(device_code + "电气的指令号:" + this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() + "与系统下发的指令:+" + instdto.getInstruction_code() + "不一致,再次下发电气信号") .build(); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } if (ObjectUtil.isEmpty(taskserver.findByCode(taskdto.getTask_code()))) { requireSucess = false; return true; } } + requireSucess = true; return false; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java index 14726e573..03e72700c 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java @@ -221,7 +221,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice this.iserror = true; LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content(this.device_code + "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null") + .content(this.device_code + "读取信号值时出现异常:" + Arrays.toString(var17.getStackTrace())) .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/paper_tube_pick_site/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/paper_tube_pick_site/ItemProtocol.java index 1f55202b3..91938f399 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/paper_tube_pick_site/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/paper_tube_pick_site/ItemProtocol.java @@ -39,6 +39,25 @@ public class ItemProtocol { public static String item_to_spec = "to_spec"; //下发物料数量 public static String item_to_qty = "to_qty"; + //下发BH-17物料类型 + public static String item_to_material1 = "to_material1"; + //下发BH-17物料规格 + public static String item_to_spec1 = "to_spec1"; + //下发BH-17物料数量 + public static String item_to_qty1 = "to_qty1"; + //下发BH-18物料类型 + public static String item_to_material2 = "to_material2"; + //下发BH-18物料规格 + public static String item_to_spec2 = "to_spec2"; + //下发BH-18物料数量 + public static String item_to_qty2 = "to_qty2"; + //下发BH-19物料类型 + public static String item_to_material3 = "to_material3"; + //下发BH-19物料规格 + public static String item_to_spec3 = "to_spec3"; + //下发BH-19物料数量 + public static String item_to_qty3 = "to_qty3"; + private PaperTubePickSiteDeviceDriver driver; @@ -139,6 +158,15 @@ public class ItemProtocol { list.add(new ItemDto(item_to_material, "下发物料类型", "DB2.W2")); list.add(new ItemDto(item_to_spec, "下发物料规格", "DB2.W4")); list.add(new ItemDto(item_to_qty, "下发物料数量", "DB2.W8")); +// list.add(new ItemDto(item_to_material1, "下发BH-17物料类型", "DB2.W2")); +// list.add(new ItemDto(item_to_spec1, "下发BH-17物料规格", "DB2.W4")); +// list.add(new ItemDto(item_to_qty1, "下发BH-17物料数量", "DB2.W8")); +// list.add(new ItemDto(item_to_material2, "下发BH-18物料类型", "DB2.W2")); +// list.add(new ItemDto(item_to_spec2, "下发BH-18物料规格", "DB2.W4")); +// list.add(new ItemDto(item_to_qty2, "下发BH-18物料数量", "DB2.W8")); +// list.add(new ItemDto(item_to_material3, "下发BH-19物料类型", "DB2.W2")); +// list.add(new ItemDto(item_to_spec3, "下发BH-19物料规格", "DB2.W4")); +// list.add(new ItemDto(item_to_qty3, "下发BH-19物料数量", "DB2.W8")); return list; } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/paper_tube_pick_site/PaperTubePickSiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/paper_tube_pick_site/PaperTubePickSiteDeviceDriver.java index dad45503d..7f2681d8a 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/paper_tube_pick_site/PaperTubePickSiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/paper_tube_pick_site/PaperTubePickSiteDeviceDriver.java @@ -105,6 +105,33 @@ public class PaperTubePickSiteDeviceDriver extends AbstractOpcDeviceDriver imple //下发物料数量 int to_qty=0; int last_to_qty=0; + +// //下发物料类型 +// String to_material1 =null; +// String last_to_material1 =null; +// //下发物料规格 +// int to_spec1=0; +// int last_to_spec1=0; +// //下发物料数量 +// int to_qty1=0; +// int last_to_qty1=0;//下发物料类型 +// String to_material2 =null; +// String last_to_material2 =null; +// //下发物料规格 +// int to_spec2=0; +// int last_to_spec2=0; +// //下发物料数量 +// int to_qty2=0; +// int last_to_qty2=0;//下发物料类型 +// String to_material3 =null; +// String last_to_material3 =null; +// //下发物料规格 +// int to_spec3=0; +// int last_to_spec3=0; +// //下发物料数量 +// int to_qty3=0; +// int last_to_qty3=0; + //管芯编码 String paper_code = null; int paper_location = 0 ; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java index 96235dc09..0a44378bf 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -221,7 +221,13 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } catch (Exception var17) { var17.printStackTrace(); // feedMessage = var17.getMessage(); - logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); + + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(this.device_code + "读取信号值时出现异常:" + Arrays.toString(var17.getStackTrace())) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } if (mode == 0) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java index 665b4b708..f458527a7 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java @@ -195,31 +195,42 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl @Override public void execute() throws Exception { - device_code = this.getDeviceCode(); - mode = this.itemProtocol.getMode(); - move = this.itemProtocol.getMove(); - action = this.itemProtocol.getAction(); - error = this.itemProtocol.getError(); - task = this.itemProtocol.getTask(); - heartbeat = this.itemProtocol.getHeartbeat(); - barcode = this.itemProtocol.getBarcode(); - weight1 = this.itemProtocol.getWeight1(); - material1 = this.itemProtocol.getMaterial1(); - weight2 = this.itemProtocol.getWeight2(); - size = this.itemProtocol.getSize(); - material2 = this.itemProtocol.getMaterial2(); - toCommand = this.itemProtocol.getTo_command(); - toMaterial1 = this.itemProtocol.getTo_material1(); - toMaterial2 = this.itemProtocol.getTo_material2(); - toMaterial3 = this.itemProtocol.getTo_material3(); - toMaterial4 = this.itemProtocol.getTo_material4(); - toQty1 = this.itemProtocol.getTo_qty1(); - toQty2 = this.itemProtocol.getTo_qty2(); - toQzzType = this.itemProtocol.getTo_qzz_type(); - toSize1 = this.itemProtocol.getTo_size1(); - toSize2 = this.itemProtocol.getTo_size2(); - toSize3 = this.itemProtocol.getTo_size3(); - toSize4 = this.itemProtocol.getTo_size4(); + try { + device_code = this.getDeviceCode(); + mode = this.itemProtocol.getMode(); + move = this.itemProtocol.getMove(); + action = this.itemProtocol.getAction(); + error = this.itemProtocol.getError(); + task = this.itemProtocol.getTask(); + heartbeat = this.itemProtocol.getHeartbeat(); + barcode = this.itemProtocol.getBarcode(); + weight1 = this.itemProtocol.getWeight1(); + material1 = this.itemProtocol.getMaterial1(); + weight2 = this.itemProtocol.getWeight2(); + size = this.itemProtocol.getSize(); + material2 = this.itemProtocol.getMaterial2(); + toCommand = this.itemProtocol.getTo_command(); + toMaterial1 = this.itemProtocol.getTo_material1(); + toMaterial2 = this.itemProtocol.getTo_material2(); + toMaterial3 = this.itemProtocol.getTo_material3(); + toMaterial4 = this.itemProtocol.getTo_material4(); + toQty1 = this.itemProtocol.getTo_qty1(); + toQty2 = this.itemProtocol.getTo_qty2(); + toQzzType = this.itemProtocol.getTo_qzz_type(); + toSize1 = this.itemProtocol.getTo_size1(); + toSize2 = this.itemProtocol.getTo_size2(); + toSize3 = this.itemProtocol.getTo_size3(); + toSize4 = this.itemProtocol.getTo_size4(); + } catch (Exception var17) { + + var17.printStackTrace(); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(this.device_code + "读取信号值时出现异常:" + Arrays.toString(var17.getStackTrace())) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } if (mode != lastMode) { requireSucess = false; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java index 2b613077b..bb5811cad 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java @@ -246,10 +246,14 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp ManipulatorApplyPointRequest manipulatorApplyPointRequest = new ManipulatorApplyPointRequest(); ManipulatorApplyPointResponse manipulatorApplyPointResponse; inst = checkInst(); + if (ObjectUtil.isEmpty(inst)) { + log.info("指令号为空!"); + return; + } String task_code = inst.getTask_code(); manipulatorApplyPointRequest.setType("1"); manipulatorApplyPointRequest.setTask_code(task_code); - if (toCommand != 6) { + if (to_getpoint == 0) { manipulatorApplyPointResponse = acsToWmsService.manipulatorApplyPointRequest(manipulatorApplyPointRequest); if (manipulatorApplyPointResponse.getstatus() == 200) { LuceneLogDto logDto1 = LuceneLogDto.builder() @@ -261,10 +265,16 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp String get_device_code = manipulatorApplyPointResponse.getDevice_code(); Device device = deviceAppService.findDeviceByCode(get_device_code); String to_new_getpoint = device.getExtraValue().get("address").toString(); - Map map = new LinkedHashMap<>(); - map.put("to_command", "6"); - map.put("to_getpoint", Integer.parseInt(to_new_getpoint)); - this.writing(map); + List list = new ArrayList(); + Map map1 = new HashMap<>(); + Map map2 = new HashMap<>(); + map1.put("code", "to_command"); + map1.put("value", "6"); + map2.put("code", "to_getpoint"); + map2.put("value", Integer.parseInt(to_new_getpoint)); + list.add(map1); + list.add(map2); + this.writing(list); message = "申请新取货点成功"; } else { message = "申请新取货点失败"; @@ -285,10 +295,14 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp ManipulatorApplyPointRequest manipulatorApplyPointRequest = new ManipulatorApplyPointRequest(); ManipulatorApplyPointResponse manipulatorApplyPointResponse; inst = checkInst(); + if (ObjectUtil.isEmpty(inst)) { + log.info("指令号为空!"); + return; + } String task_code = inst.getTask_code(); manipulatorApplyPointRequest.setType("2"); manipulatorApplyPointRequest.setTask_code(task_code); - if (toCommand != 7) { + if (to_putpoint == 0) { manipulatorApplyPointResponse = acsToWmsService.manipulatorApplyPointRequest(manipulatorApplyPointRequest); if (manipulatorApplyPointResponse.getstatus() == 200) { LuceneLogDto logDto1 = LuceneLogDto.builder() @@ -300,10 +314,16 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp String put_device_code = manipulatorApplyPointResponse.getDevice_code(); Device device = deviceAppService.findDeviceByCode(put_device_code); String to_new_putpoint = device.getExtraValue().get("address").toString(); - Map map = new LinkedHashMap<>(); - map.put("to_command", "7"); - map.put("to_putpoint", Integer.parseInt(to_new_putpoint)); - this.writing(map); + List list = new ArrayList(); + Map map1 = new HashMap<>(); + Map map2 = new HashMap<>(); + map1.put("code", "to_command"); + map1.put("value", "6"); + map2.put("code", "to_putpoint"); + map2.put("value", Integer.parseInt(to_new_putpoint)); + list.add(map1); + list.add(map2); + this.writing(list); message = "申请新放货点成功"; } else { message = "申请新放货点失败"; @@ -315,8 +335,12 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp } catch (Exception var17) { var17.printStackTrace(); - // feedMessage = var17.getMessage(); - logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(this.device_code + "读取信号值时出现异常:" + Arrays.toString(var17.getStackTrace())) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } @@ -413,9 +437,12 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp Instruction inst2 = checkInst(); if (inst2 != null) { if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) { - Map map = new LinkedHashMap<>(); - map.put("to_command", "5"); - this.writing(map); + List list = new ArrayList(); + Map map1 = new HashMap<>(); + map1.put("code", "to_command"); + map1.put("value", "5"); + list.add(map1); + this.writing(list); message = "universal_message1"; try { finish_instruction(inst2); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java index 06f96563a..fead4d8a0 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java @@ -307,8 +307,12 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp } catch (Exception var17) { var17.printStackTrace(); - // feedMessage = var17.getMessage(); - logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(this.device_code + "读取信号值时出现异常:" + Arrays.toString(var17.getStackTrace())) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java index f5164dd42..4354d79b7 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java @@ -190,8 +190,12 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl } catch (Exception var17) { - logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage()); -// return; + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(this.device_code + "读取信号值时出现异常:" + Arrays.toString(var17.getStackTrace())) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } // if (!this.itemProtocol.getIsonline()) { @@ -591,7 +595,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl try { instructionService.create(instdto); } catch (Exception e) { - logServer.deviceExecuteLog(device_code, "", instdto.getInstruction_code(), "指令创建失败,原因->" + e.getMessage()); + logServer.deviceExecuteLog(device_code, "", instdto.getInstruction_code(), "->" + e.getMessage()); } //创建指令后修改任务状态 taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex()); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index 6e2bbd6e1..3d5ad9e19 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -702,27 +702,33 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { @Override public Map getTubeMes(String jsonObject) throws Exception { log.info("下发管芯信息--------------:输入参数" + jsonObject); + JSONArray datas = JSONArray.parseArray(jsonObject); + Map map = new HashMap(); + JSONObject jo = (JSONObject) datas.get(0); + String deviceCode = jo.getString("device_code"); LuceneLogDto logDto = LuceneLogDto.builder() - .device_code("下发管芯信息") + .device_code(deviceCode) .content("下发管芯信息-----输入参数:" + jsonObject) .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); - JSONArray datas = JSONArray.parseArray(jsonObject); - Map map = new HashMap(); - for (int i = 0; i < datas.size(); i++) { - JSONObject data = (JSONObject) datas.get(i); - String device_code = data.getString("device_code"); - String to_material = data.getString("to_material"); - String to_spec = data.getString("to_spec"); - String to_qty = data.getString("to_qty"); - Device device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device)) { - throw new Exception("未找到对应设备:" + device_code); - } - PaperTubePickSiteDeviceDriver paperTubePickSiteDeviceDriver; - if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { - paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); + Device code = deviceAppService.findDeviceByCode(deviceCode); + PaperTubePickSiteDeviceDriver paperTubePickSiteDeviceDriver; + if (code.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { + paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) code.getDeviceDriver(); + for (int i = 0; i < datas.size(); i++) { + JSONObject data = (JSONObject) datas.get(i); + String device_code = data.getString("device_code"); + String to_material = data.getString("to_material"); + String to_spec = data.getString("to_spec"); + String to_qty = data.getString("to_qty"); +// String to_material1 = data.getString("to_material1"); +// String to_spec1 = data.getString("to_spec1"); +// String to_qty1 = data.getString("to_qty1"); + Device device = deviceAppService.findDeviceByCode(device_code); + if (ObjectUtil.isEmpty(device)) { + throw new Exception("未找到对应设备:" + device_code); + } if (ObjectUtil.isEmpty(to_material)) { map.put("to_material", "0"); map.put("to_spec", "0"); @@ -731,7 +737,23 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { map.put("to_material", to_material); map.put("to_spec", to_spec); map.put("to_qty", to_qty); +// if ("BH_17".equals(device_code)) { +// map.put("to_material1", to_material1); +// map.put("to_spec1", to_spec1); +// map.put("to_qty1", to_qty1); +// } +// if ("BH_18".equals(device_code)) { +// map.put("to_material2", to_material1); +// map.put("to_spec2", to_spec1); +// map.put("to_qty2", to_qty1); +// } +// if ("BH_19".equals(device_code)) { +// map.put("to_material3", to_material1); +// map.put("to_spec3", to_spec1); +// map.put("to_qty3", to_qty1); +// } } + log.info("下发电气信号--------------:参数" + map); paperTubePickSiteDeviceDriver.writing(map); log.info("给电气下发信号成功!"); @@ -741,8 +763,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { resultJson.put("status", HttpStatus.OK.value()); resultJson.put("message", "操作成功"); LuceneLogDto logDto1 = LuceneLogDto.builder() - .device_code("下发管芯信息") - .content("下发管芯信息-----返回参数:" + resultJson) + .device_code(deviceCode) + .content("下发电气信号--------------:参数" + map) .build(); logDto1.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto1); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 2907b33b1..b24029096 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -1000,7 +1000,7 @@ public class InstructionServiceImpl extends CommonServiceImpl(taskMapper) .eq(Task::getTask_id, insttaskid) @@ -1041,7 +1041,7 @@ public class InstructionServiceImpl extends CommonServiceImpl impleme for (int m = 0; m < pathlist.size(); m++) { if (pathlist.get(m).equals(start_device_code)) { //起点为货架跳过堆垛机 - if (startDevice.getDeviceDriver() instanceof StandardStorageDeviceDriver || nextDevice.getDeviceDriver() instanceof StandardStorageDeviceDriver ) { + if (startDevice.getDeviceDriver() instanceof StandardStorageDeviceDriver ) { index = m + 2; }else { index = m + 1;