去掉定时任务恢复车辆状态,改为任务做完重置车辆状态
这个提交包含在:
李广豪 2022-08-04 18:45:39 +08:00
父节点 d2e37ee2c8
当前提交 2c186a6ff4
共有 2 个文件被更改,包括 20 次插入6 次删除

查看文件

@ -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 + "任务执行失败===");

查看文件

@ -656,8 +656,8 @@ public class ScheduledTask extends BaseService {
}
}
//监听车辆是否在线
@Scheduled(fixedDelay = 1000*60)
//监听车辆是否在线,定时恢复车辆状态会导致避让时等待时间过久,再次发起任务,造成重复发起
//@Scheduled(fixedDelay = 1000*60)
public void listenVehicleOnline() throws IOException {
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS,1));
for (VehicleInfo vehicleInfo:vehicleInfoList