上报apms炉号
This commit is contained in:
李广豪 2022-11-18 10:09:47 +08:00
parent 59f008f19e
commit 592d27b858

View File

@ -91,7 +91,7 @@ public class AsynRunTaskService extends BaseService {
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId); VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask)); List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask));
//检查车辆是否冲突冲突则避让 //检查车辆是否冲突冲突则避让
rgvStatus(vehicleId, currTask,currTask.getStartPosition(),currTask.getTargetPosition()); rgvStatus(vehicleId, currTask, currTask.getStartPosition(), currTask.getTargetPosition());
//新建一条执行任务的关系表存放任务执行信息 //新建一条执行任务的关系表存放任务执行信息
RunTask runTask = new RunTask(); RunTask runTask = new RunTask();
runTask.setTaskId(currTask.getId()); runTask.setTaskId(currTask.getId());
@ -105,7 +105,7 @@ public class AsynRunTaskService extends BaseService {
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode(); Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
PointInfo pointInfo = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())); PointInfo pointInfo = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition()));
Long endPoint = pointInfo.getCode(); Long endPoint = pointInfo.getCode();
logger.info("加工炉: "+pointInfo.getName()+"可用未满,调用车辆: "+vehicleId+" 起点为提升台终点为工业炉"); logger.info("加工炉: " + pointInfo.getName() + "可用未满,调用车辆: " + vehicleId + " 起点为提升台终点为工业炉");
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue()); Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
logger.info(String.valueOf(status)); logger.info(String.valueOf(status));
//执行成功,托盘进炉 //执行成功,托盘进炉
@ -136,7 +136,7 @@ public class AsynRunTaskService extends BaseService {
apmsCreateProcess(currTask); apmsCreateProcess(currTask);
} else { } else {
int secondSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId)); int secondSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
if (secondSetp>0){ if (secondSetp > 0) {
//当前任务为自动任务里的第二步先上报第一步的apms-endProcess //当前任务为自动任务里的第二步先上报第一步的apms-endProcess
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId)); AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
CurrTask firstCurrTask = currTaskServiceBiz.getById(autoExeTask.getFTaskId()); CurrTask firstCurrTask = currTaskServiceBiz.getById(autoExeTask.getFTaskId());
@ -148,7 +148,7 @@ public class AsynRunTaskService extends BaseService {
apmsStartProcess(currTask); apmsStartProcess(currTask);
} }
int threeSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId)); int threeSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
if (threeSetp>0){ if (threeSetp > 0) {
//当前任务为自动任务里的第三步先上报第二步的apms处理endProcess //当前任务为自动任务里的第三步先上报第二步的apms处理endProcess
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId)); AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId()); CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId());
@ -171,8 +171,8 @@ public class AsynRunTaskService extends BaseService {
vehicleInfoServiceBiz.updateById(vehicle); vehicleInfoServiceBiz.updateById(vehicle);
logger.info(String.valueOf(status)); logger.info(String.valueOf(status));
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败==="); logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败===");
logger.info("任务 " + currTask.getTaskCode() + " 车辆从起点"+startPoint+"台到加工炉过程中失败。"); logger.info("任务 " + currTask.getTaskCode() + " 车辆从起点" + startPoint + "台到加工炉过程中失败。");
webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从起点"+startPoint+"台到加工炉过程中失败。"); webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从起点" + startPoint + "台到加工炉过程中失败。");
} }
} }
@ -185,7 +185,7 @@ public class AsynRunTaskService extends BaseService {
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId); VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask)); List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask));
//检查车辆是否冲突冲突则避让 //检查车辆是否冲突冲突则避让
rgvStatus(vehicleId, currTask,location.getCode(),currTask.getTargetPosition()); rgvStatus(vehicleId, currTask, location.getCode(), currTask.getTargetPosition());
//新建一条执行任务的关系表存放任务执行信息 //新建一条执行任务的关系表存放任务执行信息
RunTask runTask = new RunTask(); RunTask runTask = new RunTask();
runTask.setTaskId(currTask.getId()); runTask.setTaskId(currTask.getId());
@ -240,7 +240,7 @@ public class AsynRunTaskService extends BaseService {
apmsCreateProcess(currTask); apmsCreateProcess(currTask);
} else { } else {
int secondSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId)); int secondSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
if (secondSetp>0){ if (secondSetp > 0) {
//从缓存区到加工炉的任务,其上一步已经报告了apmsend //从缓存区到加工炉的任务,其上一步已经报告了apmsend
//当前任务为自动任务里的第二步先上报第一步的apms-endProcess //当前任务为自动任务里的第二步先上报第一步的apms-endProcess
//AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId)); //AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
@ -252,7 +252,7 @@ public class AsynRunTaskService extends BaseService {
apmsStartProcess(currTask); apmsStartProcess(currTask);
} }
int threeSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId)); int threeSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
if (threeSetp>0){ if (threeSetp > 0) {
//当前任务为自动任务里的第三步先上报第二步的apms处理endProcess //当前任务为自动任务里的第三步先上报第二步的apms处理endProcess
//AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId)); //AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
//CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId()); //CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId());
@ -286,13 +286,13 @@ public class AsynRunTaskService extends BaseService {
//工业炉已满调用车辆起点为提升台终点为缓存区 //工业炉已满调用车辆起点为提升台终点为缓存区
@Async("asyncServiceExecutor") @Async("asyncServiceExecutor")
public void asynRunTaskToWarehouse(Long currTaskId, Long vehicleId,Location location) throws IOException { public void asynRunTaskToWarehouse(Long currTaskId, Long vehicleId, Location location) throws IOException {
CurrTask currTask = currTaskServiceBiz.getById(currTaskId); CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
//Location location = locationServiceBiz.getById(currTask.getLocationId()); //Location location = locationServiceBiz.getById(currTask.getLocationId());
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId); VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId()); KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId());
//检查车辆是否冲突冲突则避让 //检查车辆是否冲突冲突则避让
rgvStatus(vehicleId, currTask,currTask.getStartPosition(),location.getCode()); rgvStatus(vehicleId, currTask, currTask.getStartPosition(), location.getCode());
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位 //新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
RunTask runTask = new RunTask(); RunTask runTask = new RunTask();
runTask.setTaskId(currTask.getId()); runTask.setTaskId(currTask.getId());
@ -343,17 +343,17 @@ public class AsynRunTaskService extends BaseService {
vehicle.setStatus(0); vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle); vehicleInfoServiceBiz.updateById(vehicle);
//如果任务为多步骤任务的非第一步置前置任务isIn为2 //如果任务为多步骤任务的非第一步置前置任务isIn为2
if (currTask.getIsAuto()==1){ if (currTask.getIsAuto() == 1) {
int count = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTaskId)); int count = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTaskId));
if (count==0){ if (count == 0) {
int secondCount = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId)); int secondCount = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
if (secondCount==1){ if (secondCount == 1) {
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId)); AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
CurrTask firstCurrTask = currTaskServiceBiz.getById(autoExeTask.getFTaskId()); CurrTask firstCurrTask = currTaskServiceBiz.getById(autoExeTask.getFTaskId());
firstCurrTask.setIsIn(2); firstCurrTask.setIsIn(2);
firstCurrTask.setStatus(2); firstCurrTask.setStatus(2);
currTaskServiceBiz.updateById(firstCurrTask); currTaskServiceBiz.updateById(firstCurrTask);
}else { } else {
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId)); AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId()); CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId());
secondCurrTask.setIsIn(2); secondCurrTask.setIsIn(2);
@ -387,7 +387,7 @@ public class AsynRunTaskService extends BaseService {
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId); VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
Location location = locationServiceBiz.getOne(new QueryWrapper<Location>().eq(Location.CODE, currTask.getOutTargetPosition())); Location location = locationServiceBiz.getOne(new QueryWrapper<Location>().eq(Location.CODE, currTask.getOutTargetPosition()));
//检查车辆是否冲突冲突则避让 //检查车辆是否冲突冲突则避让
rgvStatus(vehicleId, currTask,currTask.getStartPosition(),location.getCode()); rgvStatus(vehicleId, currTask, currTask.getStartPosition(), location.getCode());
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位 //新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
RunTask runTask = new RunTask(); RunTask runTask = new RunTask();
runTask.setTaskId(currTask.getId()); runTask.setTaskId(currTask.getId());
@ -444,33 +444,33 @@ public class AsynRunTaskService extends BaseService {
vehicle.setStatus(0); vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle); vehicleInfoServiceBiz.updateById(vehicle);
//任务为非自动任务上报apms-end-finish //任务为非自动任务上报apms-end-finish
if (currTask.getIsAuto()==0) { if (currTask.getIsAuto() == 0) {
//上报apms完成处理 //上报apms完成处理
logger.info("此任务为单步骤任务任务结束上报apms-end-finish"); logger.info("此任务为单步骤任务任务结束上报apms-end-finish");
apmsEndProcess(currTask); apmsEndProcess(currTask);
apmsFinishProcess(currTask); apmsFinishProcess(currTask);
} else { } else {
int firstSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTaskId)); int firstSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTaskId));
if (firstSetp>0){ if (firstSetp > 0) {
//当前任务为自动任务的第一步 //当前任务为自动任务的第一步
apmsEndProcess(currTask); apmsEndProcess(currTask);
} }
int secondSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId)); int secondSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
if (secondSetp>0){ if (secondSetp > 0) {
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId)); AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
if (autoExeTask.getProcessFlowType()==1){ if (autoExeTask.getProcessFlowType() == 1) {
logger.info("此任务为为自动任务里的第二步且一共只有两步任务结束上报apms-end-finish"); logger.info("此任务为为自动任务里的第二步且一共只有两步任务结束上报apms-end-finish");
//当前任务为自动任务里的第三步且一共只有两步先上报apms处理endProcess //当前任务为自动任务里的第三步且一共只有两步先上报apms处理endProcess
apmsEndProcess(currTask); apmsEndProcess(currTask);
//再上报apms-finishProcess //再上报apms-finishProcess
apmsFinishProcess(currTask); apmsFinishProcess(currTask);
}else { } else {
//当前任务为三步中的第二步 //当前任务为三步中的第二步
apmsEndProcess(currTask); apmsEndProcess(currTask);
} }
} }
int threeSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId)); int threeSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
if (threeSetp>0){ if (threeSetp > 0) {
logger.info("此任务为为自动任务里的第三步任务结束上报apms-end-finish"); logger.info("此任务为为自动任务里的第三步任务结束上报apms-end-finish");
//当前任务为自动任务里的第三步先上报apms处理endProcess //当前任务为自动任务里的第三步先上报apms处理endProcess
apmsEndProcess(currTask); apmsEndProcess(currTask);
@ -491,6 +491,7 @@ public class AsynRunTaskService extends BaseService {
webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从工业炉到缓存区过程中失败。"); webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从工业炉到缓存区过程中失败。");
} }
} }
//出库起点为加工炉终点为提升台 //出库起点为加工炉终点为提升台
@Async("asyncServiceExecutor") @Async("asyncServiceExecutor")
public void asynRunOutStockForKilnToYYT(Long currTaskId, String yeyaTaiCode, Long vehicleId) throws IOException { public void asynRunOutStockForKilnToYYT(Long currTaskId, String yeyaTaiCode, Long vehicleId) throws IOException {
@ -512,7 +513,7 @@ public class AsynRunTaskService extends BaseService {
logger.info("===执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2执行失败==="); logger.info("===执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2执行失败===");
// 2022/3/6 websocket通知页面 // 2022/3/6 websocket通知页面
webSocketServer.sendtoAll(LocalDateTime.now() + "执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2执行失败"); webSocketServer.sendtoAll(LocalDateTime.now() + "执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2执行失败");
}else { } else {
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2执行成功==="); logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2执行成功===");
} }
@ -535,7 +536,7 @@ public class AsynRunTaskService extends BaseService {
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + 1 + "移动到点位12执行失败==="); logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + 1 + "移动到点位12执行失败===");
// 2022/3/6 websocket通知页面 // 2022/3/6 websocket通知页面
webSocketServer.sendtoAll(LocalDateTime.now() + "执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + 1 + "移动到点位12执行失败"); webSocketServer.sendtoAll(LocalDateTime.now() + "执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + 1 + "移动到点位12执行失败");
}else { } else {
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + 1 + "移动到点位12执行成功==="); logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + 1 + "移动到点位12执行成功===");
} }
} }
@ -589,6 +590,7 @@ public class AsynRunTaskService extends BaseService {
webSocketServer.sendtoAll("出库任务车辆从加工炉到提升平台过程中失败。"); webSocketServer.sendtoAll("出库任务车辆从加工炉到提升平台过程中失败。");
} }
} }
//出库起点为缓存区库位终点为提升台 //出库起点为缓存区库位终点为提升台
@Async("asyncServiceExecutor") @Async("asyncServiceExecutor")
public void asynRunOutStock(Long locationId, String yeyaTaiCode, Long vehicleId) throws IOException { public void asynRunOutStock(Long locationId, String yeyaTaiCode, Long vehicleId) throws IOException {
@ -1215,16 +1217,17 @@ public class AsynRunTaskService extends BaseService {
* 多步骤任务除了第一步为清洗炉外,每步都生成炉号 * 多步骤任务除了第一步为清洗炉外,每步都生成炉号
* 单步骤任务都生成炉号 * 单步骤任务都生成炉号
*/ */
private void createStoveCode(CurrTask currTask){ private void createStoveCode(CurrTask currTask) {
if (!(isFirstTask(currTask)&&currTask.getKilnId()==3)) { if (!(isFirstTask(currTask) && currTask.getKilnId() == 3)) {
//String stoveCode = CodeGeneratorHelper.getStoveCode(currTask.getTargetPosition(), currTask.getPlcValue().toString()); //String stoveCode = CodeGeneratorHelper.getStoveCode(currTask.getTargetPosition(), currTask.getPlcValue().toString());
String stoveCode =StoveCodeUtils.getStoveCode(currTask.getTargetPosition(),currTask.getPlcValue()); String stoveCode = StoveCodeUtils.getStoveCode(currTask.getTargetPosition(), currTask.getPlcValue());
currTask.setStoveCode(stoveCode); currTask.setStoveCode(stoveCode);
currTaskServiceBiz.updateById(currTask); currTaskServiceBiz.updateById(currTask);
}else { } else {
logger.info(currTask.getId()+"任务为多步骤任务且第一步为清洗,不生成洗炉炉号."); logger.info(currTask.getId() + "任务为多步骤任务且第一步为清洗,不生成洗炉炉号.");
} }
} }
/** /**
* 上报apms创建生产单并开始处理 * 上报apms创建生产单并开始处理
* *
@ -1250,7 +1253,10 @@ public class AsynRunTaskService extends BaseService {
createItem.setWeight(e.getWeight().doubleValue()); createItem.setWeight(e.getWeight().doubleValue());
createItems.add(createItem); createItems.add(createItem);
}); });
apmsCreateSheet.setStoveCode(code); //apmsCreateSheet.setStoveCode(code);
if (currTask.getStoveCode() != null) {
apmsCreateSheet.setStoveCode(currTask.getStoveCode());
}
apmsCreateSheet.setItems(createItems); apmsCreateSheet.setItems(createItems);
logger.info(currTask.getId() + "开始创建apms生产单号"); logger.info(currTask.getId() + "开始创建apms生产单号");
R<ApmsCreateProcessSheetVo> processSheet = apmsController.createProcessSheet(apmsCreateSheet); R<ApmsCreateProcessSheetVo> processSheet = apmsController.createProcessSheet(apmsCreateSheet);
@ -1263,13 +1269,13 @@ public class AsynRunTaskService extends BaseService {
currTask.setSheetNo(processSheet.getData().getSheetNo()); currTask.setSheetNo(processSheet.getData().getSheetNo());
currTaskServiceBiz.updateById(currTask); currTaskServiceBiz.updateById(currTask);
//多步骤任务除了第一步写入sheetNo //多步骤任务除了第一步写入sheetNo
if (currTask.getIsAuto()==1){ if (currTask.getIsAuto() == 1) {
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTask.getAutoExeTaskId()); AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTask.getAutoExeTaskId());
CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId()); CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId());
secondCurrTask.setSheetNo(currTask.getSheetNo()); secondCurrTask.setSheetNo(currTask.getSheetNo());
currTaskServiceBiz.updateById(secondCurrTask); currTaskServiceBiz.updateById(secondCurrTask);
//三步任务 //三步任务
if (autoExeTask.getProcessFlowType()==2){ if (autoExeTask.getProcessFlowType() == 2) {
CurrTask threeCurrTask = currTaskServiceBiz.getById(autoExeTask.getThTaskId()); CurrTask threeCurrTask = currTaskServiceBiz.getById(autoExeTask.getThTaskId());
threeCurrTask.setSheetNo(currTask.getSheetNo()); threeCurrTask.setSheetNo(currTask.getSheetNo());
currTaskServiceBiz.updateById(threeCurrTask); currTaskServiceBiz.updateById(threeCurrTask);
@ -1281,17 +1287,21 @@ public class AsynRunTaskService extends BaseService {
/** /**
* 上报apms开始加工 * 上报apms开始加工
*
* @param currTask * @param currTask
* @return * @return
*/ */
private Boolean apmsStartProcess(CurrTask currTask) { private Boolean apmsStartProcess(CurrTask currTask) {
String code = kilnInfoServiceBiz.getById(currTask.getKilnId()).getCode(); String code = kilnInfoServiceBiz.getById(currTask.getKilnId()).getCode();
ApmsStartProcess apmsStartProcess=new ApmsStartProcess(); ApmsStartProcess apmsStartProcess = new ApmsStartProcess();
apmsStartProcess.setStartUser("QJJP03"); apmsStartProcess.setStartUser("QJJP03");
apmsStartProcess.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); apmsStartProcess.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
apmsStartProcess.setTechName(currTask.getCraftCodeId().toString()); apmsStartProcess.setTechName(currTask.getCraftCodeId().toString());
apmsStartProcess.setSheetNo(currTask.getSheetNo()); apmsStartProcess.setSheetNo(currTask.getSheetNo());
apmsStartProcess.setStoveCode(code); if (currTask.getStoveCode() != null) {
apmsStartProcess.setStoveCode(currTask.getStoveCode());
}
R<ApmsStartProcess> apmsStartProcessR = apmsController.startProcess(apmsStartProcess); R<ApmsStartProcess> apmsStartProcessR = apmsController.startProcess(apmsStartProcess);
if (apmsStartProcessR.getCode() != 0) { if (apmsStartProcessR.getCode() != 0) {
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms失败"); logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms失败");
@ -1303,10 +1313,11 @@ public class AsynRunTaskService extends BaseService {
/** /**
* 上报apms-end * 上报apms-end
*
* @param currTask * @param currTask
* @return * @return
*/ */
private Boolean apmsEndProcess(CurrTask currTask){ private Boolean apmsEndProcess(CurrTask currTask) {
ApmsEndProcess apmsEndProcess = new ApmsEndProcess(); ApmsEndProcess apmsEndProcess = new ApmsEndProcess();
apmsEndProcess.setEndTime(currTask.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); apmsEndProcess.setEndTime(currTask.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
apmsEndProcess.setEndUser("QJJP03"); apmsEndProcess.setEndUser("QJJP03");
@ -1322,10 +1333,11 @@ public class AsynRunTaskService extends BaseService {
/** /**
* 上报apms-finish * 上报apms-finish
*
* @param currTask * @param currTask
* @return * @return
*/ */
private Boolean apmsFinishProcess(CurrTask currTask){ private Boolean apmsFinishProcess(CurrTask currTask) {
logger.info("任务:" + currTask.getTaskCode() + "开始上报apms完成生产单"); logger.info("任务:" + currTask.getTaskCode() + "开始上报apms完成生产单");
ApmsFinishProcessSheet apmsFinishProcessSheet = new ApmsFinishProcessSheet(); ApmsFinishProcessSheet apmsFinishProcessSheet = new ApmsFinishProcessSheet();
apmsFinishProcessSheet.setSheetNo(currTask.getSheetNo()); apmsFinishProcessSheet.setSheetNo(currTask.getSheetNo());
@ -1350,30 +1362,32 @@ public class AsynRunTaskService extends BaseService {
} }
return true; return true;
} }
/** /**
* 车辆是否在线 * 车辆是否在线
*
* @param vehicleId 车辆id * @param vehicleId 车辆id
* @return true/false * @return true/false
* @throws IOException plc访问失败 * @throws IOException plc访问失败
*/ */
private Boolean rgvOnline(Long vehicleId) throws IOException { private Boolean rgvOnline(Long vehicleId) throws IOException {
String identifier=null; String identifier = null;
if (vehicleId==1){ if (vehicleId == 1) {
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Online"; identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Online";
} }
if (vehicleId==2){ if (vehicleId == 2) {
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Online"; identifier = "S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Online";
} }
Map<String, Object> json = new HashMap(); Map<String, Object> json = new HashMap();
json.put("nameSpace", 6); json.put("nameSpace", 6);
json.put("plcName", "plc1"); json.put("plcName", "plc1");
json.put("identifier",identifier); json.put("identifier", identifier);
String result = null; String result = null;
try { try {
result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json)); result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
logger.info("获取车辆"+vehicleId+"当前是否在线失败"); logger.info("获取车辆" + vehicleId + "当前是否在线失败");
} }
Boolean online = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString()); Boolean online = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
return online; return online;
@ -1381,55 +1395,56 @@ public class AsynRunTaskService extends BaseService {
/** /**
* 传入车辆ID,检查另一辆车是否在线如果在线检查是否位置冲突冲突则避让若另一辆车不在线则不检查是否冲突 * 传入车辆ID,检查另一辆车是否在线如果在线检查是否位置冲突冲突则避让若另一辆车不在线则不检查是否冲突
*
* @param vehicleId * @param vehicleId
* @param currTask * @param currTask
* @throws IOException * @throws IOException
*/ */
private void rgvStatus(Long vehicleId,CurrTask currTask,String startPosition,String targetPosition) throws IOException { private void rgvStatus(Long vehicleId, CurrTask currTask, String startPosition, String targetPosition) throws IOException {
Long currTaskId = currTask.getId(); Long currTaskId = currTask.getId();
if (vehicleId==1){ if (vehicleId == 1) {
Long anotherVehicleId=2L; Long anotherVehicleId = 2L;
Boolean rgv2Online = rgvOnline(anotherVehicleId); Boolean rgv2Online = rgvOnline(anotherVehicleId);
if (rgv2Online){ if (rgv2Online) {
//获取RGV2当前位置 //获取RGV2当前位置
Double rgv2CurrPosition = RGVCurrPosition(2); Double rgv2CurrPosition = RGVCurrPosition(2);
//两辆小车是否冲突 //两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, startPosition, targetPosition, rgv2CurrPosition); Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, startPosition, targetPosition, rgv2CurrPosition);
if (conflictBoolean){ if (conflictBoolean) {
Integer status = moveRgv(2, currTaskId, 2,0); Integer status = moveRgv(2, currTaskId, 2, 0);
logger.info(status.toString()); logger.info(status.toString());
if (status!=1){ if (status != 1) {
logger.info("===执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+anotherVehicleId+"移动到点位2执行失败==="); logger.info("===执行任务:" + currTask.getTaskCode() + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2执行失败===");
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+anotherVehicleId+"移动到点位2执行失败"); webSocketServer.sendtoAll(LocalDateTime.now() + "执行任务:" + currTask.getTaskCode() + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2执行失败");
}else { } else {
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+anotherVehicleId+"移动到点位2执行成功==="); logger.info("===执行任务:" + currTaskId + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2执行成功===");
} }
} }
}else { } else {
logger.info("RGV2不在线跳过检测是否避让。"); logger.info("RGV2不在线跳过检测是否避让。");
} }
}else { } else {
Long anotherVehicleId=1L; Long anotherVehicleId = 1L;
Boolean rgv1Online = rgvOnline(anotherVehicleId); Boolean rgv1Online = rgvOnline(anotherVehicleId);
if (rgv1Online){ if (rgv1Online) {
//获取RGV1当前位置 //获取RGV1当前位置
Double rgv1CurrPosition = RGVCurrPosition(1); Double rgv1CurrPosition = RGVCurrPosition(1);
//两辆小车是否冲突 //两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, startPosition, targetPosition, rgv1CurrPosition); Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, startPosition, targetPosition, rgv1CurrPosition);
if (conflictBoolean){ if (conflictBoolean) {
Integer status = moveRgv(1, currTaskId, 12,0); Integer status = moveRgv(1, currTaskId, 12, 0);
logger.info(status.toString()); logger.info(status.toString());
if (status!=1){ if (status != 1) {
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+anotherVehicleId+"移动到点位12执行失败==="); logger.info("===执行任务:" + currTaskId + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位12执行失败===");
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+anotherVehicleId+"移动到点位12执行失败"); webSocketServer.sendtoAll(LocalDateTime.now() + "执行任务:" + currTask.getTaskCode() + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位12执行失败");
}else { } else {
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+anotherVehicleId+"移动到点位12执行成功==="); logger.info("===执行任务:" + currTaskId + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位12执行成功===");
} }
} }
}else { } else {
logger.info("RGV1不在线跳过检测是否避让。"); logger.info("RGV1不在线跳过检测是否避让。");
} }
} }
@ -1437,14 +1452,15 @@ public class AsynRunTaskService extends BaseService {
/** /**
* 判断任务是否为单步骤任务多步骤任务第一步 * 判断任务是否为单步骤任务多步骤任务第一步
*
* @param currTask 任务 * @param currTask 任务
* @return 单步骤任务true多步骤任务第一步true,其他false * @return 单步骤任务true多步骤任务第一步true,其他false
*/ */
public Boolean isFirstTask(CurrTask currTask){ public Boolean isFirstTask(CurrTask currTask) {
if (currTask.getIsAuto()==1){ if (currTask.getIsAuto() == 1) {
int count = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTask.getId())); int count = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTask.getId()));
return count>0; return count > 0;
}else { } else {
return true; return true;
} }
} }