bug修改:先检查车辆在线情况再修改缓存区状态

This commit is contained in:
lgh 2022-07-17 17:55:19 +08:00
parent 8c735058a1
commit ae816ce7f3

View File

@ -154,18 +154,20 @@ public class RunTaskUtils {
Location location = locationServiceBiz.list(new QueryWrapper<Location>()
.eq(Location.STATUS, 0)
.eq(Location.VALID, 1)).get(0);
//更新 location 表对应库位状态为占用
location.setStatus(1);
location.setUpdateTime(LocalDateTime.now());
locationServiceBiz.updateById(location);
//通过库位code去point_info表中查出该库位对应的点
PointInfo pointInfo = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, location.getCode()));
//计算出路径最短的车辆id,起点液压台终点缓存区库位点
Long vehicleId = taskDistanceUtils.chooseVehicle(currTask.getStartPosition(), location.getCode());
if (vehicleId==0){
logger.info("两辆车都不在线,请检查后重试!");
return R.failed("两辆车都不在线,请检查后重试!");
}
//更新 location 表对应库位状态为占用
location.setStatus(1);
location.setUpdateTime(LocalDateTime.now());
locationServiceBiz.updateById(location);
//通过库位code去point_info表中查出该库位对应的点
PointInfo pointInfo = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, location.getCode()));
//占用车辆
VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
vehicleInfo.setStatus(1);