This commit is contained in:
USER-20220102CG\noblelift
2022-09-19 08:47:27 +08:00
parent c5c0a5cda6
commit 3939c3f1e5
4 changed files with 24 additions and 42 deletions

View File

@@ -521,4 +521,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return result;
}
public static void main(String[] args) {
String str = "10001";
System.out.println(StrUtil.startWith(str, "-") );
}
}

View File

@@ -30,6 +30,7 @@ public class AcsToXRlkServiceImpl implements AcsToXrlkService {
@Autowired
AddressService addressService;
@Autowired
private final LogServer logServer;
@Override
@@ -61,14 +62,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);
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);
log.info("isPutPermission-----反馈"+ result);
System.out.println(result);
} catch (Exception e) {
String msg = e.getMessage();
@@ -109,19 +110,21 @@ public class AcsToXRlkServiceImpl implements AcsToXrlkService {
JSONObject jo = new JSONObject();
jo.put("station",device_code);
jo.put("type",type);
log.info("AGVWorkStatus-----请求参数{}", jo.toString());
log.info("AGVWorkStatus-----请求参数"+ jo.toString());
try {
//{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"}
result = HttpRequest.post(url).body(String.valueOf(jo))
.execute();
System.out.println(result);
log.info("AGVWorkStatus-----反馈{}", result);
log.info("AGVWorkStatus-----反馈"+ result);
} catch (Exception e) {
String msg = e.getMessage();
//网络不通
System.out.println(msg);
log.info("AGVWorkStatus-----反馈"+ msg);
}
return result;
}

View File

@@ -127,11 +127,11 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
bs.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp));
}
System.out.println("收到请求参数:" + bs);
// System.out.println("收到请求参数:" + bs);
boolean flag = false;
if (arr[8] * 256 + arr[9] == 0x73) {
byte[] data = null;
System.out.println("接收agv上报信息" + bs);
// System.out.println("接收agv上报信息" + bs);
//执行阶段
int phase = arr[16] * 256 + arr[17];
// agv任务号
@@ -830,7 +830,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
case 1:
TaskDto taskDto = taskService.findByCode(inst.getTask_code());
boolean tag = false;
if (!StrUtil.startWith(inst.getTask_code(), "-") || StrUtil.equals(taskDto.getTask_type(),"3")) {
if (StrUtil.startWith(inst.getTask_code(), "-") || StrUtil.equals(taskDto.getTask_type(),"3")) {
tag = true;
}
@@ -889,13 +889,16 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
HttpResponse response = acsToXrlkService.isTakePermission(device.getDevice_code());
if (response.getStatus() == 200) {
JSONObject jo = JSONObject.fromObject(response.body());
log.info("AGV请求取货设备" + jo.toString());
if (StrUtil.equals(jo.get("result").toString(), "1")) {
data = AgvService.sendAgvOneModeInst(phase, index, 0);
} else {
log.info("AGV请求取货设备{}立库WMS不允许取货", device_code);
log.info("AGV请求取货设备立库WMS不允许取货");
}
} else {
log.info("AGV请求取货设备{}接口请求立库WMS失败", device_code);
log.info("AGV请求取货设备立库WMS失败");
}
} else {
data = AgvService.sendAgvOneModeInst(phase, index, 0);
@@ -964,10 +967,12 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
HttpResponse response = acsToXrlkService.AGVWorkStatus(device.getDevice_code(), "2");
if (response.getStatus() == 200) {
JSONObject jo = JSONObject.fromObject(response.body());
log.info("AGV取货完成请求请求立库" + jo.toString());
if (StrUtil.equals(jo.get("result").toString(), "1")) {
log.info("AGV取货完成请求请求立库{}", jo.toString());
log.info("AGV取货完成请求请求立库成功");
data = AgvService.sendAgvOneModeInst(phase, index, 0);
} else {
log.info("AGV取货完成请求请求立库失败");
log.info("AGV取货完成反馈设备{},{}", device_code, jo.getString("message"));
}
} else {
@@ -975,6 +980,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
}
} else {
data = AgvService.sendAgvOneModeInst(phase, index, 0);
log.info("AGV取货完成不需要反馈立库");
}
}
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
@@ -3770,7 +3776,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
e.printStackTrace();
}
} else {
System.out.println("agv上报不是0073类型动作不处理");
// System.out.println("agv上报不是0073类型动作不处理");
}
}
@@ -3799,7 +3805,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
public static void write(byte[] b) {
try {
log.info("下发agv数据:" + Bytes2HexString(b));
System.out.println("下发agv数据:" + Bytes2HexString(b));
// System.out.println("下发agv数据:" + Bytes2HexString(b));
dos.write(b);
dos.flush();
} catch (IOException e) {

View File

@@ -1,32 +0,0 @@
<?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="FILE7" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/ACS请求ERP/%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.erp.service.impl.AcsToErpServiceImpl" level="info" additivity="false">
<appender-ref ref="FILE7"/>
</logger>
</included>