rev:解决联调出现的问题
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package org.nl.acs.auto.run;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
@@ -188,10 +191,56 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
|
||||
} else if (phase == 0x50) {//进入区域
|
||||
agvaddr = arr[18] * 256 + arr[19];
|
||||
String device_code1 = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (ObjectUtil.isEmpty(device_code1)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
logServer.deviceExecuteLog(device_code1, "", "", agvaddr + "对应设备号为空");
|
||||
return;
|
||||
}
|
||||
JSONArray req = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("status", "5");
|
||||
map.put("device_code", device_code1);
|
||||
map.put("vehicle_code", "");
|
||||
map.put("task_code", "");
|
||||
req.add(map);
|
||||
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
logServer.deviceExecuteLog(device_code1, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
} else {
|
||||
log.error("请求开门失败,详细原因请查看acs请求wms日志");
|
||||
// log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
|
||||
}
|
||||
} else if (phase == 0x51) {//离开区域
|
||||
agvaddr = arr[18] * 256 + arr[19];
|
||||
String device_code2 = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (ObjectUtil.isEmpty(device_code2)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
logServer.deviceExecuteLog(device_code2, "", "", agvaddr + "对应设备号为空");
|
||||
return;
|
||||
}
|
||||
JSONArray req = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("status", "6");
|
||||
map.put("device_code", device_code2);
|
||||
map.put("vehicle_code", "");
|
||||
map.put("task_code", "");
|
||||
req.add(map);
|
||||
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
logServer.deviceExecuteLog(device_code2, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
} else {
|
||||
log.error("请求关门失败,详细原因请查看acs请求wms日志");
|
||||
//log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
|
||||
}
|
||||
} else {
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
if (phase == 0x67 || phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74 || phase == 0x50 || phase == 0x51 ) {
|
||||
if (phase == 0x67 || phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74) {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[18] * 256 + arr[19]));
|
||||
} else {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));
|
||||
|
||||
@@ -381,51 +381,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
agvaddr_copy = agvaddr;
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
} else if (phase == 0x50) {//进入区域
|
||||
agvaddr = arr[18] * 256 + arr[19];
|
||||
String device_code1 = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (ObjectUtil.isEmpty(device_code1)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空");
|
||||
return;
|
||||
}
|
||||
JSONArray req = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("status", "5");
|
||||
map.put("device_code", device_code1);
|
||||
map.put("vehicle_code", "");
|
||||
map.put("task_code", "");
|
||||
req.add(map);
|
||||
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
} else {
|
||||
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
|
||||
}
|
||||
} else if (phase == 0x51) {//离开区域
|
||||
agvaddr = arr[18] * 256 + arr[19];
|
||||
String device_code2 = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (ObjectUtil.isEmpty(device_code2)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空");
|
||||
return;
|
||||
}
|
||||
JSONArray req = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("status", "6");
|
||||
map.put("device_code", device_code2);
|
||||
map.put("vehicle_code", "");
|
||||
map.put("task_code", "");
|
||||
req.add(map);
|
||||
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
} else {
|
||||
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
|
||||
}
|
||||
} else if (phase == 0x67) {//agv异常
|
||||
} else if (phase == 0x67) {//agv异常
|
||||
if (ikey == 0) {
|
||||
this.setErrorInfo(ikey, "0", "正常");
|
||||
} else {
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.nl.acs.ext.wms.data.CreateTaskResponse;
|
||||
import org.nl.acs.ext.wms.service.WmsToAcsService;
|
||||
import org.nl.modules.logging.InterfaceLogType;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -33,7 +34,8 @@ import java.util.List;
|
||||
@RequestMapping("/api/wms")
|
||||
@Slf4j
|
||||
public class WmsToAcsController {
|
||||
private final WmsToAcsService wmstoacsService;
|
||||
@Autowired
|
||||
private WmsToAcsService wmstoacsService;
|
||||
|
||||
@PostMapping("/task")
|
||||
@Log(value = "ACS接收WMS任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
|
||||
|
||||
@@ -47,8 +47,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
/*@Value("${acsTowms.token}")*/
|
||||
public String token;
|
||||
|
||||
private String log_file_type="log_file_type";
|
||||
private String log_type="ACS请求LMS";
|
||||
private String log_file_type = "log_file_type";
|
||||
private String log_type = "ACS请求LMS";
|
||||
|
||||
@Override
|
||||
public String applyTaskToWms(JSONObject jo) {
|
||||
@@ -71,7 +71,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
//网络不通
|
||||
// //System.out.println(msg);
|
||||
}
|
||||
if(ObjectUtil.isEmpty(result2)){
|
||||
if (ObjectUtil.isEmpty(result2)) {
|
||||
log.info("applyTaskToWms-----输出参数{}", "返回结果为空");
|
||||
return null;
|
||||
}
|
||||
@@ -113,6 +113,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
try {
|
||||
result2 = HttpRequest.post(wmsurl + methods_url)
|
||||
.header("Authorization", token).body(String.valueOf(data))
|
||||
.timeout(10000)
|
||||
.execute();
|
||||
// //System.out.println(result2);
|
||||
} catch (Exception e) {
|
||||
@@ -472,7 +473,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public UpdateLKTaskResponse updateLKTaskRequest(UpdateLKTaskRequest param) {
|
||||
try {
|
||||
@@ -543,6 +543,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
try {
|
||||
result = HttpRequest.post(url)
|
||||
.body(String.valueOf(from))
|
||||
.timeout(10000)
|
||||
.execute();
|
||||
System.out.println(result);
|
||||
JSONObject jo = JSONObject.parseObject(result.body());
|
||||
@@ -551,6 +552,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
//System.out.println(msg);
|
||||
log.info("feedAgvTaskStatus----返回参数{}", e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.exception.WDKException;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -52,8 +53,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
private final InstructionService InstructionService;
|
||||
private final TaskService taskService;
|
||||
@Autowired
|
||||
private InstructionService InstructionService;
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
private final DeviceService deviceService;
|
||||
private final DeviceAppService deviceAppService;
|
||||
private final RouteLineService routeLineService;
|
||||
|
||||
@@ -79,7 +79,9 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
@Autowired
|
||||
RouteLineService routeLineService;
|
||||
|
||||
private final TaskService taskService;
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
|
||||
@Autowired
|
||||
AcsToLiKuService acsToLiKuService;
|
||||
|
||||
@@ -363,7 +365,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
if (ObjectUtil.isEmpty(route)) {
|
||||
throw new BadRequestException("未查询到相关路由!");
|
||||
}
|
||||
if (StrUtil.equals(shortPathsList.get(0).getType(), "2")) {
|
||||
if (!StrUtil.equals(shortPathsList.get(0).getType(), "2")) {
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ spring:
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:huNanHunYuan_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:hunanhunyuan_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:hnhs_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
username: ${DB_USER:root}
|
||||
# password: ${DB_PWD:P@ssw0rd}
|
||||
# password: ${DB_PWD:Root.123456}
|
||||
|
||||
Reference in New Issue
Block a user