bug修改

This commit is contained in:
lgh 2022-08-03 16:39:49 +08:00
parent d595e8985c
commit be0ffcae00
4 changed files with 54 additions and 3 deletions

View File

@ -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()

View File

@ -297,4 +297,34 @@ public class CurrTaskController extends BaseController {
//点击执行按钮会判断当前任务是否为自动任务如果是自动任务会去自动任务查一下该自动任务的上一步是否已完成仅非一步时
return currTaskService.runTask(param.getId());
}
@PostMapping(value = "testRunTask")
@ApiOperation(value = "执行任务")
public R<String> 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<String, Object> 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")));
}
}

View File

@ -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;
}

View File

@ -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<PointInfo>().eq(PointInfo.NOTE, startPoint)).getDistance();