|
@@ -12,6 +12,7 @@ import com.github.zuihou.business.edgeLibrary.service.StorgeService;
|
|
|
import com.github.zuihou.business.operationManagementCenter.entity.*;
|
|
|
import com.github.zuihou.business.operationManagementCenter.service.*;
|
|
|
import com.github.zuihou.business.productionReadyCenter.dao.BBomMapper;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.dao.BomProcedureMapper;
|
|
|
import com.github.zuihou.business.productionReadyCenter.entity.BBom;
|
|
|
import com.github.zuihou.business.productionReadyCenter.entity.BomProcedure;
|
|
|
import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourceBizMapper;
|
|
@@ -87,6 +88,8 @@ public class ToolRobotStrategy implements RobotStrategy {
|
|
|
@Value("${imcs-to-ccs.enabled:true}")
|
|
|
private Boolean imcsTOccsEnable;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private BomProcedureMapper bomProcedureMapper;
|
|
|
|
|
|
@Override
|
|
|
public Map robotInfo(TaskNode taskNode, String zoneName) {
|
|
@@ -162,10 +165,10 @@ public class ToolRobotStrategy implements RobotStrategy {
|
|
|
}
|
|
|
|
|
|
//处理目标库位
|
|
|
- this.robotTarget(taskNode, orderTask, null, bomProcedure,returnMap);
|
|
|
- if(returnMap.get("result") !=null && "false".equals(returnMap.get("result").toString())){
|
|
|
- return returnMap;
|
|
|
- }
|
|
|
+ ZZone zZone = (ZZone) robotInfo.get("zZone");
|
|
|
+ String zoneName = zZone.getName();
|
|
|
+ List<ProductionresourcePosition> xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(DictionaryKey.YJ_ZONE_XBK.get(zoneName+"-tool").split(","));
|
|
|
+ returnMap = this.robotTarget(taskNode, orderTask, xbkList, bomProcedure,returnMap);
|
|
|
|
|
|
Storge targetStorge = !returnMap.containsKey("store") ? null : (Storge) returnMap.get("store");
|
|
|
Long targetStorgeResourceId = !returnMap.containsKey("storeResourceId") ? null : Long.valueOf(returnMap.get("storeResourceId").toString());
|
|
@@ -175,11 +178,11 @@ public class ToolRobotStrategy implements RobotStrategy {
|
|
|
dataMap.put("resultMsg","目标点位不满足,线边库不符合要求存放");
|
|
|
return dataMap;
|
|
|
}
|
|
|
- //String targetXbk = !returnMap.containsKey("targetxbk") ? null : returnMap.get("targetxbk").toString();
|
|
|
+ String targetXbk = !returnMap.containsKey("targetxbk") ? null : returnMap.get("targetxbk").toString();
|
|
|
|
|
|
//处理机器人库位
|
|
|
List<ProductionresourcePosition> robotList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[]{taskNode.getResourceId().toString()});
|
|
|
- Map putMap = this.robotPut(returnMap, taskNode, startStore, targetStorge, robotList, null, targetStorgeResourceId);
|
|
|
+ Map putMap = this.robotPut(returnMap, taskNode, startStore, targetStorge, robotList, targetXbk, targetStorgeResourceId);
|
|
|
return putMap;
|
|
|
}
|
|
|
|
|
@@ -222,6 +225,10 @@ public class ToolRobotStrategy implements RobotStrategy {
|
|
|
locationMap.put("destLocationNo", orderTask.getCutGoalNo()); //目的刀位号
|
|
|
}
|
|
|
|
|
|
+ if(StringUtil.isNotEmpty(targetxbk) && targetxbk.equals("1")) {
|
|
|
+ returnMap.put(YunjianConstant.YUNJIAN_XBKFLAG, "1");
|
|
|
+ }
|
|
|
+
|
|
|
locationMap.put("taskType", DictionaryKey.TASK_TYPE.get("CARRY"));
|
|
|
locationMap.put("carryType", DictionaryKey.CARRY_TYPE.get("TOOL_HAND"));
|
|
|
returnMap.put("data", locationMap);
|
|
@@ -235,13 +242,23 @@ public class ToolRobotStrategy implements RobotStrategy {
|
|
|
|
|
|
@Override
|
|
|
public Map robotXbk(Map dataMap, Map robotInfo, TaskNode taskNode, Storge startStorge, Storge endStorge, List<ProductionresourcePosition> robotList) {
|
|
|
- return null;
|
|
|
+
|
|
|
+ OrderTask orderTask = (OrderTask) robotInfo.get("orderTask");
|
|
|
+ TTask task = taskService.getById(taskNode.getTaskId());
|
|
|
+ BomProcedure bomProcedure = bomProcedureMapper.selectOne(Wraps.<BomProcedure>lbQ().eq(BomProcedure::getId,task.getProcedureId()));
|
|
|
+ ZZone zZone = (ZZone) robotInfo.get("zZone");
|
|
|
+ String zoneName = zZone.getName();
|
|
|
+ List<ProductionresourcePosition> xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(DictionaryKey.YJ_ZONE_XBK.get(zoneName+"-tool").split(","));
|
|
|
+
|
|
|
+ Map returnMap = this.robotTarget(taskNode, orderTask, xbkList, bomProcedure, dataMap);
|
|
|
+ return returnMap;
|
|
|
}
|
|
|
|
|
|
//获取目标地址
|
|
|
public Map robotTarget(TaskNode taskNode, OrderTask orderTask, List<ProductionresourcePosition> xbkList, BomProcedure bomProcedure, Map<String, Object> returnMap) {
|
|
|
List<ProductionresourcePosition> targetList = null;
|
|
|
Long targetResourceId = taskNode.getTargetResourceId();
|
|
|
+/*
|
|
|
if(targetResourceId == null){
|
|
|
//msgUtil.createWarnLog("刀具节点目标位数据为空","DataException");
|
|
|
returnMap.put("resultMsg","刀具节点目标位数据为空");
|
|
@@ -294,12 +311,62 @@ public class ToolRobotStrategy implements RobotStrategy {
|
|
|
returnMap.put("resultMsg",resultMsg ==null? "刀具节点目标位放置条件不满足": resultMsg);
|
|
|
returnMap.put("result", false);
|
|
|
return null;
|
|
|
- }
|
|
|
|
|
|
- returnMap.put("storeResourceId", targetResourceId);
|
|
|
- returnMap.put("store", targetStorge);
|
|
|
- returnMap.put("targetxbk", "0");
|
|
|
+ */
|
|
|
+ String xbkFlag = "";
|
|
|
+ Storge startStorge = null;
|
|
|
+ Storge targetStorge = null;
|
|
|
|
|
|
+ if(targetResourceId != null) {
|
|
|
+ targetList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[]{targetResourceId.toString()});
|
|
|
+ if (CollectionUtil.isEmpty(targetList)) {
|
|
|
+ xbkFlag = "1";
|
|
|
+ } else {
|
|
|
+ //按类型获取目标库位
|
|
|
+ if (StringUtil.isNotEmpty(orderTask.getGoal())) {
|
|
|
+ String pointId = orderTask.getGoal().replace("CT_", "");
|
|
|
+ List<ProductionresourcePosition> positionList = targetList.stream().filter(item -> item.getPointId().equals(pointId)).collect(Collectors.toList());
|
|
|
+ targetStorge = storgeService.getById(positionList.get(0).getStorgeId());
|
|
|
+ } else {
|
|
|
+ targetStorge = storgeService.getById(targetList.get(0).getStorgeId());
|
|
|
+ }
|
|
|
+ //CCS判断目标位点位是否允许放置判断
|
|
|
+ boolean bool = true;
|
|
|
+ String pointId = targetStorge.getPointId();
|
|
|
+ if (pointId.contains(DemoLineConstant.DEMOLINE_CUT_TOOL_TYPE_CNCT)) {
|
|
|
+ //从机床刀具库放需要预置处理
|
|
|
+ Object cutToolAction = msgUtil.redis_get(DemoLineConstant.DEMOLINE_CUT_DEVICE_ACTION);
|
|
|
+ if (ObjectUtil.isEmpty(cutToolAction)) {
|
|
|
+ this.CNCTActionHandle(taskNode, true, pointId, orderTask);
|
|
|
+ msgUtil.redis_set(DemoLineConstant.DEMOLINE_CUT_DEVICE_ACTION, taskNode.getId().toString(), 10, TimeUnit.MINUTES);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //todo 与ccs联调需要释放 $需要换地址$
|
|
|
+ String resultData = this.cutToolActionCondition("/api/getCutterDeviceIsPut", taskNode, pointId);
|
|
|
+ JSONObject resultObj = JSONObject.parseObject(resultData);
|
|
|
+ bool = resultObj.getBoolean("result");
|
|
|
+ if (!bool) {
|
|
|
+ msgUtil.createWarnLog("刀具节点目标位放置条件不满足", "DataException");
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (CollectionUtil.isNotEmpty(targetList)) {
|
|
|
+ returnMap.put("storeResourceId", targetResourceId);
|
|
|
+ returnMap.put("store", targetStorge);
|
|
|
+ returnMap.put("targetxbk", "0");
|
|
|
+ }else{
|
|
|
+ xbkFlag = "1";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ("1".equals(xbkFlag)) {
|
|
|
+ ProductionresourcePosition position = xbkList.get(0);
|
|
|
+ targetStorge = storgeService.getById(position.getStorgeId());
|
|
|
+ returnMap.put("storeResourceId", position.getResourceId());
|
|
|
+ returnMap.put("store", targetStorge);
|
|
|
+ returnMap.put("targetxbk", "1");
|
|
|
+ }
|
|
|
return returnMap;
|
|
|
}
|
|
|
|