From be0ffcae005921828f84b21772229b097989f119 Mon Sep 17 00:00:00 2001 From: lgh Date: Wed, 3 Aug 2022 16:39:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mt/wms/core/utils/HttpClient.java | 4 +-- .../empty/controller/CurrTaskController.java | 30 +++++++++++++++++++ .../java/com/mt/wms/empty/params/RGVTask.java | 21 +++++++++++++ .../mt/wms/empty/task/TaskDistanceUtils.java | 2 +- 4 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 6.program/wms-empty/src/main/java/com/mt/wms/empty/params/RGVTask.java diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/utils/HttpClient.java b/6.program/wms-core/src/main/java/com/mt/wms/core/utils/HttpClient.java index 006cafe..0e8a1d0 100644 --- a/6.program/wms-core/src/main/java/com/mt/wms/core/utils/HttpClient.java +++ b/6.program/wms-core/src/main/java/com/mt/wms/core/utils/HttpClient.java @@ -49,8 +49,8 @@ public class HttpClient { public static String httpPost(String url, String json) throws IOException { //OkHttpClient httpClient = new OkHttpClient(); OkHttpClient httpClient = new OkHttpClient().newBuilder().connectTimeout(300L, TimeUnit.MINUTES) - .writeTimeout(60*30, TimeUnit.SECONDS) - .readTimeout(60*30, TimeUnit.SECONDS) + .writeTimeout(60*300, TimeUnit.SECONDS) + .readTimeout(60*300, TimeUnit.SECONDS) .build(); RequestBody requestBody = RequestBody.create(JSON, json); Request request = new Request.Builder() diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java index 5dcc292..43d30fb 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java @@ -297,4 +297,34 @@ public class CurrTaskController extends BaseController { //点击执行按钮会判断当前任务是否为自动任务,如果是自动任务会去自动任务查一下该自动任务的上一步是否已完成(仅非一步时) return currTaskService.runTask(param.getId()); } + @PostMapping(value = "testRunTask") + @ApiOperation(value = "执行任务") + public R testRunTask(@RequestBody RGVTask rgvTask){ + sendTaskToRgv(rgvTask.getTaskType(),rgvTask.getVehicleId(),rgvTask.getTaskNo(),rgvTask.getPickRow(),rgvTask.getSendRow(),rgvTask.getProcessNumber()); + return null; + } + private Integer sendTaskToRgv(Integer taskType,Long vehicleId, Long currTaskId, Long startPoint, Long endPoint, Integer processNumber) { + Map json = new HashMap(); + // taskType 1 搬运 + json.put("taskType", taskType); + json.put("sendRow", endPoint); + json.put("pickRow", startPoint); + json.put("taskNo", currTaskId); + json.put("ideNumber", currTaskId); + json.put("processNumber", processNumber); + String taskJson = JSON.toJSONString(json); + String result = null; + try { + if (vehicleId == 1) { + result = HttpClient.httpPost("http://192.168.6.51:8009/rgv1/sendTask", taskJson); + } + if (vehicleId == 2) { + result = HttpClient.httpPost("http://192.168.6.51:8009/rgv2/sendTask", taskJson); + } + } catch (IOException e) { + e.printStackTrace(); + } + JSONObject jsonObject = JSON.parseObject(result); + return Integer.parseInt(String.valueOf(jsonObject.get("msg"))); + } } diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/RGVTask.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/RGVTask.java new file mode 100644 index 0000000..c28006e --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/RGVTask.java @@ -0,0 +1,21 @@ +package com.mt.wms.empty.params; + +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "调用wcs发起任务", description = "调用wcs发起任务") +public class RGVTask { + private Integer taskType; + private Long sendRow; + private Long pickRow; + private Long taskNo; + private Long ideNumber; + private Integer processNumber; + private Long vehicleId; + +} diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/TaskDistanceUtils.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/TaskDistanceUtils.java index 2b20860..d507252 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/TaskDistanceUtils.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/TaskDistanceUtils.java @@ -65,7 +65,7 @@ public class TaskDistanceUtils { return 2L; } //液压台4 和 1号回火炉只能调用车辆1 - if ("BMC1".equals(startPoint)||"BMC1".equals(endPoint)||"YYT004".equals(startPoint)||"YYT004".equals(endPoint)){ + if ("BMC1".equals(startPoint)||"BMC1".equals(endPoint)||"BMC2".equals(startPoint)||"BMC2".equals(endPoint)||"YYT004".equals(startPoint)||"YYT004".equals(endPoint)||"YYT003".equals(startPoint)||"YYT003".equals(endPoint)){ return 1L; } Double startDistance = pointInfoServiceBiz.getOne(new QueryWrapper().eq(PointInfo.NOTE, startPoint)).getDistance(); From e3d17d19233c8a96240f84a0115557e7305d391b Mon Sep 17 00:00:00 2001 From: lgh Date: Wed, 3 Aug 2022 17:13:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=BC=93=E5=AD=98=E5=8C=BA=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/mt/wms/empty/task/AsynRunTaskService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java index cdcab79..02a6651 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java @@ -346,6 +346,9 @@ public class AsynRunTaskService extends BaseService { } } } else { + //修改库位状态 + location.setStatus(0); + locationServiceBiz.updateById(location); //任务失败清除缓存库位信息 inStockInfoServiceBiz.removeById(inStockInfo); runTask.setStatus(3);