From 65742a4bb66f944e7ff2bd4be380a6b1ca2e3e47 Mon Sep 17 00:00:00 2001 From: psh Date: Thu, 14 Sep 2023 17:05:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=A6=E5=8D=97fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agv/server/impl/NDCAgvServiceImpl.java | 112 +---- .../auto/run/NDCSocketConnectionAutoRun.java | 456 +++++++++--------- .../src/main/resources/config/application.yml | 2 +- .../src/main/resources/log/WmsToAcs.xml | 30 -- .../src/main/resources/logback-spring.xml | 56 ++- .../nl/wms/sch/tasks/SendMaterialTask.java | 18 +- .../main/resources/config/application-dev.yml | 2 +- .../resources/config/application-prod.yml | 4 +- .../src/main/resources/config/application.yml | 2 +- 9 files changed, 306 insertions(+), 376 deletions(-) delete mode 100644 acs/hd/nladmin-system/src/main/resources/log/WmsToAcs.xml diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java index 73860fa..38f15c8 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java @@ -22,6 +22,7 @@ import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppServiceImpl; import org.nl.acs.opc.DeviceType; import org.nl.exception.BadRequestException; +import org.nl.start.auto.run.NDCSocketConnectionAutoRun; import org.nl.utils.SpringContextHolder; import org.slf4j.MDC; import org.springframework.stereotype.Service; @@ -51,7 +52,7 @@ public class NDCAgvServiceImpl implements NDCAgvService { try { MDC.put(log_file_type, log_type); if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) { - int index = Integer.parseInt(inst.getAgv_jobno()); + int index = ObjectUtil.isEmpty(inst.getAgv_jobno())?0:Integer.parseInt(inst.getAgv_jobno()); byte indexhigh = (byte) IntToHexHigh(index); byte indexlow = (byte) IntToHexLow(index); @@ -181,7 +182,7 @@ public class NDCAgvServiceImpl implements NDCAgvService { }; log.info("下发AGV作业指令--{}", str1); -// NDCSocketConnectionAutoRun.write(b); + NDCSocketConnectionAutoRun.write(b); System.out.println("下发agv指令数据:" + Bytes2HexString(b)); } } finally { @@ -230,91 +231,30 @@ public class NDCAgvServiceImpl implements NDCAgvService { return new byte[0]; } - @Override public byte[] sendAgvOneModeInst(int phase, int index, int result) { - try { - MDC.put(log_file_type, log_type); - if (phase < 0 || index < 0) - return null; - byte indexhigh = (byte) IntToHexHigh(index); - byte indexlow = (byte) IntToHexLow(index); - byte phasehigh = (byte) IntToHexHigh(phase); - byte phaselow = (byte) IntToHexLow(phase); - byte resulthigh = (byte) IntToHexHigh(result); - byte resultlow = (byte) IntToHexLow(result); - - int type = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.BUSINESSTYPE)); - byte[] b = new byte[]{}; - switch (type) { - case 0: - b = new byte[]{(byte) 0X87, (byte) 0XCD, - (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X0A, - (byte) 0X00, (byte) 0X01, - (byte) 0X00, (byte) 0X6D, - (byte) 0X00, (byte) 0X06, - (byte) indexhigh, (byte) indexlow, - (byte) 0X01, (byte) 0X12, - (byte) phasehigh, (byte) phaselow - }; - break; - case 1: - b = new byte[]{(byte) 0X87, (byte) 0XCD, - (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X0D, - (byte) 0X00, (byte) 0X01, - (byte) 0X00, (byte) 0X6D, - (byte) 0X00, (byte) 0X08, - (byte) indexhigh, (byte) indexlow, - (byte) 0X01, (byte) 0X12, - (byte) phasehigh, (byte) phaselow, - (byte) resulthigh, (byte) resultlow - }; - break; - case 2: - b = new byte[]{(byte) 0X87, (byte) 0XCD, - (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X0A, - (byte) 0X00, (byte) 0X01, - (byte) 0X00, (byte) 0X6D, - (byte) 0X00, (byte) 0X06, - (byte) indexhigh, (byte) indexlow, - (byte) 0X01, (byte) 0X12, - (byte) phasehigh, (byte) phaselow - }; - break; - case 5: - b = new byte[]{(byte) 0X87, (byte) 0XCD, - (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X0A, - (byte) 0X00, (byte) 0X01, - (byte) 0X00, (byte) 0X6D, - (byte) 0X00, (byte) 0X06, - (byte) indexhigh, (byte) indexlow, - (byte) 0X01, (byte) 0X12, - (byte) phasehigh, (byte) phaselow - }; - break; - case 7: - b = new byte[]{(byte) 0X87, (byte) 0XCD, - (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X0A, - (byte) 0X00, (byte) 0X01, - (byte) 0X00, (byte) 0X6D, - (byte) 0X00, (byte) 0X06, - (byte) indexhigh, (byte) indexlow, - (byte) 0X01, (byte) 0X12, - (byte) phasehigh, (byte) phaselow - }; - break; - } - log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF)); - - System.out.println("反馈agv动作数据:" + Bytes2HexString(b)); - return b; - } finally { - MDC.remove(log_file_type); - } + if (phase < 0 || index < 0) + return null; + byte indexhigh = (byte) IntToHexHigh(index); + byte indexlow = (byte) IntToHexLow(index); + byte phasehigh = (byte) IntToHexHigh(phase); + byte phaselow = (byte) IntToHexLow(phase); + + byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, + (byte) 0X00, (byte) 0X08, + (byte) 0X00, (byte) 0X0A, + (byte) 0X00, (byte) 0X01, + (byte) 0X00, (byte) 0X6D, + (byte) 0X00, (byte) 0X06, + (byte) indexhigh, (byte) indexlow, + (byte) 0X01, (byte) 0X12, + (byte) phasehigh, (byte) phaselow + }; + + + log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF)); + + System.out.println("反馈agv动作数据:" + Bytes2HexString(b)); + return b; } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java b/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java index 5c0fbb3..5a61842 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java @@ -162,14 +162,13 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { try { if (phase == 0x01) { - data = AgvService.sendAgvOneModeInst(phase, index); if (!ObjectUtil.isEmpty(inst)) { inst.setInstruction_status("1"); inst.setAgv_jobno(String.valueOf(index)); inst.setSend_status("1"); instructionService.update(inst); - data = AgvService.sendAgvOneModeInst(phase, index, 0); } + data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } //分配 车id @@ -221,22 +220,34 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { //检测站点smart200 if (device.getDeviceDriver() instanceof StandardInspectSiteSmartDeviceDriver) { standardInspectSiteSmartDeviceDriver = (StandardInspectSiteSmartDeviceDriver) device.getDeviceDriver(); - if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.IGNOREHASGOODS), "1")) { - inst.setExecute_status("1"); + inst.setExecute_status("1"); + instructionService.update(inst); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + } + + } + // 取货完成请求离开 + else if (phase == 0x05) { + if (ObjectUtil.isEmpty(inst)) { + logServer.deviceExecuteLog("未找到指令号对应的指令:", "", "", String.valueOf(ikey)); + break; + } + if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); + standardInspectSiteDeviceDriver.writing(3); + if (standardInspectSiteDeviceDriver.getMode() != 0 + && standardInspectSiteDeviceDriver.getMove() == 0) { + inst.setExecute_status("5"); instructionService.update(inst); data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - if (device.getHas_goods() != 0) { - inst.setExecute_status("1"); - instructionService.update(inst); - data = AgvService.sendAgvOneModeInst(phase, index, 0); - flag = true; - } else { - logServer.deviceExecuteLog(device_code, "", "", "AGV请求取货设备{}无货,无法反馈"); - } + logServer.deviceExecuteLog(device_code, "", "", "AGV取货完成请求离开设备{}有货,无法反馈"); } - + } + //检测站点smart200 + if (device.getDeviceDriver() instanceof StandardInspectSiteSmartDeviceDriver) { + standardInspectSiteSmartDeviceDriver = (StandardInspectSiteSmartDeviceDriver) device.getDeviceDriver(); //如果是混料区则上送LMS当前点位的字段,同步到st_ivt_structivt仓位库存表 JSONObject jsonObject = new JSONObject(); jsonObject.put("device_code", device_code); @@ -245,49 +256,28 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { jsonObject.put("batch_code", standardInspectSiteSmartDeviceDriver.getBatch_code()); jsonObject.put("product_specifications", standardInspectSiteSmartDeviceDriver.getProduct_specifications()); jsonObject.put("time", standardInspectSiteSmartDeviceDriver.getTime()); - jsonObject.put("type","9"); + jsonObject.put("type", "9"); acsToWmsService.lnshApplyTaskToWms(jsonObject); } - - // 检验取放货条件 - JSONObject agv_check = device_extra_table - .query("is_delete = '0' AND extra_code = 'agv_check' AND device_code = '" + device.getDevice_code() + "'") - .uniqueResult(0); - if (ObjectUtil.isNotEmpty(agv_check) && "true".equals(agv_check.getString("extra_value"))) { - JSONObject agv_check_status = device_extra_table - .query("is_delete = '0' AND extra_code = 'agv_check_status' AND device_code = '" + device.getDevice_code() + "'") + // 检验取放货条件 + JSONObject agv_check = device_extra_table + .query("is_delete = '0' AND extra_code = 'agv_check' AND device_code = '" + device.getDevice_code() + "'") .uniqueResult(0); - if (ObjectUtil.isNotEmpty(agv_check_status) && "2".equals(agv_check_status.getString("extra_value"))) { - inst.setExecute_status("1"); - instructionService.update(inst); - data = AgvService.sendAgvOneModeInst(phase, index, 0); - flag = true; - agv_check_status.put("extra_value", "0"); - device_extra_table.update(agv_check_status); - } else { - logServer.deviceExecuteLog(device_code, "", "", "AGV请求取货设备{}未放盖确认,无法反馈"); - } - } - } - // 取货完成请求离开 - else if (phase == 0x05) { - if (ObjectUtil.isEmpty(inst)) { - logServer.deviceExecuteLog("未找到指令号对应的指令:", "", "", String.valueOf(ikey)); - break; - } - if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { - standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); - standardInspectSiteDeviceDriver.writing(3); - if (standardInspectSiteDeviceDriver.getMode() != 0 - && standardInspectSiteDeviceDriver.getMove() == 0) { - inst.setExecute_status("5"); - instructionService.update(inst); - data = AgvService.sendAgvOneModeInst(phase, index, 0); - flag = true; - } else { - logServer.deviceExecuteLog(device_code, "", "", "AGV取货完成请求离开设备{}有货,无法反馈"); + if (ObjectUtil.isNotEmpty(agv_check) && "true".equals(agv_check.getString("extra_value"))) { + JSONObject agv_check_status = device_extra_table + .query("is_delete = '0' AND extra_code = 'agv_check_status' AND device_code = '" + device.getDevice_code() + "'") + .uniqueResult(0); + if (ObjectUtil.isNotEmpty(agv_check_status) && "2".equals(agv_check_status.getString("extra_value"))) { + inst.setExecute_status("1"); + instructionService.update(inst); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + agv_check_status.put("extra_value", "0"); + device_extra_table.update(agv_check_status); + } else { + logServer.deviceExecuteLog(device_code, "", "", "AGV请求取货设备{}未放盖确认,无法反馈"); + } } - } // if(!inst.getTask_code().startsWith("-")) { // //反馈wms系统动作完成 @@ -302,65 +292,69 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { // acsToWmsService.feedbackActionStatusToWms(feedja); // } - } - //请求放货 - else if (phase == 0x07) { - if (ObjectUtil.isEmpty(inst)) { - logServer.deviceExecuteLog("未找到指令号对应的指令:", "", "", String.valueOf(ikey)); - break; } - if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { - standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); - standardInspectSiteDeviceDriver.writing(4); - if (standardInspectSiteDeviceDriver.getMode() != 0 - && standardInspectSiteDeviceDriver.getMove() == 0) { - inst.setExecute_status("3"); - instructionService.update(inst); - data = AgvService.sendAgvOneModeInst(phase, index, 0); - flag = true; - } else { - logServer.deviceExecuteLog(device_code, "", "", "AGV请求放货设备{}有货,无法反馈"); + //请求放货 + else if (phase == 0x07) { + if (ObjectUtil.isEmpty(inst)) { + logServer.deviceExecuteLog("未找到指令号对应的指令:", "", "", String.valueOf(ikey)); + break; } - } - // 检验取放货条件 - JSONObject agv_check = device_extra_table - .query("is_delete = '0' AND extra_code = 'agv_check' AND device_code = '" + device.getDevice_code() + "'") - .uniqueResult(0); - if (ObjectUtil.isNotEmpty(agv_check) && "true".equals(agv_check.getString("extra_value"))) { - JSONObject agv_check_status = device_extra_table - .query("is_delete = '0' AND extra_code = 'agv_check_status' AND device_code = '" + device.getDevice_code() + "'") + if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); + standardInspectSiteDeviceDriver.writing(4); + if (standardInspectSiteDeviceDriver.getMode() != 0 + && standardInspectSiteDeviceDriver.getMove() == 0) { + inst.setExecute_status("3"); + instructionService.update(inst); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + } else { + logServer.deviceExecuteLog(device_code, "", "", "AGV请求放货设备{}有货,无法反馈"); + } + } + // 检验取放货条件 + JSONObject agv_check = device_extra_table + .query("is_delete = '0' AND extra_code = 'agv_check' AND device_code = '" + device.getDevice_code() + "'") .uniqueResult(0); - if (ObjectUtil.isNotEmpty(agv_check_status) && "1".equals(agv_check_status.getString("extra_value"))) { - inst.setExecute_status("1"); - instructionService.update(inst); - data = AgvService.sendAgvOneModeInst(phase, index, 0); - flag = true; - agv_check_status.put("extra_value", "0"); - device_extra_table.update(agv_check_status); - } else { - logServer.deviceExecuteLog(device_code, "", "", "AGV请求取货设备{}未取盖确认,无法反馈"); + if (ObjectUtil.isNotEmpty(agv_check) && "true".equals(agv_check.getString("extra_value"))) { + JSONObject agv_check_status = device_extra_table + .query("is_delete = '0' AND extra_code = 'agv_check_status' AND device_code = '" + device.getDevice_code() + "'") + .uniqueResult(0); + if (ObjectUtil.isNotEmpty(agv_check_status) && "1".equals(agv_check_status.getString("extra_value"))) { + inst.setExecute_status("1"); + instructionService.update(inst); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + agv_check_status.put("extra_value", "0"); + device_extra_table.update(agv_check_status); + } else { + logServer.deviceExecuteLog(device_code, "", "", "AGV请求取货设备{}未取盖确认,无法反馈"); + } } } - } - // 放货完成请求离开 - else if (phase == 0x09) { - if (ObjectUtil.isEmpty(inst)) { - logServer.deviceExecuteLog("未找到指令号对应的指令:", "", "", String.valueOf(ikey)); - break; - } - if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { - standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); - standardInspectSiteDeviceDriver.writing(5); - if (standardInspectSiteDeviceDriver.getMode() != 0 - && standardInspectSiteDeviceDriver.getMove() != 0) { + // 放货完成请求离开 + else if (phase == 0x09) { + if (ObjectUtil.isEmpty(inst)) { + logServer.deviceExecuteLog("未找到指令号对应的指令:", "", "", String.valueOf(ikey)); + break; + } + if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); + standardInspectSiteDeviceDriver.writing(5); + if (standardInspectSiteDeviceDriver.getMode() != 0 + && standardInspectSiteDeviceDriver.getMove() != 0) { + inst.setExecute_status("6"); + instructionService.update(inst); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + } else { + logServer.deviceExecuteLog(device_code, "", "", "AGV放货完成请求离开设备{}无货,无法反馈"); + } + } else { inst.setExecute_status("6"); instructionService.update(inst); data = AgvService.sendAgvOneModeInst(phase, index, 0); - flag = true; - } else { - logServer.deviceExecuteLog(device_code, "", "", "AGV放货完成请求离开设备{}无货,无法反馈"); } - } // if(!inst.getTask_code().startsWith("-")){ // //反馈wms系统动作完成 @@ -376,167 +370,157 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { // acsToWmsService.feedbackActionStatusToWms(feedja); // } - } - //任务完毕 - //(无车id及状态) - else if (phase == 0x0A) { - if (!ObjectUtil.isEmpty(inst)) { - inst.setInstruction_status("2"); - instructionService.finish(inst); } - data = AgvService.sendAgvOneModeInst(phase, index, 0); - } - //请求删除任务 - else if (phase == 0x30) { - flag = true; - if (!ObjectUtil.isEmpty(inst)) { + //任务完毕 + //(无车id及状态) + else if (phase == 0x0A) { + if (!ObjectUtil.isEmpty(inst)) { + inst.setInstruction_status("2"); + instructionService.finish(inst); + } + data = AgvService.sendAgvOneModeInst(phase, index, 0); + } + //请求删除任务 + else if (phase == 0x30) { data = AgvService.sendAgvOneModeInst(0x8F, index, 0); - } else { - log.info("未找到对应的指令无法删除"); - break; } - } - //任务删除确认 - //(需要WCS反馈) - else if (phase == 0xFF) { - flag = true; - if (!ObjectUtil.isEmpty(inst)) { - instructionService.cancel(inst.getInstruction_id()); + //任务删除确认 + //(需要WCS反馈) + else if (phase == 0xFF) { + flag = true; + if (!ObjectUtil.isEmpty(inst)) { + instructionService.cancel(inst.getInstruction_id()); + } + data = AgvService.sendAgvOneModeInst(phase, index, 0); } - data = AgvService.sendAgvOneModeInst(phase, index, 0); - } - //进入区域 - else if (phase == 0x50) { - //开门 - if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { - standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); - standardAutodoorDeviceDriver.OpenOrClose("1"); - standardAutodoorDeviceDriver.writeing(1); - if (standardAutodoorDeviceDriver.getAction() == 1) { + //进入区域 + else if (phase == 0x50) { + //开门 + if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { + standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); standardAutodoorDeviceDriver.OpenOrClose("1"); - data = AgvService.sendAgvOneModeInst(phase, index, 0); + standardAutodoorDeviceDriver.writeing(1); + if (standardAutodoorDeviceDriver.getAction() == 1) { + standardAutodoorDeviceDriver.OpenOrClose("1"); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + } } } - } - //离开区域 - else if (phase == 0x51) { - //关门 - if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { - standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); - standardAutodoorDeviceDriver.OpenOrClose("2"); - standardAutodoorDeviceDriver.writeing(2); - if (standardAutodoorDeviceDriver.getAction() == 2) { - data = AgvService.sendAgvOneModeInst(phase, index, 0); + //离开区域 + else if (phase == 0x51) { + //关门 + if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { + standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); + standardAutodoorDeviceDriver.OpenOrClose("2"); + standardAutodoorDeviceDriver.writeing(2); + if (standardAutodoorDeviceDriver.getAction() == 2) { + data = AgvService.sendAgvOneModeInst(phase, index, 0); + } } + } else if (phase == 0x64) { + data = AgvService.sendAgvOneModeInst(phase, index, 0); } - } else if (phase == 0x64) { - data = AgvService.sendAgvOneModeInst(phase, index, 0); - } - //上报异常 - else if (phase == 0x67) { - AgvDto dto = null; - Map map = AgvService.findAllAgvFromCache(); - if (map.containsKey(String.valueOf(carno))) { - dto = map.get(String.valueOf(carno)); - } else { - dto = new AgvDto(); + //上报异常 + else if (phase == 0x67) { + AgvDto dto = null; + Map map = AgvService.findAllAgvFromCache(); + if (map.containsKey(String.valueOf(carno))) { + dto = map.get(String.valueOf(carno)); + } else { + dto = new AgvDto(); + } + dto.setName(String.valueOf(carno)); + if (arr[18] * 256 + arr[19] == 0) { + dto.setState("IDLE"); + acsToWmsService.feedbackAgvStatus(String.valueOf(carno), "0", ""); + } else { + StringBuffer errbs = new StringBuffer(); + for (int i = 0; i < ERROR.length; i++) { + if (((arr[18] * 256 + arr[19]) & (1 << i)) > 0) + errbs.append("," + ERROR[i]); + //反馈故障 + } + dto.setState("ERROR"); + acsToWmsService.feedbackAgvStatus(String.valueOf(carno), "1", "error"); + } } - dto.setName(String.valueOf(carno)); - if (arr[18] * 256 + arr[19] == 0) { - dto.setState("IDLE"); - acsToWmsService.feedbackAgvStatus(String.valueOf(carno), "0", ""); - } else { - StringBuffer errbs = new StringBuffer(); - for (int i = 0; i < ERROR.length; i++) { - if (((arr[18] * 256 + arr[19]) & (1 << i)) > 0) - errbs.append("," + ERROR[i]); - //反馈故障 + //X坐标 + else if (phase == 0x70) { + AgvDto dto = null; + Map map = AgvService.findAllAgvFromCache(); + carno = arr[18] * 256 + arr[19]; + if (map.containsKey(String.valueOf(carno))) { + dto = map.get(String.valueOf(carno)); + } else { + dto = new AgvDto(); } - dto.setState("ERROR"); - acsToWmsService.feedbackAgvStatus(String.valueOf(carno), "1", "error"); + dto.setName(String.valueOf(carno)); + dto.setPositionX(String.valueOf(ikey)); } - } - //X坐标 - else if (phase == 0x70) { - AgvDto dto = null; - Map map = AgvService.findAllAgvFromCache(); - carno = arr[18] * 256 + arr[19]; - if (map.containsKey(String.valueOf(carno))) { - dto = map.get(String.valueOf(carno)); - } else { - dto = new AgvDto(); + //Y坐标 + else if (phase == 0x71) { + AgvDto dto = null; + Map map = AgvService.findAllAgvFromCache(); + carno = arr[18] * 256 + arr[19]; + if (map.containsKey(String.valueOf(carno))) { + dto = map.get(String.valueOf(carno)); + } else { + dto = new AgvDto(); + } + dto.setName(String.valueOf(carno)); + dto.setPositionY(String.valueOf(ikey)); } - dto.setName(String.valueOf(carno)); - dto.setPositionX(String.valueOf(ikey)); - } - //Y坐标 - else if (phase == 0x71) { - AgvDto dto = null; - Map map = AgvService.findAllAgvFromCache(); - carno = arr[18] * 256 + arr[19]; - if (map.containsKey(String.valueOf(carno))) { - dto = map.get(String.valueOf(carno)); - } else { - dto = new AgvDto(); + //角度 + else if (phase == 0x72) { + AgvDto dto = null; + Map map = AgvService.findAllAgvFromCache(); + carno = arr[18] * 256 + arr[19]; + if (map.containsKey(String.valueOf(carno))) { + dto = map.get(String.valueOf(carno)); + } else { + dto = new AgvDto(); + } + dto.setName(String.valueOf(carno)); + dto.setPositionAngle(String.valueOf(ikey)); } - dto.setName(String.valueOf(carno)); - dto.setPositionY(String.valueOf(ikey)); - } - //角度 - else if (phase == 0x72) { - AgvDto dto = null; - Map map = AgvService.findAllAgvFromCache(); - carno = arr[18] * 256 + arr[19]; - if (map.containsKey(String.valueOf(carno))) { - dto = map.get(String.valueOf(carno)); - } else { - dto = new AgvDto(); + //电量 + else if (phase == 0x73) { + AgvDto dto = null; + Map map = AgvService.findAllAgvFromCache(); + carno = arr[18] * 256 + arr[19]; + if (map.containsKey(String.valueOf(carno))) { + dto = map.get(String.valueOf(carno)); + } else { + dto = new AgvDto(); + } + dto.setName(String.valueOf(carno)); + dto.setEnergyLevel(String.valueOf(ikey)); } - dto.setName(String.valueOf(carno)); - dto.setPositionAngle(String.valueOf(ikey)); - } - //电量 - else if (phase == 0x73) { - AgvDto dto = null; - Map map = AgvService.findAllAgvFromCache(); - carno = arr[18] * 256 + arr[19]; - if (map.containsKey(String.valueOf(carno))) { - dto = map.get(String.valueOf(carno)); - } else { - dto = new AgvDto(); + if (!ObjectUtil.isEmpty(data)) { + write(data); } - dto.setName(String.valueOf(carno)); - dto.setEnergyLevel(String.valueOf(ikey)); + } catch (Exception e) { + System.out.println(e); + log.info(e.toString()); + log.info(e.getMessage()); + e.printStackTrace(); } - if (!ObjectUtil.isEmpty(data)) { - write(data); - } - } catch(Exception e){ - System.out.println(e); - log.info(e.toString()); - log.info(e.getMessage()); - e.printStackTrace(); + } else { + System.out.println("agv上报不是0073类型动作,不处理"); } - } else{ - System.out.println("agv上报不是0073类型动作,不处理"); } - } - } catch( - Exception e) + } catch ( + Exception e) { - { + } finally { - } finally - - { + } } -} - @Override public void stop() { diff --git a/acs/hd/nladmin-system/src/main/resources/config/application.yml b/acs/hd/nladmin-system/src/main/resources/config/application.yml index 07d277e..8e1be36 100644 --- a/acs/hd/nladmin-system/src/main/resources/config/application.yml +++ b/acs/hd/nladmin-system/src/main/resources/config/application.yml @@ -2,7 +2,7 @@ spring: freemarker: check-template-location: false profiles: - active: dev + active: prod jackson: time-zone: GMT+8 data: diff --git a/acs/hd/nladmin-system/src/main/resources/log/WmsToAcs.xml b/acs/hd/nladmin-system/src/main/resources/log/WmsToAcs.xml deleted file mode 100644 index 85f952c..0000000 --- a/acs/hd/nladmin-system/src/main/resources/log/WmsToAcs.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/acs/hd/nladmin-system/src/main/resources/logback-spring.xml b/acs/hd/nladmin-system/src/main/resources/logback-spring.xml index a61e494..15d2500 100644 --- a/acs/hd/nladmin-system/src/main/resources/logback-spring.xml +++ b/acs/hd/nladmin-system/src/main/resources/logback-spring.xml @@ -12,7 +12,7 @@ https://juejin.cn/post/6844903775631572999 nlAdmin + value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %gray(%msg%n)"/> @@ -21,16 +21,26 @@ https://juejin.cn/post/6844903775631572999 - + + + + + + - - --> - + + + @@ -39,6 +49,7 @@ https://juejin.cn/post/6844903775631572999 + @@ -81,15 +92,37 @@ https://juejin.cn/post/6844903775631572999 + + + error + + + + ${LOG_HOME}/ERROR/%d{yyyy-MM-dd}.%i.log + + 15 + + 200MB + + 20GB + + + ${log.pattern} + ${log.charset} + + + + + @@ -130,15 +163,16 @@ https://juejin.cn/post/6844903775631572999 - + - + + diff --git a/lms/hd/nladmin-system/src/main/java/org/nl/wms/sch/tasks/SendMaterialTask.java b/lms/hd/nladmin-system/src/main/java/org/nl/wms/sch/tasks/SendMaterialTask.java index 030440c..b91502b 100644 --- a/lms/hd/nladmin-system/src/main/java/org/nl/wms/sch/tasks/SendMaterialTask.java +++ b/lms/hd/nladmin-system/src/main/java/org/nl/wms/sch/tasks/SendMaterialTask.java @@ -235,17 +235,17 @@ public class SendMaterialTask extends AbstractAcsTask { PointService pointService = SpringContextHolder.getBean(PointService.class); - // 起点是空位不能搬 +// // 起点是空位不能搬 PointDto startPoint = pointService.findByCode(start_point_code); - if (StrUtil.equals(startPoint.getPoint_status(), "00")) { - throw new BadRequestException("起点是空位"); - } - - // 终点不是空位不能搬 +// if (StrUtil.equals(startPoint.getPoint_status(), "00")) { +// throw new BadRequestException("起点是空位"); +// } +// +// // 终点不是空位不能搬 PointDto nextPoint = pointService.findByCode(next_point_code); - if (!StrUtil.equals(nextPoint.getPoint_status(), "00")) { - throw new BadRequestException("终点不是空位"); - } +// if (!StrUtil.equals(nextPoint.getPoint_status(), "00")) { +// throw new BadRequestException("终点不是空位"); +// } // 判断起点有没有未完成的指令 JSONObject startPointTask = taskTable diff --git a/lms/hd/nladmin-system/src/main/resources/config/application-dev.yml b/lms/hd/nladmin-system/src/main/resources/config/application-dev.yml index dda1a6f..e3b685d 100644 --- a/lms/hd/nladmin-system/src/main/resources/config/application-dev.yml +++ b/lms/hd/nladmin-system/src/main/resources/config/application-dev.yml @@ -68,7 +68,7 @@ spring: multi-statement-alagvslow: true redis: #数据库索引 - database: ${REDIS_DB:1} + database: ${REDIS_DB:3} host: ${REDIS_HOST:127.0.0.1} port: ${REDIS_PORT:6379} password: ${REDIS_PWD:} diff --git a/lms/hd/nladmin-system/src/main/resources/config/application-prod.yml b/lms/hd/nladmin-system/src/main/resources/config/application-prod.yml index 8ac5fdc..a372abb 100644 --- a/lms/hd/nladmin-system/src/main/resources/config/application-prod.yml +++ b/lms/hd/nladmin-system/src/main/resources/config/application-prod.yml @@ -157,4 +157,6 @@ jetcache: maxTotal: 1000 uri: - redis://localhost:6379 - +loki: + url: http://localhost:3100/loki/api/v1 + systemName: lms diff --git a/lms/hd/nladmin-system/src/main/resources/config/application.yml b/lms/hd/nladmin-system/src/main/resources/config/application.yml index 334120a..0e75762 100644 --- a/lms/hd/nladmin-system/src/main/resources/config/application.yml +++ b/lms/hd/nladmin-system/src/main/resources/config/application.yml @@ -2,7 +2,7 @@ spring: freemarker: check-template-location: false profiles: - active: dev + active: prod jackson: time-zone: GMT+8 data: