| | |
| | | |
| | | } |
| | | |
| | | @PostMapping("/agv/unbind") |
| | | @ManagerAuth |
| | | public R pdaAgvUnbind(@RequestBody Map<String,Object> map){ |
| | | |
| | | String site = (String) map.get("site"); // 暂存位 |
| | | |
| | | if (Cools.isEmpty(site)) { |
| | | return R.parse("暂存位不能为空"); |
| | | } |
| | | |
| | | return mobileService.unbind(site); |
| | | } |
| | | |
| | | private void getAgvTaskParam(ForwardAGVTaskParam agvTaskCreateParam,String agv,String sta){ |
| | | List<ForwardAGVTaskParam.PositionCodePaths> agvTaskParamList = Arrays.asList( |
| | | //起始位 |
| | |
| | | R inLocCallAgv(String sta, String inSta); |
| | | |
| | | /** |
| | | * agv解绑站点 |
| | | */ |
| | | R unbind(String site); |
| | | |
| | | /** |
| | | * 组托 |
| | | */ |
| | | void comb(CombParam param, Long userId); |
| | |
| | | } |
| | | |
| | | // 先绑定 |
| | | // 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解绑 |
| | | |
New file |
| | |
| | | package com.zy.common.constant; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author pang.jiabao |
| | | * @description Agv站点和仓位编号对应 |
| | | * @createDate 2024/11/7 10:49 |
| | | */ |
| | | public class AgvSiteConstant { |
| | | |
| | | public static final Map<String,String> SiteMap = new HashMap<String,String>(){{ |
| | | put("a1","700001EE501013");put("a2","700002EE501013");put("a3","700003EE501013");put("a4","700004EE501013"); |
| | | put("a5","700005EE501013");put("a6","700006EE501013");put("a7","700007EE501013");put("a8","700008EE501013"); |
| | | put("b1","820001EE501013");put("b2","820002EE501013");put("b3","820003EE501013");put("b4","820004EE501013"); |
| | | put("b5","820005EE501013");put("b6","820006EE501013"); |
| | | put("c1","830001EE501013");put("c2","830002EE501013");put("c3","830003EE501013");put("c4","830004EE501013"); |
| | | put("c5","830005EE501013");put("c6","830006EE501013"); |
| | | put("1040","800001FF501013");put("1042","800002FF501013"); |
| | | put("2010","600001XX501013");put("2012","600002XX501013"); |
| | | put("3010","400001GG501013");put("3012","400002GG501013"); |
| | | }}; |
| | | |
| | | } |
| | |
| | | // 入库呼叫AGV取货 |
| | | public static final String AGV_CALL_IN_PATH = "/rcms/services/rest/hikRpcService/genAgvSchedulingTask"; |
| | | |
| | | // AGV绑定仓位 |
| | | public static final String AGV_BIND_PATH = "/rcms/services/rest/hikRpcService/bindCtnrAndBin"; |
| | | |
| | | } |