|
@@ -2,6 +2,7 @@ package com.github.zuihou.business.productionResourceCenter.strategy.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.zuihou.business.DemoLine.DemoCacheKey;
|
|
|
import com.github.zuihou.business.DemoLine.DemoLineConstant;
|
|
|
import com.github.zuihou.business.DemoLine.YunjianConstant;
|
|
@@ -114,6 +115,7 @@ public class ToolRobotStrategy implements RobotStrategy {
|
|
|
dataMap.put(YunjianConstant.YUNJIAN_ROBORT_CACHE_FLAG, "0");
|
|
|
Storge startStore = null;
|
|
|
OrderTask orderTask = (OrderTask) robotInfo.get("orderTask");
|
|
|
+ /*
|
|
|
if (CollectionUtil.isNotEmpty(flikustockInfos)) {
|
|
|
//刀具线边库查询
|
|
|
startStore = storgeService.getById(flikustockInfos.get(0).getStorgeId());
|
|
@@ -121,10 +123,26 @@ public class ToolRobotStrategy implements RobotStrategy {
|
|
|
//List<ProductionresourcePosition> storgeList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[]{task.getResourceId().toString()});
|
|
|
String pointId = orderTask.getStart().replace("CT_", "");
|
|
|
startStore = storgeService.getOne(new LbqWrapper<Storge>().eq(Storge::getPointId, pointId).last("LIMIT 1"));
|
|
|
- }
|
|
|
- //CCS判断取条件是否满足
|
|
|
+ } */
|
|
|
+ String pointId = orderTask.getStart().replace("CT_", "");
|
|
|
+ startStore = storgeService.getOne(new LbqWrapper<Storge>().eq(Storge::getPointId, pointId).last("LIMIT 1"));
|
|
|
+
|
|
|
+ //CCS判断取条件是否满足getCutterDeviceIsTake
|
|
|
boolean bool = true;
|
|
|
- if(!bool){
|
|
|
+ boolean flag = true;
|
|
|
+ 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, false, pointId, orderTask);
|
|
|
+ msgUtil.redis_set(DemoLineConstant.DEMOLINE_CUT_DEVICE_ACTION, "0",10, TimeUnit.MINUTES);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ bool = this.cutToolActionCondition("/api/getCutterDeviceIsTake", taskNode,pointId);
|
|
|
+
|
|
|
+ if(!bool || !flag){
|
|
|
msgUtil.createWarnLog("刀具节点起始位取条件不满足","DataException");
|
|
|
dataMap.put("result", false);
|
|
|
dataMap.put("resultmsg","刀具节点起始位取条件不满足");
|
|
@@ -132,7 +150,7 @@ public class ToolRobotStrategy implements RobotStrategy {
|
|
|
}
|
|
|
|
|
|
//处理目标库位
|
|
|
- returnMap = this.robotTarget(taskNode, orderTask.getGoal(), null, bomProcedure,returnMap);
|
|
|
+ returnMap = this.robotTarget(taskNode, orderTask, null, bomProcedure,returnMap);
|
|
|
|
|
|
Storge targetStorge = !returnMap.containsKey("store") ? null : (Storge) returnMap.get("store");
|
|
|
Long targetStorgeResourceId = !returnMap.containsKey("storeResourceId") ? null : Long.valueOf(returnMap.get("storeResourceId").toString());
|
|
@@ -206,7 +224,7 @@ public class ToolRobotStrategy implements RobotStrategy {
|
|
|
}
|
|
|
|
|
|
//获取目标地址
|
|
|
- public Map robotTarget(TaskNode taskNode, String goal, List<ProductionresourcePosition> xbkList, BomProcedure bomProcedure, Map<String, Object> 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){
|
|
@@ -218,20 +236,33 @@ public class ToolRobotStrategy implements RobotStrategy {
|
|
|
msgUtil.createWarnLog("刀具节点目标位被占用","DataException");
|
|
|
return null;
|
|
|
}
|
|
|
+ //按类型获取目标库位
|
|
|
+ Storge targetStorge = null;
|
|
|
+ if(StringUtil.isNotEmpty(orderTask.getGoal())){
|
|
|
+ List<ProductionresourcePosition> positionList = targetList.stream().filter(item->item.getPointId().equals(orderTask.getGoal())).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, "1",10, TimeUnit.MINUTES);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ bool = this.cutToolActionCondition("/api/getCutterDeviceIsPut", taskNode,pointId);
|
|
|
+
|
|
|
if(!bool){
|
|
|
msgUtil.createWarnLog("刀具节点目标位放置条件不满足","DataException");
|
|
|
return null;
|
|
|
}
|
|
|
- //按类型获取目标库位
|
|
|
- Storge targetStorge = null;
|
|
|
- if(StringUtil.isNotEmpty(goal)){
|
|
|
- List<ProductionresourcePosition> poistionList = targetList.stream().filter(item->item.getPointId().equals(goal)).collect(Collectors.toList());
|
|
|
- targetStorge = storgeService.getById(poistionList.get(0).getStorgeId());
|
|
|
- }else{
|
|
|
- targetStorge = storgeService.getById(targetList.get(0).getStorgeId());
|
|
|
- }
|
|
|
|
|
|
returnMap.put("storeResourceId", targetResourceId);
|
|
|
returnMap.put("store", targetStorge);
|
|
@@ -240,4 +271,37 @@ public class ToolRobotStrategy implements RobotStrategy {
|
|
|
return returnMap;
|
|
|
}
|
|
|
|
|
|
+ //非机床取放条件判断
|
|
|
+ private boolean cutToolActionCondition(String url, TaskNode taskNode, String pointId){
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("taskId", taskNode.getTaskId());
|
|
|
+ jsonObject.put("taskNodeId", taskNode.getId());
|
|
|
+ JSONObject data = new JSONObject();
|
|
|
+ data.put("location", pointId);
|
|
|
+ jsonObject.put("data",data);
|
|
|
+ String resultData = msgUtil.getCcsData(url, jsonObject, taskNode);
|
|
|
+ JSONObject resultObj = JSONObject.parseObject(resultData);
|
|
|
+ return resultObj.getBoolean("result");
|
|
|
+ }
|
|
|
+
|
|
|
+ //机床刀具库条件判断处理
|
|
|
+ private void CNCTActionHandle(TaskNode taskNode, boolean isPut, String pointId, OrderTask orderTask){
|
|
|
+ JSONObject cutToolObject = new JSONObject();
|
|
|
+ cutToolObject.put("taskId", taskNode.getTaskId());
|
|
|
+ cutToolObject.put("taskNodeId", taskNode.getId());
|
|
|
+ JSONObject cutToolData = new JSONObject();
|
|
|
+ cutToolData.put("taskType", "1");
|
|
|
+ cutToolData.put("carryType", "1");
|
|
|
+ //是否执行下料放
|
|
|
+ if(isPut){
|
|
|
+ cutToolData.put("destLocation", pointId);
|
|
|
+ cutToolData.put("destLocationNo", orderTask.getCutGoalNo());
|
|
|
+ }else{
|
|
|
+ cutToolData.put("location", pointId);
|
|
|
+ cutToolData.put("locationNo", orderTask.getCutStartNo());
|
|
|
+ }
|
|
|
+ cutToolObject.put("data", cutToolData);
|
|
|
+ msgUtil.getCcsData("/api/CutterDeviceTakeOrPutRequest", cutToolObject, taskNode);
|
|
|
+ }
|
|
|
+
|
|
|
}
|