Browse Source

rev:wms与acs接口

master
gengby 1 year ago
parent
commit
e3980f3063
  1. 24
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java
  2. 1
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java
  3. 14
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java

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

@ -34,10 +34,7 @@ import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString;
@ -100,9 +97,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
if (ikey != 0) {
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
// if (ObjectUtil.isEmpty(inst)) {
// inst = instructionService.findByCode(String.valueOf(ikey));
// }
}
if (!ObjectUtil.isEmpty(link_inst)) {
link_flag = true;
@ -121,14 +115,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
//普通站点
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
//货架
StandardStorageDeviceDriver standardStorageDeviceDriver;
//
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
//自动门
StandardAutoDoorDeviceDriver standardAutoDoorDeviceDriver;
//分配 车id
//(不需要WCS反馈)
@ -189,7 +175,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getJSONObject("payload").getInteger("status") == 200) {
if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs请求wms取货申请成功,wms允许agv申请取货,已反馈agv允许取货", inst.getInstruction_code());
} else {
@ -254,7 +240,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getJSONObject("payload").getInteger("status") == 200) {
if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs反馈wms取货完成离开成功,wms允许agv取货完成离开,已反馈agv取货完成离开", inst.getInstruction_code());
} else {
@ -316,7 +302,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getJSONObject("payload").getInteger("status") == 200) {
if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code());
} else {
@ -379,7 +365,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getJSONObject("payload").getInteger("status") == 200) {
if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs请求wms放货完成申请成功,wms允许agv放货完成,已反馈agv放货完成", inst.getInstruction_code());
} else {
@ -407,7 +393,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (!ObjectUtil.isEmpty(data)) {
phase = 0;
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data));
log.info("{},{}", device_code,"agvphase:" + phase + "反馈:" + Bytes2HexString(data));
log.info("{},{}", device_code, "agvphase:" + phase + "反馈:" + Bytes2HexString(data));
OneNDCSocketConnectionAutoRun.write(data);
}
}

1
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java

@ -18,7 +18,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @author ludj

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

@ -100,28 +100,21 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
MDC.put(log_file_type, log_type);
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
log.info("开始反馈wms任务状态,请求参数:{}", JSON.toJSONString(data));
this.getTokenFromWms();
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
HttpResponse result = null;
AddressDto addressDto = addressService.findByCode("feedbackTaskStatusToWms");
String methods_url = addressDto.getMethods_url();
String url = wmsurl + methods_url;
Map<String, Object> map = new HashMap<>();
map.put("payload", JSON.toJSONString(data));
try {
result = HttpRequest
.post(url)
.header("Content-Type", "application/json;charset=UTF-8")
.header("Authorization", String.valueOf(redisUtils.get("wms_token")))
.body(JSON.toJSONString(map))
.body(JSON.toJSONString(data))
.timeout(3000)
.execute();
log.info("反馈wms任务状态成功,请求路径:{},请求参数:{},响应参数:{}", url, JSON.toJSONString(map), JSON.toJSONString(result.body()));
log.info("反馈wms任务状态成功,请求路径:{},请求参数:{},响应参数:{}", url, JSON.toJSONString(data), JSON.toJSONString(result.body()));
} catch (Exception e) {
log.error("反馈wms任务状态失败,请求路径:{},失败原因:{}", url, e.getMessage());
CompletableFuture.runAsync(() -> {
retryableUtil.retryable(url, JSON.toJSONString(map));
});
}
return result;
}
@ -559,7 +552,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public HttpResponse feedAgvTaskStatus(JSONArray from) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
log.info("开始反馈WMS AGV取放货状态,请求参数:{}", from);
this.getTokenFromWms();
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("feedAgvTaskStatus");
String methods_url = addressDto.getMethods_url();
@ -570,7 +562,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
try {
result = HttpRequest.post(url)
.header("Content-Type", "application/json;charset=UTF-8")
.header("Authorization", String.valueOf(redisUtils.get("wms_token")))
.body(JSON.toJSONString(from))
.timeout(3000)
.execute();
@ -585,7 +576,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public JSONObject test(JSONObject form) {
this.getTokenFromWms();
String url = "https://zoneda.onestep-cloud.com/lwmss/v1/41/chsv-unqualified-products/execute-inspection-ng";
JSONObject resp = null;
try {

Loading…
Cancel
Save