|
|
@ -223,11 +223,13 @@ public class AcsToWmsZDServiceImpl implements AcsToWmsZDService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> checkDeviceStatus(Map whereJson) throws Exception { |
|
|
|
public Map<String, Object> checkDeviceStatus(Map whereJson) { |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
String systemCode = MapUtil.getStr(whereJson, "systemCode"); |
|
|
|
String houseCode = MapUtil.getStr(whereJson, "houseCode"); |
|
|
|
String parameters = MapUtil.getStr(whereJson, "parameters"); |
|
|
|
HttpResponse result = null; |
|
|
|
AddressDto addressDto = addressService.findByCode("checkDeviceStatus"); |
|
|
|
String wcsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WCSURL); |
|
|
|
String methods_url = addressDto.getMethods_url(); |
|
|
|
String url = wcsurl + methods_url; |
|
|
|
String deviceCode = MapUtil.getStr(whereJson, "deviceCode"); |
|
|
|
if (StrUtil.isEmpty(deviceCode)) { |
|
|
|
map.put("responseCode", 1); |
|
|
@ -235,31 +237,20 @@ public class AcsToWmsZDServiceImpl implements AcsToWmsZDService { |
|
|
|
map.put("parameters", new HashMap<>()); |
|
|
|
return map; |
|
|
|
} |
|
|
|
Device device = deviceAppService.findDeviceByCode(deviceCode); |
|
|
|
StandardConveyorLineDeviceDriver standardConveyorLineDeviceDriver; |
|
|
|
int status = 0; |
|
|
|
Boolean hasGoods = false; |
|
|
|
String statusDescription = "正常"; |
|
|
|
if (device.getDeviceDriver() instanceof StandardConveyorLineDeviceDriver) { |
|
|
|
standardConveyorLineDeviceDriver = (StandardConveyorLineDeviceDriver) device.getDeviceDriver(); |
|
|
|
status = standardConveyorLineDeviceDriver.getError(); |
|
|
|
int move = standardConveyorLineDeviceDriver.getMove(); |
|
|
|
if (status != 0) { |
|
|
|
statusDescription = "异常"; |
|
|
|
} |
|
|
|
if (move == 1) { |
|
|
|
hasGoods = true; |
|
|
|
} |
|
|
|
} else if (1 == 1) { |
|
|
|
|
|
|
|
try { |
|
|
|
result = HttpRequest.post(url) |
|
|
|
.header("Authorization", token).body(String.valueOf(whereJson)) |
|
|
|
.execute(); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
logServer.log(deviceCode, "checkDeviceStatus", "error", whereJson.toString(), e.getMessage(), String.valueOf(result.getStatus()), url, ""); |
|
|
|
map.put("responseCode", 1); |
|
|
|
map.put("responseMessage", e.getMessage()); |
|
|
|
return map; |
|
|
|
} |
|
|
|
map.put("responseCode", 0); |
|
|
|
map.put("responseMessage", "响应成功!"); |
|
|
|
map.put("parameters", new HashMap<>()); |
|
|
|
map.put("status", status); |
|
|
|
map.put("statusDescription", statusDescription); |
|
|
|
map.put("hasGoods", hasGoods); |
|
|
|
return map; |
|
|
|
JSONObject jo = JSONObject.fromObject(result.body()); |
|
|
|
log.info("checkDeviceStatus-----输出参数{}", jo.toString()); |
|
|
|
return jo; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|