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 b71884e..b593dbd 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 @@ -165,6 +165,8 @@ public class AsynRunTaskService extends BaseService { runTaskServiceBiz.updateById(runTask); currTask.setStatus(0); currTaskServiceBiz.updateById(currTask); + vehicle.setStatus(0); + vehicleInfoServiceBiz.updateById(vehicle); logger.info(String.valueOf(status)); logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败==="); logger.info("任务 " + currTask.getTaskCode() + " 车辆从起点"+startPoint+"台到加工炉过程中失败。"); @@ -266,6 +268,9 @@ public class AsynRunTaskService extends BaseService { runTask.setStatus(3); runTask.setUpdateTime(LocalDateTime.now()); runTaskServiceBiz.updateById(runTask); + + vehicle.setStatus(0); + vehicleInfoServiceBiz.updateById(vehicle); logger.info(String.valueOf(status)); logger.info("任务 " + currTask.getTaskCode() + " 车辆从缓存区到加工炉过程中失败。"); logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败==="); @@ -357,6 +362,8 @@ public class AsynRunTaskService extends BaseService { runTask.setStatus(3); runTask.setUpdateTime(LocalDateTime.now()); runTaskServiceBiz.updateById(runTask); + vehicle.setStatus(0); + vehicleInfoServiceBiz.updateById(vehicle); logger.info(String.valueOf(status)); logger.info("任务 " + currTask.getTaskCode() + " 车辆从液压台到缓存区过程中失败。"); logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败==="); @@ -465,6 +472,8 @@ public class AsynRunTaskService extends BaseService { } else { runTask.setStatus(3); runTask.setUpdateTime(LocalDateTime.now()); + vehicle.setStatus(0); + vehicleInfoServiceBiz.updateById(vehicle); runTaskServiceBiz.updateById(runTask); logger.info("任务 " + currTask.getTaskCode() + " 车辆从工业炉到缓存区过程中失败。"); logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败==="); @@ -477,6 +486,7 @@ public class AsynRunTaskService extends BaseService { public void asynRunOutStockForKilnToYYT(Long currTaskId, String yeyaTaiCode, Long vehicleId) throws IOException { CurrTask currTask = currTaskServiceBiz.getById(currTaskId); KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId()); + VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId); if (vehicleId == 1) { Long anotherVehicleId = 2L; Boolean rgv2Online = rgvOnline(anotherVehicleId); @@ -543,9 +553,8 @@ public class AsynRunTaskService extends BaseService { runTask.setEndTime(LocalDateTime.now()); runTaskServiceBiz.updateById(runTask); //更新车辆状态 - VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId); - vehicleInfo.setStatus(0); - vehicleInfoServiceBiz.updateById(vehicleInfo); + vehicle.setStatus(0); + vehicleInfoServiceBiz.updateById(vehicle); //更新currTask表 currTask.setIsOut(2); currTask.setUpdateTime(LocalDateTime.now()); @@ -561,6 +570,8 @@ public class AsynRunTaskService extends BaseService { runTask.setStatus(3); runTask.setUpdateTime(LocalDateTime.now()); runTaskServiceBiz.updateById(runTask); + vehicle.setStatus(0); + vehicleInfoServiceBiz.updateById(vehicle); logger.info("任务 " + runTask.getTaskCode() + " 车辆从加工炉到提升平台过程中失败。"); logger.info("===执行任务出库任务,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败==="); // 2021/12/14 websocket推送到前端 @@ -570,6 +581,8 @@ public class AsynRunTaskService extends BaseService { //出库。起点为缓存区库位,终点为提升台 @Async("asyncServiceExecutor") public void asynRunOutStock(Long locationId, String yeyaTaiCode, Long vehicleId) throws IOException { + + VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId); Location location = locationServiceBiz.getById(locationId); if (vehicleId == 1) { Long anotherVehicleId = 2L; @@ -652,13 +665,14 @@ public class AsynRunTaskService extends BaseService { locationServiceBiz.updateById(location); //更新车辆状态 - VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId); vehicleInfo.setStatus(0); vehicleInfoServiceBiz.updateById(vehicleInfo); } else { runTask.setStatus(3); runTask.setUpdateTime(LocalDateTime.now()); runTaskServiceBiz.updateById(runTask); + vehicleInfo.setStatus(0); + vehicleInfoServiceBiz.updateById(vehicleInfo); logger.info("任务 " + runTask.getTaskCode() + " 车辆从缓存区到提升平台过程中失败。"); logger.info("===执行任务出库任务,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败==="); System.out.println("===执行任务出库任务,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败==="); diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java index 6d2495b..b404e70 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java @@ -656,8 +656,8 @@ public class ScheduledTask extends BaseService { } } - //监听车辆是否在线 - @Scheduled(fixedDelay = 1000*60) + //监听车辆是否在线,定时恢复车辆状态会导致避让时等待时间过久,再次发起任务,造成重复发起 + //@Scheduled(fixedDelay = 1000*60) public void listenVehicleOnline() throws IOException { List vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper().eq(VehicleInfo.STATUS,1)); for (VehicleInfo vehicleInfo:vehicleInfoList