|
|
|
|
@ -189,13 +189,13 @@ public class RCSUtil { |
|
|
|
|
* @return {@code Result} |
|
|
|
|
*/ |
|
|
|
|
public synchronized Result rcsCreateTask(RcsCreateTaskDto dto) { |
|
|
|
|
log.info("AGV下发任务信息:"+JsonUtil.toJSONString(dto)); |
|
|
|
|
if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get(RedisConstant.out17+dto.getTaskId()))){ |
|
|
|
|
return Result.err().msg("此任务已经下发至rcs任务号:"+dto.getTaskId()); |
|
|
|
|
log.info("AGV下发任务信息:" + JsonUtil.toJSONString(dto)); |
|
|
|
|
if (ObjectUtils.isNotEmpty(redisTemplate.opsForValue().get(RedisConstant.out17 + dto.getTaskId()))) { |
|
|
|
|
return Result.err().msg("此任务已经下发至rcs任务号:" + dto.getTaskId()); |
|
|
|
|
} |
|
|
|
|
//获取任务详细信息,下发给RCS设置行号
|
|
|
|
|
BusinDataTask businDataTask = iBusinDataTaskService.getById(dto.getTaskId()); |
|
|
|
|
if (StringUtils.isNotEmpty(businDataTask.getToRow())){ |
|
|
|
|
if (StringUtils.isNotEmpty(businDataTask.getToRow())) { |
|
|
|
|
dto.setStation(businDataTask.getToRow()); |
|
|
|
|
} |
|
|
|
|
String json = JSONObject.toJSONString(dto); |
|
|
|
|
@ -205,10 +205,10 @@ public class RCSUtil { |
|
|
|
|
.addHeaders(headerMap) |
|
|
|
|
.body(json) |
|
|
|
|
.execute().body(); |
|
|
|
|
log.info(dto.getTaskId() + "AGV下发任务返回结果:"+res); |
|
|
|
|
log.info(dto.getTaskId() + "AGV下发任务返回结果:" + res); |
|
|
|
|
Result result = parseThirdRcsResult(res); |
|
|
|
|
if (result.getCode() == 200){ |
|
|
|
|
redisTemplate.opsForValue().set(RedisConstant.out17+dto.getTaskId(),result.toString()); |
|
|
|
|
if (result.getCode() == 200) { |
|
|
|
|
redisTemplate.opsForValue().set(RedisConstant.out17 + dto.getTaskId(), result.toString()); |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
@ -217,34 +217,35 @@ public class RCSUtil { |
|
|
|
|
return Result.err().msg(e.getMessage()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 更改AGV点位信息 |
|
|
|
|
*/ |
|
|
|
|
public Result removePoint(AGVUploadStatusBo bo){ |
|
|
|
|
log.info("AGV更新点位信息:"+JsonUtil.toJSONString(bo)); |
|
|
|
|
public Result removePoint(AGVUploadStatusBo bo) { |
|
|
|
|
log.info("AGV更新点位信息:" + JsonUtil.toJSONString(bo)); |
|
|
|
|
BusinDataTask byId = iBusinDataTaskService.getById(bo.getTaskId()); |
|
|
|
|
String sn = bo.getSn(); |
|
|
|
|
if (ObjectUtils.isNotEmpty(byId)) { |
|
|
|
|
Map map =new HashMap(); |
|
|
|
|
map.put("taskId",byId.getId()); |
|
|
|
|
Map map = new HashMap(); |
|
|
|
|
map.put("taskId", byId.getId()); |
|
|
|
|
Result result = new Result(); |
|
|
|
|
result.setCode(0); |
|
|
|
|
List list = new ArrayList(); |
|
|
|
|
if (StringUtils.isEmpty(byId.getNewDestination())){ |
|
|
|
|
if (StringUtils.isEmpty(byId.getNewDestination())) { |
|
|
|
|
return Result.err(); |
|
|
|
|
} |
|
|
|
|
if (!"1".equals(byId.getTaskStatus())){ |
|
|
|
|
if (!"1".equals(byId.getTaskStatus())) { |
|
|
|
|
return Result.err(); |
|
|
|
|
} |
|
|
|
|
Map points = (Map) JSON.parse(byId.getPoints()); |
|
|
|
|
int pointnumber= points.size(); |
|
|
|
|
if (pointnumber>Integer.valueOf(sn)) { |
|
|
|
|
int pointnumber = points.size(); |
|
|
|
|
if (pointnumber > Integer.valueOf(sn)) { |
|
|
|
|
Map<Object, Object> mapSn = new HashMap<>(); |
|
|
|
|
mapSn.put("sn", pointnumber); |
|
|
|
|
mapSn.put("id", byId.getNewDestination()); |
|
|
|
|
mapSn.put("action", "singleMove"); |
|
|
|
|
list.add(mapSn); |
|
|
|
|
return result.data(list); |
|
|
|
|
return result.data(list); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
@ -328,7 +329,7 @@ public class RCSUtil { |
|
|
|
|
RcsCreateTaskDto dto = new RcsCreateTaskDto(); |
|
|
|
|
dto.setMapId(1); |
|
|
|
|
dto.setTaskType(bo.getTaskType()); |
|
|
|
|
if (StringUtils.isNotEmpty(bo.getRobotId())){ |
|
|
|
|
if (StringUtils.isNotEmpty(bo.getRobotId())) { |
|
|
|
|
dto.setRobotId(bo.getRobotId()); |
|
|
|
|
} |
|
|
|
|
dto.setTaskId(bo.getTaskId().toString()); |
|
|
|
|
@ -346,11 +347,11 @@ public class RCSUtil { |
|
|
|
|
// return Result.ok();
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Result<Boolean> moveByAGV(AGVMoveBo bo,String toRow) { |
|
|
|
|
public Result<Boolean> moveByAGV(AGVMoveBo bo, String toRow) { |
|
|
|
|
RcsCreateTaskDto dto = new RcsCreateTaskDto(); |
|
|
|
|
dto.setMapId(1); |
|
|
|
|
dto.setTaskType(bo.getTaskType()); |
|
|
|
|
if (StringUtils.isNotEmpty(bo.getRobotId())){ |
|
|
|
|
if (StringUtils.isNotEmpty(bo.getRobotId())) { |
|
|
|
|
dto.setRobotId(bo.getRobotId()); |
|
|
|
|
} |
|
|
|
|
dto.setTaskId(bo.getTaskId().toString()); |
|
|
|
|
@ -373,10 +374,9 @@ public class RCSUtil { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Result<Boolean> moveByAGVTmp(BusinTaskQueryBo bo) { |
|
|
|
|
//呼叫AGV
|
|
|
|
|
String targetPoint = isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putin_point); |
|
|
|
|
String targetPoint = isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putin_point); |
|
|
|
|
String tmpPoint = isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point_tmp); |
|
|
|
|
String startPoint = isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.target_point); |
|
|
|
|
|
|
|
|
|
@ -396,18 +396,18 @@ public class RCSUtil { |
|
|
|
|
businTaskAddBo.setTaskCode(taskCode); |
|
|
|
|
businTaskAddBo.setAgvNo(agvNo); |
|
|
|
|
|
|
|
|
|
Map<String,String> snPointMap = new HashMap<>(3); |
|
|
|
|
snPointMap.put("1",startPoint); |
|
|
|
|
snPointMap.put("2",tmpPoint); |
|
|
|
|
snPointMap.put("3",tmpPoint); |
|
|
|
|
snPointMap.put("4",targetPoint); |
|
|
|
|
Map<String, String> snPointMap = new HashMap<>(3); |
|
|
|
|
snPointMap.put("1", startPoint); |
|
|
|
|
snPointMap.put("2", tmpPoint); |
|
|
|
|
snPointMap.put("3", tmpPoint); |
|
|
|
|
snPointMap.put("4", targetPoint); |
|
|
|
|
|
|
|
|
|
//新增任务单据
|
|
|
|
|
businTaskAddBo.setTaskStatus("1"); |
|
|
|
|
businTaskAddBo.setPoints(JsonUtil.toJSONString(snPointMap)); |
|
|
|
|
BusinDataTask businDataTask = BeanUtil.toBean(businTaskAddBo, BusinDataTask.class); |
|
|
|
|
iBusinDataTaskService.insertBusinDataTask(businDataTask); |
|
|
|
|
Long taskId =businDataTask.getId(); |
|
|
|
|
Long taskId = businDataTask.getId(); |
|
|
|
|
RcsCreateTaskDto dto = new RcsCreateTaskDto(); |
|
|
|
|
dto.setMapId(1); |
|
|
|
|
dto.setTaskType(25); |
|
|
|
|
@ -429,7 +429,7 @@ public class RCSUtil { |
|
|
|
|
idList.add(midIdTwo); |
|
|
|
|
idList.add(endId); |
|
|
|
|
dto.setTargets(idList); |
|
|
|
|
return rcsCreateTask(dto); |
|
|
|
|
return rcsCreateTask(dto); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -449,10 +449,9 @@ public class RCSUtil { |
|
|
|
|
//获取AGV状态信息 推送前端及存储数据库及存储redis
|
|
|
|
|
res = res.trim(); |
|
|
|
|
RcsThirdResult thirdResult = JSONObject.parseObject(res, RcsThirdResult.class); |
|
|
|
|
if (thirdResult.getCode() == 0){ |
|
|
|
|
if (thirdResult.getCode() == 0) { |
|
|
|
|
return Result.ok().data(thirdResult.getData()).msg(thirdResult.getComment()); |
|
|
|
|
}else |
|
|
|
|
{ |
|
|
|
|
} else { |
|
|
|
|
return Result.err().msg(thirdResult.getComment()); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
@ -510,17 +509,18 @@ public class RCSUtil { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据任务ID检查是否紧急出库 |
|
|
|
|
* |
|
|
|
|
* @param taskId |
|
|
|
|
*/ |
|
|
|
|
public void checkEmergencyOutbound(Long taskId){ |
|
|
|
|
public void checkEmergencyOutbound(Long taskId) { |
|
|
|
|
List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = null; |
|
|
|
|
BusinDataTask businDataTask = businDataTaskMapper.selectById(taskId); |
|
|
|
|
if (businDataTask != null){ |
|
|
|
|
if (businDataTask != null) { |
|
|
|
|
String taskType = businDataTask.getTaskType(); |
|
|
|
|
//是否是紧急出库
|
|
|
|
|
if(taskType.equals(TaskTypeEnum.urgent_out.getValue())){ |
|
|
|
|
if (taskType.equals(TaskTypeEnum.urgent_out.getValue())) { |
|
|
|
|
//查询物料明细
|
|
|
|
|
businDataTaskGoodsVos = businDataTaskGoodsMapper.getTaskGoodsByTaskCodeForOut(taskId); |
|
|
|
|
businDataTaskGoodsVos = businDataTaskGoodsMapper.getTaskGoodsByTaskCodeForOut(taskId); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
redisTemplate.opsForValue().set(RedisConstant.redisEmergencyOutbound, businDataTaskGoodsVos); |
|
|
|
|
@ -534,71 +534,73 @@ public class RCSUtil { |
|
|
|
|
* @return {@code Result} |
|
|
|
|
*/ |
|
|
|
|
public Result uploadAgvTaskStatusTmp(AGVUploadStatusBo bo) { |
|
|
|
|
log.info("AGV上报信息:"+JsonUtil.toJSONString(bo)); |
|
|
|
|
log.info("AGV上报信息:" + JsonUtil.toJSONString(bo)); |
|
|
|
|
Long taskID = null; |
|
|
|
|
String[] idArr = bo.getTaskId().split("_"); |
|
|
|
|
if(idArr.length > 1){ |
|
|
|
|
if (idArr.length > 1) { |
|
|
|
|
taskID = Long.valueOf(idArr[0]); |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
taskID = Long.valueOf(bo.getTaskId()); |
|
|
|
|
} |
|
|
|
|
BusinDataTask businDataTask = businDataTaskMapper.selectById(taskID); |
|
|
|
|
if (businDataTask == null){ |
|
|
|
|
return Result.err().msg("当前任务号未找到任务信息:"+taskID); |
|
|
|
|
if (businDataTask == null) { |
|
|
|
|
return Result.err().msg("当前任务号未找到任务信息:" + taskID); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String taskType = businDataTask.getTaskType(); |
|
|
|
|
//log.info("AGV上报数据查询到的任务信息:" + JsonUtil.toJSONString(businDataTask));
|
|
|
|
|
String tunnl=null; |
|
|
|
|
tunnl=businDataTask.getTunnel(); |
|
|
|
|
String tunnl = null; |
|
|
|
|
tunnl = businDataTask.getTunnel(); |
|
|
|
|
Long plcId = businDataTask.getPlcId(); |
|
|
|
|
Long DPSplcId=businDataTask.getDpsNoOne(); |
|
|
|
|
if (StringUtils.isNotEmpty(tunnl)&&(plcId==null||!bo.getSn().equals("2"))&&!"15".equals(businDataTask.getTaskType())){ |
|
|
|
|
plcId=DPSplcId; |
|
|
|
|
} |
|
|
|
|
if("15".equals(businDataTask.getTaskType())){ |
|
|
|
|
if(bo.getSn().equals("2")){ |
|
|
|
|
Long DPSplcId = businDataTask.getDpsNoOne(); |
|
|
|
|
if (StringUtils.isNotEmpty(tunnl) && (plcId == null || !bo.getSn().equals("2")) && !"15".equals(taskType)) { |
|
|
|
|
plcId = DPSplcId; |
|
|
|
|
} |
|
|
|
|
if ("15".equals(taskType)) { |
|
|
|
|
if (bo.getSn().equals("2")) { |
|
|
|
|
plcId = 39L; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if("1".equals(businDataTask.getTaskType())){ |
|
|
|
|
if(2 < Integer.parseInt(bo.getSn())){ |
|
|
|
|
if ("1".equals(taskType)) { |
|
|
|
|
if (2 < Integer.parseInt(bo.getSn())) { |
|
|
|
|
plcId = 39L; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
String points = businDataTask.getPoints(); |
|
|
|
|
Map<String, String> agvMap = new HashMap<>(); |
|
|
|
|
if(StringUtils.isNotEmpty(points)){ |
|
|
|
|
if (StringUtils.isNotEmpty(points)) { |
|
|
|
|
agvMap = JsonUtil.JsonStrToMap(points); |
|
|
|
|
} |
|
|
|
|
log.info("AGV的点位信息:"+agvMap.toString()); |
|
|
|
|
log.info("AGV的点位信息:" + agvMap.toString()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WcsPlcConnect conn = iWcsPlcConnectService.selectWcsPlcConnectById(plcId); |
|
|
|
|
String readAddress = ""; |
|
|
|
|
String readValueType = ""; |
|
|
|
|
String agvPoint=""; |
|
|
|
|
String agvPoint = ""; |
|
|
|
|
|
|
|
|
|
String putAddress = ""; |
|
|
|
|
String putAddressVtype = ""; |
|
|
|
|
String putAgvPoint =""; |
|
|
|
|
String putAgvPoint = ""; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String TaskAddress=""; |
|
|
|
|
String TaskddressVtype=""; |
|
|
|
|
String TaskPoint=""; |
|
|
|
|
String TaskAddress = ""; |
|
|
|
|
String TaskddressVtype = ""; |
|
|
|
|
String TaskPoint = ""; |
|
|
|
|
|
|
|
|
|
String overAddress=""; |
|
|
|
|
String overValueType=""; |
|
|
|
|
String overputAgvPoint=""; |
|
|
|
|
String overAddress = ""; |
|
|
|
|
String overValueType = ""; |
|
|
|
|
String overputAgvPoint = ""; |
|
|
|
|
|
|
|
|
|
String waringWaitpoint=""; |
|
|
|
|
String waringWaitpointType=""; |
|
|
|
|
String waringWaitpoint = ""; |
|
|
|
|
String waringWaitpointType = ""; |
|
|
|
|
|
|
|
|
|
Result result = new Result(); |
|
|
|
|
result.setCode(200); |
|
|
|
|
result.setResult(true); |
|
|
|
|
|
|
|
|
|
//空治具回库
|
|
|
|
|
if (businDataTask.getTaskType().equals(TaskTypeEnum.emptyCon.getValue())){ |
|
|
|
|
if (taskType.equals(TaskTypeEnum.emptyCon.getValue())) { |
|
|
|
|
BusinDataTask fontbusinDataTask = businDataTaskMapper.selectfrontById(businDataTask); |
|
|
|
|
if (ObjectUtils.isNotEmpty(fontbusinDataTask)) { |
|
|
|
|
QueryWrapper<BusinPickup> pickupQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
@ -606,7 +608,7 @@ public class RCSUtil { |
|
|
|
|
List<BusinPickup> businPickupList = businPickupMapper.selectList(pickupQueryWrapper); |
|
|
|
|
if (businPickupList.size() > 0) { |
|
|
|
|
BusinPickup businPickup = businPickupList.get(0); |
|
|
|
|
log.info("空治具回库时,释放码头点位信息:"+JsonUtil.toJSONString(businPickup)); |
|
|
|
|
log.info("空治具回库时,释放码头点位信息:" + JsonUtil.toJSONString(businPickup)); |
|
|
|
|
BasePoint basePoint = iBasePointService.selectBasePointById(Long.valueOf(businPickup.getPointNo())); |
|
|
|
|
basePoint.setIsActive("1"); |
|
|
|
|
basePoint.setIsOccupy("0"); |
|
|
|
|
@ -620,56 +622,55 @@ public class RCSUtil { |
|
|
|
|
/** |
|
|
|
|
* 只针对机械手输送线和立库输送线 |
|
|
|
|
*/ |
|
|
|
|
if (wcsPlcProperty.getPointType().equals("8") ) { |
|
|
|
|
if (StringUtils.isNotEmpty(tunnl)&&(wcsPlcProperty.getTunnel()).equals(tunnl)){ |
|
|
|
|
if (wcsPlcProperty.getPointType().equals("8")) { |
|
|
|
|
if (StringUtils.isNotEmpty(tunnl) && (wcsPlcProperty.getTunnel()).equals(tunnl)) { |
|
|
|
|
//放料完成点位
|
|
|
|
|
putAddress = wcsPlcProperty.getAddress(); |
|
|
|
|
putAddressVtype = wcsPlcProperty.getValueType(); |
|
|
|
|
agvPoint =wcsPlcProperty.getRelPoint(); |
|
|
|
|
}else if (StringUtils.isEmpty(tunnl)){ |
|
|
|
|
agvPoint = wcsPlcProperty.getRelPoint(); |
|
|
|
|
} else if (StringUtils.isEmpty(tunnl)) { |
|
|
|
|
//放料完成点位
|
|
|
|
|
putAddress = wcsPlcProperty.getAddress(); |
|
|
|
|
putAddressVtype = wcsPlcProperty.getValueType(); |
|
|
|
|
agvPoint = wcsPlcProperty.getRelPoint(); |
|
|
|
|
}else if (businDataTask.getTaskType().equals("15")){ |
|
|
|
|
} else if (taskType.equals("15")) { |
|
|
|
|
putAddress = wcsPlcProperty.getAddress(); |
|
|
|
|
putAddressVtype = wcsPlcProperty.getValueType(); |
|
|
|
|
agvPoint =wcsPlcProperty.getRelPoint(); |
|
|
|
|
agvPoint = wcsPlcProperty.getRelPoint(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else if (wcsPlcProperty.getPointType().equals("1") ) { |
|
|
|
|
if (StringUtils.isNotEmpty(tunnl)&&(wcsPlcProperty.getTunnel()).equals(tunnl)){ |
|
|
|
|
//点位类型=1,是否允许放料
|
|
|
|
|
readAddress = wcsPlcProperty.getAddress(); |
|
|
|
|
readValueType = wcsPlcProperty.getValueType(); |
|
|
|
|
putAgvPoint=wcsPlcProperty.getRelPoint(); |
|
|
|
|
}else if (StringUtils.isEmpty(tunnl)){ |
|
|
|
|
} else if (wcsPlcProperty.getPointType().equals("1")) { |
|
|
|
|
if (StringUtils.isNotEmpty(tunnl) && (wcsPlcProperty.getTunnel()).equals(tunnl)) { |
|
|
|
|
//点位类型=1,是否允许放料
|
|
|
|
|
readAddress = wcsPlcProperty.getAddress(); |
|
|
|
|
readValueType = wcsPlcProperty.getValueType(); |
|
|
|
|
putAgvPoint = wcsPlcProperty.getRelPoint(); |
|
|
|
|
} else if (StringUtils.isEmpty(tunnl)) { |
|
|
|
|
//点位类型=1,是否允许放料
|
|
|
|
|
readAddress = wcsPlcProperty.getAddress(); |
|
|
|
|
readValueType = wcsPlcProperty.getValueType(); |
|
|
|
|
putAgvPoint=wcsPlcProperty.getRelPoint(); |
|
|
|
|
putAgvPoint = wcsPlcProperty.getRelPoint(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}else if(wcsPlcProperty.getPointType().equals("6") && StringUtils.isNotEmpty(tunnl)&&(wcsPlcProperty.getTunnel()).equals(tunnl)){ |
|
|
|
|
} else if (wcsPlcProperty.getPointType().equals("6") && StringUtils.isNotEmpty(tunnl) && (wcsPlcProperty.getTunnel()).equals(tunnl)) { |
|
|
|
|
//请求入库
|
|
|
|
|
//只针对立库输送线
|
|
|
|
|
TaskAddress= wcsPlcProperty.getAddress(); |
|
|
|
|
TaskddressVtype=wcsPlcProperty.getValueType(); |
|
|
|
|
TaskPoint=wcsPlcProperty.getRelPoint(); |
|
|
|
|
} |
|
|
|
|
else if(wcsPlcProperty.getPointType().equals("7")){ |
|
|
|
|
if (StringUtils.isNotEmpty(tunnl)&&(wcsPlcProperty.getTunnel()).equals(tunnl)||wcsPlcProperty.getTunnel().equals("0")){ |
|
|
|
|
TaskAddress = wcsPlcProperty.getAddress(); |
|
|
|
|
TaskddressVtype = wcsPlcProperty.getValueType(); |
|
|
|
|
TaskPoint = wcsPlcProperty.getRelPoint(); |
|
|
|
|
} else if (wcsPlcProperty.getPointType().equals("7")) { |
|
|
|
|
if (StringUtils.isNotEmpty(tunnl) && (wcsPlcProperty.getTunnel()).equals(tunnl) || wcsPlcProperty.getTunnel().equals("0")) { |
|
|
|
|
//点位类型=7,取料完成
|
|
|
|
|
overAddress = wcsPlcProperty.getAddress(); |
|
|
|
|
overValueType = wcsPlcProperty.getValueType(); |
|
|
|
|
overputAgvPoint=wcsPlcProperty.getRelPoint(); |
|
|
|
|
}else if (StringUtils.isEmpty(tunnl)){ |
|
|
|
|
overputAgvPoint = wcsPlcProperty.getRelPoint(); |
|
|
|
|
} else if (StringUtils.isEmpty(tunnl)) { |
|
|
|
|
//点位类型=7,取料完成
|
|
|
|
|
overAddress = wcsPlcProperty.getAddress(); |
|
|
|
|
overValueType = wcsPlcProperty.getValueType(); |
|
|
|
|
overputAgvPoint=wcsPlcProperty.getRelPoint(); |
|
|
|
|
overputAgvPoint = wcsPlcProperty.getRelPoint(); |
|
|
|
|
} |
|
|
|
|
}else if(wcsPlcProperty.getPointType().equals("wait")){ |
|
|
|
|
} else if (wcsPlcProperty.getPointType().equals("wait")) { |
|
|
|
|
waringWaitpoint = wcsPlcProperty.getAddress(); |
|
|
|
|
waringWaitpointType = wcsPlcProperty.getValueType(); |
|
|
|
|
} |
|
|
|
|
@ -700,60 +701,60 @@ public class RCSUtil { |
|
|
|
|
Map allWriteMap = new HashMap(2); |
|
|
|
|
|
|
|
|
|
Map overWriteMap = new HashMap(2); |
|
|
|
|
log.info("overputAgvPoint:"+overputAgvPoint); |
|
|
|
|
log.info("overputAgvPoint:" + overputAgvPoint); |
|
|
|
|
//写入agv取货完成
|
|
|
|
|
if(StringUtils.isNotEmpty(overputAgvPoint)) { |
|
|
|
|
if (StringUtils.isNotEmpty(overputAgvPoint)) { |
|
|
|
|
if (bo.getStatus().equals("completed") && overputAgvPoint.equals(taskAgvpoint)) { |
|
|
|
|
|
|
|
|
|
Map writeMap = new HashMap(1); |
|
|
|
|
writeMap.put(overValueType, "true"); |
|
|
|
|
overWriteMap.put(overAddress, writeMap); |
|
|
|
|
Boolean over = plcReadAndWrite.execWrite(plcOperate, JSON.toJSONString(overWriteMap)); |
|
|
|
|
int i=0; |
|
|
|
|
while (!over&&i<50){ |
|
|
|
|
int i = 0; |
|
|
|
|
while (!over && i < 50) { |
|
|
|
|
over = plcReadAndWrite.execWrite(plcOperate, JSON.toJSONString(overWriteMap)); |
|
|
|
|
i++; |
|
|
|
|
} |
|
|
|
|
log.info("是否取货完成"+over+" 取货完成点位:"+overputAgvPoint+" 任务号:"+bo.getTaskId()+" 写入次数:"+i+" 写入点位:"+overAddress); |
|
|
|
|
log.info("是否取货完成" + over + " 取货完成点位:" + overputAgvPoint + " 任务号:" + bo.getTaskId() + " 写入次数:" + i + " 写入点位:" + overAddress); |
|
|
|
|
|
|
|
|
|
if (businDataTask.getTaskPath().equals(ParameterConstants.ParameterSystem.assemble_point_before) |
|
|
|
|
|| businDataTask.getTaskPath().equals(ParameterConstants.ParameterSystem.assemble_point_after)) { |
|
|
|
|
int temp = 0; |
|
|
|
|
String assemblePointType = RedisConstant.assemblePointBeforeTaskCount; |
|
|
|
|
//小组装等待点位为一个,设置等待数也只需要一个
|
|
|
|
|
if(businDataTask.getTaskPath().equals(ParameterConstants.ParameterSystem.assemble_point_after)){ |
|
|
|
|
if (businDataTask.getTaskPath().equals(ParameterConstants.ParameterSystem.assemble_point_after)) { |
|
|
|
|
assemblePointType = RedisConstant.assemblePointAfterTaskCount; |
|
|
|
|
} |
|
|
|
|
if (ObjectUtils.isEmpty(redisTemplate.opsForValue().get(assemblePointType))) { |
|
|
|
|
redisTemplate.opsForValue().set(assemblePointType, 1); |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
temp = Integer.parseInt(redisTemplate.opsForValue().get(assemblePointType).toString()); |
|
|
|
|
if (temp < 3) { |
|
|
|
|
redisTemplate.opsForValue().set(assemblePointType, ++temp); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
log.info("添加小组装等待数完成!点位:"+assemblePointType+"数量为:" + temp); |
|
|
|
|
log.info("添加小组装等待数完成!点位:" + assemblePointType + "数量为:" + temp); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//到达紧急出库点位时调用checkEmergencyOutbound方法
|
|
|
|
|
String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.urgency_out_point); |
|
|
|
|
BasePointDeviceQueryBo pointQueryBo = new BasePointDeviceQueryBo(); |
|
|
|
|
String outPoint =""; |
|
|
|
|
String outPoint = ""; |
|
|
|
|
|
|
|
|
|
pointQueryBo.setGroupNo(tepairGroup); |
|
|
|
|
BasePointDeviceVo pointDeviceout = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBo); |
|
|
|
|
if (pointDeviceout==null){ |
|
|
|
|
if (pointDeviceout == null) { |
|
|
|
|
log.info("请维护紧急出库接驳点"); |
|
|
|
|
} |
|
|
|
|
outPoint=pointDeviceout.getPointNo(); |
|
|
|
|
outPoint = pointDeviceout.getPointNo(); |
|
|
|
|
if (bo.getStatus().equals("completed") && outPoint.equals(taskAgvpoint)) { |
|
|
|
|
checkEmergencyOutbound(Long.valueOf(bo.getTaskId())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//放置治具完成状态,回填AGV放置治具完成状态
|
|
|
|
|
log.info("agvPoint:"+agvPoint); |
|
|
|
|
log.info("taskAgvPoint:"+taskAgvpoint); |
|
|
|
|
log.info("agvPoint:" + agvPoint); |
|
|
|
|
log.info("taskAgvPoint:" + taskAgvpoint); |
|
|
|
|
if (bo.getStatus().equals("completed") && agvPoint.equals(taskAgvpoint)) { |
|
|
|
|
Map writeMap = new HashMap(1); |
|
|
|
|
writeMap.put(putAddressVtype, "true"); |
|
|
|
|
@ -761,36 +762,36 @@ public class RCSUtil { |
|
|
|
|
* A-->b-->c场景不适用写入 |
|
|
|
|
*/ |
|
|
|
|
allWriteMap.put(putAddress, writeMap); |
|
|
|
|
if (tunnl != ""&&tunnl!=null && !businDataTask.getTaskType().equals("15")) { |
|
|
|
|
if (tunnl != "" && tunnl != null && !taskType.equals("15")) { |
|
|
|
|
Map taskidMap = new HashMap(1); |
|
|
|
|
Map TaskwriteMap = new HashMap(1); |
|
|
|
|
TaskwriteMap.put(TaskddressVtype, bo.getTaskId()); |
|
|
|
|
taskidMap.put(TaskAddress, TaskwriteMap); |
|
|
|
|
Boolean aBoolean=plcReadAndWrite.execWrite(plcOperate, JSON.toJSONString(taskidMap)); |
|
|
|
|
int i=0; |
|
|
|
|
while (!aBoolean&&i<50) { |
|
|
|
|
Boolean aBoolean = plcReadAndWrite.execWrite(plcOperate, JSON.toJSONString(taskidMap)); |
|
|
|
|
int i = 0; |
|
|
|
|
while (!aBoolean && i < 50) { |
|
|
|
|
aBoolean = plcReadAndWrite.execWrite(plcOperate, JSON.toJSONString(taskidMap)); |
|
|
|
|
i++; |
|
|
|
|
} |
|
|
|
|
log.info("写入放货完成任务号是否成功:"+aBoolean+" 任务号:"+bo.getTaskId()+" 写入次数:"+i+" 写入内容:"+TaskAddress); |
|
|
|
|
log.info("写入放货完成任务号是否成功:" + aBoolean + " 任务号:" + bo.getTaskId() + " 写入次数:" + i + " 写入内容:" + TaskAddress); |
|
|
|
|
} |
|
|
|
|
Boolean aBoolean=plcReadAndWrite.execWrite(plcOperate, JSON.toJSONString(allWriteMap)); |
|
|
|
|
int i=0; |
|
|
|
|
while (!aBoolean&&i<50) { |
|
|
|
|
Boolean aBoolean = plcReadAndWrite.execWrite(plcOperate, JSON.toJSONString(allWriteMap)); |
|
|
|
|
int i = 0; |
|
|
|
|
while (!aBoolean && i < 50) { |
|
|
|
|
aBoolean = plcReadAndWrite.execWrite(plcOperate, JSON.toJSONString(allWriteMap)); |
|
|
|
|
i++; |
|
|
|
|
} |
|
|
|
|
log.info("写入放货完成是否成功:"+aBoolean+" 任务号:"+bo.getTaskId()+" 写入次数:"+i+" 写入的点位:"+putAddress); |
|
|
|
|
log.info("写入放货完成是否成功:" + aBoolean + " 任务号:" + bo.getTaskId() + " 写入次数:" + i + " 写入的点位:" + putAddress); |
|
|
|
|
|
|
|
|
|
if(TaskTypeEnum.mechainical.getValue().equals(businDataTask.getTaskType())|| TaskTypeEnum.emptyContainer_out.getValue().equals(businDataTask.getTaskType())){ |
|
|
|
|
if (TaskTypeEnum.mechainical.getValue().equals(taskType) || TaskTypeEnum.emptyContainer_out.getValue().equals(taskType)) { |
|
|
|
|
BusinDpscontainerRecord oneByTask = businDpsContainerRecordMapper.selectByTaskid(String.valueOf(businDataTask.getId())); |
|
|
|
|
oneByTask.setIsState("3"); |
|
|
|
|
businDpsContainerRecordMapper.updateById(oneByTask); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if (TaskTypeEnum.emptyCon.getValue().equals(businDataTask.getTaskType()) || |
|
|
|
|
TaskTypeEnum.mechainical.getValue().equals(businDataTask.getTaskType()) |
|
|
|
|
||TaskTypeEnum.emptyContainer_out.getValue().equals(businDataTask.getTaskType())) { |
|
|
|
|
if (TaskTypeEnum.emptyCon.getValue().equals(taskType) || |
|
|
|
|
TaskTypeEnum.mechainical.getValue().equals(taskType) |
|
|
|
|
|| TaskTypeEnum.emptyContainer_out.getValue().equals(taskType)) { |
|
|
|
|
//更改任务状态为已完成
|
|
|
|
|
businDataTask.setTaskStatus("2"); |
|
|
|
|
businDataTaskMapper.updateById(businDataTask); |
|
|
|
|
@ -807,35 +808,35 @@ public class RCSUtil { |
|
|
|
|
// 4#入口 DB320.2.8
|
|
|
|
|
// 5#入口 DB320.2.10
|
|
|
|
|
// 6#入口 DB320.2.12
|
|
|
|
|
if ("KW5".equals(businDataTask.getTaskPath())){ |
|
|
|
|
write1.put("Boolean","true"); |
|
|
|
|
if ("KW5".equals(businDataTask.getTaskPath())) { |
|
|
|
|
write1.put("Boolean", "true"); |
|
|
|
|
allHbMap.put("DB320.2.2", write1); |
|
|
|
|
} |
|
|
|
|
if ("KW7".equals(businDataTask.getTaskPath())){ |
|
|
|
|
write1.put("Boolean","true"); |
|
|
|
|
if ("KW7".equals(businDataTask.getTaskPath())) { |
|
|
|
|
write1.put("Boolean", "true"); |
|
|
|
|
allHbMap.put("DB320.2.4", write1); |
|
|
|
|
} |
|
|
|
|
if ("KW9".equals(businDataTask.getTaskPath())){ |
|
|
|
|
write1.put("Boolean","true"); |
|
|
|
|
if ("KW9".equals(businDataTask.getTaskPath())) { |
|
|
|
|
write1.put("Boolean", "true"); |
|
|
|
|
allHbMap.put("DB320.2.5", write1); |
|
|
|
|
} |
|
|
|
|
if ("KW22".equals(businDataTask.getTaskPath())){ |
|
|
|
|
write1.put("Boolean","true"); |
|
|
|
|
if ("KW22".equals(businDataTask.getTaskPath())) { |
|
|
|
|
write1.put("Boolean", "true"); |
|
|
|
|
allHbMap.put("DB320.2.8", write1); |
|
|
|
|
} |
|
|
|
|
if ("KW24".equals(businDataTask.getTaskPath())){ |
|
|
|
|
write1.put("Boolean","true"); |
|
|
|
|
if ("KW24".equals(businDataTask.getTaskPath())) { |
|
|
|
|
write1.put("Boolean", "true"); |
|
|
|
|
allHbMap.put("DB320.2.10", write1); |
|
|
|
|
} |
|
|
|
|
if ("KW26".equals(businDataTask.getTaskPath())){ |
|
|
|
|
write1.put("Boolean","true"); |
|
|
|
|
if ("KW26".equals(businDataTask.getTaskPath())) { |
|
|
|
|
write1.put("Boolean", "true"); |
|
|
|
|
allHbMap.put("DB320.2.12", write1); |
|
|
|
|
} |
|
|
|
|
String writePoint = JSON.toJSONString(allHbMap); |
|
|
|
|
PlcOperate plcOperateWrite =plcInit.getPlcOperateByIp(conn1.getPlcIp()); |
|
|
|
|
PlcOperate plcOperateWrite = plcInit.getPlcOperateByIp(conn1.getPlcIp()); |
|
|
|
|
Boolean execWrite = plcReadAndWrite.execWrite(plcOperateWrite, writePoint); |
|
|
|
|
if (execWrite){ |
|
|
|
|
log.info("++++++++++++" + businDataTask.getTaskPath()+"打开安全光电成功"); |
|
|
|
|
if (execWrite) { |
|
|
|
|
log.info("++++++++++++" + businDataTask.getTaskPath() + "打开安全光电成功"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return Result.ok(); |
|
|
|
|
@ -997,24 +998,23 @@ public class RCSUtil { |
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String assemblePointGroupBefore = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.Manual_drop_point); |
|
|
|
|
BasePointDeviceQueryBo pointReportQueryBoBefore = new BasePointDeviceQueryBo(); |
|
|
|
|
String assemblePointBefore =""; |
|
|
|
|
String assemblePointAfter =""; |
|
|
|
|
String assemblePointBefore = ""; |
|
|
|
|
String assemblePointAfter = ""; |
|
|
|
|
|
|
|
|
|
pointReportQueryBoBefore.setGroupNo(assemblePointGroupBefore); |
|
|
|
|
List<BasePointDeviceVo> assemblePointDeviceOutBefore = basePointDeviceMapper.getBasePointByGroupNoList(pointReportQueryBoBefore); |
|
|
|
|
if(ObjectUtils.isEmpty(assemblePointDeviceOutBefore)){ |
|
|
|
|
if (ObjectUtils.isEmpty(assemblePointDeviceOutBefore)) { |
|
|
|
|
log.info("请维护组装线点位"); |
|
|
|
|
} |
|
|
|
|
for (BasePointDeviceVo str : assemblePointDeviceOutBefore) { |
|
|
|
|
if (str.getPointNo().equals(ParameterConstants.ParameterSystem.assemble_point_after)) { |
|
|
|
|
assemblePointAfter =ParameterConstants.ParameterSystem.assemble_point_after; |
|
|
|
|
assemblePointAfter = ParameterConstants.ParameterSystem.assemble_point_after; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (str.getPointNo().equals(ParameterConstants.ParameterSystem.assemble_point_before)) { |
|
|
|
|
assemblePointBefore =ParameterConstants.ParameterSystem.assemble_point_before; |
|
|
|
|
assemblePointBefore = ParameterConstants.ParameterSystem.assemble_point_before; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1027,7 +1027,7 @@ public class RCSUtil { |
|
|
|
|
|
|
|
|
|
assemblyLineAddBo.setTaskId(businDataTask.getId()); |
|
|
|
|
assemblyLineAddBo.setAgvNo(businDataTask.getAgvNo()); |
|
|
|
|
assemblyLineAddBo.setTaskType(businDataTask.getTaskType()); |
|
|
|
|
assemblyLineAddBo.setTaskType(taskType); |
|
|
|
|
assemblyLineAddBo.setContainerId(businDataTask.getContainerId()); |
|
|
|
|
assemblyLineAddBo.setPointNo(assemblePointBefore); |
|
|
|
|
|
|
|
|
|
@ -1050,13 +1050,13 @@ public class RCSUtil { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 到达组装线前杠点位之后的业务逻辑处理
|
|
|
|
|
if (bo.getStatus().equals("completed") && assemblePointAfter.equals(taskAgvpoint)&& businDataTask.getTaskPath().equals(assemblePointAfter) && assemblePointAfter.equals(ParameterConstants.ParameterSystem.assemble_point_after)) { |
|
|
|
|
if (bo.getStatus().equals("completed") && assemblePointAfter.equals(taskAgvpoint) && businDataTask.getTaskPath().equals(assemblePointAfter) && assemblePointAfter.equals(ParameterConstants.ParameterSystem.assemble_point_after)) { |
|
|
|
|
// TODO 测试注释 要打开
|
|
|
|
|
AssemblyLineAddBo assemblyLineAddBo = new AssemblyLineAddBo(); |
|
|
|
|
|
|
|
|
|
assemblyLineAddBo.setTaskId(businDataTask.getId()); |
|
|
|
|
assemblyLineAddBo.setAgvNo(businDataTask.getAgvNo()); |
|
|
|
|
assemblyLineAddBo.setTaskType(businDataTask.getTaskType()); |
|
|
|
|
assemblyLineAddBo.setTaskType(taskType); |
|
|
|
|
assemblyLineAddBo.setContainerId(businDataTask.getContainerId()); |
|
|
|
|
assemblyLineAddBo.setPointNo(assemblePointAfter); |
|
|
|
|
|
|
|
|
|
@ -1072,10 +1072,10 @@ public class RCSUtil { |
|
|
|
|
pointQueryBo.setGroupNo(abnormalWaitPintGroup); |
|
|
|
|
|
|
|
|
|
// TODO 中科 测试 需要删除 修改平库释放后直接去下挂逻辑,后续不需要可以删掉
|
|
|
|
|
if(bo.getSn().equals("3") && bo.getStatus().equals("completed")&&"KW18".equals(taskAgvpoint)){ |
|
|
|
|
if (bo.getSn().equals("3") && bo.getStatus().equals("completed") && "KW18".equals(taskAgvpoint)) { |
|
|
|
|
businDataTask.setTaskStatus("2"); |
|
|
|
|
iBusinDataTaskService.updateById(businDataTask); |
|
|
|
|
// 创建任务
|
|
|
|
|
// 创建任务
|
|
|
|
|
// BusinDataTask task = new BusinDataTask();
|
|
|
|
|
// task.setTaskCode("T_" + DateUtils.dateTimeNow());
|
|
|
|
|
// task.setTaskPath("KW16");
|
|
|
|
|
@ -1131,7 +1131,7 @@ public class RCSUtil { |
|
|
|
|
// log.error(task.toString());
|
|
|
|
|
//平库空治具流向接口
|
|
|
|
|
Result<Boolean> kw18Result = iBusinEnptyContainerService.emptyContainerFlowDir("KW18", businDataTask.getContainerId(), bo.getRobotId(), null); |
|
|
|
|
log.info("平库空治具流向接口:"+kw18Result.getMsg()); |
|
|
|
|
log.info("平库空治具流向接口:" + kw18Result.getMsg()); |
|
|
|
|
} |
|
|
|
|
// TODO 中科 测试 需要删除
|
|
|
|
|
|
|
|
|
|
@ -1216,26 +1216,27 @@ public class RCSUtil { |
|
|
|
|
|
|
|
|
|
List<BasePointDeviceVo> basePointDeviceVos = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo); |
|
|
|
|
if (basePointDeviceVos.size() > 0) { |
|
|
|
|
for (BasePointDeviceVo basePointDeviceVo: basePointDeviceVos) { |
|
|
|
|
if(basePointDeviceVo.getPointNo().contains("KW11")){ |
|
|
|
|
for (BasePointDeviceVo basePointDeviceVo : basePointDeviceVos) { |
|
|
|
|
if (basePointDeviceVo.getPointNo().contains("KW11")) { |
|
|
|
|
toPointNoTwo = basePointDeviceVo.getPointNo(); |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
toPointNoOne = basePointDeviceVo.getPointNo(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 如果到达 冲孔取货点位 就修改当前任务ID并且将任务ID存入redis 用于之后的冲孔流程使用
|
|
|
|
|
if(bo.getStatus().equals("completed")&& toPointNoOne.equals(taskAgvpoint) && toPointNoOne.equals(businDataTask.getTaskPath())){ |
|
|
|
|
if (bo.getStatus().equals("completed") && toPointNoOne.equals(taskAgvpoint) && toPointNoOne.equals(businDataTask.getTaskPath())) { |
|
|
|
|
businDataTask.setTaskStatus("2"); |
|
|
|
|
iBusinDataTaskService.updateById(businDataTask); |
|
|
|
|
BasePunchRecord basePunchRecord = iBasePunchRecordService.getOne(new LambdaQueryWrapper<BasePunchRecord>() |
|
|
|
|
.eq(BasePunchRecord::getTaskCode,Long.valueOf(bo.getTaskId())) |
|
|
|
|
.eq(BasePunchRecord::getTaskCode, Long.valueOf(bo.getTaskId())) |
|
|
|
|
.last("limit 1")); |
|
|
|
|
basePunchRecord.setAgvNo(bo.getRobotId()); |
|
|
|
|
iBasePunchRecordService.updateById(basePunchRecord);; |
|
|
|
|
redisTemplate.opsForValue().set(RedisConstant.startPunchingTaskId, bo.getTaskId()+"_"+bo.getRobotId()+"_"+businDataTask.getContainerId()); |
|
|
|
|
redisTemplate.opsForValue().set(RedisConstant.endPunchingTaskId, bo.getTaskId()+"_"+bo.getRobotId()+"_"+businDataTask.getContainerId()); |
|
|
|
|
iBasePunchRecordService.updateById(basePunchRecord); |
|
|
|
|
; |
|
|
|
|
redisTemplate.opsForValue().set(RedisConstant.startPunchingTaskId, bo.getTaskId() + "_" + bo.getRobotId() + "_" + businDataTask.getContainerId()); |
|
|
|
|
redisTemplate.opsForValue().set(RedisConstant.endPunchingTaskId, bo.getTaskId() + "_" + bo.getRobotId() + "_" + businDataTask.getContainerId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 如果到达 冲孔放货点位 就修改当前任务ID并且将任务ID存入redis 用于之后的冲孔流程使用
|
|
|
|
|
@ -1269,16 +1270,17 @@ public class RCSUtil { |
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// 新增安全光电相关逻辑
|
|
|
|
|
// 新增安全光电相关逻辑
|
|
|
|
|
// if (TaskTypeEnum.normal_in.getValue().equals(businDataTask.getTaskType())
|
|
|
|
|
// ||TaskTypeEnum.empty_in.getValue().equals(businDataTask.getTaskType())
|
|
|
|
|
// && bo.getSn().equals("3") && bo.getStatus().equals("completed")){
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if (TaskTypeEnum.emptyContainer_out.getValue().equals(businDataTask.getTaskType()) |
|
|
|
|
||TaskTypeEnum.normal_out.getValue().equals(businDataTask.getTaskType()) |
|
|
|
|
||TaskTypeEnum.urgent_out.getValue().equals(businDataTask.getTaskType())){ |
|
|
|
|
if (TaskTypeEnum.emptyContainer_out.getValue().equals(taskType) |
|
|
|
|
|| TaskTypeEnum.normal_out.getValue().equals(taskType) |
|
|
|
|
|| TaskTypeEnum.urgent_out.getValue().equals(taskType) |
|
|
|
|
|| TaskTypeEnum.named_loc.getValue().equals(taskType)) { |
|
|
|
|
Map<String, String> pointMap = JsonUtil.JsonStrToMap(businDataTask.getPoints()); |
|
|
|
|
String s1 = pointMap.get("1"); |
|
|
|
|
String s2 = pointMap.get("2"); |
|
|
|
|
@ -1288,80 +1290,79 @@ public class RCSUtil { |
|
|
|
|
// 4#出口 DB320.2.9
|
|
|
|
|
// 5#出口 DB320.2.11
|
|
|
|
|
// 6#出口 DB320.2.13
|
|
|
|
|
if ("1".equals(bo.getSn())&&"completed".equals(bo.getStatus())){ |
|
|
|
|
if ("KW6".equals(s1)){ |
|
|
|
|
writeMap1.put("Boolean","false"); |
|
|
|
|
if ("1".equals(bo.getSn()) && "completed".equals(bo.getStatus())) { |
|
|
|
|
if ("KW6".equals(s1)) { |
|
|
|
|
writeMap1.put("Boolean", "false"); |
|
|
|
|
allHbMap.put("DB320.2.3", writeMap1); |
|
|
|
|
} |
|
|
|
|
if ("KW8".equals(s1)){ |
|
|
|
|
writeMap1.put("Boolean","false"); |
|
|
|
|
if ("KW8".equals(s1)) { |
|
|
|
|
writeMap1.put("Boolean", "false"); |
|
|
|
|
allHbMap.put("DB320.2.7", writeMap1); |
|
|
|
|
} |
|
|
|
|
if ("KW10".equals(s1)){ |
|
|
|
|
writeMap1.put("Boolean","false"); |
|
|
|
|
if ("KW10".equals(s1)) { |
|
|
|
|
writeMap1.put("Boolean", "false"); |
|
|
|
|
allHbMap.put("DB320.2.6", writeMap1); |
|
|
|
|
} |
|
|
|
|
if ("KW23".equals(s1)){ |
|
|
|
|
writeMap1.put("Boolean","false"); |
|
|
|
|
if ("KW23".equals(s1)) { |
|
|
|
|
writeMap1.put("Boolean", "false"); |
|
|
|
|
allHbMap.put("DB320.2.9", writeMap1); |
|
|
|
|
} |
|
|
|
|
if ("KW25".equals(s1)){ |
|
|
|
|
writeMap1.put("Boolean","false"); |
|
|
|
|
if ("KW25".equals(s1)) { |
|
|
|
|
writeMap1.put("Boolean", "false"); |
|
|
|
|
allHbMap.put("DB320.2.11", writeMap1); |
|
|
|
|
} |
|
|
|
|
if ("KW27".equals(s1)){ |
|
|
|
|
writeMap1.put("Boolean","false"); |
|
|
|
|
if ("KW27".equals(s1)) { |
|
|
|
|
writeMap1.put("Boolean", "false"); |
|
|
|
|
allHbMap.put("DB320.2.13", writeMap1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if("2".equals(bo.getSn())&&"completed".equals(bo.getStatus())){ |
|
|
|
|
if ("LY80".equals(s2)){ |
|
|
|
|
writeMap1.put("Boolean","true"); |
|
|
|
|
if ("2".equals(bo.getSn()) && "completed".equals(bo.getStatus())) { |
|
|
|
|
if ("LY80".equals(s2)) { |
|
|
|
|
writeMap1.put("Boolean", "true"); |
|
|
|
|
allHbMap.put("DB320.2.3", writeMap1); |
|
|
|
|
} |
|
|
|
|
if ("LY82".equals(s2)){ |
|
|
|
|
writeMap1.put("Boolean","true"); |
|
|
|
|
if ("LY82".equals(s2)) { |
|
|
|
|
writeMap1.put("Boolean", "true"); |
|
|
|
|
allHbMap.put("DB320.2.7", writeMap1); |
|
|
|
|
} |
|
|
|
|
if ("LY84".equals(s2)){ |
|
|
|
|
writeMap1.put("Boolean","true"); |
|
|
|
|
if ("LY84".equals(s2)) { |
|
|
|
|
writeMap1.put("Boolean", "true"); |
|
|
|
|
allHbMap.put("DB320.2.6", writeMap1); |
|
|
|
|
} |
|
|
|
|
if ("LY244".equals(s1)){ |
|
|
|
|
writeMap1.put("Boolean","true"); |
|
|
|
|
if ("LY244".equals(s1)) { |
|
|
|
|
writeMap1.put("Boolean", "true"); |
|
|
|
|
allHbMap.put("DB320.2.9", writeMap1); |
|
|
|
|
} |
|
|
|
|
if ("LY247".equals(s1)){ |
|
|
|
|
writeMap1.put("Boolean","true"); |
|
|
|
|
if ("LY247".equals(s1)) { |
|
|
|
|
writeMap1.put("Boolean", "true"); |
|
|
|
|
allHbMap.put("DB320.2.11", writeMap1); |
|
|
|
|
} |
|
|
|
|
if ("LY250".equals(s1)){ |
|
|
|
|
writeMap1.put("Boolean","true"); |
|
|
|
|
if ("LY250".equals(s1)) { |
|
|
|
|
writeMap1.put("Boolean", "true"); |
|
|
|
|
allHbMap.put("DB320.2.13", writeMap1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
String writePoint = JSON.toJSONString(allHbMap); |
|
|
|
|
PlcOperate plcOperateWrite = plcInit.getPlcOperateByIp(conn1.getPlcIp()); |
|
|
|
|
Boolean execWrite = plcReadAndWrite.execWrite(plcOperateWrite, writePoint); |
|
|
|
|
if (execWrite){ |
|
|
|
|
log.info("++++++++++++" + s1+"关闭安全光电成功"); |
|
|
|
|
if (execWrite) { |
|
|
|
|
log.info("++++++++++++" + s1 + "关闭安全光电成功"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
log.info("agv上报接口执行结束"); |
|
|
|
|
return Result.ok(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 呼叫AGV |
|
|
|
|
* |
|
|
|
|
* @param taskId |
|
|
|
|
* @param taskType |
|
|
|
|
* @param points |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public Result<Boolean> callAGV(Long taskId,int taskType, List<String> points){ |
|
|
|
|
public Result<Boolean> callAGV(Long taskId, int taskType, List<String> points) { |
|
|
|
|
AGVMoveBo moveBo = new AGVMoveBo(); |
|
|
|
|
moveBo.setTaskId(taskId); |
|
|
|
|
moveBo.setTaskType(taskType); |
|
|
|
|
@ -1372,44 +1373,47 @@ public class RCSUtil { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 添加角度 |
|
|
|
|
* @author Comair |
|
|
|
|
* @date 2023/7/21 20:09 |
|
|
|
|
* |
|
|
|
|
* @param taskId |
|
|
|
|
* @param taskType |
|
|
|
|
* @param points |
|
|
|
|
* @param toRow |
|
|
|
|
* @return com.shkj.common.core.domain.Result<java.lang.Boolean> |
|
|
|
|
* @author Comair |
|
|
|
|
* @date 2023/7/21 20:09 |
|
|
|
|
*/ |
|
|
|
|
public Result<Boolean> callAGV(Long taskId,int taskType, List<String> points,String toRow){ |
|
|
|
|
public Result<Boolean> callAGV(Long taskId, int taskType, List<String> points, String toRow) { |
|
|
|
|
// List<Integer> list = Arrays.asList(1,2,5,7,9,11,13,14);
|
|
|
|
|
AGVMoveBo moveBo = new AGVMoveBo(); |
|
|
|
|
moveBo.setTaskId(taskId); |
|
|
|
|
moveBo.setTaskType(taskType); |
|
|
|
|
moveBo.setPoints(points); |
|
|
|
|
Result<Boolean> booleanResult = null; |
|
|
|
|
if("0".equals(taskType) || "7".equals(taskType)){ |
|
|
|
|
booleanResult = moveByAGV(moveBo,toRow); |
|
|
|
|
if ("0".equals(taskType) || "7".equals(taskType)) { |
|
|
|
|
booleanResult = moveByAGV(moveBo, toRow); |
|
|
|
|
// if(list.contains(Integer.parseInt(toRow))){
|
|
|
|
|
//
|
|
|
|
|
// }else{
|
|
|
|
|
// booleanResult = moveByAGV(moveBo,0);
|
|
|
|
|
// }
|
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
booleanResult = moveByAGV(moveBo); |
|
|
|
|
} |
|
|
|
|
return booleanResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 添加角度 |
|
|
|
|
* @author Comair |
|
|
|
|
* @date 2023/7/21 20:09 |
|
|
|
|
* |
|
|
|
|
* @param taskId |
|
|
|
|
* @param taskType |
|
|
|
|
* @param points |
|
|
|
|
* @param toRow |
|
|
|
|
* @return com.shkj.common.core.domain.Result<java.lang.Boolean> |
|
|
|
|
* @author Comair |
|
|
|
|
* @date 2023/7/21 20:09 |
|
|
|
|
*/ |
|
|
|
|
public Result<Boolean> callAGV(Long taskId,int taskType, List<String> points,String toRow,String agvno){ |
|
|
|
|
public Result<Boolean> callAGV(Long taskId, int taskType, List<String> points, String toRow, String agvno) { |
|
|
|
|
//List<Integer> list = Arrays.asList(1,2,5,7,9,11,13,14);
|
|
|
|
|
AGVMoveBo moveBo = new AGVMoveBo(); |
|
|
|
|
moveBo.setTaskId(taskId); |
|
|
|
|
@ -1417,31 +1421,31 @@ public class RCSUtil { |
|
|
|
|
moveBo.setPoints(points); |
|
|
|
|
moveBo.setRobotId(agvno); |
|
|
|
|
Result<Boolean> booleanResult = null; |
|
|
|
|
if("0".equals(taskType) || "7".equals(taskType)){ |
|
|
|
|
booleanResult = moveByAGV(moveBo,toRow); |
|
|
|
|
if ("0".equals(taskType) || "7".equals(taskType)) { |
|
|
|
|
booleanResult = moveByAGV(moveBo, toRow); |
|
|
|
|
// if(list.contains(Integer.parseInt(toRow))){
|
|
|
|
|
//
|
|
|
|
|
// }else{
|
|
|
|
|
// booleanResult = moveByAGV(moveBo,0);
|
|
|
|
|
// }
|
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
booleanResult = moveByAGV(moveBo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return booleanResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取AGV的实时数据,并存储至Redis中 |
|
|
|
|
* |
|
|
|
|
* @param mapId |
|
|
|
|
*/ |
|
|
|
|
public void doAgvStates(String mapId){ |
|
|
|
|
public void doAgvStates(String mapId) { |
|
|
|
|
//获取AGV系统的实时数据
|
|
|
|
|
String agvData = rcsRobotsStatesForString(mapId); |
|
|
|
|
// log.info("AGV实时数据:"+agvData);
|
|
|
|
|
// log.info("AGV实时数据:"+agvData);
|
|
|
|
|
//处理设备信息,存redis中
|
|
|
|
|
this.doAGVRobotsStatesForRedis(agvData); |
|
|
|
|
} |
|
|
|
|
@ -1454,10 +1458,10 @@ public class RCSUtil { |
|
|
|
|
* @return {@code Result} |
|
|
|
|
*/ |
|
|
|
|
public String rcsRobotsStatesForString(String mapId) { |
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
// map.put("mapId",Integer.parseInt(mapId));
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
// map.put("mapId",Integer.parseInt(mapId));
|
|
|
|
|
String json = JSONObject.toJSONString(map); |
|
|
|
|
String res=""; |
|
|
|
|
String res = ""; |
|
|
|
|
try { |
|
|
|
|
Map<String, String> headerMap = getHeaderMap(); |
|
|
|
|
res = HttpRequest.post(agvStatesUrl) |
|
|
|
|
@ -1475,13 +1479,14 @@ public class RCSUtil { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* AGV设备实时状态,存储至Redis中 |
|
|
|
|
* |
|
|
|
|
* @param agvData |
|
|
|
|
*/ |
|
|
|
|
public void doAGVRobotsStatesForRedis(String agvData){ |
|
|
|
|
public void doAGVRobotsStatesForRedis(String agvData) { |
|
|
|
|
//log.info("处理agv设备状态信息开始");
|
|
|
|
|
if (StringUtils.isNotEmpty(agvData)){ |
|
|
|
|
if (StringUtils.isNotEmpty(agvData)) { |
|
|
|
|
RcsThirdResult thirdResult = JSONObject.parseObject(agvData, RcsThirdResult.class); |
|
|
|
|
List<BusinAgvRealRedisInfo> redisList = new ArrayList<>(); |
|
|
|
|
List<BusinAgvRealRedisInfo> redisList = new ArrayList<>(); |
|
|
|
|
List<BusinAgvRealInfo> list = JSONArray.parseArray(thirdResult.getData().toString(), BusinAgvRealInfo.class); |
|
|
|
|
BusinAgvRealRedisInfo businAgvRealRedisInfo = null; |
|
|
|
|
for (BusinAgvRealInfo businAgvRealInfo : list) { |
|
|
|
|
@ -1493,17 +1498,17 @@ public class RCSUtil { |
|
|
|
|
businAgvRealRedisInfo.setTaskId(businAgvRealInfo.getTaskId()); |
|
|
|
|
|
|
|
|
|
//如果在线状态是离线,则为离线,其他为AGV状态信息
|
|
|
|
|
if (online.equals("false")){ |
|
|
|
|
if (online.equals("false")) { |
|
|
|
|
businAgvRealRedisInfo.setAgvState(online); |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
businAgvRealRedisInfo.setAgvState(agvState); |
|
|
|
|
} |
|
|
|
|
businAgvRealRedisInfo.setErrors(businAgvRealInfo.getErrors()); |
|
|
|
|
redisList.add(businAgvRealRedisInfo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
redisTemplate.opsForValue().set(RedisConstant.redisAgvRealInfo ,redisList); |
|
|
|
|
}else { |
|
|
|
|
redisTemplate.opsForValue().set(RedisConstant.redisAgvRealInfo, redisList); |
|
|
|
|
} else { |
|
|
|
|
log.info("AGV实时数据为空"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|