|
@@ -190,53 +190,55 @@ public class CacheRobotStrategy implements RobotStrategy {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- jqrStorge.setCompleteBatchNo(taskNode.getCompleteBatchNo());
|
|
|
- storgeService.lockStorge(jqrStorge, taskNode.getId());
|
|
|
-
|
|
|
- //List<ProductionresourcePosition> hcwList = jqrMap.get(jqrMap.keySet().stream().filter(p -> !DemoLineConstant.DEMOLINE_RJQR_ZS.equals(p) && !DemoLineConstant.DEMOLINE_RJQR_SIX.equals(p)).findFirst().get());
|
|
|
- List<ProductionresourcePosition> hcwList = robotList.stream().filter(p -> !DemoLineConstant.DEMOLINE_RJQR_ZS.equals(p.getPointId()) && !DemoLineConstant.DEMOLINE_RJQR_SIX.equals(p.getPointId())).collect(Collectors.toList());
|
|
|
+ List<ProductionresourcePosition> hcwList = robotList.stream().filter(p -> !DemoLineConstant.DEMOLINE_RJQR_ZS.equals(p.getPointId())).collect(Collectors.toList());
|
|
|
if (hcwList.size() == 0) {
|
|
|
//限定抓手交换功能
|
|
|
- boolean hasJqrhcwPartFlag = false;
|
|
|
- List<Long> hcwStorgeIdList = hcwList.stream().map(ProductionresourcePosition::getStorgeId).collect(Collectors.toList());
|
|
|
+ List<Long> hcwStorgeIdList = productionresourcePositionService.list(new LbqWrapper<ProductionresourcePosition>().eq(ProductionresourcePosition::getResourceId, taskNode.getResourceId()).ne(ProductionresourcePosition::getPointId, DemoLineConstant.DEMOLINE_RJQR_ZS)).stream().map(ProductionresourcePosition::getStorgeId).collect(Collectors.toList());
|
|
|
List<TWorkpiece> workpieceList = workpieceService.list(new LbqWrapper<TWorkpiece>().eq(TWorkpiece::getIsEnd, "0").in(TWorkpiece::getStorgeId, hcwStorgeIdList));
|
|
|
if (workpieceList.size() > 2 || workpieceList.size() == 0) {
|
|
|
msgUtil.createWarnLog("机器人设备暂存位数据有误", "DataException");
|
|
|
returnMap.put("result", false);
|
|
|
}
|
|
|
-
|
|
|
- for (TWorkpiece item : workpieceList) {
|
|
|
- long jqrHcwStorgeTaskNodeId = item.getTaskNodeId();
|
|
|
- Object hcwStorgeFlag = msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_HCW_XBK_FLAG + jqrHcwStorgeTaskNodeId);
|
|
|
- TaskNode hcwTaskNode = taskNodeService.getById(jqrHcwStorgeTaskNodeId);
|
|
|
- boolean bool = ObjectUtil.isNotEmpty(hcwStorgeFlag) && hcwTaskNode.getTargetResourceId().equals(taskNode.getTargetResourceId()) && taskNode.getCompleteBatchNo() != hcwTaskNode.getCompleteBatchNo();
|
|
|
- if (bool) {
|
|
|
- hasJqrhcwPartFlag = true;
|
|
|
- msgUtil.redis_set(DemoLineConstant.JQR_HCW_PART_PRIOTY_EXEC_FLAG + jqrHcwStorgeTaskNodeId, "1");
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (hasJqrhcwPartFlag) {
|
|
|
+ Object jqrPriotyFlag = msgUtil.redis_get(DemoLineConstant.JQR_HCW_PART_PRIOTY_EXEC_FLAG + taskNode.getId());
|
|
|
+ if(ObjectUtil.isNotEmpty(jqrPriotyFlag)){
|
|
|
returnMap.put("result", false);
|
|
|
return returnMap;
|
|
|
}
|
|
|
+
|
|
|
+ TWorkpiece workpiece = workpieceList.stream().filter(item->!item.getTaskNodeId().equals(taskNode.getId())).collect(Collectors.toList()).get(0);
|
|
|
+ Object hcwStorgeFlag = msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_HCW_XBK_FLAG + workpiece.getTaskNodeId());
|
|
|
+ if(ObjectUtil.isEmpty(hcwStorgeFlag)){
|
|
|
+ Object hcwPriotyFlag = msgUtil.redis_get(DemoLineConstant.JQR_HCW_PART_PRIOTY_EXEC_FLAG + workpiece.getTaskNodeId());
|
|
|
+ TTask task = taskService.getById(taskNode.getTaskId());
|
|
|
+ //判断交换位目标设备是否与暂存位任务设备一致
|
|
|
+ if(ObjectUtil.isEmpty(hcwPriotyFlag) && taskNode.getTargetResourceId().equals(task.getResourceId())) {
|
|
|
+ msgUtil.redis_set(DemoLineConstant.JQR_HCW_PART_PRIOTY_EXEC_FLAG + workpiece.getTaskNodeId(), "1");
|
|
|
+ returnMap.put("result", false);
|
|
|
+ return returnMap;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
//锁定暂存缓存位库位
|
|
|
startStorge.setCompleteBatchNo(taskNode.getCompleteBatchNo());
|
|
|
storgeService.lockStorge(startStorge, taskNode.getId());
|
|
|
+ //锁定抓手
|
|
|
+ jqrStorge.setCompleteBatchNo(taskNode.getCompleteBatchNo());
|
|
|
+ storgeService.lockStorge(jqrStorge, taskNode.getId());
|
|
|
+
|
|
|
//暂存库位作为库位起始位不需重复锁定暂存位
|
|
|
ProductionresourcePosition startPosition = productionresourcePositionService.getOne(new LbqWrapper<ProductionresourcePosition>().eq(ProductionresourcePosition::getStorgeId, startStorge.getId()).last("limit 1"));
|
|
|
List<ProductionresourcePosition> hcwFilter = hcwList.stream().filter(p -> p.getResourceId().equals(startPosition.getResourceId())).collect(Collectors.toList());
|
|
|
Storge hcwStorge = null;
|
|
|
- if(hcwFilter.size() == 0) {
|
|
|
+ if(hcwFilter.size() == 0 && hcwList.size()>0) {
|
|
|
hcwStorge = storgeService.getById(hcwList.get(0).getStorgeId());
|
|
|
hcwStorge.setCompleteBatchNo(taskNode.getCompleteBatchNo());
|
|
|
storgeService.lockStorge(hcwStorge, taskNode.getId());
|
|
|
}else{
|
|
|
hcwStorge = startStorge;
|
|
|
}
|
|
|
+ Object hcwExecFlag = msgUtil.redis_get(DemoLineConstant.JQR_HCW_PART_PRIOTY_EXEC_FLAG + taskNode.getId());
|
|
|
|
|
|
- //暂存位线边库判断
|
|
|
+ //暂存位判断(暂存位无占用目标位占用 或者 暂存位被占用一个需进行优先级处理判断)
|
|
|
if (hcwList.size() > 1 && targetXbk.equals("1")) {
|
|
|
//锁定暂存缓存位库位
|
|
|
targetStorge = hcwStorge;
|
|
@@ -244,9 +246,13 @@ public class CacheRobotStrategy implements RobotStrategy {
|
|
|
returnMap.put(YunjianConstant.YUNJIAN_XBKFLAG, "1");
|
|
|
returnMap.put(YunjianConstant.YUNJIAN_HCW_XBKFLAG, "1");
|
|
|
msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + taskNode.getId(), targetStorge, 10, TimeUnit.DAYS);
|
|
|
+ }else if(hcwList.size() == 1 && ObjectUtil.isEmpty(hcwExecFlag)){
|
|
|
+ targetStorge = hcwStorge;
|
|
|
+ returnMap.put(YunjianConstant.YUNJIAN_XBKFLAG, "1");
|
|
|
+ returnMap.put(YunjianConstant.YUNJIAN_HCW_XBKFLAG, "1");
|
|
|
+ msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + taskNode.getId(), targetStorge, 10, TimeUnit.DAYS);
|
|
|
} else {
|
|
|
- //暂存位优先级处理判断
|
|
|
-
|
|
|
+ //暂存位无占用直接处理(即size>1或者size=0)
|
|
|
if (targetXbk.equals("0")) {
|
|
|
//目标缓存
|
|
|
msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + taskNode.getId(), targetStorge, 10, TimeUnit.DAYS);
|
|
@@ -310,13 +316,13 @@ public class CacheRobotStrategy implements RobotStrategy {
|
|
|
@Override
|
|
|
public Map robotXbk(Map dataMap, Map robotInfo, TaskNode taskNode, Storge startStorge, Storge goalStorge, List<ProductionresourcePosition> robotList) {
|
|
|
//暂存位线边库处理
|
|
|
- Object targetHcwXbk = msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_HCW_XBK_FLAG + taskNode.getId());
|
|
|
- if(ObjectUtil.isNotEmpty(targetHcwXbk)){
|
|
|
+ //Object targetHcwXbk = msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_HCW_XBK_FLAG + taskNode.getId());
|
|
|
+ //if(ObjectUtil.isNotEmpty(targetHcwXbk)){
|
|
|
Object jqrHcwPartPriotyExec = (null == msgUtil.redis_get(DemoLineConstant.JQR_HCW_PART_PRIOTY_EXEC_FLAG + taskNode.getId())) ? null : msgUtil.redis_get(DemoLineConstant.JQR_HCW_PART_PRIOTY_EXEC_FLAG + taskNode.getId());
|
|
|
if(ObjectUtil.isNotEmpty(jqrHcwPartPriotyExec)){
|
|
|
robotList = robotList.stream().filter(item->item.getPointId().equals(DemoLineConstant.DEMOLINE_RJQR_ZS) && item.getStatus().equals("0")).collect(Collectors.toList());
|
|
|
}
|
|
|
- }
|
|
|
+ //}
|
|
|
if(robotList.size() == 0 ) {
|
|
|
dataMap.put("result", false);
|
|
|
return dataMap;
|
|
@@ -337,7 +343,8 @@ public class CacheRobotStrategy implements RobotStrategy {
|
|
|
return dataMap;
|
|
|
}
|
|
|
Storge startStore = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
|
|
|
- Map putMap = this.robotPut(returnMap, taskNode, startStore, targetStorge, robotList, targetXbk, targetStorgeResourceId);
|
|
|
+ List<ProductionresourcePosition> robotXbkList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[]{taskNode.getResourceId().toString()});
|
|
|
+ Map putMap = this.robotPut(returnMap, taskNode, startStore, targetStorge, robotXbkList, targetXbk, targetStorgeResourceId);
|
|
|
return putMap;
|
|
|
}
|
|
|
|
|
@@ -420,6 +427,8 @@ public class CacheRobotStrategy implements RobotStrategy {
|
|
|
}
|
|
|
} else {
|
|
|
targetList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[]{targetResourceId.toString()});
|
|
|
+ //排除刀具库位
|
|
|
+ targetList = targetList.stream().filter(p->!p.getPointId().contains("CNCT")).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(targetList)) {
|