diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java index e13a97f..0499578 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java @@ -117,6 +117,7 @@ public class AgvServiceImpl implements AgvService { @Override public HttpResponse queryMagicAgvDeviceStatus() { + log.info("查询agv状态数据-----------------"); if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) { String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL); String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/MagicAgvServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/MagicAgvServiceImpl.java index 5ab9d20..dfe1ece 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/MagicAgvServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/MagicAgvServiceImpl.java @@ -423,52 +423,51 @@ public class MagicAgvServiceImpl implements MagicAgvService { ModbusInspectSiteDeviceDriver driver = (ModbusInspectSiteDeviceDriver) addressdevice.getDeviceDriver(); //请求取货 if ("Load".equals(action)) { + log.info("driver.getTo_command():" + driver.getTo_command()); + log.info("driver.getAction():" + driver.getAction()); + //请求进入 if (driver.getTo_command() == 1) { + // 1允许进入 if (driver.getAction() == 1) { + log.info("111:"+addressdevice.getExtraValue().get("inspect_in_stocck")); + //是否判断光电 if ("1".equals(addressdevice.getExtraValue().get("inspect_in_stocck"))) { if (driver.getMove() == 1) { - if (driver.getTo_command() == 2) { - inst.setExecute_status("1"); - is_feedback = true; - } else { - driver.writing(2); - } - } - } else { - if (driver.getTo_command() == 2) { + driver.writing(2); + log.info("下发to_command:2"); inst.setExecute_status("1"); is_feedback = true; - } else { - driver.writing(2); } + } else { + driver.writing(2); + log.info("下发to_command:2"); + inst.setExecute_status("1"); + is_feedback = true; } } } else { + log.info("当前to_command:" + driver.getTo_command() + ",下发to_command:1"); driver.writing(1); } //请求放货 } else if ("Unload".equals(action)) { if (driver.getTo_command() == 1) { if (driver.getAction() == 1) { + log.info("111:"+addressdevice.getExtraValue().get("inspect_in_stocck")); if ("1".equals(addressdevice.getExtraValue().get("inspect_in_stocck"))) { if (driver.getMove() == 0) { - if (driver.getTo_command() == 2) { - inst.setExecute_status("3"); - is_feedback = true; - } else { - driver.writing(2); - } - } - } else { - if (driver.getTo_command() == 2) { + driver.writing(2); inst.setExecute_status("3"); is_feedback = true; - } else { - driver.writing(2); } + } else { + driver.writing(2); + inst.setExecute_status("3"); + is_feedback = true; } } } else { + log.info("当前to_command:" + driver.getTo_command() + ",下发to_command:1"); driver.writing(1); } } @@ -483,7 +482,6 @@ public class MagicAgvServiceImpl implements MagicAgvService { } //取放货完成 } else if ("onStation".equals(type)) { - if (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) { //取货完成 if ("Load".equals(action)) { @@ -576,6 +574,7 @@ public class MagicAgvServiceImpl implements MagicAgvService { } else if (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) { ModbusInspectSiteDeviceDriver driver = (ModbusInspectSiteDeviceDriver) addressdevice.getDeviceDriver(); driver.writing(3); + log.info("AGV请求离开,to_command:{}", driver.getTo_command()); flag = true; } else { flag = true; diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/inspect_site/modbus_inspect_site/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/inspect_site/modbus_inspect_site/ItemProtocol.java index 90b70ab..f7f01b6 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/inspect_site/modbus_inspect_site/ItemProtocol.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/inspect_site/modbus_inspect_site/ItemProtocol.java @@ -63,7 +63,6 @@ public class ItemProtocol { list.add(new ItemDto(item_heartbeat, "心跳", "40004")); list.add(new ItemDto(item_move, "光电开关信号", "40002")); list.add(new ItemDto(item_action, "取放信号", "40001")); - list.add(new ItemDto(item_to_command, "作业命令", "40006")); return list; } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index 907b45f..459edf4 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -855,15 +855,17 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { String url = wmsUrl + methods_url; HttpResponse result = null; log.info("feedbackAgv----请求参数{}", from); + log.info("feedbackAgv----请求url{}", url); try { result = HttpRequest.post(url) .body(String.valueOf(from)) .execute(); - System.out.println(result); - log.info("feedbackAgv----返回参数{}", result); + System.out.println(result.body()); + log.info("feedbackAgv----返回参数{}", result.body()); } catch (Exception e) { String msg = e.getMessage(); + log.info("feedbackAgv----异常返回参数{}", result.body()); //网络不通 System.out.println(msg); } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 27aa397..fbc926e 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -42,6 +42,7 @@ import org.nl.utils.SpringContextHolder; import org.nl.wql.WQL; import org.nl.wql.core.bean.WQLObject; import org.nl.wql.util.WqlUtil; +import org.springframework.context.annotation.Lazy; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -68,6 +69,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu private final AcsConfigService acsConfigService; private final RouteLineService routeLineService; + @Lazy private final TaskService taskService; diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index 453a2d7..1e2fb1b 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -46,6 +46,7 @@ import org.nl.wql.WQL; import org.nl.wql.core.bean.WQLObject; import org.nl.wql.util.WqlUtil; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -65,6 +66,7 @@ import java.util.regex.Pattern; @Service @RequiredArgsConstructor @Slf4j + public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { List tasks = new ArrayList(); @@ -84,6 +86,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { private final DeviceAssignedService deviceAssignedService; @Autowired + @Lazy private InstructionService instructionService; private final StorageCellService storageCellService; diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryMagicAgvDeviceStatus.java b/acs/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryMagicAgvDeviceStatus.java index 3cd15df..1373e80 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryMagicAgvDeviceStatus.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryMagicAgvDeviceStatus.java @@ -17,7 +17,7 @@ import org.springframework.stereotype.Component; * 查询AGV设备状态 */ @Slf4j -@Component("queryMagicAgvDeviceStatus") +@Component public class QueryMagicAgvDeviceStatus { @Autowired @@ -27,8 +27,7 @@ public class QueryMagicAgvDeviceStatus { AgvService agvService; - public void run() throws Exception { - HttpResponse response = agvService.queryMagicAgvDeviceStatus(); + public void run() throws Exception { HttpResponse response = agvService.queryMagicAgvDeviceStatus(); } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/ToAgvDevice.java b/acs/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/ToAgvDevice.java index 72af367..b4644a9 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/ToAgvDevice.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/ToAgvDevice.java @@ -15,7 +15,7 @@ import org.springframework.stereotype.Component; import java.util.Map; /** - * 查询AGV设备状态 + * 反馈AGV设备信息 */ @Slf4j @Component @@ -31,9 +31,10 @@ public class ToAgvDevice { Map agv_map = agvService.findAllAgvFromCache(); JSONArray agv_rows = new JSONArray(); - JSONObject row = new JSONObject(); + for (AgvDto agvDto : agv_map.values()) { + JSONObject row = new JSONObject(); row.put("device_code", agvDto.getName()); row.put("energyLevel", agvDto.getEnergyLevel()); if (agvDto.getState().equals("UNKNOWN")) { diff --git a/acs/hd/nladmin-system/src/main/resources/log/AcsToWms.xml b/acs/hd/nladmin-system/src/main/resources/log/AcsToWms.xml index 690ae29..fb101c1 100644 --- a/acs/hd/nladmin-system/src/main/resources/log/AcsToWms.xml +++ b/acs/hd/nladmin-system/src/main/resources/log/AcsToWms.xml @@ -3,7 +3,7 @@ - + ${LOG_HOME}/ACS请求WMS/%d{yyyy-MM-dd}.%i.log @@ -26,7 +26,7 @@ --> - - + + diff --git a/acs/hd/nladmin-system/src/main/resources/log/MagicAgvServiceImpl.xml b/acs/hd/nladmin-system/src/main/resources/log/MagicAgvServiceImpl.xml index 2a7b829..cbfd700 100644 --- a/acs/hd/nladmin-system/src/main/resources/log/MagicAgvServiceImpl.xml +++ b/acs/hd/nladmin-system/src/main/resources/log/MagicAgvServiceImpl.xml @@ -3,10 +3,10 @@ - + - ${LOG_HOME}/查询agv状态/%d{yyyy-MM-dd}.%i.log + ${LOG_HOME}/查询AGV设备状态/%d{yyyy-MM-dd}.%i.log 15 @@ -26,7 +26,7 @@ --> - - + + diff --git a/acs/hd/nladmin-system/src/main/resources/log/QueryAgvTaskStatus.xml b/acs/hd/nladmin-system/src/main/resources/log/QueryAgvTaskStatus.xml index 53bbd12..de25cd3 100644 --- a/acs/hd/nladmin-system/src/main/resources/log/QueryAgvTaskStatus.xml +++ b/acs/hd/nladmin-system/src/main/resources/log/QueryAgvTaskStatus.xml @@ -3,10 +3,10 @@ - + - ${LOG_HOME}/查询agv任务状态/%d{yyyy-MM-dd}.%i.log + ${LOG_HOME}/查询AGV任务状态/%d{yyyy-MM-dd}.%i.log 15 @@ -26,7 +26,7 @@ --> - - + + 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 1769485..48625fc 100644 --- a/acs/hd/nladmin-system/src/main/resources/logback-spring.xml +++ b/acs/hd/nladmin-system/src/main/resources/logback-spring.xml @@ -22,6 +22,7 @@ https://juejin.cn/post/6844903775631572999 + ${log.pattern} @@ -70,6 +71,7 @@ https://juejin.cn/post/6844903775631572999 + @@ -106,3 +108,4 @@ https://juejin.cn/post/6844903775631572999 +