Browse Source

rev:反馈wms参数字段修改

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

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

@ -184,7 +184,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.getInteger("status") == 200) {
if (resp.getJSONObject("payload").getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs请求wms取货申请成功,wms允许agv申请取货,已反馈agv允许取货", inst.getInstruction_code());
} else {
@ -249,7 +249,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.getInteger("status") == 200) {
if (resp.getJSONObject("payload").getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs反馈wms取货完成离开成功,wms允许agv取货完成离开,已反馈agv取货完成离开", inst.getInstruction_code());
} else {
@ -311,7 +311,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.getInteger("status") == 200) {
if (resp.getJSONObject("payload").getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code());
} else {
@ -374,7 +374,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.getInteger("status") == 200) {
if (resp.getJSONObject("payload").getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs请求wms放货完成申请成功,wms允许agv放货完成,已反馈agv放货完成", inst.getInstruction_code());
} else {

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

@ -42,9 +42,9 @@ public class AcsToWmsController {
@PostMapping("/taskStatusFeedback")
@Log(value = "ACS向WMS反馈任务状态", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
@ApiOperation("ACS向WMS反馈任务状态")
public ResponseEntity<Object> feedbackTaskStatusToWms(@RequestBody Map whereJson) {
JSONArray data = JSONArray.parseArray(String.valueOf(whereJson));
return new ResponseEntity<>(acstowmsService.feedbackTaskStatusToWms(data), HttpStatus.OK);
@SaIgnore
public ResponseEntity<Object> feedbackTaskStatusToWms(@RequestBody JSONArray form) {
return new ResponseEntity<>(acstowmsService.feedbackTaskStatusToWms(form), HttpStatus.OK);
}
@PostMapping("/feedbackAgvStatus")

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

@ -16,15 +16,14 @@ import org.nl.acs.device.address.service.dto.AddressDto;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.ext.wms.data.*;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.system.service.ParamService;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@Service
@ -92,23 +91,25 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public HttpResponse feedbackTaskStatusToWms(JSONArray data) {
try {
MDC.put(log_file_type, log_type);
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
log.info("开始反馈wms任务状态,请求参数:{}", JSON.toJSONString(data));
if (!redisUtils.hasKey("wms_token")) {
if (redisUtils.getExpire("wms_token") == -1) {
this.getTokenFromWms();
}
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
HttpResponse result = null;
AddressDto addressDto = addressService.findByCode("feedbackTaskStatusToWms");
String methods_url = addressDto.getMethods_url();
Map<String, Object> map = new HashMap<>();
map.put("payload", JSON.toJSONString(data));
try {
result = HttpRequest
.post(wmsurl + methods_url)
.header("Content-Type", "application/json;charset=UTF-8")
.header("Authorization", String.valueOf(redisUtils.get("wms_token")))
.body(JSON.toJSONString(data))
.body(JSON.toJSONString(map))
.execute();
log.info("反馈wms任务状态成功,请求路径:{},请求参数:{}", wmsurl + methods_url, JSON.toJSONString(data));
} catch (Exception e) {
@ -548,13 +549,19 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public HttpResponse feedAgvTaskStatus(JSONArray from) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
log.info("开始反馈WMS AGV取放货状态,请求参数:{}", from);
if (redisUtils.getExpire("wms_token") == -1) {
this.getTokenFromWms();
}
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("feedAgvTaskStatus");
String methods_url = addressDto.getMethods_url();
String url = wmsUrl + methods_url;
HttpResponse result = null;
Map<String, Object> map = new HashMap<>();
map.put("payload", JSON.toJSONString(from));
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))
.execute();
@ -569,7 +576,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public HttpResponse test(JSONObject form) {
if (!redisUtils.hasKey("wms_token")) {
if (redisUtils.getExpire("wms_token") == -1) {
this.getTokenFromWms();
}
String url = "https://zoneda.onestep-cloud.com/lwmss/v1/41/chsv-unqualified-products/execute-inspection-ng";

Loading…
Cancel
Save