This commit is contained in:
USER-20220102CG\noblelift
2022-09-05 09:05:38 +08:00
parent 54086bea6f
commit 5735bb53ec
10 changed files with 65 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
# sh_wcs
# whxr_acs
#### Description
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}

View File

@@ -1,2 +1,2 @@
# sh_wcs
# whxr_acs

View File

@@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>sh_wcs</artifactId>
<artifactId>whxr_acs</artifactId>
<groupId>org.nl</groupId>
<version>1.0-SNAPSHOT</version>
</parent>

View File

@@ -43,7 +43,7 @@ public class StorageConveyorDefination implements DeviceDriverDefination {
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList();
types.add(DeviceType.storage);
types.add(DeviceType.conveyor);
return types;
}
}

View File

@@ -4,12 +4,15 @@ import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSON;
import net.sf.json.JSONObject;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.device.address.service.AddressService;
import org.nl.acs.device.address.service.dto.AddressDto;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.ext.xr_lk.service.AcsToXrlkService;
import org.nl.acs.log.service.LogServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -27,21 +30,27 @@ public class AcsToXRlkServiceImpl implements AcsToXrlkService {
@Autowired
AddressService addressService;
private final LogServer logServer;
@Override
public HttpResponse invokeDoor(String device_code) {
String wcsurl = acsConfigService.findConfigFromCache().get(AcsConfig.ERPURL);
AddressDto addressDto = addressService.findByCode("invokeDoor");
String url = wcsurl + addressDto.getMethods_url() + device_code;
HttpResponse result = null;
log.info("invokeDoor-----请求url{}",url);
try {
//{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"}
result = HttpRequest.get(url)
.execute();
log.info("invokeDoor-----反馈{}", result);
System.out.println(result);
} catch (Exception e) {
String msg = e.getMessage();
//网络不通
System.out.println(msg);
}
return result;
}
@@ -52,10 +61,14 @@ public class AcsToXRlkServiceImpl implements AcsToXrlkService {
AddressDto addressDto = addressService.findByCode("isPutPermission");
String url = wcsurl + addressDto.getMethods_url() + device_code;
HttpResponse result = null;
log.info("isPutPermission-----请求url{}",url);
try {
//{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"}
result = HttpRequest.get(url)
.execute();
log.info("isPutPermission-----反馈{}", result);
System.out.println(result);
} catch (Exception e) {
String msg = e.getMessage();
@@ -71,11 +84,14 @@ public class AcsToXRlkServiceImpl implements AcsToXrlkService {
AddressDto addressDto = addressService.findByCode("isTakePermission");
String url = wcsurl + addressDto.getMethods_url() + device_code;
HttpResponse result = null;
log.info("isTakePermission-----请求url{}",url);
try {
//{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"}
result = HttpRequest.get(url)
.execute();
System.out.println(result);
log.info("isTakePermission-----反馈{}", result);
} catch (Exception e) {
String msg = e.getMessage();
//网络不通
@@ -90,11 +106,18 @@ public class AcsToXRlkServiceImpl implements AcsToXrlkService {
AddressDto addressDto = addressService.findByCode("AGVWorkStatus");
String url = wcsurl + addressDto.getMethods_url();
HttpResponse result = null;
JSONObject jo = new JSONObject();
jo.put("station",device_code);
jo.put("type",type);
log.info("AGVWorkStatus-----请求参数{}", jo.toString());
try {
//{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"}
result = HttpRequest.get(url)
result = HttpRequest.post(url).body(String.valueOf(jo))
.execute();
System.out.println(result);
log.info("AGVWorkStatus-----反馈{}", result);
} catch (Exception e) {
String msg = e.getMessage();
//网络不通

View File

@@ -882,7 +882,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
HttpResponse response = acsToXrlkService.isTakePermission(device.getDevice_code());
if (response.getStatus() == 200) {
JSONObject jo = JSONObject.fromObject(response.body());
if (StrUtil.equals(jo.get("signal").toString(), "1")) {
if (StrUtil.equals(jo.get("result").toString(), "1")) {
data = AgvService.sendAgvOneModeInst(phase, index, 0);
} else {
log.info("AGV请求取货设备{}立库WMS不允许取货", device_code);
@@ -1103,7 +1103,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
HttpResponse response = acsToXrlkService.isPutPermission(device.getDevice_code());
if (response.getStatus() == 200) {
JSONObject jo = JSONObject.fromObject(response.body());
if (StrUtil.equals(jo.get("signal").toString(), "1")) {
if (StrUtil.equals(jo.get("result").toString(), "1")) {
data = AgvService.sendAgvOneModeInst(phase, index, 0);
} else {
log.info("AGV请求放货设备{}立库WMS不允许放货", device_code);

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE15" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/ACS请求立库WMS/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>200MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>2GB</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
<appender-ref ref="FILE3"/>
</logger>-->
<!-- 打印sql -->
<logger name="org.nl.acs.ext.wms.service.impl.AcsToXRlkServiceImpl" level="info" additivity="false">
<appender-ref ref="FILE15"/>
</logger>
</included>

View File

@@ -26,6 +26,7 @@ https://juejin.cn/post/6844903775631572999
<include resource="log/QueryXZAgvTaskStatus.xml"/>
<include resource="log/NDCSocketConnectionAutoRun.xml"/>
<include resource="log/ScannerBarcode.xml"/>
<include resource="log/AcsToLKWms.xml"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
@@ -66,7 +67,7 @@ https://juejin.cn/post/6844903775631572999
<!--生产环境:打印控制台和输出到文件-->
<springProfile name="prod">
<root level="error">
<root level="off">
<appender-ref ref="asyncFileAppender"/>
</root>

View File

@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.nl</groupId>
<artifactId>sh_wcs</artifactId>
<artifactId>whxr_acs</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>开发平台</name>

View File