姚云青 3 lat temu
rodzic
commit
1857b02f17

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

@@ -377,6 +377,8 @@ public class TaskWorkNode {
         //临时先把请求参数放出来
         msgUtil.redis_set("testParam", bizJsonObject.toJSONString(), 1, TimeUnit.DAYS);
 
+        logger.info("节点业务参数" + bizJsonObject.toJSONString());
+
         return jsonObject.toJSONString();
     }
 
@@ -596,7 +598,7 @@ public class TaskWorkNode {
 
                 jqrStorge = storgeService.getById(robotList.get(0).getStorgeId());
 
-                Storge startStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
+                Storge startStore = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
 
                 ProductionresourcePosition po = logical(robotList,targetStorge,zone);
                 //机器人手抓没被锁定,并且有空闲未知
@@ -632,7 +634,7 @@ public class TaskWorkNode {
             } else if (count == 1) {
                 jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + taskNode.getId());
                 dataMap.put("method", "GetServoStacker");
-                Storge currentStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
+                Storge currentStore = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
                 dataMap.put("fromStorge", currentStore);
 
                 Map locationMap = new HashMap();
@@ -644,7 +646,7 @@ public class TaskWorkNode {
                 dataMap.put("toStorge", jqrStorge);
                 dataMap.put("result", true);
             } else if (count == 2) {
-                Storge currentStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
+                Storge currentStore = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
                 dataMap.put("method", "SendServoStacker");
                 dataMap.put("fromStorge", currentStore);
                 //出入库类型
@@ -702,7 +704,7 @@ public class TaskWorkNode {
 
                 dataMap.put("method", "GetServoStacker");
                 if (logical(robotList,targetStorge,zone)!=null) {
-                    Storge startStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
+                    Storge startStore = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
 
                     dataMap.put("fromStorge", startStore);
 

+ 1 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/WorkpieceService.java

@@ -70,7 +70,7 @@ public interface WorkpieceService extends SuperService<TWorkpiece> {
     public void setWorkPieceStock(String completeBatchNo, String currStorgeId, String parentStorgeId, TaskNode taskNode);
 
 
-    public Storge getWorkPieceStock(Long taskNodeId, boolean isParent);
+    public Storge getWorkPieceStock(String  completeBatchNo, boolean isParent);
 
     public Storge getWorkPieceTargetStock(Long taskNodeId);
 

+ 8 - 7
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/WorkpieceServiceImpl.java

@@ -515,11 +515,12 @@ public class WorkpieceServiceImpl extends SuperServiceImpl<WorkpieceMapper, TWor
                 tWorkpiece.setPpointId(pstorge.getPointId());
             }
 
-            if(taskNode.getTargetResourceId()!=null){
-                Storge tstorge = storgeMapper.selectById(taskNode.getTargetResourceId());
-                tWorkpiece.setTstorgeId(taskNode.getTargetResourceId());
-                tWorkpiece.setTpointId(tstorge.getPointId());
-            }
+            //TODO 临时去掉
+//            if(taskNode.getTargetResourceId()!=null){
+//                Storge tstorge = storgeMapper.selectById(taskNode.getTargetResourceId());
+//                tWorkpiece.setTstorgeId(taskNode.getTargetResourceId());
+//                tWorkpiece.setTpointId(tstorge.getPointId());
+//            }
 
             baseMapper.updateAllById(tWorkpiece);
         }
@@ -532,10 +533,10 @@ public class WorkpieceServiceImpl extends SuperServiceImpl<WorkpieceMapper, TWor
      * @return
      */
     @Override
-    public Storge getWorkPieceStock(Long taskNodeId,boolean isParent) {
+    public Storge getWorkPieceStock(String completeBatchNo,boolean isParent) {
         Storge storge = new Storge();
         TWorkpiece tWorkpiece = new TWorkpiece();
-        List<TWorkpiece>list = baseMapper.selectList(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getTaskNodeId,taskNodeId));
+        List<TWorkpiece>list = baseMapper.selectList(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getCompleteBatchNo,completeBatchNo));
         if(CollectionUtil.isNotEmpty(list)){
             tWorkpiece = list.get(0);
         }

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

@@ -231,7 +231,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
             beforTaskNode.setAutoNode(resourceAutoCodeMapper.selectById(beforTaskNode.getAutoNode().getId()));
             //前序是设备序并且最后一个节点是agv搬运,锁定agv相关库位信息
             if(beforTaskNode.getTaskId().equals(taskNode.getTaskId()) && "1".equals(beforTaskNode.getAutoNode().getCategory()) && null == lastOperationTaskNode.getResourceId()){
-                currStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
+                currStore = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
                 ProductionresourcePosition startProductionresourcePosition = null;
                 ProductionresourcePosition endProductionresourcePosition = null;
                 Storge agvStartStationStorge = null;
@@ -380,14 +380,20 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                     Map<String, List<ProductionresourcePosition>> jqrMap = robotList.stream().collect(groupingBy(ProductionresourcePosition::getPointId));
 
                     TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+
+                    //获取当前位置
+                    if(CollectionUtil.isNotEmpty(flikustockInfos)){//
+                        startStore = storgeMapper.selectById(flikustockInfos.get(0).getStorgeId());
+                    }
+
                     //目标库位,可能是
-                    Map returnMap = getTargetStorge(nextTaskNode,flikustockInfos);
+                    Map returnMap = getTargetStorge(nextTaskNode);
                     //目标地址和类型
                     Storge targetStorge = returnMap.get("store")==null?null:(Storge)returnMap.get("store");
                     String targetxbk = returnMap.get("targetxbk")==null?null:(String)returnMap.get("targetxbk");
 
 
-                    ProductionresourcePosition po = logical(robotList,targetStorge);
+                    ProductionresourcePosition po = logical(robotList,targetStorge,flikustockInfos,taskNode);
                     //机器人手抓没被锁定,并且有空闲未知
 
                     if (po!=null) {
@@ -418,7 +424,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
 
                         //满足条件--机器人空闲,设备或线边库有一个空闲
                         Map locationMap = new HashMap();
-                        locationMap.put("location",targetStorge.getPointId());
+                        locationMap.put("location",startStore.getPointId());
                         dataMap.put("data", locationMap);
                         dataMap.put("method", "MoveRobotPosition");
                     }
@@ -426,7 +432,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                 } else if (count == 1) {
                     jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + YunjianConstant.YUNJIAN_JXS + taskNode.getId());
                     dataMap.put("method", "GetServoStacker");
-                    Storge currentStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
+                    Storge currentStore = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
                     dataMap.put("fromStorge", currentStore);
 
                     Map locationMap = new HashMap();
@@ -438,7 +444,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                     dataMap.put("toStorge", jqrStorge);
                     dataMap.put("result", true);
                 } else if (count == 2) {
-                    Storge currentStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
+                    Storge currentStore = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
                     dataMap.put("method", "SendServoStacker");
                     dataMap.put("fromStorge", currentStore);
                     //出入库类型
@@ -455,26 +461,36 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                 }
             }else if (BizConstant.ROBOT_TYPE_NOCACHE.equals(zoneService.getRobotTypebyZone(zoneName))) {
                 TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                Map returnMap = getTargetStorge(nextTaskNode,flikustockInfos);
+                Map returnMap = getTargetStorge(nextTaskNode);
+
+                //获取当前位置
+                if(CollectionUtil.isNotEmpty(flikustockInfos)){//
+                    startStore = storgeMapper.selectById(flikustockInfos.get(0).getStorgeId());
+                }
 
                 //目标地址和类型
                 Storge targetStorge = returnMap.get("store")==null?null:(Storge)returnMap.get("store");
                 String targetxbk = returnMap.get("targetxbk")==null?null:(String)returnMap.get("targetxbk");
 
                 dataMap.put("method", "GetServoStacker");
-                ProductionresourcePosition po = logical(robotList,targetStorge);
+                ProductionresourcePosition po = logical(robotList,targetStorge,flikustockInfos,taskNode);
 
                 if (po!=null) {//机器人只有一只手
                     jqrStorge = storgeService.getById(robotList.get(0).getStorgeId());
 
-                    dataMap.put("fromStorge", targetStorge);
+                    dataMap.put("fromStorge", startStore);
 
                     Map locationMap = new HashMap();
-                    locationMap.put("location",targetStorge.getPointId());
+                    locationMap.put("location",startStore.getPointId());
                     dataMap.put("data", locationMap);
                     // TODO 有问题,需要区分是否是第一步上料
                     //出入库类型
-                    dataMap.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_TRAY_CRK);
+                    if(taskNode.getCompleteBatchSort()==1){//TODO 条件后续再丰富
+                        dataMap.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_TRAY_CRK);
+                    }else {
+                        dataMap.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+                    }
+
                     //目的地为机器人手臂
                     dataMap.put("toStorge", jqrStorge);
 
@@ -545,14 +561,21 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                     }
                 }
             }else if (BizConstant.ROBOT_TYPE_NOCACHE.equals(zoneService.getRobotTypebyZone(zoneName))) {
+                Storge currentStore = workpieceService.getWorkPieceStock(taskNode.getCompleteBatchNo(), false);
                 dataMap.put("method", "SendServoStacker");
                 dataMap.put("toStorge", targetStorge);
+                dataMap.put("fromStorge", currentStore);
 
                 Map locationMap = new HashMap();
                 locationMap.put("location",targetStorge.getPointId());
                 dataMap.put("data", locationMap);
 
-                dataMap.put(DemoLineConstant.DEMOLINE_STOCK_TYPE,DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+                //出入库类型
+                if(taskNode.getCompleteBatchSort()==2){//TODO 条件后续再丰富
+                    dataMap.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_TRAY_CRK);
+                }else {
+                    dataMap.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+                }
                 String targetxbk =(String)msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_XBK_FLAG + taskNode.getId());
                 if("1".equals(targetxbk)){
                     dataMap.put(YunjianConstant.DEMOLINE_XBKFLAG, YunjianConstant.DEMOLINE_XBKFLAG);
@@ -583,7 +606,8 @@ public class RobotNodeServiceImpl implements NodeOperationService {
     }
 
 
-    public Map getTargetStorge(TaskNode taskNode,List<StockInfo> flikustockInfos){
+
+    public Map getTargetStorge(TaskNode taskNode){
         Map returnMap = new HashMap();
         Storge targetStorge = null;
         Long resourceId = taskNode.getTargetResourceId();
@@ -591,12 +615,12 @@ public class RobotNodeServiceImpl implements NodeOperationService {
 
         //
 //        if(taskNode.getCompleteBatchSort()==1){
-            if(CollectionUtil.isNotEmpty(flikustockInfos)){
-                targetStorge = storgeMapper.selectById(flikustockInfos.get(0).getStorgeId());
-                returnMap.put("store",targetStorge);
-                returnMap.put("targetxbk","0");
-                return returnMap;
-            }
+//            if(CollectionUtil.isNotEmpty(flikustockInfos)){
+//                targetStorge = storgeMapper.selectById(flikustockInfos.get(0).getStorgeId());
+//                returnMap.put("store",targetStorge);
+//                returnMap.put("targetxbk","0");
+//                return returnMap;
+//            }
 //        }
 
         //目标设备
@@ -640,7 +664,12 @@ public class RobotNodeServiceImpl implements NodeOperationService {
      * @param robotList
      * @return
      */
-    public ProductionresourcePosition logical(List<ProductionresourcePosition> robotList,Storge targetStorge){
+    public ProductionresourcePosition logical(List<ProductionresourcePosition> robotList,Storge targetStorge,List<StockInfo>flikustockInfos,TaskNode taskNode){
+        if(taskNode.getCompleteBatchSort()==1){
+            if(CollectionUtil.isEmpty(flikustockInfos)){
+                return null;
+            }
+        }
 
         //设备不存在
         if(!checkRobot()){