|
|
@ -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"; |
|
|
|