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