Browse Source

rev:解决联调出现的问题

master
gengby 5 months ago
parent
commit
1f59e51472
  1. 51
      acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java
  2. 44
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java
  3. 4
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java
  4. 4
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java
  5. 7
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java
  6. 6
      acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  7. 2
      acs/nladmin-system/src/main/resources/config/application-prod.yml

51
acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java

@ -1,6 +1,9 @@
package org.nl.acs.auto.run; package org.nl.acs.auto.run;
import cn.hutool.core.util.ObjectUtil; 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 lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig; import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.agv.server.NDCAgvService;
@ -188,10 +191,56 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
} }
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); 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 { } else {
//上报异常信息 //上报异常信息
//(不需要WCS反馈) //(不需要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])); device = deviceAppService.findDeviceByCode(Integer.toString(arr[18] * 256 + arr[19]));
} else { } else {
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20])); device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));

44
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java

@ -381,50 +381,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
agvaddr_copy = agvaddr; agvaddr_copy = agvaddr;
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); 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) { if (ikey == 0) {
this.setErrorInfo(ikey, "0", "正常"); this.setErrorInfo(ikey, "0", "正常");

4
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java

@ -14,6 +14,7 @@ import org.nl.acs.ext.wms.data.CreateTaskResponse;
import org.nl.acs.ext.wms.service.WmsToAcsService; import org.nl.acs.ext.wms.service.WmsToAcsService;
import org.nl.modules.logging.InterfaceLogType; import org.nl.modules.logging.InterfaceLogType;
import org.nl.modules.logging.annotation.Log; import org.nl.modules.logging.annotation.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -33,7 +34,8 @@ import java.util.List;
@RequestMapping("/api/wms") @RequestMapping("/api/wms")
@Slf4j @Slf4j
public class WmsToAcsController { public class WmsToAcsController {
private final WmsToAcsService wmstoacsService; @Autowired
private WmsToAcsService wmstoacsService;
@PostMapping("/task") @PostMapping("/task")
@Log(value = "ACS接收WMS任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) @Log(value = "ACS接收WMS任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)

4
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java

@ -113,6 +113,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
try { try {
result2 = HttpRequest.post(wmsurl + methods_url) result2 = HttpRequest.post(wmsurl + methods_url)
.header("Authorization", token).body(String.valueOf(data)) .header("Authorization", token).body(String.valueOf(data))
.timeout(10000)
.execute(); .execute();
// //System.out.println(result2); // //System.out.println(result2);
} catch (Exception e) { } catch (Exception e) {
@ -472,7 +473,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} }
@Override @Override
public UpdateLKTaskResponse updateLKTaskRequest(UpdateLKTaskRequest param) { public UpdateLKTaskResponse updateLKTaskRequest(UpdateLKTaskRequest param) {
try { try {
@ -543,6 +543,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
try { try {
result = HttpRequest.post(url) result = HttpRequest.post(url)
.body(String.valueOf(from)) .body(String.valueOf(from))
.timeout(10000)
.execute(); .execute();
System.out.println(result); System.out.println(result);
JSONObject jo = JSONObject.parseObject(result.body()); JSONObject jo = JSONObject.parseObject(result.body());
@ -551,6 +552,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
String msg = e.getMessage(); String msg = e.getMessage();
//网络不通 //网络不通
//System.out.println(msg); //System.out.println(msg);
log.info("feedAgvTaskStatus----返回参数{}", e.getMessage());
} }
return result; return result;
} }

7
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java

@ -36,6 +36,7 @@ import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.exception.WDKException; import org.nl.modules.wql.exception.WDKException;
import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.SpringContextHolder;
import org.slf4j.MDC; import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -52,8 +53,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
private final ApplicationContext applicationContext; private final ApplicationContext applicationContext;
private final InstructionService InstructionService; @Autowired
private final TaskService taskService; private InstructionService InstructionService;
@Autowired
private TaskService taskService;
private final DeviceService deviceService; private final DeviceService deviceService;
private final DeviceAppService deviceAppService; private final DeviceAppService deviceAppService;
private final RouteLineService routeLineService; private final RouteLineService routeLineService;

6
acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java

@ -79,7 +79,9 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
@Autowired @Autowired
RouteLineService routeLineService; RouteLineService routeLineService;
private final TaskService taskService; @Autowired
private TaskService taskService;
@Autowired @Autowired
AcsToLiKuService acsToLiKuService; AcsToLiKuService acsToLiKuService;
@ -363,7 +365,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
if (ObjectUtil.isEmpty(route)) { if (ObjectUtil.isEmpty(route)) {
throw new BadRequestException("未查询到相关路由!"); 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 ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto); ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
} }

2
acs/nladmin-system/src/main/resources/config/application-prod.yml

@ -13,7 +13,7 @@ spring:
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy 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: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: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} username: ${DB_USER:root}
# password: ${DB_PWD:P@ssw0rd} # password: ${DB_PWD:P@ssw0rd}
# password: ${DB_PWD:Root.123456} # password: ${DB_PWD:Root.123456}

Loading…
Cancel
Save