最后一步加工炉完成后直接出库到一号液压台

This commit is contained in:
lgh 2022-07-18 12:26:23 +08:00
parent c44edba722
commit f555907877
3 changed files with 151 additions and 34 deletions

View File

@ -84,7 +84,7 @@ public class EnergyController extends BaseController {
private TaskHisServiceBiz taskHisServiceBiz;
@PostMapping(value = "eletric")
@ApiOperation(value = "根据工业炉id获取消耗情况")
@ApiOperation(value = "根据任务id获取消耗情况")
public R<String> list(@Validated({Default.class}) @RequestBody ElectricQueryParam electricQueryParam) {
Long kiln = electricQueryParam.getKilnId();
//工业炉id为0代表全部存储的时候计算全部

View File

@ -457,7 +457,98 @@ public class AsynRunTaskService extends BaseService {
webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从工业炉到缓存区过程中失败。");
}
}
//出库起点为加工炉终点为提升台
@Async("asyncServiceExecutor")
public void asynRunOutStockForKilnToYYT(Long currTaskId, String yeyaTaiCode, Long vehicleId) throws IOException {
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId());
if (vehicleId == 1) {
Long anotherVehicleId = 2L;
Boolean rgv2Online = rgvOnline(anotherVehicleId);
if (rgv2Online) {
//获取RGV2当前位置
Double rgv2CurrPosition = RGVCurrPosition(2);
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, kilnInfo.getCode(), yeyaTaiCode, rgv2CurrPosition);
if (conflictBoolean) {
Integer status = moveRgv(2, 1L, 2, 0);
if (status != 1) {
logger.info("===执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位39执行失败===");
// 2022/3/6 websocket通知页面
webSocketServer.sendtoAll(LocalDateTime.now() + "执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位39执行失败");
return;
}
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位39执行成功===");
}
} else {
logger.info("RGV2不在线跳过检测是否避让。");
}
} else {
Boolean rgv1Online = rgvOnline(1L);
if (rgv1Online) {
//获取RGV1当前位置
Double rgv1CurrPosition = RGVCurrPosition(1);
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, kilnInfo.getCode(), yeyaTaiCode, rgv1CurrPosition);
if (conflictBoolean) {
Integer status = moveRgv(1, 1L, 12, 0);
if (status != 1) {
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位1执行失败===");
// 2022/3/6 websocket通知页面
webSocketServer.sendtoAll(LocalDateTime.now() + "执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位1执行失败");
return;
}
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位1执行成功===");
}
} else {
logger.info("RGV1不在线跳过检测是否避让。");
}
}
RunTask runTask = new RunTask();
// setCommonField(runTask);
runTask.setVehicleId(vehicleId);
runTask.setBeginTime(LocalDateTime.now());
runTask.setStartPosition(kilnInfo.getCode());
runTask.setEndPosition(yeyaTaiCode);
runTaskServiceBiz.save(runTask);
// 2021/12/14 调用车辆填入起终点,得到车辆执行结果,填入任务号出库任务任务号为0
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
Integer status = sendTaskToRgv(vehicleId, 0L, startPoint, endPoint, 0);
if (status == 1) {
logger.info("===执行任务出库任务,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行成功===");
//更新调度任务表状态为完成
runTask.setUpdateTime(LocalDateTime.now());
runTask.setStatus(2);
runTask.setEndTime(LocalDateTime.now());
runTaskServiceBiz.updateById(runTask);
//更新车辆状态
VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
vehicleInfo.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicleInfo);
//更新currTask表
currTask.setIsOut(2);
currTask.setUpdateTime(LocalDateTime.now());
currTask.setStatus(2);
currTask.setIsIn(2);
currTask.setUpdateTime(LocalDateTime.now());
logger.info("修改currTask任务状态");
currTaskServiceBiz.updateById(currTask);
//上报apms
apmsEndProcess(currTask);
apmsFinishProcess(currTask);
} else {
runTask.setStatus(3);
runTask.setUpdateTime(LocalDateTime.now());
runTaskServiceBiz.updateById(runTask);
logger.info("任务 " + runTask.getTaskCode() + " 车辆从加工炉到提升平台过程中失败。");
logger.info("===执行任务出库任务,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败===");
System.out.println("===执行任务出库任务,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败===");
// 2021/12/14 websocket推送到前端
webSocketServer.sendtoAll("出库任务车辆从加工炉到提升平台过程中失败。");
}
}
//出库起点为缓存区库位终点为提升台
@Async("asyncServiceExecutor")
public void asynRunOutStock(Long locationId, String yeyaTaiCode, Long vehicleId) throws IOException {

View File

@ -241,6 +241,31 @@ public class RunTaskUtils {
}
}
}
//液压台允许放货
if (true) {
//是否有小车在运行
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1));
if (vehicleInfoList.size() > 0) {
//有小车在运行提示当前有车辆在运行请稍后
logger.info("当前轨道有RGV车辆在运动请等待当前RGV车辆执行完毕再执行任务");
return R.failed("当前轨道有RGV车辆在运动请等待当前RGV车辆执行完毕再执行任务");
}
//计算出路径最短的车辆id
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
//工业炉为起点,缓存区为一号液压台
Long vehicleId = taskDistanceUtils.chooseVehicle(kilnInfo.getCode(), "YYT001");
if (vehicleId == 0) {
logger.info("两辆车都不在线,请检查后重试!");
return R.failed("两辆车都不在线,请检查后重试!");
}
//占用车辆
VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
vehicleInfo.setStatus(1);
vehicleInfo.setUpdateTime(LocalDateTime.now());
vehicleInfoServiceBiz.updateById(vehicleInfo);
asynRunTaskService.asynRunOutStockForKilnToYYT(currTask.getId(),"YYT001",vehicleId);
return R.ok("操作成功!托盘即将出库到一号液压台。");
} else {
//查询缓存区库位是否已满
int count = locationServiceBiz.count(new QueryWrapper<Location>()
.eq(Location.STATUS, 0)
@ -285,6 +310,7 @@ public class RunTaskUtils {
return R.ok("当前缓存区已满,无法从加工炉出炉到缓存区。");
}
}
}
/**
* 从缓存区出库