| | |
| | | } |
| | | |
| | | // 先绑定 |
| | | // boolean flag = bindPodAndBerth(sta); |
| | | // if (!flag) { |
| | | // return R.parse(inSta + "绑定失败"); |
| | | // } |
| | | boolean flag = bindPodAndBerth(sta); |
| | | if (!flag) { |
| | | return R.parse(inSta + "绑定失败"); |
| | | } |
| | | |
| | | ForwardAGVTaskParam forwardAGVTaskParam = new ForwardAGVTaskParam(); |
| | | forwardAGVTaskParam.setReqCode(UUID.randomUUID().toString().replace("-", "")); |
| | |
| | | return success ? R.ok("呼叫agv成功") : R.parse(message); |
| | | } |
| | | |
| | | @Override |
| | | public R unbind(String site) { |
| | | String staMap = AgvSiteConstant.SiteMap.get(site); |
| | | if (staMap == null) { |
| | | return R.parse("没有找到该站点的入库映射:" + site); |
| | | } |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("reqCode",UUID.randomUUID().toString().replace("-", "")); // 请求唯一值 |
| | | jsonObject.put("ctnrTyp","2"); // 容器类型2 |
| | | jsonObject.put("stgBinCode",staMap); // 仓位编号,根据客仓编号转换 |
| | | jsonObject.put("indBind","0"); // 1绑定,0解绑 |
| | | |
| | | String body = jsonObject.toJSONString(); |
| | | String response = ""; |
| | | String message = ""; |
| | | boolean success = false; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(ApiInterfaceConstant.AGV_IP) |
| | | .setPath(ApiInterfaceConstant.AGV_BIND_PATH) |
| | | .setJson(body) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject res = JSON.parseObject(response); |
| | | message = jsonObject.getString("message"); |
| | | if (res.getInteger("code").equals(0)) { |
| | | success = true; |
| | | } else { |
| | | log.error("调用agv解绑暂存位失败!!!url:{};request:{};response:{}", ApiInterfaceConstant.AGV_IP + ApiInterfaceConstant.AGV_BIND_PATH, body, response); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("调用agv解绑暂存位异常", e); |
| | | } finally { |
| | | try { |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "调用agv解绑暂存位", |
| | | ApiInterfaceConstant.AGV_IP + ApiInterfaceConstant.AGV_BIND_PATH, |
| | | null, |
| | | "127.0.0.1", |
| | | body, |
| | | response, |
| | | success |
| | | ); |
| | | } catch (Exception e) { |
| | | log.error("", e); |
| | | } |
| | | } |
| | | return success ? R.ok("解绑成功") : R.parse(message); |
| | | } |
| | | |
| | | private boolean bindPodAndBerth(String sta) { |
| | | String staMap = AgvSiteConstant.SiteMap.get(sta); |
| | | if (staMap == null) { |
| | |
| | | } |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("reqCode",UUID.randomUUID().toString().replace("-", "")); // 请求唯一值 |
| | | jsonObject.put("crnType","2"); // 容器类型2 |
| | | jsonObject.put("ctnrTyp","2"); // 容器类型2 |
| | | jsonObject.put("stgBinCode",staMap); // 仓位编号,根据客仓编号转换 |
| | | jsonObject.put("indBind","1"); // 1绑定,0解绑 |
| | | |