|
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.zuihou.authority.entity.auth.RoleOrg;
|
|
|
+import com.github.zuihou.authority.entity.common.DictionaryItem;
|
|
|
import com.github.zuihou.authority.entity.core.Org;
|
|
|
import com.github.zuihou.base.R;
|
|
|
import com.github.zuihou.business.DemoLine.DemoCacheKey;
|
|
@@ -62,6 +63,7 @@ import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static java.util.stream.Collectors.groupingBy;
|
|
|
+import static java.util.stream.Collectors.toList;
|
|
|
|
|
|
@Slf4j
|
|
|
@Service
|
|
@@ -281,7 +283,15 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
dataMap.put("msg", DictionaryKey.NodeException.RUNNING_FALSE);
|
|
|
return dataMap;
|
|
|
}
|
|
|
- String functionName = DictionaryKey.ROBOT_ACTION.get(resourceAutoCode.getCommand());
|
|
|
+
|
|
|
+ String bizType = dataMap.get("bizType")==null?"":dataMap.get("bizType").toString();
|
|
|
+ String functionName = "";
|
|
|
+ if("3".equals(bizType)){
|
|
|
+ functionName = dataMap.get("functionName")==null?"":dataMap.get("functionName").toString();
|
|
|
+ }else{
|
|
|
+ functionName = DictionaryKey.ROBOT_ACTION.get(resourceAutoCode.getCommand());
|
|
|
+ }
|
|
|
+
|
|
|
//设备条件判断
|
|
|
//当需要锁定agv开始、结束的接驳位库位
|
|
|
Storge agvStartStationStorge = null;
|
|
@@ -549,7 +559,13 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
|
|
|
dataMap.put("result", false);
|
|
|
}else{
|
|
|
- Map returnMap = getTargetStorge(nextTaskNode,taskNode.getFindAgvFlag(),bomProcedure.getType());
|
|
|
+ Map returnMap = null;
|
|
|
+ String bizType = dataMap.get("bizType")==null?"":dataMap.get("bizType").toString();
|
|
|
+ if("3".equals(bizType)){
|
|
|
+ returnMap = getFanmianTargetStorge(taskNode,dataMap);
|
|
|
+ }else {
|
|
|
+ returnMap = getTargetStorge(nextTaskNode,taskNode.getFindAgvFlag(),bomProcedure.getType());
|
|
|
+ }
|
|
|
|
|
|
//目标地址和类型
|
|
|
Storge targetStorge = returnMap.get("store")==null?null:(Storge)returnMap.get("store");
|
|
@@ -818,6 +834,49 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 翻面都是根据执行步骤写死的目标路径
|
|
|
+ * @param taskNode
|
|
|
+ * @param dataMap
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map getFanmianTargetStorge(TaskNode taskNode,Map<String, Object> dataMap){
|
|
|
+ Map returnMap = new HashMap();
|
|
|
+ Storge targetStorge = null;
|
|
|
+ int count = Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count") == null ? "0" : dataMap.get(taskNode.getId().toString() + "count").toString());
|
|
|
+ Long resourceId = null;
|
|
|
+ if(count==0){//先
|
|
|
+ //获取机器人操作线边库
|
|
|
+ String xbkKey = zoneName+"-"+bomzZone.getNo();
|
|
|
+ xbkArr = DictionaryKey.YJ_ZONE_XBK.get(xbkKey).split(",");
|
|
|
+ xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(xbkArr);
|
|
|
+ if(CollectionUtil.isNotEmpty(xbkList)){
|
|
|
+ ProductionresourcePosition position = xbkList.get(0);
|
|
|
+ targetStorge = storgeService.getById(position.getStorgeId());
|
|
|
+ returnMap.put("storeResourceId",position.getResourceId());
|
|
|
+ returnMap.put("store",targetStorge);
|
|
|
+ }
|
|
|
+ }else if(count==2){//到线边库
|
|
|
+ //获取翻面工序的托盘夹具
|
|
|
+ ProductionresourcePosition position = getProductionresourcePosition(taskNode);
|
|
|
+ targetStorge = storgeService.getById(position.getStorgeId());
|
|
|
+ returnMap.put("storeResourceId",position.getResourceId());
|
|
|
+ returnMap.put("store",targetStorge);
|
|
|
+
|
|
|
+ }else if(count==4){//到线边库
|
|
|
+ //获取翻面工序的托盘夹具
|
|
|
+ resourceId = taskNode.getTargetResourceId();
|
|
|
+ targetList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[] {resourceId.toString()});
|
|
|
+ if(CollectionUtil.isNotEmpty(targetList)){
|
|
|
+ targetStorge = storgeService.getById(targetList.get(0).getStorgeId());
|
|
|
+ returnMap.put("storeResourceId",targetList.get(0).getResourceId());
|
|
|
+ returnMap.put("store",targetStorge);
|
|
|
+ returnMap.put("targetxbk","0");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return returnMap;
|
|
|
+ }
|
|
|
|
|
|
public Map getTargetStorge(TaskNode taskNode,String findAgvFlag,String bomProcedureType){
|
|
|
Map returnMap = new HashMap();
|
|
@@ -1166,4 +1225,36 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ private ProductionresourcePosition getProductionresourcePosition(TaskNode taskNode){
|
|
|
+ ProductionresourcePosition position = new ProductionresourcePosition();
|
|
|
+ List<BomProcedureTray>trayList = procedureTrayService.list(Wraps.<BomProcedureTray>lbQ().in(BomProcedureTray::getProcedureId, taskNode.getProcedureId()));
|
|
|
+ List<Long>trayIdList = trayList.stream().map(t->t.getTrayId()).collect(Collectors.toList());
|
|
|
+ List<ProductionresourcePosition> list = productionresourcePositionService.getFullProductionresourcePositionByNos(xbkArr);
|
|
|
+ if(CollectionUtil.isNotEmpty(list)){
|
|
|
+ Map<Long,List<ProductionresourcePosition>>map = list.stream().collect(groupingBy(ProductionresourcePosition::getStorgeId, LinkedHashMap::new, toList()));
|
|
|
+ for(Long l:map.keySet()){
|
|
|
+ List<ProductionresourcePosition>subList = map.get(l);
|
|
|
+ if(CollectionUtil.isNotEmpty(subList)&&subList.size()==2){
|
|
|
+ List<Long>goodIdList = subList.stream().map(t->t.getGoodsId()).collect(Collectors.toList());
|
|
|
+ if(containAll(trayIdList,goodIdList)){
|
|
|
+ position = subList.get(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return position;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private Boolean containAll(List<Long> A, List<Long> B) {
|
|
|
+ List<Long> collect = A.stream().filter(item -> B.contains(item)).collect(Collectors.toList());
|
|
|
+ if (null != collect && collect.size() > 0) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|