| | |
| | | if (!agvLockMastService.updateById(locMast)) { |
| | | throw new CoolException("主库位修改失败"); |
| | | } else { |
| | | try { |
| | | if (locMast.getLocSts().equals("O")) { |
| | | HashMap<String, String> data = new HashMap<>(); |
| | | data.put("reqCode", System.currentTimeMillis() + ""); |
| | | data.put("podCode", barcode); |
| | | data.put("positionCode", locMast.getLocNo()); |
| | | data.put("indBind", "0"); |
| | | String response = ""; |
| | | boolean success = false; |
| | | int code = 0; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(url) |
| | | .setPath(locStsUrl) |
| | | .setTimeout(30, TimeUnit.SECONDS) |
| | | .setJson(JSONObject.toJSONString(data)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | code = Integer.parseInt(jsonObject.get("code").toString()); |
| | | if (code != 0) { |
| | | log.info("库位解绑AGV接口调用失败,返回信息:" + response); |
| | | } else { |
| | | success = true; |
| | | } |
| | | } catch (Exception e) { |
| | | throw new CoolException("调用AGV响应错误"); |
| | | } finally { |
| | | apiLogService.save( |
| | | "货架与位置解绑", |
| | | url + locStsUrl, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(data), |
| | | response, |
| | | success |
| | | ); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | // try { |
| | | // if (locMast.getLocSts().equals("O")) { |
| | | // HashMap<String, String> data = new HashMap<>(); |
| | | // data.put("reqCode", System.currentTimeMillis() + ""); |
| | | // data.put("podCode", barcode); |
| | | // data.put("positionCode", locMast.getLocNo()); |
| | | // data.put("indBind", "0"); |
| | | // String response = ""; |
| | | // boolean success = false; |
| | | // int code = 0; |
| | | // try { |
| | | // response = new HttpHandler.Builder() |
| | | // .setUri(url) |
| | | // .setPath(locStsUrl) |
| | | // .setTimeout(30, TimeUnit.SECONDS) |
| | | // .setJson(JSONObject.toJSONString(data)) |
| | | // .build() |
| | | // .doPost(); |
| | | // JSONObject jsonObject = JSON.parseObject(response); |
| | | // code = Integer.parseInt(jsonObject.get("code").toString()); |
| | | // if (code != 0) { |
| | | // log.info("库位解绑AGV接口调用失败,返回信息:" + response); |
| | | // } else { |
| | | // success = true; |
| | | // } |
| | | // } catch (Exception e) { |
| | | // throw new CoolException("调用AGV响应错误"); |
| | | // } finally { |
| | | // apiLogService.save( |
| | | // "货架与位置解绑", |
| | | // url + locStsUrl, |
| | | // null, |
| | | // "127.0.0.1", |
| | | // JSON.toJSONString(data), |
| | | // response, |
| | | // success |
| | | // ); |
| | | // } |
| | | // } |
| | | // } catch (Exception e) { |
| | | // |
| | | // } |
| | | } |
| | | return R.ok(); |
| | | } |