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/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); 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 8dbe757..3d8077d 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();