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 c2ea864..823d2de 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 @@ -15,6 +15,7 @@ import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.agv.utils.TwoAgvPhase; +import org.nl.acs.device_driver.conveyor.standard_conveyor_with_inspect.StandardConveyorWithInspectDeviceDriver; import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; import org.nl.acs.device_driver.paper_tube_pick_site.PaperTubePickSiteDeviceDriver; @@ -178,6 +179,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic //废箔称重位 WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver; + StandardConveyorWithInspectDeviceDriver standardConveyorWithInspectDeviceDriver; + if (phase == 0x02) { if (ObjectUtil.isEmpty(inst)) { log.info("未找到指令号{}对应的指令", ikey); @@ -243,8 +246,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); - } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ - standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); + } else if (device.getDeviceDriver() instanceof StandardConveyorWithInspectDeviceDriver) { + standardConveyorWithInspectDeviceDriver = (StandardConveyorWithInspectDeviceDriver) device.getDeviceDriver(); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(this.getDeviceCode()) @@ -350,7 +353,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic acsToWmsService.actionFinishRequest2(jsonObject); } this.setPhase(phase); - } else { + } else if (device.getDeviceDriver() instanceof StandardConveyorWithInspectDeviceDriver) { + standardConveyorWithInspectDeviceDriver = (StandardConveyorWithInspectDeviceDriver) device.getDeviceDriver(); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(this.getDeviceCode()) @@ -358,188 +362,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); - } - } - - // 取货完毕 - //(Itype=1、3,需要WCS反馈) - else if (phase == 0x0A) { - if (agvaddr == 0) { - agvaddr = agvaddr_copy; - } - if (agvaddr < 1) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("agv地址参数有误,phase:" + phase) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - return; - } - if (agvaddr != 0) { - CommonFinalParam commonFinalParam = new CommonFinalParam(); - old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); - if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) { - String[] point = old_device_code.split(commonFinalParam.getBARRE()); - device_code = point[0]; - } else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) { - String[] point = old_device_code.split("\\."); - device_code = point[0]; - emptyNum = point[1]; - } else { - device_code = old_device_code; - } - } - - device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device_code)) { - log.info(agvaddr + "对应设备号为空!"); - return; - } - if (ObjectUtil.isEmpty(inst)) { - log.info("未找到指令号{}对应的指令", ikey); - return; - } - String agv_inst_type = inst.getAgv_inst_type(); - if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) - && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())) { - standardOrdinarySiteDeviceDriver.setOption(0); - } else { - 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); - } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - standardOrdinarySiteDeviceDriver.setAgvphase(phase); - standardOrdinarySiteDeviceDriver.setIndex(index); - standardOrdinarySiteDeviceDriver.setInst(inst); - 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(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("feedbackToLms")) - && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) { - JSONObject jsonObject = new JSONObject(); - jsonObject.put("task_code", task_code); - LuceneLogDto logDto1 = LuceneLogDto.builder() - .device_code(standardOrdinarySiteDeviceDriver.getDevice_code()) - .content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + standardOrdinarySiteDeviceDriver.getDeviceCode()) - .build(); - logDto1.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto1); - acsToWmsService.actionFinishRequest2(jsonObject); - } - - } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { - hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); - try { - hongXiangStationDeviceDriver.writing(0); - } catch (Exception e) { - e.printStackTrace(); - } - if (hongXiangStationDeviceDriver.getMove() == 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 { - message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - try { - manipulatorAgvStationDeviceDriver.writing(3); - } 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()) - .build(); - logDto1.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto1); - acsToWmsService.actionFinishRequest2(jsonObject); - } - } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { - paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); - try { - paperTubePickSiteDeviceDriver.writing(3); - } catch (Exception e) { - e.printStackTrace(); - } - if (paperTubePickSiteDeviceDriver.getAction() == 1 - && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { - 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 { - message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { - standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); - - try { - standardInspectSiteDeviceDriver.writing(1); - } catch (Exception e) { - e.printStackTrace(); - } - if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 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 { - message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); LuceneLogDto logDto = LuceneLogDto.builder() @@ -549,9 +371,199 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); } - } +// // 取货完毕 +// //(Itype=1、3,需要WCS反馈) +// else if (phase == 0x0A) { +// if (agvaddr == 0) { +// agvaddr = agvaddr_copy; +// } +// if (agvaddr < 1) { +// LuceneLogDto logDto = LuceneLogDto.builder() +// .device_code(device_code) +// .content("agv地址参数有误,phase:" + phase) +// .build(); +// logDto.setLog_level(4); +// luceneExecuteLogService.deviceExecuteLog(logDto); +// return; +// } +// if (agvaddr != 0) { +// CommonFinalParam commonFinalParam = new CommonFinalParam(); +// old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); +// if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) { +// String[] point = old_device_code.split(commonFinalParam.getBARRE()); +// device_code = point[0]; +// } else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) { +// String[] point = old_device_code.split("\\."); +// device_code = point[0]; +// emptyNum = point[1]; +// } else { +// device_code = old_device_code; +// } +// } +// +// device = deviceAppService.findDeviceByCode(device_code); +// if (ObjectUtil.isEmpty(device_code)) { +// log.info(agvaddr + "对应设备号为空!"); +// return; +// } +// if (ObjectUtil.isEmpty(inst)) { +// log.info("未找到指令号{}对应的指令", ikey); +// return; +// } +// String agv_inst_type = inst.getAgv_inst_type(); +// if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { +// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); +// if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) +// && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())) { +// standardOrdinarySiteDeviceDriver.setOption(0); +// } else { +// 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); +// } +// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); +// standardOrdinarySiteDeviceDriver.setAgvphase(phase); +// standardOrdinarySiteDeviceDriver.setIndex(index); +// standardOrdinarySiteDeviceDriver.setInst(inst); +// 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(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("feedbackToLms")) +// && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) { +// JSONObject jsonObject = new JSONObject(); +// jsonObject.put("task_code", task_code); +// LuceneLogDto logDto1 = LuceneLogDto.builder() +// .device_code(standardOrdinarySiteDeviceDriver.getDevice_code()) +// .content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + standardOrdinarySiteDeviceDriver.getDeviceCode()) +// .build(); +// logDto1.setLog_level(4); +// luceneExecuteLogService.deviceExecuteLog(logDto1); +// acsToWmsService.actionFinishRequest2(jsonObject); +// } +// +// } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { +// hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); +// try { +// hongXiangStationDeviceDriver.writing(0); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// if (hongXiangStationDeviceDriver.getMove() == 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 { +// message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件"; +// LuceneLogDto logDto = LuceneLogDto.builder() +// .device_code(this.getDeviceCode()) +// .content(message) +// .build(); +// logDto.setLog_level(4); +// luceneExecuteLogService.deviceExecuteLog(logDto); +// } +// } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { +// manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); +// try { +// manipulatorAgvStationDeviceDriver.writing(3); +// } 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()) +// .build(); +// logDto1.setLog_level(4); +// luceneExecuteLogService.deviceExecuteLog(logDto1); +// acsToWmsService.actionFinishRequest2(jsonObject); +// } +// } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { +// paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); +// try { +// paperTubePickSiteDeviceDriver.writing(3); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// if (paperTubePickSiteDeviceDriver.getAction() == 1 +// && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { +// 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 { +// message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; +// LuceneLogDto logDto = LuceneLogDto.builder() +// .device_code(this.getDeviceCode()) +// .content(message) +// .build(); +// logDto.setLog_level(4); +// luceneExecuteLogService.deviceExecuteLog(logDto); +// } +// } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { +// standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); +// +// try { +// standardInspectSiteDeviceDriver.writing(1); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 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 { +// message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; +// LuceneLogDto logDto = LuceneLogDto.builder() +// .device_code(this.getDeviceCode()) +// .content(message) +// .build(); +// logDto.setLog_level(4); +// luceneExecuteLogService.deviceExecuteLog(logDto); +// } +// } else { +// 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); +// } +// +// } + // 到达放货点 //(Itype=1/2/3,需要WCS反馈) else if (phase == 0x07) { @@ -618,6 +630,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic luceneExecuteLogService.deviceExecuteLog(logDto); } + } else if (device.getDeviceDriver() instanceof StandardConveyorWithInspectDeviceDriver) { + standardConveyorWithInspectDeviceDriver = (StandardConveyorWithInspectDeviceDriver) device.getDeviceDriver(); + 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 if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); try { @@ -806,6 +827,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); this.setPhase(phase); + }else if (device.getDeviceDriver() instanceof StandardConveyorWithInspectDeviceDriver){ + standardConveyorWithInspectDeviceDriver = (StandardConveyorWithInspectDeviceDriver) device.getDeviceDriver(); + 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 { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); LuceneLogDto logDto = LuceneLogDto.builder() diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_conveyor_with_inspect/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_conveyor_with_inspect/ItemProtocol.java new file mode 100644 index 0000000..0752946 --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_conveyor_with_inspect/ItemProtocol.java @@ -0,0 +1,44 @@ +package org.nl.acs.device_driver.conveyor.standard_conveyor_with_inspect; + +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +public class ItemProtocol { + public static String item_move = "move"; + + private StandardConveyorWithInspectDeviceDriver driver; + + public ItemProtocol(StandardConveyorWithInspectDeviceDriver driver){ + this.driver=driver; + } + + public int getMove() { + return this.getOpcIntegerValue(item_move); + } + + public int getOpcIntegerValue(String protocol) { + Integer value = this.driver.getIntegeregerValue(protocol); + if (value == null) { + // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); + } else { + return value; + } + return 0; + + } + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_move, "光电信号", "10001")); + return list; + } + + @Override + public String toString() { + return ""; + } +} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_conveyor_with_inspect/StandardConveyorWithInspectDefination.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_conveyor_with_inspect/StandardConveyorWithInspectDefination.java new file mode 100644 index 0000000..4ad0cd6 --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_conveyor_with_inspect/StandardConveyorWithInspectDefination.java @@ -0,0 +1,58 @@ +package org.nl.acs.device_driver.conveyor.standard_conveyor_with_inspect; + +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; +import org.nl.acs.device.domain.Device; +import org.nl.acs.device.enums.DeviceType; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; +import org.springframework.stereotype.Service; + +import java.util.LinkedList; +import java.util.List; + +@Service +public class StandardConveyorWithInspectDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "standard_conveyor_with_inspect"; + } + + @Override + public String getDriverName() { + return "标准版-带光电检测站点"; + } + + @Override + public String getDriverDescription() { + return "标准版-带光电检测站点"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new StandardConveyorWithInspectDeviceDriver()).setDevice(device).setDriverDefination(this); + } + + @Override + public Class getDeviceDriverType() { + return StandardConveyorWithInspectDeviceDriver.class; + } + + @Override + public List getFitDeviceTypes() { + List types = new LinkedList(); + types.add(DeviceType.conveyor); + return types; + } + + @Override + public List getReadableItemDtos() { + return ItemProtocol.getReadableItemDtos(); + } + + @Override + public List getWriteableItemDtos() { + return null; + } + + +} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_conveyor_with_inspect/StandardConveyorWithInspectDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_conveyor_with_inspect/StandardConveyorWithInspectDeviceDriver.java new file mode 100644 index 0000000..8c209d4 --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_conveyor_with_inspect/StandardConveyorWithInspectDeviceDriver.java @@ -0,0 +1,62 @@ +package org.nl.acs.device_driver.conveyor.standard_conveyor_with_inspect; + +import com.alibaba.fastjson.JSONObject; +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.domain.Device; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.log.service.DeviceExecuteLogService; +import org.nl.acs.monitor.DeviceStageMonitor; +import org.nl.config.SpringContextHolder; +import org.nl.config.lucene.service.LuceneExecuteLogService; +import org.springframework.beans.factory.annotation.Autowired; + +@Slf4j +@Data +@RequiredArgsConstructor +public class StandardConveyorWithInspectDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, DeviceStageMonitor { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); + @Autowired + LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); + int move = 0; + int last_move = 0; + String device_code = null; + @Override + public Device getDevice() { + return this.device; + } + + @Override + public void execute() { + device_code = this.getDevice().getDevice_code(); + move = this.itemProtocol.getMove(); + last_move = move; + } + + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String move = ""; + + if (this.getMove() == 0) { + move = "无货"; + } else if (this.getMove() == 1) { + move = "有货"; + } + + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("move", move); + jo.put("isOnline", true); + + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + + } +} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java index f0ef25b..81d1955 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java @@ -72,7 +72,7 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc group = opcServerService.getServer(this.getOpcServer()); itemsString = new ArrayList<>(itemValues.keySet()); Iterator nis = itemsString.iterator(); - + while (nis.hasNext()) { String string = (String) nis.next(); try { diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml b/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml index c6fb979..9af4d53 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml @@ -10,7 +10,7 @@ spring: driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy # url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true # url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true - url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:hanguodoushan}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true + url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:xlm_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true username: ${DB_USER:root} # password: ${DB_PWD:Root.123456} diff --git a/acs2/nladmin-ui/src/i18n/langs/device/en.js b/acs2/nladmin-ui/src/i18n/langs/device/en.js index c3e4e14..f13b716 100644 --- a/acs2/nladmin-ui/src/i18n/langs/device/en.js +++ b/acs2/nladmin-ui/src/i18n/langs/device/en.js @@ -22,6 +22,7 @@ export default { 'device_dialog': { 'zh_device_name': 'ZH-name', 'en_device_name': 'EN-name', + 'in_device_name': 'IN-Nama', 'ko_device_name': 'KO-Nama' }, 'driver_configuration': { diff --git a/acs2/nladmin-ui/src/i18n/langs/device/in.js b/acs2/nladmin-ui/src/i18n/langs/device/in.js index 3e34e65..3fa9140 100644 --- a/acs2/nladmin-ui/src/i18n/langs/device/in.js +++ b/acs2/nladmin-ui/src/i18n/langs/device/in.js @@ -22,6 +22,7 @@ export default { 'device_dialog': { 'zh_device_name': 'ZH-Nama', 'en_device_name': 'EN-Nama', + 'in_device_name': 'IN-Nama', 'ko_device_name': 'KO-Nama' }, 'driver_configuration': { diff --git a/acs2/nladmin-ui/src/i18n/langs/device/zh.js b/acs2/nladmin-ui/src/i18n/langs/device/zh.js index de8f0bb..d1b2556 100644 --- a/acs2/nladmin-ui/src/i18n/langs/device/zh.js +++ b/acs2/nladmin-ui/src/i18n/langs/device/zh.js @@ -22,6 +22,7 @@ export default { 'device_dialog': { 'zh_device_name': '中文设备名称', 'en_device_name': '英文设备名称', + 'in_device_name': '因你设备名称', 'ko_device_name': '韩国设备名称' }, 'driver_configuration': { diff --git a/acs2/nladmin-ui/src/views/acs/device/config.vue b/acs2/nladmin-ui/src/views/acs/device/config.vue index c14de0f..1f9f671 100644 --- a/acs2/nladmin-ui/src/views/acs/device/config.vue +++ b/acs2/nladmin-ui/src/views/acs/device/config.vue @@ -74,6 +74,7 @@ import crud from '@/mixins/crud' import { get, selectDriverCodeList } from '@/api/acs/device/driverConfig' import { getDicts } from '@/views/system/dict/dict' import standard_autodoor from '@/views/acs/device/driver/standard_autodoor' +import standard_conveyor_with_inspect from '@/views/acs/device/driver/standard_conveyor_with_inspect' import standard_inspect_site from './driver/standard_inspect_site' import ranging_stations from './driver/ranging_stations' import standard_ordinary_site from './driver/standard_ordinary_site' @@ -198,6 +199,7 @@ export default { manipulator_cache, paper_tube_pick_size, one_rgv, + standard_conveyor_with_inspect, die_manipulator }, dicts: ['device_type'], diff --git a/acs2/nladmin-ui/src/views/acs/device/driver/standard_conveyor_with_inspect.vue b/acs2/nladmin-ui/src/views/acs/device/driver/standard_conveyor_with_inspect.vue new file mode 100644 index 0000000..d440ea8 --- /dev/null +++ b/acs2/nladmin-ui/src/views/acs/device/driver/standard_conveyor_with_inspect.vue @@ -0,0 +1,413 @@ + + + + + diff --git a/acs2/nladmin-ui/src/views/acs/device/index.vue b/acs2/nladmin-ui/src/views/acs/device/index.vue index 31fde73..2d12e91 100644 --- a/acs2/nladmin-ui/src/views/acs/device/index.vue +++ b/acs2/nladmin-ui/src/views/acs/device/index.vue @@ -116,6 +116,9 @@ + + + @@ -248,7 +251,8 @@ const defaultForm = { remark: null, zh_device_name: null, en_device_name: null, - in_device_name: null + in_device_name: null, + ko_device_name: null } export default { name: 'Device',