最后一步加工炉完成后直接出库到一号液压台
This commit is contained in:
parent
c44edba722
commit
f555907877
@ -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代表全部,存储的时候计算全部
|
||||
|
@ -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 {
|
||||
|
@ -200,8 +200,8 @@ public class RunTaskUtils {
|
||||
.eq("status", 1)
|
||||
.eq("kiln_id", kilnId));
|
||||
//查询是否为自动任务
|
||||
if (currTask.getIsAuto()==1) {
|
||||
logger.info(currTask.getId()+"为自动任务");
|
||||
if (currTask.getIsAuto() == 1) {
|
||||
logger.info(currTask.getId() + "为自动任务");
|
||||
//查询自动任务的哪一步的设备id是该工业炉
|
||||
int firstCount = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTask.getId()));
|
||||
if (firstCount == 1) {
|
||||
@ -211,9 +211,9 @@ public class RunTaskUtils {
|
||||
Long taskId = autoExeTask.getTTaskId();
|
||||
CurrTask currTaskTwo = currTaskServiceBiz.getById(taskId);
|
||||
try {
|
||||
logger.info("自动任务第一步:"+currTask.getTaskCode()+"已执行完成。开始执行第二步任务:"+currTaskTwo);
|
||||
logger.info("自动任务第一步:" + currTask.getTaskCode() + "已执行完成。开始执行第二步任务:" + currTaskTwo);
|
||||
// 2022/2/27 websocket推送到页面显示
|
||||
webSocketServer.sendtoAll("自动任务第一步:"+currTask.getTaskCode()+"已执行完成。开始执行第二步任务:"+currTaskTwo);
|
||||
webSocketServer.sendtoAll("自动任务第一步:" + currTask.getTaskCode() + "已执行完成。开始执行第二步任务:" + currTaskTwo);
|
||||
return runTaskForInKiln(taskId);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
@ -225,13 +225,13 @@ public class RunTaskUtils {
|
||||
//当前为自动任务第二步
|
||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTask.getId()));
|
||||
//该自动任务的工艺类型为2,还有第三步
|
||||
if (autoExeTask.getProcessFlowType()==2){
|
||||
if (autoExeTask.getProcessFlowType() == 2) {
|
||||
Long thTaskId = autoExeTask.getThTaskId();
|
||||
CurrTask currTaskThree = currTaskServiceBiz.getById(thTaskId);
|
||||
try {
|
||||
logger.info("自动任务第二步:"+currTask.getTaskCode()+"已执行完成。开始执行第三步任务:"+currTaskThree.getId());
|
||||
logger.info("自动任务第二步:" + currTask.getTaskCode() + "已执行完成。开始执行第三步任务:" + currTaskThree.getId());
|
||||
// 2022/2/27 websocket推送到页面显示
|
||||
webSocketServer.sendtoAll("自动任务第二步:"+currTask.getTaskCode()+"已执行完成。开始执行第三步任务:"+currTaskThree.getId());
|
||||
webSocketServer.sendtoAll("自动任务第二步:" + currTask.getTaskCode() + "已执行完成。开始执行第三步任务:" + currTaskThree.getId());
|
||||
return runTaskForInKiln(thTaskId);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
@ -241,28 +241,20 @@ public class RunTaskUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
//查询缓存区库位是否已满
|
||||
int count = locationServiceBiz.count(new QueryWrapper<Location>()
|
||||
.eq(Location.STATUS, 0)
|
||||
.eq(Location.VALID, 1));
|
||||
//缓存区未满
|
||||
if (count >0) {
|
||||
List<Location> locationList = locationServiceBiz.list(new QueryWrapper<Location>()
|
||||
.eq(Location.STATUS, 0)
|
||||
.eq(Location.VALID, 1).orderByDesc(Location.ID));
|
||||
//液压台允许放货
|
||||
if (true) {
|
||||
//是否有小车在运行
|
||||
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1));
|
||||
if (vehicleInfoList.size()>0){
|
||||
if (vehicleInfoList.size() > 0) {
|
||||
//有小车在运行,提示当前有车辆在运行,请稍后
|
||||
logger.info("当前轨道有RGV车辆在运动,请等待当前RGV车辆执行完毕再执行任务!");
|
||||
return R.failed("当前轨道有RGV车辆在运动,请等待当前RGV车辆执行完毕再执行任务!");
|
||||
}
|
||||
//计算出路径最短的车辆id
|
||||
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
|
||||
//工业炉为起点,缓存区为终点
|
||||
Location location = locationList.get(0);
|
||||
Long vehicleId = taskDistanceUtils.chooseVehicle(kilnInfo.getCode(), location.getCode());
|
||||
if (vehicleId==0){
|
||||
//工业炉为起点,缓存区为一号液压台
|
||||
Long vehicleId = taskDistanceUtils.chooseVehicle(kilnInfo.getCode(), "YYT001");
|
||||
if (vehicleId == 0) {
|
||||
logger.info("两辆车都不在线,请检查后重试!");
|
||||
return R.failed("两辆车都不在线,请检查后重试!");
|
||||
}
|
||||
@ -271,18 +263,52 @@ public class RunTaskUtils {
|
||||
vehicleInfo.setStatus(1);
|
||||
vehicleInfo.setUpdateTime(LocalDateTime.now());
|
||||
vehicleInfoServiceBiz.updateById(vehicleInfo);
|
||||
//修改任务状态
|
||||
currTask.setIsOut(0);
|
||||
currTask.setTaskType(2);
|
||||
currTask.setUpdateTime(LocalDateTime.now());
|
||||
currTask.setOutStartPosition(kilnInfo.getCode());
|
||||
currTask.setOutTargetPosition(location.getCode());
|
||||
currTaskServiceBiz.updateById(currTask);
|
||||
// 2022/2/16 异步调用车辆
|
||||
asynRunTaskService.asynRunTaskForKilnToWarehouse(currTask.getId(),vehicleId);
|
||||
return R.ok("操作成功!托盘加入缓存区。");
|
||||
}else {
|
||||
return R.ok("当前缓存区已满,无法从加工炉出炉到缓存区。");
|
||||
asynRunTaskService.asynRunOutStockForKilnToYYT(currTask.getId(),"YYT001",vehicleId);
|
||||
return R.ok("操作成功!托盘即将出库到一号液压台。");
|
||||
} else {
|
||||
//查询缓存区库位是否已满
|
||||
int count = locationServiceBiz.count(new QueryWrapper<Location>()
|
||||
.eq(Location.STATUS, 0)
|
||||
.eq(Location.VALID, 1));
|
||||
//缓存区未满
|
||||
if (count > 0) {
|
||||
List<Location> locationList = locationServiceBiz.list(new QueryWrapper<Location>()
|
||||
.eq(Location.STATUS, 0)
|
||||
.eq(Location.VALID, 1).orderByDesc(Location.ID));
|
||||
//是否有小车在运行
|
||||
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);
|
||||
//工业炉为起点,缓存区为终点
|
||||
Location location = locationList.get(0);
|
||||
Long vehicleId = taskDistanceUtils.chooseVehicle(kilnInfo.getCode(), location.getCode());
|
||||
if (vehicleId == 0) {
|
||||
logger.info("两辆车都不在线,请检查后重试!");
|
||||
return R.failed("两辆车都不在线,请检查后重试!");
|
||||
}
|
||||
//占用车辆
|
||||
VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
|
||||
vehicleInfo.setStatus(1);
|
||||
vehicleInfo.setUpdateTime(LocalDateTime.now());
|
||||
vehicleInfoServiceBiz.updateById(vehicleInfo);
|
||||
//修改任务状态
|
||||
currTask.setIsOut(0);
|
||||
currTask.setTaskType(2);
|
||||
currTask.setUpdateTime(LocalDateTime.now());
|
||||
currTask.setOutStartPosition(kilnInfo.getCode());
|
||||
currTask.setOutTargetPosition(location.getCode());
|
||||
currTaskServiceBiz.updateById(currTask);
|
||||
// 2022/2/16 异步调用车辆
|
||||
asynRunTaskService.asynRunTaskForKilnToWarehouse(currTask.getId(), vehicleId);
|
||||
return R.ok("操作成功!托盘加入缓存区。");
|
||||
} else {
|
||||
return R.ok("当前缓存区已满,无法从加工炉出炉到缓存区。");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user