diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java index a28a123..07bd33e 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java @@ -74,196 +74,65 @@ public class NDCAgvServiceImpl implements NDCAgvService { } - @Override public void sendAgvInstToNDC(String agv_system_type, Instruction inst) { - log.info("sendAgvInstToNDC 指令下发NDC:" + "inst_code:" + inst.getInstruction_code() + ",agv_system_type:" + agv_system_type + ",agv_inst_type:" + inst.getAgv_inst_type() + - ",priority:" + inst.getPriority() + ",startAddress:" + inst.getStart_point_code() + + log.info("sendAgvInstToNDC 指令下发NDC:" + "inst_code:" + inst.getInstruction_code() + ",agv_system_type:" + agv_system_type + ",agv_inst_type:" + inst.getAgv_inst_type() + + ",priority:" + inst.getPriority() + ",startAddress:" + inst.getStart_point_code() + ",nextAddress:" + inst.getNext_point_code()); if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) { - if (!StrUtil.equals(agv_system_type, "1")) { - String instcode = inst.getInstruction_code(); - int type = Integer.parseInt(inst.getAgv_inst_type()); - int priority = Integer.parseInt(inst.getPriority()) + 128; - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); - int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code()); - int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code()); - int startAddress2 = deviceService.queryAddressBydeviceCode(inst.getStart_point_code2()); - int nextAddress2 = deviceService.queryAddressBydeviceCode(inst.getNext_point_code2()); - byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode)); - byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode)); - byte typehigh = (byte) IntToHexHigh(type); - byte typelow = (byte) IntToHexLow(type); - byte qhdhigh = (byte) IntToHexHigh(startAddress); - byte qhdlow = (byte) IntToHexLow(startAddress); - byte qhdhigh2 = (byte) IntToHexHigh(startAddress2); - byte qhdlow2 = (byte) IntToHexLow(startAddress2); - byte fhdhigh = (byte) IntToHexHigh(nextAddress); - byte fhdlow = (byte) IntToHexLow(nextAddress); - byte fhdhigh2 = (byte) IntToHexHigh(nextAddress2); - byte fhdlow2 = (byte) IntToHexLow(nextAddress2); - byte prioritylow = (byte) IntToHexLow(priority); - - String str = "十进制下发:"; - String str1 = "十六进制下发:"; - str += "任务号 ikey:" + (Integer.parseInt(instcode)); - str1 += "任务号 ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF); - - str += "指令类型 /type:" + (type); - str1 += "指令类型 /type:" + hexToString(typehigh & 0xFF) + hexToString(typelow & 0xFF); - - str += "取货点 /qhd:" + (startAddress); - str1 += "取货点 /qhd:" + hexToString(qhdhigh & 0xFF) + hexToString(qhdlow & 0xFF); - str += "放货点 /fhd:" + (nextAddress); - str1 += "放货点 /fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF); - - str += "取货点2 /qhd2:" + (startAddress2); - str1 += "取货点2 /qhd2:" + hexToString(qhdhigh2 & 0xFF) + hexToString(qhdlow2 & 0xFF); - str += "放货点2 /fhd2:" + (nextAddress2); - str1 += "放货点2 /fhd2:" + hexToString(fhdhigh2 & 0xFF) + hexToString(fhdlow2 & 0xFF); - - str += "优先级 /priority:" + (priority); - str1 += "优先级 /priority:" + hexToString(prioritylow & 0xFF); - - byte[] b = new byte[]{}; - if (type == 1) { - b = new byte[]{(byte) 0X87, (byte) 0XCD, - (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X16, - (byte) 0X00, (byte) 0X01, - (byte) 0X00, (byte) 0X71, - (byte) 0X00, (byte) 0X12, - (byte) 0X01, prioritylow, - (byte) 0X00, (byte) 0X01, - (byte) ikeyhigh, (byte) ikeylow, - (byte) ikeyhigh, (byte) ikeylow, - (byte) typehigh, (byte) typelow, - (byte) qhdhigh, (byte) qhdlow, - (byte) qhdhigh2, (byte) qhdlow2, - (byte) fhdhigh, (byte) fhdlow, - (byte) fhdhigh2, (byte) fhdlow2 - }; - } else if (type == 2) { - b = new byte[]{(byte) 0X87, (byte) 0XCD, - (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X16, - (byte) 0X00, (byte) 0X01, - (byte) 0X00, (byte) 0X71, - (byte) 0X00, (byte) 0X12, - (byte) 0X01, prioritylow, - (byte) 0X00, (byte) 0X01, - (byte) ikeyhigh, (byte) ikeylow, - (byte) ikeyhigh, (byte) ikeylow, - (byte) typehigh, (byte) typelow, - (byte) qhdhigh, (byte) qhdlow, - (byte) 0X00, (byte) 0X00, - (byte) fhdhigh, (byte) fhdlow, - (byte) 0X00, (byte) 0X00 - }; - } else if (type == 3) { - b = new byte[]{(byte) 0X87, (byte) 0XCD, - (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X16, - (byte) 0X00, (byte) 0X01, - (byte) 0X00, (byte) 0X71, - (byte) 0X00, (byte) 0X12, - (byte) 0X01, prioritylow, - (byte) 0X00, (byte) 0X01, - (byte) ikeyhigh, (byte) ikeylow, - (byte) ikeyhigh, (byte) ikeylow, - (byte) typehigh, (byte) typelow, - (byte) qhdhigh, (byte) qhdlow, - (byte) qhdhigh2, (byte) qhdlow2, - (byte) fhdhigh, (byte) fhdlow, - (byte) fhdhigh2, (byte) fhdlow2 - }; - } - log.info("下发AGV作业指令 --{}", str1); - log.info("下发AGV作业指令--{}", str); - log.info("下发agv指令数据--{}", Bytes2HexString(b)); - - if (StrUtil.equals(agv_system_type, "2")) { - TwoNDCSocketConnectionAutoRun.write(b); - } - } else { - - String instcode = inst.getInstruction_code(); - int startHeight = Integer.parseInt(StrUtil.isEmpty(inst.getStart_height()) ? "0" : inst.getStart_height()); - int nextHeight = Integer.parseInt(StrUtil.isEmpty(inst.getNext_height()) ? "0" : inst.getNext_height()); - //默认取货放货高度都为0 - //int type = Integer.parseInt(inst.getInstruction_type()); - int type = 4; - if (startHeight != 0 && nextHeight != 0) { - //取货放货高度都不为0 - type = 1; - } else if (startHeight != 0 && nextHeight == 0) { - //取货高度不为0 放货高度为0 - type = 2; - } else if (startHeight == 0 && nextHeight != 0) { - //取货高度为0 放货高度不为0 - type = 3; - } - int priority = Integer.parseInt(inst.getPriority()) + 128; - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); - int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code()); - int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code()); - - byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode)); - byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode)); - byte typehigh = (byte) IntToHexHigh(type); - byte typelow = (byte) IntToHexLow(type); - byte qhdhigh = (byte) IntToHexHigh(startAddress); - byte qhdlow = (byte) IntToHexLow(startAddress); - byte fhdhigh = (byte) IntToHexHigh(nextAddress); - byte fhdlow = (byte) IntToHexLow(nextAddress); - byte prioritylow = (byte) IntToHexLow(priority); - - byte shhigh = (byte) IntToHexHigh(startHeight); - byte shlow = (byte) IntToHexLow(startHeight); - - byte nhhigh = (byte) IntToHexHigh(nextHeight); - byte nhlow = (byte) IntToHexLow(nextHeight); - - String str = "十进制下发:"; - String str1 = "十六进制下发:"; - str += "ikey:" + (Integer.parseInt(instcode)); - str1 += "ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF); - - str += "/type:" + (type); - str1 += "/type:" + hexToString(typehigh & 0xFF) + hexToString(typelow & 0xFF); - - str += "/qhd:" + (startAddress); - str1 += "/qhd:" + hexToString(qhdhigh & 0xFF) + hexToString(qhdlow & 0xFF); - str += "/fhd:" + (nextAddress); - str1 += "/fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF); - - str += "/priority:" + (priority); - str1 += "/priority:" + hexToString(prioritylow & 0xFF); - - System.out.println(str); - System.out.println(str1); - byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, + + String instcode = inst.getInstruction_code(); + int type = Integer.parseInt(inst.getAgv_inst_type()); + int priority = Integer.parseInt(inst.getPriority()) + 128; + DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); + int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code()); + int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code()); + byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode)); + byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode)); + byte typehigh = (byte) IntToHexHigh(type); + byte typelow = (byte) IntToHexLow(type); + byte qhdhigh = (byte) IntToHexHigh(startAddress); + byte qhdlow = (byte) IntToHexLow(startAddress); + byte fhdhigh = (byte) IntToHexHigh(nextAddress); + byte fhdlow = (byte) IntToHexLow(nextAddress); + + String str = "十进制下发:"; + String str1 = "十六进制下发:"; + str += "任务号 ikey:" + (Integer.parseInt(instcode)); + str1 += "任务号 ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF); + + str += "指令类型 /type:" + (type); + str1 += "指令类型 /type:" + hexToString(typehigh & 0xFF) + hexToString(typelow & 0xFF); + + str += "取货点 /qhd:" + (startAddress); + str1 += "取货点 /qhd:" + hexToString(qhdhigh & 0xFF) + hexToString(qhdlow & 0xFF); + str += "放货点 /fhd:" + (nextAddress); + str1 += "放货点 /fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF); + + + byte[] b = new byte[]{}; + if (type == 1) { + b = new byte[]{(byte) 0X87, (byte) 0XCD, (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X16, + (byte) 0X00, (byte) 0X12, (byte) 0X00, (byte) 0X01, (byte) 0X00, (byte) 0X71, (byte) 0X00, (byte) 0X12, - (byte) 0X01, prioritylow, + (byte) 0X01, (byte) 0X80, (byte) 0X00, (byte) 0X01, (byte) ikeyhigh, (byte) ikeylow, (byte) ikeyhigh, (byte) ikeylow, (byte) typehigh, (byte) typelow, (byte) qhdhigh, (byte) qhdlow, (byte) fhdhigh, (byte) fhdlow, - (byte) shhigh, (byte) shlow, - (byte) nhhigh, (byte) nhlow }; - log.info("下发AGV作业指令 --{}", str1); - log.info("下发AGV作业指令--{}", str); - log.info("下发agv指令数据--{}", Bytes2HexString(b)); - OneNDCSocketConnectionAutoRun.write(b); + } + log.info("下发AGV作业指令 --{}", str1); + log.info("下发AGV作业指令--{}", str); + log.info("下发agv指令数据--{}", Bytes2HexString(b)); + + if (StrUtil.equals(agv_system_type, "2")) { + TwoNDCSocketConnectionAutoRun.write(b); } } } @@ -337,7 +206,7 @@ public class NDCAgvServiceImpl implements NDCAgvService { } @Override - public byte[] sendAgvTwoModeInst(int phase, int index, int result,int offset,int quantity) { + public byte[] sendAgvTwoModeInst(int phase, int index, int result, int offset, int quantity) { if (phase < 0 || index < 0) return null; byte indexhigh = (byte) IntToHexHigh(index); @@ -364,7 +233,7 @@ public class NDCAgvServiceImpl implements NDCAgvService { log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" - + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF)+",是否侧移: "+(offset == 1?"侧移":"不测移") + ",偏离量: " + quantity); + + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF) + ",是否侧移: " + (offset == 1 ? "侧移" : "不测移") + ",偏离量: " + quantity); System.out.println("反馈agv动作数据:" + Bytes2HexString(b)); return b; @@ -506,7 +375,6 @@ public class NDCAgvServiceImpl implements NDCAgvService { } - @Override public Map findAllAgvFromCache() { return AGVDeviceStatus; 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 a0529e8..7ee74df 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 @@ -197,7 +197,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { } //任务完毕 //(无车id及状态) - else if (phase == 0x14) { + else if (phase == 0x0A) { if (ObjectUtil.isEmpty(inst)) { log.info("未找到指令号{}对应的指令", ikey); } else { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/dto/DeviceDto.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/dto/DeviceDto.java index 8fc4f1d..1f97bf9 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/dto/DeviceDto.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/dto/DeviceDto.java @@ -135,7 +135,7 @@ public class DeviceDto implements Serializable { private String en_device_name; /** - * 设备印尼名称 + * 设备韩国名称 */ - private String in_device_name; + private String ko_device_name; } 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 f7c30b7..5b4da55 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 @@ -165,8 +165,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic //普通站点 StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; - //货架 - StandardStorageDeviceDriver standardStorageDeviceDriver; + //纸管抓取位 PaperTubePickSiteDeviceDriver paperTubePickSiteDeviceDriver; //标准-光电检测 @@ -175,8 +174,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic HongXiangStationDeviceDriver hongXiangStationDeviceDriver; //行架-agv对接位 ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver; - //行架-agv对接位 - RangingStationsDeviceDriver rangingStationsDeviceDriver; + //废箔称重位 WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver; @@ -277,188 +275,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic 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 if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - try { - manipulatorAgvStationDeviceDriver.writing(2); - } catch (Exception e) { - e.printStackTrace(); - } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - 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 { - log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", manipulatorAgvStationDeviceDriver.getDeviceCode(), manipulatorAgvStationDeviceDriver.getAction(), ikey); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { - hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); - try { - hongXiangStationDeviceDriver.writing(1); - } 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() + "无货不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { - paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); - try { - paperTubePickSiteDeviceDriver.writing(2); - } 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 RangingStationsDeviceDriver) { - rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver(); - ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); - String device_code1 = device.getDevice_code(); - String length1 = rangingStationsDeviceDriver.getLength1(); - String length2 = rangingStationsDeviceDriver.getLength2(); - Float len1 = 0.0F; - Float len2 = 0.0F; - if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1) && ObjectUtil.isNotEmpty(length2) && !"null".equals(length2)) { - len1 = Float.parseFloat(length1); - len2 = Float.parseFloat(length2); - } - if (len1 * len2 < 0) { - if (ObjectUtil.isNotEmpty(device_code1) && (('A') == (device_code1.charAt(device_code1.length() - 1)))) { - String offSet_A = paramService.findByCode(AcsConfig.OFFSET_A).getValue(); - if (ObjectUtil.isNotEmpty(offSet_A) && !"null".equals(offSet_A)) { - Integer integer = Integer.valueOf(offSet_A); - len1 = len1 - integer; - } - } else if (ObjectUtil.isNotEmpty(device_code1) && (('B') == (device_code1.charAt(device_code1.length() - 1)))) { - String offSet_B = paramService.findByCode(AcsConfig.OFFSET_B).getValue(); - if (ObjectUtil.isNotEmpty(offSet_B) && !"null".equals(offSet_B)) { - Integer integer = Integer.valueOf(offSet_B); - len1 = integer + len1; - } - } else { - log.info("{}设备名不符合条件,指令号{}", device_code, ikey); - } - int roundedNumber = ObjectUtil.isNotEmpty(len1) ? NumberUtil.round(len1, 0).intValue() : 0; - if (roundedNumber == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } else if (roundedNumber > -50 || roundedNumber < 50) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } else if (roundedNumber > 50 || roundedNumber < -50) { - log.info("设备{},偏移数据超出范围导致未反馈{},指令号{}", device_code, roundedNumber, ikey); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content(device_code + "设备,偏移数据超出范围导致未反馈" + roundedNumber + "指令号" + ikey) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } else { - log.info("设备{},偏移数据出错导致未反馈{},指令号{}", device_code, rangingStationsDeviceDriver.getLength1() + "," + rangingStationsDeviceDriver.getLength2(), ikey); - } - }*/ else if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { - wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); - if (wasteFoilWeighingStationDriver.getMove() == 1 && wasteFoilWeighingStationDriver.getAction() == 1 - && wasteFoilWeighingStationDriver.getError() == 0 && wasteFoilWeighingStationDriver.getMode() == 2) { - try { - Map map = new LinkedHashMap<>(); - map.put("to_command", "2"); - wasteFoilWeighingStationDriver.writing(map); - 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); - } catch (Exception e) { - e.printStackTrace(); - } - } else { - message = "设备号:" + device_code + "光电信号:" + wasteFoilWeighingStationDriver.getMove() + ",动作信号:" + wasteFoilWeighingStationDriver.getAction() + "报警信号:" + wasteFoilWeighingStationDriver.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() @@ -556,14 +372,75 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic acsToWmsService.actionFinishRequest2(jsonObject); } this.setPhase(phase); - } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - try { - manipulatorAgvStationDeviceDriver.writing(3); - } catch (Exception e) { - e.printStackTrace(); + } 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、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) @@ -571,18 +448,19 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic 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())) { + 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(manipulatorAgvStationDeviceDriver.getDevice_code()) - .content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + manipulatorAgvStationDeviceDriver.getDeviceCode()) + .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 { @@ -590,7 +468,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } catch (Exception e) { e.printStackTrace(); } - if (hongXiangStationDeviceDriver.getMove() > 0) { + if (hongXiangStationDeviceDriver.getMove() == 0) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(this.getDeviceCode()) @@ -607,6 +485,33 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic 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 { @@ -636,11 +541,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); try { - standardInspectSiteDeviceDriver.writing(0); + standardInspectSiteDeviceDriver.writing(1); } catch (Exception e) { e.printStackTrace(); } - if ((standardInspectSiteDeviceDriver.getMove() != 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) { + 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()) @@ -657,1112 +562,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); } - } else if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { - wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); - if (wasteFoilWeighingStationDriver.getMove() == 0 && wasteFoilWeighingStationDriver.getAction() == 1 - && wasteFoilWeighingStationDriver.getError() == 0 && wasteFoilWeighingStationDriver.getMode() == 2) { - try { - Map map = new LinkedHashMap<>(); - map.put("to_command", "3"); - wasteFoilWeighingStationDriver.writing(map); - 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); - } catch (Exception e) { - e.printStackTrace(); - } - } else { - message = "设备号:" + device_code + "光电信号:" + wasteFoilWeighingStationDriver.getMove() + ",动作信号:" + wasteFoilWeighingStationDriver.getAction() + "报警信号:" + wasteFoilWeighingStationDriver.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、3,需要WCS反馈) - else if (phase == 0x08) { - 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) { - old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); - CommonFinalParam commonFinalParam = new CommonFinalParam(); - 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; - } - if (ObjectUtil.isEmpty(inst.getCarno())) { - inst.setCarno(String.valueOf(carno)); - instructionService.update(inst); - } - - String agv_inst_type = inst.getAgv_inst_type(); - if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - standardOrdinarySiteDeviceDriver.setAgvphase(phase); - if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) - && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())) { - if (standardOrdinarySiteDeviceDriver.getOption() == 1) { - standardOrdinarySiteDeviceDriver.setAgvphase(0); - String task_code = standardOrdinarySiteDeviceDriver.getTask_code(); - log.info("当前任务号{},创建任务号{}", task.getTask_code(), task_code); - if (StrUtil.isEmpty(task_code) || !task_code.equals(task.getTask_code())) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("任务号为空!") - .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); - } - } else { - log.info("等待LMS系统进行确认允许取货,设备号{},option值{}", standardOrdinarySiteDeviceDriver.getDeviceCode(), standardOrdinarySiteDeviceDriver.getOption()); - message = "等待LMS系统进行确认允许取货,设备号:" + standardOrdinarySiteDeviceDriver.getDeviceCode() + ",option值:" + standardOrdinarySiteDeviceDriver.getOption(); - logServer.deviceExecuteLog(standardOrdinarySiteDeviceDriver.getDeviceCode(), "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code()); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(standardOrdinarySiteDeviceDriver.getDeviceCode()) - .content(standardOrdinarySiteDeviceDriver.getDevice_code() + "option值不为1") - .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); - } - } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - - try { - manipulatorAgvStationDeviceDriver.writing(2); - } catch (Exception e) { - e.printStackTrace(); - } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - 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 + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(manipulatorAgvStationDeviceDriver.getDevice_code()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { - paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); - try { - paperTubePickSiteDeviceDriver.writing(2); - } 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 HongXiangStationDeviceDriver) { - hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); - try { - hongXiangStationDeviceDriver.writing(1); - } 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 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 if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { - rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver(); - ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); - String device_code1 = device.getDevice_code(); - String length1 = rangingStationsDeviceDriver.getLength1(); - String length2 = rangingStationsDeviceDriver.getLength2(); - Float len1 = 0.0F; - Float len2 = 0.0F; - if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1) && ObjectUtil.isNotEmpty(length2) && !"null".equals(length2)) { - len1 = Float.parseFloat(length1); - len2 = Float.parseFloat(length2); - } - if (len1 * len2 < 1) { - if (ObjectUtil.isNotEmpty(device_code1) && device_code1.contains("A")) { - String offSet_A = paramService.findByCode(AcsConfig.OFFSET_A).getValue(); - if (ObjectUtil.isNotEmpty(offSet_A) && !"null".equals(offSet_A)) { - Integer integer = Integer.valueOf(offSet_A); - len1 = len1 - integer; - } - } else if (ObjectUtil.isNotEmpty(device_code1) && device_code1.contains("B")) { - String offSet_B = paramService.findByCode(AcsConfig.OFFSET_B).getValue(); - if (ObjectUtil.isNotEmpty(offSet_B) && !"null".equals(offSet_B)) { - Integer integer = Integer.valueOf(offSet_B); - len1 = integer + len1; - } - } else { - log.info("{}设备名不符合条件,指令号{}", device_code, ikey); - } - int roundedNumber = ObjectUtil.isNotEmpty(len1) ? NumberUtil.round(len1, 0).intValue() : 0; - if (roundedNumber == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } else if (roundedNumber > -50 || roundedNumber < 50) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } else if (roundedNumber > 50 || roundedNumber < -50) { - log.info("设备{},偏移数据超出范围导致未反馈{},指令号{}", device_code, roundedNumber, ikey); - } - } else { - log.info("设备{},偏移数据出错导致未反馈{},指令号{}", device_code, rangingStationsDeviceDriver.getLength1() + "," + rangingStationsDeviceDriver.getLength2(), ikey); - } - }*/ else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - - } else if (phase == 0x4D) { - 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 start_device_code = inst.getStart_device_code(); - String next_device_code = inst.getNext_device_code(); - String start_device_code2 = inst.getStart_device_code2(); - String next_device_code2 = inst.getNext_device_code2(); - - if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, start_device_code)) { - if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - - try { - manipulatorAgvStationDeviceDriver.writing(2); - } catch (Exception e) { - e.printStackTrace(); - } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - 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 + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } - } else if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, next_device_code)) { - if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - - try { - manipulatorAgvStationDeviceDriver.writing(4); - } catch (Exception e) { - e.printStackTrace(); - } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - 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 + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } - } else if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, start_device_code2)) { - if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - - try { - manipulatorAgvStationDeviceDriver.writing(4); - } catch (Exception e) { - e.printStackTrace(); - } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - 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 + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } - } else if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, next_device_code2)) { - if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - - try { - manipulatorAgvStationDeviceDriver.writing(2); - } catch (Exception e) { - e.printStackTrace(); - } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - 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 = "设备号:" + manipulatorAgvStationDeviceDriver.getDevice_code() + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") - .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、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,上传称重数据) - else if (phase == 0x64) { - if (ObjectUtil.isEmpty(inst)) { - log.info("未找到指令号{}对应的指令", ikey); - return; - } - String instruction_type = inst.getInstruction_type(); - //上传称重数据 - if (StrUtil.equals(instruction_type, CommonFinalParam.ONE)) { - weight = agvaddr; - inst.setWeight(String.valueOf(weight)); - instructionService.update(inst); - - if (ObjectUtil.isNotEmpty(task)) { - logServer.deviceExecuteLog(this.device_code, "", "", "上报满卷重量,weight:" + weight); - message = "上报满卷重量,weight:" + weight + ",指令号:" + ikey; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - task.setWeight(String.valueOf(weight)); - task.setCarno(this.device_code); - taskService.update(task); - } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } - // 到达放货点 - //(Itype=1/2/3,需要WCS反馈) - else if (phase == 0x0C) { - 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; - } - if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) 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); - standardOrdinarySiteDeviceDriver.setAgvphase(phase); - standardOrdinarySiteDeviceDriver.setIndex(index); - standardOrdinarySiteDeviceDriver.setInst(inst); - - } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { - paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); - try { - paperTubePickSiteDeviceDriver.writing(4); - } 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 + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足放货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() - , paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), 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(4); - } catch (Exception e) { - e.printStackTrace(); - } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - 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 + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { - hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); - try { - hongXiangStationDeviceDriver.writing(1); - } 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() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() - , hongXiangStationDeviceDriver.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(); - standardInspectSiteDeviceDriver.writing(1); - if ((standardInspectSiteDeviceDriver.getMove() == 0 && 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 + "不满足放货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,报警信号{},不满足放货条件,指令号{}", 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 if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { - rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver(); - ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); - String device_code1 = device.getDevice_code(); - String length1 = rangingStationsDeviceDriver.getLength1(); - String length2 = rangingStationsDeviceDriver.getLength2(); - Float len1 = 0.0F; - Float len2 = 0.0F; - if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1) && ObjectUtil.isNotEmpty(length2) && !"null".equals(length2)) { - len1 = Float.parseFloat(length1); - len2 = Float.parseFloat(length2); - } - if (len1 * len2 < 1) { - if (ObjectUtil.isNotEmpty(device_code1) && device_code1.contains("A")) { - String offSet_A = paramService.findByCode(AcsConfig.OFFSET_A).getValue(); - if (ObjectUtil.isNotEmpty(offSet_A) && !"null".equals(offSet_A)) { - Integer integer = Integer.valueOf(offSet_A); - len1 = len1 - integer; - } - } else if (ObjectUtil.isNotEmpty(device_code1) && device_code1.contains("B")) { - String offSet_B = paramService.findByCode(AcsConfig.OFFSET_B).getValue(); - if (ObjectUtil.isNotEmpty(offSet_B) && !"null".equals(offSet_B)) { - Integer integer = Integer.valueOf(offSet_B); - len1 = integer + len1; - } - } else { - log.info("{}设备名不符合条件,指令号{}", device_code, ikey); - } - int roundedNumber = ObjectUtil.isNotEmpty(len1) ? NumberUtil.round(len1, 0).intValue() : 0; - if (roundedNumber == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } else if (roundedNumber > -50 || roundedNumber < 50) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } else if (roundedNumber > 50 || roundedNumber < -50) { - log.info("设备{},偏移数据超出范围导致未反馈{},指令号{}", device_code, roundedNumber, ikey); - } - } else { - log.info("设备{},偏移数据出错导致未反馈{},指令号{}", device_code, rangingStationsDeviceDriver.getLength1() + "," + rangingStationsDeviceDriver.getLength2(), ikey); - } - }*/ else if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { - wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); - if (wasteFoilWeighingStationDriver.getMove() == 0 && wasteFoilWeighingStationDriver.getAction() == 1 - && wasteFoilWeighingStationDriver.getError() == 0 && wasteFoilWeighingStationDriver.getMode() == 2) { - try { - Map map = new LinkedHashMap<>(); - map.put("to_command", "4"); - wasteFoilWeighingStationDriver.writing(map); - 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); - } catch (Exception e) { - e.printStackTrace(); - } - } else { - message = "设备号:" + device_code + "光电信号:" + wasteFoilWeighingStationDriver.getMove() + ",动作信号:" + wasteFoilWeighingStationDriver.getAction() + "报警信号:" + wasteFoilWeighingStationDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货条件,指令号{}", device_code, wasteFoilWeighingStationDriver.getMove(), wasteFoilWeighingStationDriver.getAction() - , wasteFoilWeighingStationDriver.getError(), wasteFoilWeighingStationDriver.getMode(), 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 == 0x0E) { - 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; - } - 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()) -// && StrUtil.equals(task.getTask_type(), "1")) { -// // -// if (standardOrdinarySiteDeviceDriver.getOption() == 2) { -// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); -// standardOrdinarySiteDeviceDriver.setOption(0); -// } else { -// log.info("等待LMS系统进行确认离开,设备号{},指令号:{}", device_code, ikey); -// message = "等待LMS系统进行确认离开,设备号:" + device_code + ",指令号:" + ikey; -// } -// } else { -// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 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); - this.setPhase(phase); - } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - - try { - manipulatorAgvStationDeviceDriver.writing(5); - } 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); - } 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() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足放货完成反馈,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() - , hongXiangStationDeviceDriver.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 PaperTubePickSiteDeviceDriver) { - paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); - try { - TaskDto byTaskCode = taskService.findByTaskCode(inst.getTask_code()); - Map map = new HashMap(); - if (StrUtil.isNotEmpty(byTaskCode.getInteraction_json())) { - String interaction_json = byTaskCode.getInteraction_json(); - JSONObject jsonObject = JSONObject.parseObject(interaction_json); - String to_material = jsonObject.getString("to_material"); - String to_spec = jsonObject.getString("to_spec"); - String to_qty = jsonObject.getString("to_qty"); - map.put("to_command", 5); - map.put("to_material", to_material); - map.put("to_spec", to_spec); - map.put("to_qty", to_qty); - paperTubePickSiteDeviceDriver.writing(map); - } else { - map.put("to_command", 5); - paperTubePickSiteDeviceDriver.writing(map); - } - } 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); - paperTubePickSiteDeviceDriver.setFlag(3); - } else { - message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() - , paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), 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(); - standardInspectSiteDeviceDriver.writing(0); - if ((standardInspectSiteDeviceDriver.getMove() == 1)) { - 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 WasteFoilWeighingStationDriver) { - wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); - if (wasteFoilWeighingStationDriver.getMove() == 1 && wasteFoilWeighingStationDriver.getAction() == 1 - && wasteFoilWeighingStationDriver.getError() == 0 && wasteFoilWeighingStationDriver.getMode() == 2) { - try { - Map map = new LinkedHashMap<>(); - map.put("to_command", "5"); - wasteFoilWeighingStationDriver.writing(map); - 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); - } catch (Exception e) { - e.printStackTrace(); - } - } else { - message = "设备号:" + device_code + "光电信号:" + wasteFoilWeighingStationDriver.getMove() + ",动作信号:" + wasteFoilWeighingStationDriver.getAction() + "报警信号:" + wasteFoilWeighingStationDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货条件,指令号{}", device_code, wasteFoilWeighingStationDriver.getMove(), wasteFoilWeighingStationDriver.getAction() - , wasteFoilWeighingStationDriver.getError(), wasteFoilWeighingStationDriver.getMode(), 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() @@ -1772,10 +571,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); } + } - //到达放货点 - //(Itype=1、3,需要WCS反馈) - else if (phase == 0x10) { + + // 到达放货点 + //(Itype=1/2/3,需要WCS反馈) + else if (phase == 0x07) { if (agvaddr == 0) { agvaddr = agvaddr_copy; } @@ -1812,23 +613,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic 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()) -// && StrUtil.equals(task.getTask_type(), "1")) { -// // -// if (standardOrdinarySiteDeviceDriver.getOption() == 2) { -// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); -// standardOrdinarySiteDeviceDriver.setOption(0); -// } else { -// log.info("等待LMS系统进行确认离开,设备号{},指令号:{}", device_code, ikey); -// message = "等待LMS系统进行确认离开,设备号:" + device_code + ",指令号:" + ikey; -// } -// } else { -// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); -// } + standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(this.getDeviceCode()) @@ -1836,8 +623,37 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); - this.setPhase(phase); + standardOrdinarySiteDeviceDriver.setAgvphase(phase); + standardOrdinarySiteDeviceDriver.setIndex(index); + standardOrdinarySiteDeviceDriver.setInst(inst); + } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { + paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); + try { + paperTubePickSiteDeviceDriver.writing(4); + } 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 + "不满足取货条件"; + log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足放货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() + , paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), 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(); @@ -1890,15 +706,10 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); } - } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { - paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); - try { - paperTubePickSiteDeviceDriver.writing(4); - } catch (Exception e) { - e.printStackTrace(); - } - if (paperTubePickSiteDeviceDriver.getAction() == 1 - && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { + } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); + standardInspectSiteDeviceDriver.writing(1); + if ((standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(this.getDeviceCode()) @@ -1907,9 +718,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); } else { - message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() - , paperTubePickSiteDeviceDriver.getError(), ikey); + message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足放货条件"; + log.info("设备{}当前光电信号{},动作信号{} ,报警信号{},不满足放货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction() + , standardInspectSiteDeviceDriver.getError(), ikey); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(this.getDeviceCode()) .content(message) @@ -1917,64 +728,36 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); } - }/* else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { - rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver(); - ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); - String device_code1 = device.getDevice_code(); - String length1 = rangingStationsDeviceDriver.getLength1(); - String length2 = rangingStationsDeviceDriver.getLength2(); - Float len1 = 0.0F; - Float len2 = 0.0F; - if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1) && ObjectUtil.isNotEmpty(length2) && !"null".equals(length2)) { - len1 = Float.parseFloat(length1); - len2 = Float.parseFloat(length2); - } - if (len1 * len2 < 1) { - if (ObjectUtil.isNotEmpty(device_code1) && device_code1.contains("A")) { - String offSet_A = paramService.findByCode(AcsConfig.OFFSET_A).getValue(); - if (ObjectUtil.isNotEmpty(offSet_A) && !"null".equals(offSet_A)) { - Integer integer = Integer.valueOf(offSet_A); - len1 = len1 - integer; - } - } else if (ObjectUtil.isNotEmpty(device_code1) && device_code1.contains("B")) { - String offSet_B = paramService.findByCode(AcsConfig.OFFSET_B).getValue(); - if (ObjectUtil.isNotEmpty(offSet_B) && !"null".equals(offSet_B)) { - Integer integer = Integer.valueOf(offSet_B); - len1 = integer + len1; - } - } else { - log.info("{}设备名不符合条件,指令号{}", device_code, ikey); - } - int roundedNumber = ObjectUtil.isNotEmpty(len1) ? NumberUtil.round(len1, 0).intValue() : 0; - if (roundedNumber == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } else if (roundedNumber > -50 || roundedNumber < 50) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } else if (roundedNumber > 50 || roundedNumber < -50) { - log.info("设备{},偏移数据超出范围导致未反馈{},指令号{}", device_code, roundedNumber, ikey); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("设备" + device_code + "偏移数据超出范围导致未反馈" + roundedNumber + "指令号" + ikey) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } else { - log.info("设备{},偏移数据出错导致未反馈{},指令号{}", device_code, rangingStationsDeviceDriver.getLength1() + "," + rangingStationsDeviceDriver.getLength2(), ikey); + }else if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { + wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); + if (wasteFoilWeighingStationDriver.getMove() == 0 && wasteFoilWeighingStationDriver.getAction() == 1 + && wasteFoilWeighingStationDriver.getError() == 0 && wasteFoilWeighingStationDriver.getMode() == 2) { + try { + Map map = new LinkedHashMap<>(); + map.put("to_command", "4"); + wasteFoilWeighingStationDriver.writing(map); + 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); + } catch (Exception e) { + e.printStackTrace(); } - }*/ else { + } else { + message = "设备号:" + device_code + "光电信号:" + wasteFoilWeighingStationDriver.getMove() + ",动作信号:" + wasteFoilWeighingStationDriver.getAction() + "报警信号:" + wasteFoilWeighingStationDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; + log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货条件,指令号{}", device_code, wasteFoilWeighingStationDriver.getMove(), wasteFoilWeighingStationDriver.getAction() + , wasteFoilWeighingStationDriver.getError(), wasteFoilWeighingStationDriver.getMode(), 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()) @@ -1985,8 +768,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } } //放货完成 - //(Itype=1、3,需要WCS反馈) - else if (phase == 0x12) { + //(Itype=1/2/3,需要WCS反馈) + else if (phase == 0x09) { if (agvaddr == 0) { agvaddr = agvaddr_copy; } @@ -2023,23 +806,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic 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()) -// && StrUtil.equals(task.getTask_type(), "1")) { -// // -// if (standardOrdinarySiteDeviceDriver.getOption() == 2) { -// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); -// standardOrdinarySiteDeviceDriver.setOption(0); -// } else { -// log.info("等待LMS系统进行确认离开,设备号{},指令号:{}", device_code, ikey); -// message = "等待LMS系统进行确认离开,设备号:" + device_code + ",指令号:" + ikey; -// } -// } else { -// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); -// } data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(this.getDeviceCode()) @@ -2048,75 +815,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); this.setPhase(phase); - - } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - try { - manipulatorAgvStationDeviceDriver.writing(5); - } 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); - } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { - paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); - try { - paperTubePickSiteDeviceDriver.writing(5); - } 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.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), 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 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() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() - , hongXiangStationDeviceDriver.getError(), ikey); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } else { + } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(this.getDeviceCode()) @@ -2126,6 +825,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic luceneExecuteLogService.deviceExecuteLog(logDto); } } + //上传AGV电量 else if (phase == 0x70) { //x坐标 @@ -2257,12 +957,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); -// if (StrUtil.equals(inst.getAgv_system_type(), "2")) { -// TwoNDCSocketConnectionAutoRun.write(data); -// } -// else if (StrUtil.equals(inst.getAgv_system_type(), "3")) { -// TwoNDC2SocketConnectionAutoRun.write(data); -// } if (StrUtil.equals(inst.getAgv_system_type(), "2")) { TwoNDCSocketConnectionAutoRun.write(data); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java index 0413bc4..ab10b5e 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java @@ -266,7 +266,6 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple DeviceDto dto = deviceservice.findByCode(this.getDevice().getDevice_code()); jo.put("zh_device_name",dto.getZh_device_name()); jo.put("en_device_name",dto.getEn_device_name()); - jo.put("in_device_name",dto.getIn_device_name()); jo.put("mode", mode); jo.put("move", move); jo.put("action", action); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/rest/InstructionController.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/rest/InstructionController.java index f238666..5a7a516 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/rest/InstructionController.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/rest/InstructionController.java @@ -51,8 +51,6 @@ public class InstructionController { @GetMapping("/reload") @Log("数据同步") - - public ResponseEntity reload() { instructionService.reload(); return new ResponseEntity<>(HttpStatus.OK); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/language/InitLocaleResolver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/language/InitLocaleResolver.java index 2ed33f9..26bca48 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/language/InitLocaleResolver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/language/InitLocaleResolver.java @@ -11,7 +11,7 @@ import java.util.Map; public class InitLocaleResolver implements LocaleResolver { - public static Map Language_Country = MapOf.of("id","in-ID","in","in-ID","en-US,en;q=0.9","en-US","en","en-US","zh","zh-CN"); + public static Map Language_Country = MapOf.of("id","in-ID","in","in-ID","en-US,en;q=0.9","en-US","en","en-US","zh","zh-CN","ko","ko-KR"); public static String language = ""; @Override public Locale resolveLocale(HttpServletRequest request) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/hand/rest/HandController.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/hand/rest/HandController.java index f433a78..be11c2c 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/hand/rest/HandController.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/hand/rest/HandController.java @@ -15,8 +15,10 @@ import org.nl.system.service.dict.dao.Dict; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.web.HttpRequestHandler; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; import java.util.Map; /** @@ -84,7 +86,8 @@ public class HandController { @ApiOperation("查询未完成指令") @SaIgnore //@PreAuthorize("@el.check('sect:list')") - public ResponseEntity querytasks(@RequestBody HeadTaskDto dto) { + public ResponseEntity querytasks(@RequestBody HeadTaskDto dto, HttpServletRequest request ) { + request.getHeader("Accept-Language"); return new ResponseEntity<>(handService.querytasks(dto), HttpStatus.OK); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/impl/SysDictServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/impl/SysDictServiceImpl.java index e389ed0..74c701f 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/impl/SysDictServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/dict/impl/SysDictServiceImpl.java @@ -156,6 +156,7 @@ public class SysDictServiceImpl extends ServiceImpl impleme dic.setZh_label(dict.getZh_label()); dic.setEn_label(dict.getEn_label()); dic.setIn_label(dict.getIn_label()); + dic.setKo_label(dict.getKo_label()); sysDictMapper.updateById(dic); return; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_ko.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_ko_KR.properties similarity index 100% rename from acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_ko.properties rename to acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_ko_KR.properties diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_ko.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_ko_KR.properties similarity index 100% rename from acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_ko.properties rename to acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_ko_KR.properties