From e29a9f245ff4e57a40bbab1c0acc3cbc31d3ac2b Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期一, 21 四月 2025 11:13:13 +0800 Subject: [PATCH] #出库找待机位优化 --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/TaskTimer.java | 74 ++++++++++++++++++++++++++++++++---- 1 files changed, 65 insertions(+), 9 deletions(-) diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/TaskTimer.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/TaskTimer.java index cdc3cd6..5041bed 100644 --- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/TaskTimer.java +++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/TaskTimer.java @@ -67,17 +67,30 @@ taskService.updateById(task); continue; }else if (task.getMemo().equals("06YZ0001")){ - task.setTaskSts(1001L); - taskService.updateById(task); + HashMap<String, String> mesMap = new HashMap<>(); + mesMap.put("taskNo", task.getWmsTaskNo()); + mesMap.put("contNo",task.getZpallet()); + boolean returnTask4 = toMesHttpRequest(mesMap, "172.18.231.126", "/api/wcs/wcsTaskInfo", "4",task.getZpallet()); + if (returnTask4){ + task.setTaskSts(1001L); + taskService.updateById(task); + log.info("鍑哄簱浠诲姟瀹屾垚鎺ㄩ�乵es"+task.getWmsTaskNo()); + }else { + log.error("鍑哄簱浠诲姟瀹屾垚鎺ㄩ�乵es澶辫触"+task.getWmsTaskNo()); + } continue; } if (task.getTaskNo().equals(basConveyorSta.getTaskNo().toString())) { + //缁戝畾鎵樼洏鐮� + boolean httpRequest1 = agvBindBarcodeHttpRequest("", "", task); AgvTaskCreateParam agvTaskCreateParam = new AgvTaskCreateParam(); getOutRequestParam(agvTaskCreateParam,task); + //鍙戦�佸嚭搴撲换鍔� boolean httpRequest = doHttpRequest(agvTaskCreateParam, "172.18.16.248:443", "/rcs/rtas/api/robot/controller/task/submit"); if (httpRequest){ task.setTaskSts(1000L); taskService.updateById(task); + log.info("鍑哄簱浠诲姟鎺ㄩ�乺gv"+task.getWmsTaskNo()); }else { log.error("鍑哄簱浠诲姟鎺ㄩ�乺gv澶辫触"+task.getWmsTaskNo()); } @@ -104,6 +117,39 @@ agvTaskCreateParam.setCarrierInfo(carrierInfoParam); } + private boolean agvBindBarcodeHttpRequest(String url, String path,Task task){ + String response = ""; + boolean success = false; + Map<String, Object> headers = new HashMap<>(); + headers.put("Content-Type", "application/json;charset=UTF-8"); + headers.put("X-lr-request-id", task.getWmsTaskNo()); + headers.put("X-lr-version", 4.1); + headers.put("X-lr-trace-id", "{{$guid}}"); + + Map<String, Object> map = new HashMap<>(); + map.put("carrierCode",task.getZpallet()); + map.put("siteCode","06YZ0001"); + map.put("extra",null); + try { + response = new HttpHandler.Builder() + .setHeaders(headers) + .setUri("172.18.16.248:443") + .setHttps(true) + .setPath("/rcs/rtas/api/robot/controller/carrier/bind") + .setJson(JSONObject.toJSONString(map)) + .build() + .doPost(); + JSONObject jsonObject = JSON.parseObject(response); + String code = jsonObject.get("code").toString(); + log.info("agv缁戝畾绠卞彿,璇锋眰浣�:"+JSONObject.toJSONString(map)+",杩斿洖:"+response); + if(code.equals("SUCCESS")){ + success = true; + } + }catch (Exception e){ + log.info("agv缁戝畾绠卞彿璇锋眰鎶ラ敊"+e.getMessage()); + } + return success; + } private boolean doHttpRequest(AgvTaskCreateParam requestParam, String url, String path){ String response = ""; @@ -113,6 +159,7 @@ map.put("X-lr-request-id", requestParam.getRobotTaskCode()); map.put("X-lr-version", 4.1); map.put("X-lr-trace-id", "{{$guid}}"); + log.info("杞彂agv璇锋眰鎶ユ枃:"+JSONObject.toJSONString(requestParam)); try { response = new HttpHandler.Builder() .setHeaders(map) @@ -123,14 +170,14 @@ .build() .doPost(); JSONObject jsonObject = JSON.parseObject(response); - + log.info("杞彂agv璇锋眰杩斿洖:"+response); String code = jsonObject.get("code").toString(); if(code.equals("SUCCESS")){ success = true; } }catch (Exception e){ - + log.info("杞彂agv璇锋眰鎶ラ敊"+e.getMessage()); } return success; } @@ -140,22 +187,25 @@ public synchronized void clearCompletedTask() { ArrayList<Long> taskSts = new ArrayList<>(); taskSts.add(TaskStsType.COMPLETE_INBOUND.sts); - taskSts.add(TaskStsType.OUT_TASK_OVER.sts); - taskSts.add(TaskStsType.COMPLETE_CHARGE.sts); - taskSts.add(TaskStsType.COMPLETE_MOVE.sts); - taskSts.add(TaskStsType.COMPLETE_MANUAL.sts); - taskSts.add(TaskStsType.COMPLETE_LADEN_MOVE.sts); + List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>() .eq(Task::getStatus, 1) .in(Task::getTaskSts, taskSts)); for (Task task : tasks) { + if (Cools.isEmpty(task.getMemo())){ + task.setTaskSts(998L); + taskService.updateById(task); + continue; + } + HashMap<String, String> mesMap = new HashMap<>(); mesMap.put("taskNo", task.getWmsTaskNo()); mesMap.put("contNo",task.getZpallet()); boolean returnTask4 = toMesHttpRequest(mesMap, "172.18.231.126", "/api/wcs/wcsTaskInfo", "4",task.getMemo()); if (returnTask4){ + log.info("浠诲姟瀹屾垚鍚庝笂鎶es鎴愬姛锛屼换鍔″彿:"+task.getWmsTaskNo()); //璁板綍搴撳瓨淇℃伅 updateRecordLoc(task); //浠诲姟杞巻鍙叉。 @@ -173,6 +223,12 @@ public synchronized void clearCompletedTask999() { ArrayList<Long> taskSts = new ArrayList<>(); taskSts.add(TaskStsType.OUT_TASK_OVER_HAND.sts); + taskSts.add(TaskStsType.OUT_TASK_OVER.sts); + taskSts.add(TaskStsType.COMPLETE_CHARGE.sts); + taskSts.add(TaskStsType.COMPLETE_MOVE.sts); + taskSts.add(TaskStsType.COMPLETE_MANUAL.sts); + taskSts.add(TaskStsType.COMPLETE_LADEN_MOVE.sts); + taskSts.add(TaskStsType.IN_TASK_OVER_HAND.sts); List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>() -- Gitblit v1.9.1