Browse Source

更新

master
周俊杰 1 year ago
parent
commit
2e8f5d94f5
  1. 1
      acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java
  2. 33
      acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/MagicAgvServiceImpl.java
  3. 1
      acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/inspect_site/modbus_inspect_site/ItemProtocol.java
  4. 6
      acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java
  5. 2
      acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  6. 3
      acs/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
  7. 5
      acs/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryMagicAgvDeviceStatus.java
  8. 5
      acs/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/ToAgvDevice.java
  9. 6
      acs/hd/nladmin-system/src/main/resources/log/AcsToWms.xml
  10. 8
      acs/hd/nladmin-system/src/main/resources/log/MagicAgvServiceImpl.xml
  11. 8
      acs/hd/nladmin-system/src/main/resources/log/QueryAgvTaskStatus.xml
  12. 3
      acs/hd/nladmin-system/src/main/resources/logback-spring.xml

1
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 @Override
public HttpResponse queryMagicAgvDeviceStatus() { public HttpResponse queryMagicAgvDeviceStatus() {
log.info("查询agv状态数据-----------------");
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) { if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) {
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL); String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT); String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);

33
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(); ModbusInspectSiteDeviceDriver driver = (ModbusInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
//请求取货 //请求取货
if ("Load".equals(action)) { if ("Load".equals(action)) {
log.info("driver.getTo_command():" + driver.getTo_command());
log.info("driver.getAction():" + driver.getAction());
//请求进入
if (driver.getTo_command() == 1) { if (driver.getTo_command() == 1) {
// 1允许进入
if (driver.getAction() == 1) { if (driver.getAction() == 1) {
log.info("111:"+addressdevice.getExtraValue().get("inspect_in_stocck"));
//是否判断光电
if ("1".equals(addressdevice.getExtraValue().get("inspect_in_stocck"))) { if ("1".equals(addressdevice.getExtraValue().get("inspect_in_stocck"))) {
if (driver.getMove() == 1) { if (driver.getMove() == 1) {
if (driver.getTo_command() == 2) { driver.writing(2);
log.info("下发to_command:2");
inst.setExecute_status("1"); inst.setExecute_status("1");
is_feedback = true; is_feedback = true;
} else {
driver.writing(2);
}
} }
} else { } else {
if (driver.getTo_command() == 2) { driver.writing(2);
log.info("下发to_command:2");
inst.setExecute_status("1"); inst.setExecute_status("1");
is_feedback = true; is_feedback = true;
} else {
driver.writing(2);
}
} }
} }
} else { } else {
log.info("当前to_command:" + driver.getTo_command() + ",下发to_command:1");
driver.writing(1); driver.writing(1);
} }
//请求放货 //请求放货
} else if ("Unload".equals(action)) { } else if ("Unload".equals(action)) {
if (driver.getTo_command() == 1) { if (driver.getTo_command() == 1) {
if (driver.getAction() == 1) { if (driver.getAction() == 1) {
log.info("111:"+addressdevice.getExtraValue().get("inspect_in_stocck"));
if ("1".equals(addressdevice.getExtraValue().get("inspect_in_stocck"))) { if ("1".equals(addressdevice.getExtraValue().get("inspect_in_stocck"))) {
if (driver.getMove() == 0) { if (driver.getMove() == 0) {
if (driver.getTo_command() == 2) { driver.writing(2);
inst.setExecute_status("3"); inst.setExecute_status("3");
is_feedback = true; is_feedback = true;
} else {
driver.writing(2);
}
} }
} else { } else {
if (driver.getTo_command() == 2) { driver.writing(2);
inst.setExecute_status("3"); inst.setExecute_status("3");
is_feedback = true; is_feedback = true;
} else {
driver.writing(2);
}
} }
} }
} else { } else {
log.info("当前to_command:" + driver.getTo_command() + ",下发to_command:1");
driver.writing(1); driver.writing(1);
} }
} }
@ -483,7 +482,6 @@ public class MagicAgvServiceImpl implements MagicAgvService {
} }
//取放货完成 //取放货完成
} else if ("onStation".equals(type)) { } else if ("onStation".equals(type)) {
if (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) { if (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) {
//取货完成 //取货完成
if ("Load".equals(action)) { if ("Load".equals(action)) {
@ -576,6 +574,7 @@ public class MagicAgvServiceImpl implements MagicAgvService {
} else if (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) { } else if (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) {
ModbusInspectSiteDeviceDriver driver = (ModbusInspectSiteDeviceDriver) addressdevice.getDeviceDriver(); ModbusInspectSiteDeviceDriver driver = (ModbusInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
driver.writing(3); driver.writing(3);
log.info("AGV请求离开,to_command:{}", driver.getTo_command());
flag = true; flag = true;
} else { } else {
flag = true; flag = true;

1
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_heartbeat, "心跳", "40004"));
list.add(new ItemDto(item_move, "光电开关信号", "40002")); list.add(new ItemDto(item_move, "光电开关信号", "40002"));
list.add(new ItemDto(item_action, "取放信号", "40001")); list.add(new ItemDto(item_action, "取放信号", "40001"));
list.add(new ItemDto(item_to_command, "作业命令", "40006"));
return list; return list;
} }

6
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; String url = wmsUrl + methods_url;
HttpResponse result = null; HttpResponse result = null;
log.info("feedbackAgv----请求参数{}", from); log.info("feedbackAgv----请求参数{}", from);
log.info("feedbackAgv----请求url{}", url);
try { try {
result = HttpRequest.post(url) result = HttpRequest.post(url)
.body(String.valueOf(from)) .body(String.valueOf(from))
.execute(); .execute();
System.out.println(result); System.out.println(result.body());
log.info("feedbackAgv----返回参数{}", result); log.info("feedbackAgv----返回参数{}", result.body());
} catch (Exception e) { } catch (Exception e) {
String msg = e.getMessage(); String msg = e.getMessage();
log.info("feedbackAgv----异常返回参数{}", result.body());
//网络不通 //网络不通
System.out.println(msg); System.out.println(msg);
} }

2
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.WQL;
import org.nl.wql.core.bean.WQLObject; import org.nl.wql.core.bean.WQLObject;
import org.nl.wql.util.WqlUtil; import org.nl.wql.util.WqlUtil;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -68,6 +69,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
private final AcsConfigService acsConfigService; private final AcsConfigService acsConfigService;
private final RouteLineService routeLineService; private final RouteLineService routeLineService;
@Lazy
private final TaskService taskService; private final TaskService taskService;

3
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.core.bean.WQLObject;
import org.nl.wql.util.WqlUtil; import org.nl.wql.util.WqlUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -65,6 +66,7 @@ import java.util.regex.Pattern;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
List<TaskDto> tasks = new ArrayList(); List<TaskDto> tasks = new ArrayList();
@ -84,6 +86,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
private final DeviceAssignedService deviceAssignedService; private final DeviceAssignedService deviceAssignedService;
@Autowired @Autowired
@Lazy
private InstructionService instructionService; private InstructionService instructionService;
private final StorageCellService storageCellService; private final StorageCellService storageCellService;

5
acs/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryMagicAgvDeviceStatus.java

@ -17,7 +17,7 @@ import org.springframework.stereotype.Component;
* 查询AGV设备状态 * 查询AGV设备状态
*/ */
@Slf4j @Slf4j
@Component("queryMagicAgvDeviceStatus") @Component
public class QueryMagicAgvDeviceStatus { public class QueryMagicAgvDeviceStatus {
@Autowired @Autowired
@ -27,8 +27,7 @@ public class QueryMagicAgvDeviceStatus {
AgvService agvService; AgvService agvService;
public void run() throws Exception { public void run() throws Exception { HttpResponse response = agvService.queryMagicAgvDeviceStatus();
HttpResponse response = agvService.queryMagicAgvDeviceStatus();
} }

5
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; import java.util.Map;
/** /**
* 查询AGV设备状态 * 反馈AGV设备信息
*/ */
@Slf4j @Slf4j
@Component @Component
@ -31,9 +31,10 @@ public class ToAgvDevice {
Map<String, AgvDto> agv_map = agvService.findAllAgvFromCache(); Map<String, AgvDto> agv_map = agvService.findAllAgvFromCache();
JSONArray agv_rows = new JSONArray(); JSONArray agv_rows = new JSONArray();
JSONObject row = new JSONObject();
for (AgvDto agvDto : agv_map.values()) { for (AgvDto agvDto : agv_map.values()) {
JSONObject row = new JSONObject();
row.put("device_code", agvDto.getName()); row.put("device_code", agvDto.getName());
row.put("energyLevel", agvDto.getEnergyLevel()); row.put("energyLevel", agvDto.getEnergyLevel());
if (agvDto.getState().equals("UNKNOWN")) { if (agvDto.getState().equals("UNKNOWN")) {

6
acs/hd/nladmin-system/src/main/resources/log/AcsToWms.xml

@ -3,7 +3,7 @@
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> <springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/> <property name="LOG_HOME" value="${logPath}"/>
<!-- 按照每天生成日志文件 --> <!-- 按照每天生成日志文件 -->
<appender name="FILEACSTOWMS" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="FILEAcsToWmsServiceImpl" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名--> <!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/ACS请求WMS/%d{yyyy-MM-dd}.%i.log</FileNamePattern> <FileNamePattern>${LOG_HOME}/ACS请求WMS/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
@ -26,7 +26,7 @@
</logger>--> </logger>-->
<!-- 打印sql --> <!-- 打印sql -->
<logger name="org.nl.acs.agv.server.impl.AgvServiceImpl" level="info" additivity="false"> <logger name="org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl" level="info" additivity="false">
<appender-ref ref="FILEACSTOWMS"/> <appender-ref ref="FILEAcsToWmsServiceImpl"/>
</logger> </logger>
</included> </included>

8
acs/hd/nladmin-system/src/main/resources/log/MagicAgvServiceImpl.xml

@ -3,10 +3,10 @@
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> <springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/> <property name="LOG_HOME" value="${logPath}"/>
<!-- 按照每天生成日志文件 --> <!-- 按照每天生成日志文件 -->
<appender name="FILEMagicAgvServiceImpl" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="FILEAgvServiceImpl" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名--> <!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/查询agv状态/%d{yyyy-MM-dd}.%i.log</FileNamePattern> <FileNamePattern>${LOG_HOME}/查询AGV设备状态/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数--> <!--日志文件保留天数-->
<maxHistory>15</maxHistory> <maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来--> <!--单个日志最大容量 至少10MB才能看得出来-->
@ -26,7 +26,7 @@
</logger>--> </logger>-->
<!-- 打印sql --> <!-- 打印sql -->
<logger name="package org.nl.acs.agv.server.impl.MagicAgvServiceImpl" level="info" additivity="false"> <logger name="org.nl.acs.agv.server.impl.AgvServiceImpl" level="info" additivity="false">
<appender-ref ref="FILEMagicAgvServiceImpl"/> <appender-ref ref="FILEAgvServiceImpl"/>
</logger> </logger>
</included> </included>

8
acs/hd/nladmin-system/src/main/resources/log/QueryAgvTaskStatus.xml

@ -3,10 +3,10 @@
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/> <springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/> <property name="LOG_HOME" value="${logPath}"/>
<!-- 按照每天生成日志文件 --> <!-- 按照每天生成日志文件 -->
<appender name="FILEQueryMagicAgvTaskStatus" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="FILEMagicAgvServiceImpl" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名--> <!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/查询agv任务状态/%d{yyyy-MM-dd}.%i.log</FileNamePattern> <FileNamePattern>${LOG_HOME}/查询AGV任务状态/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数--> <!--日志文件保留天数-->
<maxHistory>15</maxHistory> <maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来--> <!--单个日志最大容量 至少10MB才能看得出来-->
@ -26,7 +26,7 @@
</logger>--> </logger>-->
<!-- 打印sql --> <!-- 打印sql -->
<logger name="package org.nl.modules.quartz.task.QueryMagicAgvTaskStatus" level="info" additivity="false"> <logger name="org.nl.acs.agv.server.impl.MagicAgvServiceImpl" level="info" additivity="false">
<appender-ref ref="FILEQueryMagicAgvTaskStatus"/> <appender-ref ref="FILEMagicAgvServiceImpl"/>
</logger> </logger>
</included> </included>

3
acs/hd/nladmin-system/src/main/resources/logback-spring.xml

@ -22,6 +22,7 @@ https://juejin.cn/post/6844903775631572999
<include resource="log/AcsToWms.xml"/> <include resource="log/AcsToWms.xml"/>
<include resource="log/QueryAgvTaskStatus.xml"/> <include resource="log/QueryAgvTaskStatus.xml"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
@ -70,6 +71,7 @@ https://juejin.cn/post/6844903775631572999
<springProfile name="dev"> <springProfile name="dev">
<root level="info"> <root level="info">
<appender-ref ref="CONSOLE"/> <appender-ref ref="CONSOLE"/>
<appender-ref ref="asyncFileAppender"/>
</root> </root>
<logger name="jdbc.audit" level="ERROR" additivity="false"> <logger name="jdbc.audit" level="ERROR" additivity="false">
@ -106,3 +108,4 @@ https://juejin.cn/post/6844903775631572999
</root> </root>
</springProfile> </springProfile>
</configuration> </configuration>

Loading…
Cancel
Save