Переглянути джерело

【恒轮】舱体恒轮逻辑优化

lxb 2 роки тому
батько
коміт
88da1a8d61

+ 7 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/StorgeService.java

@@ -126,4 +126,11 @@ public interface StorgeService extends SuperCacheService<Storge> {
      */
     boolean szbStockHandle(boolean isFetched, TaskNode taskNode);
 
+    /**
+     * 恒轮点位处理
+     * @param taskNode
+     * @return
+     */
+    String getHellerPoint(TaskNode taskNode);
+
 }

+ 55 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/impl/StorgeServiceImpl.java

@@ -32,10 +32,13 @@ import com.github.zuihou.business.productionReadyCenter.service.PlateService;
 import com.github.zuihou.business.productionReadyCenter.service.TrayService;
 import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourceBizMapper;
 import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourcePositionMapper;
+import com.github.zuihou.business.productionResourceCenter.dao.ZZoneProductionresourceMapper;
 import com.github.zuihou.business.productionResourceCenter.entity.Productionresource;
 import com.github.zuihou.business.productionResourceCenter.entity.ProductionresourcePosition;
 import com.github.zuihou.business.productionResourceCenter.entity.ZZone;
+import com.github.zuihou.business.productionResourceCenter.entity.ZZoneProductionresource;
 import com.github.zuihou.business.productionResourceCenter.service.ProductionresourcePositionService;
+import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
 import com.github.zuihou.business.productionResourceCenter.service.impl.RobotNodeServiceImpl;
 import com.github.zuihou.business.util.MsgUtil;
 import com.github.zuihou.common.constant.BizConstant;
@@ -113,6 +116,12 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
     @Autowired
     private TrayService trayService;
 
+    @Autowired
+    private ZZoneProductionresourceMapper zZoneProductionresourceMapper;
+
+    @Autowired
+    private ZZoneService zoneService;
+
     private static Logger logger = LoggerFactory.getLogger(StorgeServiceImpl.class);
 
     @Override
@@ -658,4 +667,50 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
         logger.warn("三坐标节点{}取放条件不通过", taskNode.getId());
         return false;
     }
+
+    /**
+     * 恒轮点位处理
+     * @param taskNode
+     * @return
+     */
+    @Override
+    public String getHellerPoint(TaskNode taskNode) {
+        ZZoneProductionresource zoneProductionresource = zZoneProductionresourceMapper.selectOne(Wraps.<ZZoneProductionresource>lbQ().eq(ZZoneProductionresource::getResourceId,taskNode.getResourceId()));
+        long zoneId = zoneProductionresource.getZoneId();
+        ZZone zZone = zoneService.getById(zoneId);
+
+        String instructionUrl = "/api/hellerFreeStatus";
+        //动态调用接口和新增指令执行时间
+        String paramKey = zZone.getNo() + "_plc";
+        String plcUrl = (null == msgUtil.redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)msgUtil.redis_get(ParameterKey.PARAMETERS)).get(paramKey).toString());
+        instructionUrl = plcUrl + instructionUrl;
+
+        JSONObject jsonParam = new JSONObject();
+        Map<String, String> hellerMap = DictionaryKey.RESOURCE_NET.get("heller");
+        jsonParam.put("url", hellerMap.get("url"));
+        jsonParam.put("port", hellerMap.get("port"));
+        jsonParam.put("taskId",taskNode.getTaskId() + "");
+        jsonParam.put("taskNodeId",taskNode.getId() + "");
+
+        logger.warn("调用【恒轮调试空闲接口】地址{}", instructionUrl);
+        logger.warn("调用【恒轮调试空闲接口】传参{}", jsonParam.toJSONString());
+        String returnData = msgUtil.httpForPost(instructionUrl,jsonParam.toString());
+        if(StringUtil.isEmpty(returnData)) logger.warn("【恒轮调试空闲接口】返回数据为空");
+        logger.warn("【恒轮调试空闲接口】返回值:{}",returnData);
+
+        JSONObject returnObj = JSONObject.parseObject(returnData);
+        Object result = returnObj.get("result");
+        Object work = returnObj.get("data");
+
+        result = "true";
+        work = "1";
+
+        String point = null;
+        if(!Objects.isNull(result) && "true".equals(result) && !Objects.isNull(work)){
+            point = DictionaryKey.HL_WORK_LOCATION.get(work.toString());
+        }else{
+            logger.warn("【恒轮调试空闲接口】条件不满足:result={},work={}",result,work);
+        }
+        return point;
+    }
 }

+ 19 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/mq/TaskWorkNode.java

@@ -456,6 +456,11 @@ public class TaskWorkNode {
                                         JSONObject ret = new JSONObject();
                                         ret.put("result","true");
                                         returnData = ret.toJSONString();
+                                    }else if(taskNode.getTargetResourceId() == Long.parseLong("1496354747433615360")){
+                                       logger.warn("恒轮机床上传程序内部调用");
+                                       JSONObject ret = new JSONObject();
+                                       ret.put("result","true");
+                                       returnData = ret.toJSONString();
                                     }else{
                                         //组装接口参数
                                         HttpHeaders headers = new HttpHeaders();
@@ -1454,6 +1459,20 @@ public class TaskWorkNode {
                                     String putPoint = DictionaryKey.ZEISS_LOCATION.get("M");
                                     targetList = productionresourcePositionService.list(Wraps.<ProductionresourcePosition>lbQ().eq(ProductionresourcePosition::getResourceId, taskNode.getTargetResourceId()).eq(ProductionresourcePosition::getPointId,putPoint));
                                 }
+                            }else if(resourceId == Long.parseLong("1496354747433615360")){
+                                //恒轮
+                                String hellerPoint = storgeService.getHellerPoint(taskNode);
+                                if(StringUtil.isNotEmpty(hellerPoint)) {
+                                    Map sxlzmap = new HashMap();
+                                    sxlzmap.put("resourceIdStr",StringUtil.changeIdsArrToSubQueryStr(new String[] {taskNode.getTargetResourceId().toString()}));
+                                    sxlzmap.put("freeFlag","1");
+                                    sxlzmap.put("pointId",hellerPoint);
+                                    targetList = productionresourcePositionMapper.getPPList(sxlzmap);
+                                    if(CollectionUtil.isEmpty(targetList)){
+                                        logger.warn("恒轮调试空闲接口返回点位:{},ECS当前点位被锁定或占用",hellerPoint);
+                                    }
+                                    logger.warn("恒轮调试目标库位:{}", JSONObject.toJSONString(targetList));
+                                }
                             }else{
                                 targetList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[] {resourceId.toString()});
                             }

+ 6 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/MachineNodeServiceImpl.java

@@ -315,7 +315,12 @@ public class MachineNodeServiceImpl implements NodeOperationService {
                     //String fileName = "";
                     //String fileNames[] = fileName.split(",");
                     JSONObject data = new JSONObject();
-                    data.put("remotePath", procedureProgramList.get(0).getSubmittedFileName());
+                    if(productionresource.getModeSpecification().contains("HELLER")){
+                        data.put("remotePath", "3");
+
+                    }else{
+                        data.put("remotePath", procedureProgramList.get(0).getSubmittedFileName());
+                    }
                     map.put("data", data);
                     map.put("method", "StartNCProgram");
                     map.put("result", true);

+ 21 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RobotNodeServiceImpl.java

@@ -770,6 +770,12 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                         dataMap.put(DemoLineConstant.DEMOLINE_STOCK_TYPE,DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
 
                         Map locationMap = new HashMap();
+
+                        Productionresource productionresource =  productionresourceBizMapper.selectOne(Wraps.<Productionresource>lbQ().eq(Productionresource::getId,taskNode.getTargetResourceId()));
+                        if(productionresource.getModeSpecification().contains("HELLER")){
+                            locationMap.put("fileName","3");
+                        }
+
                         locationMap.put("location",targetStorge.getPointId());
                         dataMap.put("data", locationMap);
 
@@ -1177,6 +1183,21 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                                 String putPoint = DictionaryKey.ZEISS_LOCATION.get("M");
                                 targetList = productionresourcePositionService.list(Wraps.<ProductionresourcePosition>lbQ().eq(ProductionresourcePosition::getResourceId, taskNode.getTargetResourceId()).eq(ProductionresourcePosition::getPointId,putPoint));
                             }
+                        }else if(resourceId == Long.parseLong("1496354747433615360")){
+                            targetList = null;
+                            //恒轮
+                            String hellerPoint = storgeService.getHellerPoint(taskNode);
+                            if(StringUtil.isNotEmpty(hellerPoint)) {
+                                Map sxlzmap = new HashMap();
+                                sxlzmap.put("resourceIdStr",StringUtil.changeIdsArrToSubQueryStr(new String[] {taskNode.getTargetResourceId().toString()}));
+                                sxlzmap.put("freeFlag","1");
+                                sxlzmap.put("pointId",hellerPoint);
+                                targetList = productionresourcePositionMapper.getPPList(sxlzmap);
+                                if(CollectionUtil.isEmpty(targetList)){
+                                    logger.warn("恒轮调试空闲接口返回点位:{},ECS当前点位被锁定或占用",hellerPoint);
+                                }
+                                logger.warn("恒轮调试目标库位:{}", JSONObject.toJSONString(targetList));
+                            }
                         }else{
                             targetList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[] {resourceId.toString()});
                         }