This commit is contained in:
李广豪 2022-08-04 15:11:30 +08:00
commit e1181e0423
2 changed files with 14 additions and 10 deletions

View File

@ -68,6 +68,8 @@ public class CurrTaskController extends BaseController {
private CurrTaskServiceBiz currTaskServiceBiz;
@Autowired
private AutoExeTaskServiceBiz autoExeTaskServiceBiz;
@Autowired
private TaskDistanceUtils taskDistanceUtils;
@PostMapping(value = "createProcessTask")
@ -306,9 +308,10 @@ public class CurrTaskController extends BaseController {
}
@PostMapping(value = "testRgv")
@ApiOperation(value = "测试rgv避让逻辑")
private Boolean testRgv(@RequestBody TestRgv testRgv) throws IOException {
TaskDistanceUtils taskDistanceUtils=new TaskDistanceUtils();
return taskDistanceUtils.conflictForVehicle(testRgv.getVehicleId(),testRgv.getStartPoint(),testRgv.getEndPoint(),testRgv.getOtherVehicle());
private String testRgv(@RequestBody TestRgv testRgv) throws IOException {
Long aLong = taskDistanceUtils.chooseVehicle(testRgv.getStartPoint(), testRgv.getEndPoint());
Boolean aBoolean = taskDistanceUtils.conflictForVehicle(testRgv.getVehicleId(), testRgv.getStartPoint(), testRgv.getEndPoint(), testRgv.getOtherVehicle());
return String.valueOf(aLong)+String.valueOf(aBoolean);
}
private Integer sendTaskToRgv(Integer taskType,Long vehicleId, Long currTaskId, Long startPoint, Long endPoint, Integer processNumber) {
Map<String, Object> json = new HashMap();

View File

@ -91,7 +91,7 @@ public class AsynRunTaskService extends BaseService {
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask));
//检查车辆是否冲突冲突则避让
rgvStatus(vehicleId, currTask);
rgvStatus(vehicleId, currTask,currTask.getStartPosition(),currTask.getTargetPosition());
//新建一条执行任务的关系表存放任务执行信息
RunTask runTask = new RunTask();
runTask.setTaskId(currTask.getId());
@ -180,7 +180,7 @@ public class AsynRunTaskService extends BaseService {
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask));
//检查车辆是否冲突冲突则避让
rgvStatus(vehicleId, currTask);
rgvStatus(vehicleId, currTask,location.getCode(),currTask.getTargetPosition());
//新建一条执行任务的关系表存放任务执行信息
RunTask runTask = new RunTask();
runTask.setTaskId(currTask.getId());
@ -280,7 +280,7 @@ public class AsynRunTaskService extends BaseService {
//Location location = locationServiceBiz.getById(currTask.getLocationId());
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
//检查车辆是否冲突冲突则避让
rgvStatus(vehicleId, currTask);
rgvStatus(vehicleId, currTask,currTask.getStartPosition(),location.getCode());
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
RunTask runTask = new RunTask();
runTask.setTaskId(currTask.getId());
@ -367,8 +367,9 @@ public class AsynRunTaskService extends BaseService {
public void asynRunTaskForKilnToWarehouse(Long currTaskId, Long vehicleId) throws IOException {
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
Location location = locationServiceBiz.getOne(new QueryWrapper<Location>().eq(Location.CODE, currTask.getOutTargetPosition()));
//检查车辆是否冲突冲突则避让
rgvStatus(vehicleId, currTask);
rgvStatus(vehicleId, currTask,currTask.getStartPosition(),location.getCode());
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
RunTask runTask = new RunTask();
runTask.setTaskId(currTask.getId());
@ -379,7 +380,7 @@ public class AsynRunTaskService extends BaseService {
runTask.setEndPosition(currTask.getOutTargetPosition());
runTaskServiceBiz.save(runTask);
//更新 location 表对应库位状态为占用
Location location = locationServiceBiz.getOne(new QueryWrapper<Location>().eq(Location.CODE, currTask.getOutTargetPosition()));
location.setStatus(1);
location.setUpdateTime(LocalDateTime.now());
locationServiceBiz.updateById(location);
@ -1340,7 +1341,7 @@ public class AsynRunTaskService extends BaseService {
* @param currTask
* @throws IOException
*/
private void rgvStatus(Long vehicleId,CurrTask currTask) throws IOException {
private void rgvStatus(Long vehicleId,CurrTask currTask,String startPosition,String targetPosition) throws IOException {
Long currTaskId = currTask.getId();
if (vehicleId==1){
Long anotherVehicleId=2L;
@ -1349,7 +1350,7 @@ public class AsynRunTaskService extends BaseService {
//获取RGV2当前位置
Double rgv2CurrPosition = RGVCurrPosition(2);
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getStartPosition(), currTask.getTargetPosition(), rgv2CurrPosition);
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, startPosition, targetPosition, rgv2CurrPosition);
if (conflictBoolean){
Integer status = moveRgv(2, currTaskId, 2,0);
if (status!=1){