Bladeren bron

机器人

laoyao 3 jaren geleden
bovenliggende
commit
b54ab42f11

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

@@ -92,16 +92,12 @@ public class AGVNodeServiceImpl implements NodeOperationService {
         Storge targetStore = storgeService.getById(targetId);
 
         //开始位置
-//        Long startId = resourceAutoCode.getStartId();
-//        Storge startStore = storgeService.getById(startId);
         Storge startStore = workpieceService.getWorkPieceStock(taskNode.getId(),true);
 
-
-
-
         jbwarr = new String[] {targetStore.getNo()};
         List<ProductionresourcePosition> jbwList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jbwarr);
 
+        //TODO还需要验证,开始接驳位是否被其他锁定。并且尚未放置上去。
         if (CollectionUtil.isNotEmpty(jbwList)) {
             //3、把起始终点库位存放到map,用于接口
             map.put("fromStorge", startStore);

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

@@ -11,8 +11,10 @@ import com.github.zuihou.business.operationManagementCenter.entity.TTask;
 import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
 import com.github.zuihou.business.operationManagementCenter.service.TaskNodeService;
 import com.github.zuihou.business.operationManagementCenter.service.TaskService;
+import com.github.zuihou.business.operationManagementCenter.service.WorkpieceService;
 import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourcePositionMapper;
 import com.github.zuihou.business.productionResourceCenter.entity.ProductionresourcePosition;
+import com.github.zuihou.business.productionResourceCenter.entity.ResourceAutoCode;
 import com.github.zuihou.business.productionResourceCenter.service.NodeOperationService;
 import com.github.zuihou.business.productionResourceCenter.service.ProductionresourcePositionService;
 import com.github.zuihou.business.util.MsgUtil;
@@ -54,6 +56,9 @@ public class RobotNodeServiceImpl implements NodeOperationService {
     @Autowired
     private MsgUtil msgUtil;
 
+    @Autowired
+    private WorkpieceService workpieceService;
+
     private String ZK_ip_zlzx = "192.168.170.61";
 
     //智能单元
@@ -85,1301 +90,1388 @@ public class RobotNodeServiceImpl implements NodeOperationService {
         map.put("task", task);
         map.put("bizType", bizType);
 
-        //质量中心机器人
-        if(DemoLineConstant.JQR1.equals(robotType)){
-            //机器人放子盘夹具到上下料站(从子盘到机械手)。可能进行换手操作
-            if (DemoLineConstant.DEMOLINE_OP01_03.equals(taskNode.getNodeNo())) {
-                //机器人放子盘夹具到上下料站(从子盘到机械手)。可能进行换手操作
-                //执行步骤
-                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
-                if (count == 0) {
-                    //更换抓手尚未考虑
-                    //判断上下料站
-                    sxlzIdArr = new String[] {task.getResourceId().toString()};
-                    List<ProductionresourcePosition> sxlzList = productionresourcePositionService.getFreeProductionresourcePositionByIds(sxlzIdArr);
-                    //判断机器人是否为空
-                    String jqrarr[] = {DemoLineConstant.JQR1};
-                    List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jqrarr);
-
-                    Storge xbkstorge = storgeService.getTrayStorge(task);
-                    if (CollectionUtil.isNotEmpty(sxlzList) && CollectionUtil.isNotEmpty(jqrList) && xbkstorge != null) {
-                        Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
-                        //(由于搬运拆成两个节点),把锁定的节点放到缓存,便于下个节点使用
-                        TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-
-                        //机器人库位锁定
-                        jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                        storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
-                        //锁定放入缓存
-                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
-                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
 
-                        //锁定线边库
-                        xbkstorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                        storgeService.lockStorge(xbkstorge, nextTaskNode.getId());
-                        //锁定放入缓存
-                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.XBK + nextTaskNode.getId(), xbkstorge, 1, TimeUnit.DAYS);
-                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.XBK + taskNode.getId(), xbkstorge, 1, TimeUnit.DAYS);
 
-                        //锁定上下料站
-                        TaskNode next2TaskNode = taskNodeService.getNextNTaskNode(taskNode, 2);
-                        Storge sxlzStorge = storgeService.getById(sxlzList.get(0).getStorgeId());
-                        sxlzStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                        storgeService.lockStorge(sxlzStorge, next2TaskNode.getId());
+        ResourceAutoCode resourceAutoCode = taskNode.getAutoNode();
+        String functionName = resourceAutoCode.getCommand();
+        String moduleName = dataMap.get("moduleName") == null ? "" : dataMap.get("moduleName").toString();
 
-                        //锁定放入缓存
-                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.SXLZ + next2TaskNode.getId(), sxlzStorge, 1, TimeUnit.DAYS);
-                        //上下料站在下个节点和下下个节点都用到
-                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.SXLZ + nextTaskNode.getId(), sxlzStorge, 1, TimeUnit.DAYS);
 
-                        map.put("zkIp", ZK_ip_zlzx);
-                        Map handMap = taskService.checkChangeHand(task);
-                        //需要换手抓
-                        if ("1".equals(handMap.get("result").toString())) {
-                            taskService.handleChangeHand(handMap, map);
-                        } else {//不需要换手
-                            map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                            map.put("Data", xbkstorge);
-                            map.put("fromStorge", xbkstorge);
-                            map.put("toStorge", jqrStorge);
-                            //出入库类型
-                            map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_TRAY_CRK);
-                        }
-                        map.put(taskNode.getId().toString() + "count", count);
-                    }
-                    map.put("result", (CollectionUtil.isNotEmpty(sxlzList) && CollectionUtil.isNotEmpty(jqrList) && xbkstorge != null));
-                }
-                else if (count == 1) {//前面换手完成,机器人放子盘夹具到上下料站(从子盘到机械手),这一步可能不用走
-                    Storge xbkstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.XBK + taskNode.getId());
-                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId());
-                    map.put("zkIp", ZK_ip_zlzx);
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                    map.put("Data", xbkstorge);
-                    map.put("fromStorge", xbkstorge);
-                    map.put("toStorge", jqrStorge);
-                    //出入库类型
-                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_TRAY_CRK);
-                    map.put("result", true);
-                }
-            }
-
-            else if (DemoLineConstant.DEMOLINE_OP01_04.equals(taskNode.getNodeNo())) {
-                //1、取出质量中心机器人
-                Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId());
-                //重新锁定一下机器人的库位,更新一下被锁定的业务ID(由于搬运拆成两个节点)
-                //storgeService.lockStorge(jqrStorge, taskNode.getId());
-                //2、取出上下料站
-                Storge sxlzstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.SXLZ + taskNode.getId());
-                map.put("zkIp", ZK_ip_zlzx);
-                //3、把起始终点库位存放到map,用于接口
-                map.put("fromStorge", jqrStorge);
-                map.put("toStorge", sxlzstorge);
-                //出入库类型-托盘夹具出入库
-                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_TRAY_CRK);
-
-                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
-                map.put("Data", sxlzstorge);
-                //这个节点没有需要验证的内容,都在前一个节点验证并且锁定了
-                map.put("result", true);
-                //4、记录机器人的库位,下一个步骤使用
-//                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), sxlzstorge, 1, TimeUnit.DAYS);
-            }
-            else if (DemoLineConstant.DEMOLINE_OP01_06.equals(taskNode.getNodeNo())) {
-                //机器人取料(机器人从人工上料站取料放到机械手)
-                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
-                if (count == 0) {
-                    //判断机器人是否为空
-                    jqrarr = new String[] {DemoLineConstant.JQR1};
-                    List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jqrarr);
+        if ("拿".equals(moduleName)) {
+            map.put("zkIp", ZK_ip_zndy);
+            map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+            //判断机器人是否为空
+            String jrqarr[] = {resourceAutoCode.getResourceId().toString()};
+            List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByIds(jrqarr);
 
-                    Storge plantStorge = null;
-                    String jbwCode = "";
-                    List<ProductionresourcePosition> xbkList = null;
-                    if (CollectionUtil.isNotEmpty(jqrList)) {
-                        //只要机器人空闲就可以搬
-                        //判断接驳位D\E是否为空
-                        jbwarr = new String[] {DemoLineConstant.JBW_D, DemoLineConstant.JBW_E};
-                        Map plateMap = storgeService.getPlateStorgeByNo(jbwarr, task.getCompleteBatchNo());
-                        //获取锁定的托板上的库位
-                        plantStorge = plateMap.get("storge") == null ? null : (Storge) plateMap.get("storge");
-                        jbwCode = plateMap.get("jbwCode") == null ? "" : plateMap.get("jbwCode").toString();
-                        TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                        TaskNode next3TaskNode = taskNodeService.getNextNTaskNode(taskNode, 3);
-                        if (plantStorge != null) {//设备空闲
-                            plantStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(plantStorge, next3TaskNode.getId());
-                            //放入缓存,下个节点使用
-                            Storge jbwStorge = plateMap.get("jbwStorge") == null ? null : (Storge) plateMap.get("jbwStorge");
-//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.TB + next3TaskNode.getId(), plantStorge, 1, TimeUnit.DAYS);
-//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JBW + next3TaskNode.getId(), jbwStorge, 1, TimeUnit.DAYS);
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo(), jbwStorge, 1, TimeUnit.DAYS);
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo(), plantStorge, 1, TimeUnit.DAYS);
-
-                        } else {//设备忙碌,放置到线边库
-                            String zlzxXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZLZX_XBK};
-                            xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(zlzxXBKarr);
-                            if (CollectionUtil.isNotEmpty(xbkList)) {
-                                //锁定线边库
-                                Storge xbkStorge = storgeService.getById(xbkList.get(0).getStorgeId());
-                                xbkStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                                storgeService.lockStorge(xbkStorge, nextTaskNode.getId());
-                                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZLZX_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
-                            }
-                        }
-                        //满足条件--机器人空闲,设备或线边库有一个空闲
-                        if (CollectionUtil.isNotEmpty(jqrList) && ((plantStorge != null) || CollectionUtil.isNotEmpty(xbkList))) {
-                            //目的地为机器人手臂
-                            Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
-                            //锁定机器人
-                            jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
-                            //锁定放入缓存
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
-
-                            map.put("zkIp", ZK_ip_zlzx);
-                            Map handMap = taskService.checkChangeHand(task);
-                            //需要换手抓
-                            if ("1".equals(handMap.get("result").toString())) {
-                                taskService.handleChangeHand(handMap, map);
-                            } else {//不需要换手
-                                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                                //取出前一步骤存放的上下料站库位
-                                Storge sxlzstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
-                                //出入库参数
-                                map.put("fromStorge", sxlzstorge);
-
-                                map.put("toStorge", jqrStorge);
-                                //接口用参数
-                                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                                map.put("Data", sxlzstorge);
-                                //出入库类型
-                                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                                //记录产品流转到的库位
-                                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
-                            }
-                            map.put(taskNode.getId().toString() + "count", count);
-                        }
-                    }
-                    map.put("result", CollectionUtil.isNotEmpty(jqrList) && ((plantStorge != null) || CollectionUtil.isNotEmpty(xbkList)));
-                }
-                else if (count == 1) {
-                    //前面换手完成,机器人放子盘夹具到上下料站(从子盘到机械手),这一步可能不用走
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                    //取出前一步骤存放的上下料站库位
-                    Storge sxlzstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
-                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId());
-                    map.put("zkIp", ZK_ip_zlzx);
-                    //出入库参数
-                    map.put("fromStorge", sxlzstorge);
-
-                    map.put("toStorge", jqrStorge);
-                    //接口用参数
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                    map.put("Data", sxlzstorge);
-                    //出入库类型
-                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-
-                    map.put("result", true);
-//                    //记录产品流转到的库位
-//                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
-                }
-            }
-            else if (DemoLineConstant.DEMOLINE_OP01_07.equals(taskNode.getNodeNo())) {
-                //机器人取料(机器人放料到接驳位或者线边库)
-                Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId());
-                map.put("zkIp", ZK_ip_zlzx);
-                map.put("fromStorge", jqrStorge);
-                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
-                //出入库类型
-                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-
-                Storge plantStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo());
-                Storge jbwStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo());
-                //后续要先锁定接驳位,先调试
-                if (jbwStorge != null) {//接驳位有空闲
-//                    //锁定的托板上的库位,锁定的业务ID是下一个节点的ID
-//                    TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-//                    storgeService.lockStorge(plantStorge, nextTaskNode.getId());
-                    //目的地为托板上的其中一个库位
-                    map.put("toStorge", plantStorge);
-
-                    map.put("Data", plantStorge);
-                    //所属接驳位
-                    map.put("jbwCode", jbwStorge.getResourceNo());
-                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), plantStorge, 1, TimeUnit.DAYS);
-
-                } else {//接驳位忙碌,只能放到10.1预占的线边库
-                    //1、取出10-1锁定的线边库
-                    Storge xbkStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZLZX_XBK + taskNode.getId());
-                    map.put("toStorge", xbkStorge);
-                    map.put("Data", xbkStorge);
-                    //临时存放到了线边库的标志
-                    map.put(DemoLineConstant.DEMOLINE_XBKFLAG, "1");
-                    //临时存放到了质量中心的线边库
-                    map.put(DemoLineConstant.DEMOLINE_XBK_TYPE, DemoLineConstant.NODE_RESOURCE_ZLZX_XBK);
-                    //搬运类型
-                    map.put(DemoLineConstant.DEMOLINE_XBK_CARRY_TYPE, BizConstant.MQ_TASK_NODE_TYPE_STORAGE_WAIT_ZLZX_JBW);
-                }
-                //无需条件
-                map.put("result", true);
-            }
-
-            else if (DemoLineConstant.DEMOLINE_OP05_02.equals(taskNode.getNodeNo())) {
-                //取放到三坐标
-                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
-                if (count == 0) {
-                    //机器人为空
-                    String jrqarr[] = {DemoLineConstant.JQR1};
-                    List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
-
-                    //三坐标空闲
-                    String szbarr[] = {DemoLineConstant.Q3ZUOBIAO};
-                    List<ProductionresourcePosition> szbList = productionresourcePositionService.getFreeProductionresourcePositionByNos(szbarr);
-
-                    List<ProductionresourcePosition> xbkList = new ArrayList<>();
-
-                    if (CollectionUtil.isNotEmpty(jqrList)) {//机器人是空闲
-                        TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                        if (CollectionUtil.isNotEmpty(szbList)) {//三坐标为空,并且
-                            //锁定三坐标
-                            Storge szbStorge = storgeService.getById(szbList.get(0).getStorgeId());
-                            szbStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(szbStorge, nextTaskNode.getId());
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.Q3ZUOBIAO + nextTaskNode.getId(), szbStorge, 1, TimeUnit.DAYS);
-                        } else {
-                            String zlzxXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZLZX_XBK};
-                            xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(zlzxXBKarr);
-                            if (xbkList != null && xbkList.size() > 0) {
-                                //锁定线边库
-                                Storge xbkStorge = storgeService.getById(xbkList.get(0).getStorgeId());
-                                xbkStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                                storgeService.lockStorge(xbkStorge, nextTaskNode.getId());
-                                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZLZX_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
-                            }
-                        }
-
-                        if ((CollectionUtil.isNotEmpty(jqrList)) && ((CollectionUtil.isNotEmpty(szbList) || CollectionUtil.isNotEmpty(xbkList)))) {
-                            Storge plantStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo());
-                            //目的地为机器人手臂
-                            Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
-                            //锁定机器人
-                            jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
-                            //锁定放入缓存
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
-
-                            map.put("zkIp", ZK_ip_zlzx);
-                            Map handMap = taskService.checkChangeHand(task);
-                            //需要换手抓
-                            if ("1".equals(handMap.get("result").toString())) {
-                                taskService.handleChangeHand(handMap, map);
-                            } else {//不需要换手
-                                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                                map.put("fromStorge", plantStorge);
-                                //目的地为机器人手臂
-                                map.put("toStorge", jqrStorge);
-                                map.put("Data", plantStorge);
-                                //出入库类型
-                                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                                //记录产品流转到的库位
-                                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
-                            }
-                            map.put(taskNode.getId().toString() + "count", count);
-                        }
-                        map.put("result", (CollectionUtil.isNotEmpty(jqrList)) && ((CollectionUtil.isNotEmpty(szbList) || CollectionUtil.isNotEmpty(xbkList))));
-                    }
-                }
-                else if (count == 1) {
-                    Storge plantStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo());
-                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId());
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                    map.put("fromStorge", plantStorge);
-                    map.put("toStorge", jqrStorge);
-                    map.put("Data", plantStorge);
-                    //出入库类型
-                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                    //锁定机器人
-                    jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                    storgeService.lockStorge(jqrStorge, taskNode.getId());
-                    //记录产品流转到的库位
-                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
-                }
-            }
-
-            else if (DemoLineConstant.DEMOLINE_OP05_05.equals(taskNode.getNodeNo())) {
-                //机械手从三坐标取出
-                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
-                if (count == 0) {
-                    String[] sxlzIdArr = {DemoLineConstant.SXLZ1, DemoLineConstant.SXLZ2};
-                    List<ProductionresourcePosition> sxlzList = productionresourcePositionService.getFreeProductionresourcePositionByNos(sxlzIdArr);
-                    //判断机器人是否为空
-                    String jrqarr[] = {DemoLineConstant.JQR1};
-                    List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
-
-                    List<ProductionresourcePosition> xbkList = new ArrayList<>();
-
-                    if (CollectionUtil.isNotEmpty(jqrList)) {//机器人是空闲
-                        if (CollectionUtil.isNotEmpty(sxlzList)) {//三坐标为空,并且
-                            TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                            //锁定上下料站
-                            Storge sxlzStorge = storgeService.getById(sxlzList.get(0).getStorgeId());
-                            sxlzStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(sxlzStorge, nextTaskNode.getId());
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.SXLZ + nextTaskNode.getId(), sxlzStorge, 1, TimeUnit.DAYS);
-                        } else {
-                            String zlzxXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZLZX_XBK};
-                            xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(zlzxXBKarr);
-                            if (xbkList != null && xbkList.size() > 0) {
-                                //锁定线边库
-                                Storge xbkStorge = storgeService.getById(xbkList.get(0).getStorgeId());
-                                TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                                xbkStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                                storgeService.lockStorge(xbkStorge, nextTaskNode.getId());
-                                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZLZX_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
-                            }
-                        }
-                    }
-
-
-                    if (CollectionUtil.isNotEmpty(jqrList) && ((CollectionUtil.isNotEmpty(sxlzList) || CollectionUtil.isNotEmpty(xbkList)))) {
-                        map.put("zkIp", ZK_ip_zlzx);
-                        Storge szbStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
-                        //取出包含托盘夹具的库位
-                        Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
-                        //机器人库位锁定
-                        jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                        //锁定机器人
-                        TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                        storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
-                        //锁定放入缓存
-                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
-                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
-
-                        Map handMap = taskService.checkChangeHand(task);
-                        //需要换手抓
-                        if ("1".equals(handMap.get("result").toString())) {
-                            taskService.handleChangeHand(handMap, map);
-                        } else {//不需要换手
-                            map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                            //出入库类型
-                            map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                            //目的地为机器人手臂
-                            map.put("Data", szbStorge);
-                            map.put("toStorge", jqrStorge);
-                            map.put("fromStorge", szbStorge);
-                            //(由于搬运拆成两个节点),把锁定的节点放到缓存,便于下个节点使用
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
-                            //记录产品流转到的库位
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
-                        }
-                        map.put(taskNode.getId().toString() + "count", count);
-                    }
-                    map.put("result", CollectionUtil.isNotEmpty(jqrList) && ((CollectionUtil.isNotEmpty(sxlzList) || CollectionUtil.isNotEmpty(xbkList))));
-                } else if (count == 1) {
-                    Storge szbStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
-                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId());
-                    map.put("zkIp", ZK_ip_zlzx);
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                    //出入库类型
-                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                    //目的地为机器人手臂
-                    map.put("Data", szbStorge);
-                    map.put("toStorge", jqrStorge);
-                    map.put("fromStorge", szbStorge);
-                    map.put("result", true);
-                    //(由于搬运拆成两个节点),把锁定的节点放到缓存,便于下个节点使用
-                    //记录产品流转到的库位
-                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
-                }
-            }
-
-            else if (DemoLineConstant.DEMOLINE_OP05_06.equals(taskNode.getNodeNo())) {
-                //机器人放子盘夹具到上下料站(从机械手到上下料站)
-                //节点4的任务都在节点3被锁定过了,只要从缓存拿出来对应的值即可
-                //1、取出机器人
-                Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId());
-                //2、取出上下料站
-                Storge sxlzstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.SXLZ + taskNode.getId());
-                map.put("zkIp", ZK_ip_zlzx);
-                //3、把起始终点库位存放到map,用于接口
-                map.put("fromStorge", jqrStorge);
-                map.put("toStorge", sxlzstorge);
-                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
+            TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                //判断目标
+//                String sum50[] = {DemoLineConstant.DEMOLINE_SUM50_ZNDY};
+//                List<ProductionresourcePosition> sum50List = productionresourcePositionService.getFreeProductionresourcePositionByNos(sum50);
+//                List<ProductionresourcePosition> xbkList = new ArrayList<>();
+//
+//                TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+            if (CollectionUtil.isNotEmpty(jqrList)) {
+                Storge startStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
+                map.put("fromStorge", startStore);
+                map.put("Data", startStore);
                 //出入库类型
                 map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
                 //目的地为机器人手臂
-                map.put("Data", sxlzstorge);
-                //这个节点没有需要验证的内容,都在前一个节点验证并且锁定了
-                map.put("result", true);
-                //4、记录机器人的库位,下一个步骤使用
-                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), sxlzstorge, 1, TimeUnit.DAYS);
+                Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
+                map.put("toStorge", jqrStorge);
+                //锁定机器人
+                jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+                storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
             }
-
-            else if (DemoLineConstant.DEMOLINE_OP06_02.equals(taskNode.getNodeNo())) {
-                //子盘,夹具,归还线边库
-                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
-                if (count == 0) {
-                    Storge sxlzstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
-                    //更换抓手尚未考虑
-                    //判断上下料站
-                    //根据工件获取所在的生产单元(产线)
-                    String zoneNo = msgUtil.redis_get(DemoCacheKey.DEMOLINE_WORKOP_ZONE + task.getCompleteBatchNo()) == null ? ""
-                            : msgUtil.redis_get(DemoCacheKey.DEMOLINE_WORKOP_ZONE + task.getCompleteBatchNo()).toString();
-                    //线边库事宜的托盘类型
-                    String fitTrayType = "1";
-                    if (DemoLineConstant.DEMOLINE_WORK_SPACE1.equals(zoneNo)) {
-                        fitTrayType = "0";
-                    }
-
-                    String zlzxXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZLZX_XBK};
-                    List<ProductionresourcePosition> xbkList = productionresourcePositionService.getFreeProductionresourcePositionByTrayTypeNos(zlzxXBKarr, fitTrayType);
-                    //判断机器人是否为空
-                    String jrqarr[] = {DemoLineConstant.JQR1};
-                    List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
+            //
+            map.put("result", (CollectionUtil.isNotEmpty(jqrList)));
+        }else if("拿1".equals(moduleName)){
+            int count = dataMap.get(taskNode.getId().toString()+"count")==null?0:Integer.parseInt(dataMap.get(taskNode.getId().toString()+"count").toString());
+            //执行到第几步
+            map.put(taskNode.getId().toString()+"count",count);
+            map.put(DemoLineConstant.DEMOLINE_RXJQR_FLAG, "1");
+            map.put("zkIp",ZK_ip_rxx);
+
+//            if(count==0){//第一步的时候锁定资源
+//                //判断机器人是否为空
+//                String jrqarr[] = {resourceAutoCode.getResourceId().toString()};
+//                List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
+//                Map<String,List<ProductionresourcePosition>> jqrMap = jqrList.stream().collect(groupingBy(ProductionresourcePosition::getPointId));
+//
+//                TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                //机器人手抓没被锁定,并且有空闲未知
+//                if (CollectionUtil.isNotEmpty(jqrList)&&jqrList.size()>1&&jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS)) {
+//                    //满足条件--机器人空闲,设备或线边库有一个空闲
+//                    Storge startStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
+//                    map.put("Data", startStore);
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE,"moveMaterial");
+//                }
+//                map.put("result", (CollectionUtil.isNotEmpty(jqrList) )&&jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS));
+//            }else if(count == 1){
+//                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE,"fetchMaterial");
+//                Storge currentStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
+//                map.put("fromStorge", currentStore);
+//                map.put("Data", currentStore);
+//                //出入库类型
+//                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE,DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                //目的地为机器人手臂
+//                map.put("toStorge", jqrStorge);
+//                map.put("result", true);
+//            }else if(count == 2){
+//                Storge currentStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
+//                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE,"putMaterial");
+//                map.put("fromStorge", currentStore);
+//                //出入库类型
+//                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE,DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                //目的地为机器人手臂
+//                Storge hcwStorge = (Storge)redisTemplate.opsForValue().get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId());
+//                map.put("Data", hcwStorge);
+//                map.put("toStorge", hcwStorge);
+//                map.put("result", true);
+//            }
+//        }
+                return map;
+        }
 
 
-                    if (CollectionUtil.isNotEmpty(xbkList) && CollectionUtil.isNotEmpty(jqrList)) {
-                        Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
-                        //机器人库位锁定
-                        jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                        //(由于搬运拆成两个节点),把锁定的节点放到缓存,便于下个节点使用
-                        TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                        storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
-                        //锁定放入缓存
-                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
-                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
 
-                        //锁定线边库
-                        Storge xbkstorge = storgeService.getById(xbkList.get(0).getStorgeId());
-                        xbkstorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                        storgeService.lockStorge(xbkstorge, nextTaskNode.getId());
-                        //锁定放入缓存
-                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.XBK + nextTaskNode.getId(), xbkstorge, 1, TimeUnit.DAYS);
 
-                        map.put("zkIp", ZK_ip_zlzx);
-                        Map handMap = taskService.checkChangeHand(task);
-                        //需要换手抓
-                        if ("1".equals(handMap.get("result").toString())) {
-                            taskService.handleChangeHand(handMap, map);
-                        } else {
-                            map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                            map.put("fromStorge", sxlzstorge);
-                            map.put("toStorge", jqrStorge);
-                            map.put("Data", sxlzstorge);
-                            map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_TRAY_CRK);
-                        }
-                        map.put(taskNode.getId().toString() + "count", count);
-                    }
-                    map.put("result", CollectionUtil.isNotEmpty(xbkList) && CollectionUtil.isNotEmpty(jqrList));
-                } else if (count == 1) {//前面换手完成,机器人放子盘夹具到上下料站(从子盘到机械手),这一步可能不用走
-                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId());
-                    Storge sxlzstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                    map.put("fromStorge", sxlzstorge);
-                    map.put("toStorge", jqrStorge);
-                    map.put("Data", sxlzstorge);
-                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_TRAY_CRK);
-                }
-            }
 
-            else if (DemoLineConstant.DEMOLINE_OP06_03.equals(taskNode.getNodeNo())) {
-                //机器人放子盘夹具到上下料站(从机械手到上下料站)
-                //节点4的任务都在节点3被锁定过了,只要从缓存拿出来对应的值即可
-                //1、取出机器人
-                Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId());
+        //质量中心机器人
+//        if(DemoLineConstant.JQR1.equals(robotType)){
+//            //机器人放子盘夹具到上下料站(从子盘到机械手)。可能进行换手操作
+//            if (DemoLineConstant.DEMOLINE_OP01_03.equals(taskNode.getNodeNo())) {
+//                //机器人放子盘夹具到上下料站(从子盘到机械手)。可能进行换手操作
+//                //执行步骤
+//                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
+//                if (count == 0) {
+//                    //更换抓手尚未考虑
+//                    //判断上下料站
+//                    sxlzIdArr = new String[] {task.getResourceId().toString()};
+//                    List<ProductionresourcePosition> sxlzList = productionresourcePositionService.getFreeProductionresourcePositionByIds(sxlzIdArr);
+//                    //判断机器人是否为空
+//                    String jqrarr[] = {DemoLineConstant.JQR1};
+//                    List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jqrarr);
+//
+//                    Storge xbkstorge = storgeService.getTrayStorge(task);
+//                    if (CollectionUtil.isNotEmpty(sxlzList) && CollectionUtil.isNotEmpty(jqrList) && xbkstorge != null) {
+//                        Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
+//                        //(由于搬运拆成两个节点),把锁定的节点放到缓存,便于下个节点使用
+//                        TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//
+//                        //机器人库位锁定
+//                        jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                        storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
+//                        //锁定放入缓存
+//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//
+//                        //锁定线边库
+//                        xbkstorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                        storgeService.lockStorge(xbkstorge, nextTaskNode.getId());
+//                        //锁定放入缓存
+//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.XBK + nextTaskNode.getId(), xbkstorge, 1, TimeUnit.DAYS);
+//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.XBK + taskNode.getId(), xbkstorge, 1, TimeUnit.DAYS);
+//
+//                        //锁定上下料站
+//                        TaskNode next2TaskNode = taskNodeService.getNextNTaskNode(taskNode, 2);
+//                        Storge sxlzStorge = storgeService.getById(sxlzList.get(0).getStorgeId());
+//                        sxlzStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                        storgeService.lockStorge(sxlzStorge, next2TaskNode.getId());
+//
+//                        //锁定放入缓存
+//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.SXLZ + next2TaskNode.getId(), sxlzStorge, 1, TimeUnit.DAYS);
+//                        //上下料站在下个节点和下下个节点都用到
+//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.SXLZ + nextTaskNode.getId(), sxlzStorge, 1, TimeUnit.DAYS);
+//
+//                        map.put("zkIp", ZK_ip_zlzx);
+//                        Map handMap = taskService.checkChangeHand(task);
+//                        //需要换手抓
+//                        if ("1".equals(handMap.get("result").toString())) {
+//                            taskService.handleChangeHand(handMap, map);
+//                        } else {//不需要换手
+//                            map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                            map.put("Data", xbkstorge);
+//                            map.put("fromStorge", xbkstorge);
+//                            map.put("toStorge", jqrStorge);
+//                            //出入库类型
+//                            map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_TRAY_CRK);
+//                        }
+//                        map.put(taskNode.getId().toString() + "count", count);
+//                    }
+//                    map.put("result", (CollectionUtil.isNotEmpty(sxlzList) && CollectionUtil.isNotEmpty(jqrList) && xbkstorge != null));
+//                }
+//                else if (count == 1) {//前面换手完成,机器人放子盘夹具到上下料站(从子盘到机械手),这一步可能不用走
+//                    Storge xbkstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.XBK + taskNode.getId());
+//                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId());
+//                    map.put("zkIp", ZK_ip_zlzx);
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                    map.put("Data", xbkstorge);
+//                    map.put("fromStorge", xbkstorge);
+//                    map.put("toStorge", jqrStorge);
+//                    //出入库类型
+//                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_TRAY_CRK);
+//                    map.put("result", true);
+//                }
+//            }
+//
+//            else if (DemoLineConstant.DEMOLINE_OP01_04.equals(taskNode.getNodeNo())) {
+//                //1、取出质量中心机器人
+//                Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId());
 //                //重新锁定一下机器人的库位,更新一下被锁定的业务ID(由于搬运拆成两个节点)
-//                storgeService.lockStorge(jqrStorge, taskNode.getId());
-                //2、取出上下料站
-                Storge xbkstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.XBK + taskNode.getId());
-                map.put("zkIp", ZK_ip_zlzx);
-                //3、把起始终点库位存放到map,用于接口
-                map.put("fromStorge", jqrStorge);
-                map.put("toStorge", xbkstorge);
-                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_TRAY_CRK);
-
-                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
-                map.put("Data", xbkstorge);
-                //这个节点没有需要验证的内容,都在前一个节点验证并且锁定了
-                map.put("result", true);
-                //4、记录机器人的库位,下一个步骤使用
+//                //storgeService.lockStorge(jqrStorge, taskNode.getId());
+//                //2、取出上下料站
+//                Storge sxlzstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.SXLZ + taskNode.getId());
+//                map.put("zkIp", ZK_ip_zlzx);
+//                //3、把起始终点库位存放到map,用于接口
+//                map.put("fromStorge", jqrStorge);
+//                map.put("toStorge", sxlzstorge);
+//                //出入库类型-托盘夹具出入库
+//                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_TRAY_CRK);
+//
+//                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
+//                map.put("Data", sxlzstorge);
+//                //这个节点没有需要验证的内容,都在前一个节点验证并且锁定了
+//                map.put("result", true);
+//                //4、记录机器人的库位,下一个步骤使用
+////                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), sxlzstorge, 1, TimeUnit.DAYS);
+//            }
+//            else if (DemoLineConstant.DEMOLINE_OP01_06.equals(taskNode.getNodeNo())) {
+//                //机器人取料(机器人从人工上料站取料放到机械手)
+//                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
+//                if (count == 0) {
+//                    //判断机器人是否为空
+//                    jqrarr = new String[] {DemoLineConstant.JQR1};
+//                    List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jqrarr);
+//
+//                    Storge plantStorge = null;
+//                    String jbwCode = "";
+//                    List<ProductionresourcePosition> xbkList = null;
+//                    if (CollectionUtil.isNotEmpty(jqrList)) {
+//                        //只要机器人空闲就可以搬
+//                        //判断接驳位D\E是否为空
+//                        jbwarr = new String[] {DemoLineConstant.JBW_D, DemoLineConstant.JBW_E};
+//                        Map plateMap = storgeService.getPlateStorgeByNo(jbwarr, task.getCompleteBatchNo());
+//                        //获取锁定的托板上的库位
+//                        plantStorge = plateMap.get("storge") == null ? null : (Storge) plateMap.get("storge");
+//                        jbwCode = plateMap.get("jbwCode") == null ? "" : plateMap.get("jbwCode").toString();
+//                        TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                        TaskNode next3TaskNode = taskNodeService.getNextNTaskNode(taskNode, 3);
+//                        if (plantStorge != null) {//设备空闲
+//                            plantStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(plantStorge, next3TaskNode.getId());
+//                            //放入缓存,下个节点使用
+//                            Storge jbwStorge = plateMap.get("jbwStorge") == null ? null : (Storge) plateMap.get("jbwStorge");
+////                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.TB + next3TaskNode.getId(), plantStorge, 1, TimeUnit.DAYS);
+////                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JBW + next3TaskNode.getId(), jbwStorge, 1, TimeUnit.DAYS);
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo(), jbwStorge, 1, TimeUnit.DAYS);
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo(), plantStorge, 1, TimeUnit.DAYS);
+//
+//                        } else {//设备忙碌,放置到线边库
+//                            String zlzxXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZLZX_XBK};
+//                            xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(zlzxXBKarr);
+//                            if (CollectionUtil.isNotEmpty(xbkList)) {
+//                                //锁定线边库
+//                                Storge xbkStorge = storgeService.getById(xbkList.get(0).getStorgeId());
+//                                xbkStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                                storgeService.lockStorge(xbkStorge, nextTaskNode.getId());
+//                                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZLZX_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
+//                            }
+//                        }
+//                        //满足条件--机器人空闲,设备或线边库有一个空闲
+//                        if (CollectionUtil.isNotEmpty(jqrList) && ((plantStorge != null) || CollectionUtil.isNotEmpty(xbkList))) {
+//                            //目的地为机器人手臂
+//                            Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
+//                            //锁定机器人
+//                            jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
+//                            //锁定放入缓存
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//
+//                            map.put("zkIp", ZK_ip_zlzx);
+//                            Map handMap = taskService.checkChangeHand(task);
+//                            //需要换手抓
+//                            if ("1".equals(handMap.get("result").toString())) {
+//                                taskService.handleChangeHand(handMap, map);
+//                            } else {//不需要换手
+//                                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                                //取出前一步骤存放的上下料站库位
+//                                Storge sxlzstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
+//                                //出入库参数
+//                                map.put("fromStorge", sxlzstorge);
+//
+//                                map.put("toStorge", jqrStorge);
+//                                //接口用参数
+//                                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                                map.put("Data", sxlzstorge);
+//                                //出入库类型
+//                                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                                //记录产品流转到的库位
+//                                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
+//                            }
+//                            map.put(taskNode.getId().toString() + "count", count);
+//                        }
+//                    }
+//                    map.put("result", CollectionUtil.isNotEmpty(jqrList) && ((plantStorge != null) || CollectionUtil.isNotEmpty(xbkList)));
+//                }
+//                else if (count == 1) {
+//                    //前面换手完成,机器人放子盘夹具到上下料站(从子盘到机械手),这一步可能不用走
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                    //取出前一步骤存放的上下料站库位
+//                    Storge sxlzstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
+//                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId());
+//                    map.put("zkIp", ZK_ip_zlzx);
+//                    //出入库参数
+//                    map.put("fromStorge", sxlzstorge);
+//
+//                    map.put("toStorge", jqrStorge);
+//                    //接口用参数
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                    map.put("Data", sxlzstorge);
+//                    //出入库类型
+//                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//
+//                    map.put("result", true);
+////                    //记录产品流转到的库位
+////                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
+//                }
+//            }
+//            else if (DemoLineConstant.DEMOLINE_OP01_07.equals(taskNode.getNodeNo())) {
+//                //机器人取料(机器人放料到接驳位或者线边库)
+//                Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId());
+//                map.put("zkIp", ZK_ip_zlzx);
+//                map.put("fromStorge", jqrStorge);
+//                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
+//                //出入库类型
+//                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//
+//                Storge plantStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo());
+//                Storge jbwStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo());
+//                //后续要先锁定接驳位,先调试
+//                if (jbwStorge != null) {//接驳位有空闲
+////                    //锁定的托板上的库位,锁定的业务ID是下一个节点的ID
+////                    TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+////                    storgeService.lockStorge(plantStorge, nextTaskNode.getId());
+//                    //目的地为托板上的其中一个库位
+//                    map.put("toStorge", plantStorge);
+//
+//                    map.put("Data", plantStorge);
+//                    //所属接驳位
+//                    map.put("jbwCode", jbwStorge.getResourceNo());
+//                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), plantStorge, 1, TimeUnit.DAYS);
+//
+//                } else {//接驳位忙碌,只能放到10.1预占的线边库
+//                    //1、取出10-1锁定的线边库
+//                    Storge xbkStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZLZX_XBK + taskNode.getId());
+//                    map.put("toStorge", xbkStorge);
+//                    map.put("Data", xbkStorge);
+//                    //临时存放到了线边库的标志
+//                    map.put(DemoLineConstant.DEMOLINE_XBKFLAG, "1");
+//                    //临时存放到了质量中心的线边库
+//                    map.put(DemoLineConstant.DEMOLINE_XBK_TYPE, DemoLineConstant.NODE_RESOURCE_ZLZX_XBK);
+//                    //搬运类型
+//                    map.put(DemoLineConstant.DEMOLINE_XBK_CARRY_TYPE, BizConstant.MQ_TASK_NODE_TYPE_STORAGE_WAIT_ZLZX_JBW);
+//                }
+//                //无需条件
+//                map.put("result", true);
+//            }
+//
+//            else if (DemoLineConstant.DEMOLINE_OP05_02.equals(taskNode.getNodeNo())) {
+//                //取放到三坐标
+//                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
+//                if (count == 0) {
+//                    //机器人为空
+//                    String jrqarr[] = {DemoLineConstant.JQR1};
+//                    List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
+//
+//                    //三坐标空闲
+//                    String szbarr[] = {DemoLineConstant.Q3ZUOBIAO};
+//                    List<ProductionresourcePosition> szbList = productionresourcePositionService.getFreeProductionresourcePositionByNos(szbarr);
+//
+//                    List<ProductionresourcePosition> xbkList = new ArrayList<>();
+//
+//                    if (CollectionUtil.isNotEmpty(jqrList)) {//机器人是空闲
+//                        TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                        if (CollectionUtil.isNotEmpty(szbList)) {//三坐标为空,并且
+//                            //锁定三坐标
+//                            Storge szbStorge = storgeService.getById(szbList.get(0).getStorgeId());
+//                            szbStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(szbStorge, nextTaskNode.getId());
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.Q3ZUOBIAO + nextTaskNode.getId(), szbStorge, 1, TimeUnit.DAYS);
+//                        } else {
+//                            String zlzxXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZLZX_XBK};
+//                            xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(zlzxXBKarr);
+//                            if (xbkList != null && xbkList.size() > 0) {
+//                                //锁定线边库
+//                                Storge xbkStorge = storgeService.getById(xbkList.get(0).getStorgeId());
+//                                xbkStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                                storgeService.lockStorge(xbkStorge, nextTaskNode.getId());
+//                                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZLZX_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
+//                            }
+//                        }
+//
+//                        if ((CollectionUtil.isNotEmpty(jqrList)) && ((CollectionUtil.isNotEmpty(szbList) || CollectionUtil.isNotEmpty(xbkList)))) {
+//                            Storge plantStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo());
+//                            //目的地为机器人手臂
+//                            Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
+//                            //锁定机器人
+//                            jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
+//                            //锁定放入缓存
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//
+//                            map.put("zkIp", ZK_ip_zlzx);
+//                            Map handMap = taskService.checkChangeHand(task);
+//                            //需要换手抓
+//                            if ("1".equals(handMap.get("result").toString())) {
+//                                taskService.handleChangeHand(handMap, map);
+//                            } else {//不需要换手
+//                                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                                map.put("fromStorge", plantStorge);
+//                                //目的地为机器人手臂
+//                                map.put("toStorge", jqrStorge);
+//                                map.put("Data", plantStorge);
+//                                //出入库类型
+//                                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                                //记录产品流转到的库位
+//                                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
+//                            }
+//                            map.put(taskNode.getId().toString() + "count", count);
+//                        }
+//                        map.put("result", (CollectionUtil.isNotEmpty(jqrList)) && ((CollectionUtil.isNotEmpty(szbList) || CollectionUtil.isNotEmpty(xbkList))));
+//                    }
+//                }
+//                else if (count == 1) {
+//                    Storge plantStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo());
+//                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId());
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                    map.put("fromStorge", plantStorge);
+//                    map.put("toStorge", jqrStorge);
+//                    map.put("Data", plantStorge);
+//                    //出入库类型
+//                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                    //锁定机器人
+//                    jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                    storgeService.lockStorge(jqrStorge, taskNode.getId());
+//                    //记录产品流转到的库位
+//                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
+//                }
+//            }
+//
+//            else if (DemoLineConstant.DEMOLINE_OP05_05.equals(taskNode.getNodeNo())) {
+//                //机械手从三坐标取出
+//                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
+//                if (count == 0) {
+//                    String[] sxlzIdArr = {DemoLineConstant.SXLZ1, DemoLineConstant.SXLZ2};
+//                    List<ProductionresourcePosition> sxlzList = productionresourcePositionService.getFreeProductionresourcePositionByNos(sxlzIdArr);
+//                    //判断机器人是否为空
+//                    String jrqarr[] = {DemoLineConstant.JQR1};
+//                    List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
+//
+//                    List<ProductionresourcePosition> xbkList = new ArrayList<>();
+//
+//                    if (CollectionUtil.isNotEmpty(jqrList)) {//机器人是空闲
+//                        if (CollectionUtil.isNotEmpty(sxlzList)) {//三坐标为空,并且
+//                            TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                            //锁定上下料站
+//                            Storge sxlzStorge = storgeService.getById(sxlzList.get(0).getStorgeId());
+//                            sxlzStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(sxlzStorge, nextTaskNode.getId());
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.SXLZ + nextTaskNode.getId(), sxlzStorge, 1, TimeUnit.DAYS);
+//                        } else {
+//                            String zlzxXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZLZX_XBK};
+//                            xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(zlzxXBKarr);
+//                            if (xbkList != null && xbkList.size() > 0) {
+//                                //锁定线边库
+//                                Storge xbkStorge = storgeService.getById(xbkList.get(0).getStorgeId());
+//                                TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                                xbkStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                                storgeService.lockStorge(xbkStorge, nextTaskNode.getId());
+//                                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZLZX_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
+//                            }
+//                        }
+//                    }
+//
+//
+//                    if (CollectionUtil.isNotEmpty(jqrList) && ((CollectionUtil.isNotEmpty(sxlzList) || CollectionUtil.isNotEmpty(xbkList)))) {
+//                        map.put("zkIp", ZK_ip_zlzx);
+//                        Storge szbStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
+//                        //取出包含托盘夹具的库位
+//                        Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
+//                        //机器人库位锁定
+//                        jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                        //锁定机器人
+//                        TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                        storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
+//                        //锁定放入缓存
+//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//
+//                        Map handMap = taskService.checkChangeHand(task);
+//                        //需要换手抓
+//                        if ("1".equals(handMap.get("result").toString())) {
+//                            taskService.handleChangeHand(handMap, map);
+//                        } else {//不需要换手
+//                            map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                            //出入库类型
+//                            map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                            //目的地为机器人手臂
+//                            map.put("Data", szbStorge);
+//                            map.put("toStorge", jqrStorge);
+//                            map.put("fromStorge", szbStorge);
+//                            //(由于搬运拆成两个节点),把锁定的节点放到缓存,便于下个节点使用
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//                            //记录产品流转到的库位
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
+//                        }
+//                        map.put(taskNode.getId().toString() + "count", count);
+//                    }
+//                    map.put("result", CollectionUtil.isNotEmpty(jqrList) && ((CollectionUtil.isNotEmpty(sxlzList) || CollectionUtil.isNotEmpty(xbkList))));
+//                } else if (count == 1) {
+//                    Storge szbStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
+//                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId());
+//                    map.put("zkIp", ZK_ip_zlzx);
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                    //出入库类型
+//                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                    //目的地为机器人手臂
+//                    map.put("Data", szbStorge);
+//                    map.put("toStorge", jqrStorge);
+//                    map.put("fromStorge", szbStorge);
+//                    map.put("result", true);
+//                    //(由于搬运拆成两个节点),把锁定的节点放到缓存,便于下个节点使用
+//                    //记录产品流转到的库位
+//                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
+//                }
+//            }
+//
+//            else if (DemoLineConstant.DEMOLINE_OP05_06.equals(taskNode.getNodeNo())) {
+//                //机器人放子盘夹具到上下料站(从机械手到上下料站)
+//                //节点4的任务都在节点3被锁定过了,只要从缓存拿出来对应的值即可
+//                //1、取出机器人
+//                Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId());
+//                //2、取出上下料站
+//                Storge sxlzstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.SXLZ + taskNode.getId());
+//                map.put("zkIp", ZK_ip_zlzx);
+//                //3、把起始终点库位存放到map,用于接口
+//                map.put("fromStorge", jqrStorge);
+//                map.put("toStorge", sxlzstorge);
+//                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
+//                //出入库类型
+//                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                //目的地为机器人手臂
+//                map.put("Data", sxlzstorge);
+//                //这个节点没有需要验证的内容,都在前一个节点验证并且锁定了
+//                map.put("result", true);
+//                //4、记录机器人的库位,下一个步骤使用
 //                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), sxlzstorge, 1, TimeUnit.DAYS);
-            }
-
-        }
-        //智能单元机器人
-        else if(DemoLineConstant.JQR2.equals(robotType)){
-            if (DemoLineConstant.DEMOLINE_OP02_01.equals(taskNode.getNodeNo())) {
-                map.put("zkIp", ZK_ip_zndy);
-                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                //判断机器人是否为空
-                String jrqarr[] = {DemoLineConstant.JQR2};
-                List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
-
-                Storge plantStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo());
-
-                //判断设备是否空闲
-                String sum50[] = {DemoLineConstant.DEMOLINE_SUM50_ZNDY};
-                List<ProductionresourcePosition> sum50List = productionresourcePositionService.getFreeProductionresourcePositionByNos(sum50);
-                List<ProductionresourcePosition> xbkList = new ArrayList<>();
-
-                TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                if (CollectionUtil.isNotEmpty(jqrList)) {
-                    if (CollectionUtil.isNotEmpty(sum50List)) {//设备空闲
-                        Storge sum50Storge = storgeService.getById(sum50List.get(0).getStorgeId());
-                        //锁定加工设备库位
-                        sum50Storge.setCompleteBatchNo(task.getCompleteBatchNo());
-                        storgeService.lockStorge(sum50Storge, nextTaskNode.getId());
-                        //放入缓存,下个节点使用
-                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_SUM50_ZNDY + nextTaskNode.getId(), sum50Storge, 1, TimeUnit.DAYS);
-
-                    }
-                    else {//设备忙碌,放置到线边库
-                        String znscdyXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK};
-                        xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(znscdyXBKarr);
-                        if (xbkList != null && xbkList.size() > 0) {
-                            //锁定线边库
-                            Storge xbkStorge = storgeService.getById(xbkList.get(0).getStorgeId());
-
-                            xbkStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(xbkStorge, nextTaskNode.getId());
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
-                        }
-                    }
-                    //满足条件--机器人空闲,设备或线边库有一个空闲
-                    if (CollectionUtil.isNotEmpty(jqrList) && ((CollectionUtil.isNotEmpty(sum50List) || CollectionUtil.isNotEmpty(xbkList)))) {
-                        map.put("fromStorge", plantStorge);
-                        map.put("Data", plantStorge);
-                        //出入库类型
-                        map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                        //目的地为机器人手臂
-                        Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
-                        map.put("toStorge", jqrStorge);
-                        //锁定机器人
-                        jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                        storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
-                        //记录产品流转到的库位
-                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
-
-                    }
-                }
-                map.put("result", (CollectionUtil.isNotEmpty(jqrList) && ((CollectionUtil.isNotEmpty(sum50List) || CollectionUtil.isNotEmpty(xbkList)))));
-            }
-
-            else if (DemoLineConstant.DEMOLINE_OP02_02.equals(taskNode.getNodeNo())) {
-                map.put("zkIp", ZK_ip_zndy);
-                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
-                //前序绑定的sum50
-                Object sum50Storge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_SUM50_ZNDY + taskNode.getId());
-                if (sum50Storge != null) {//前序是绑定到sum50
-                    sum50Storge = (Storge) sum50Storge;
-                    //目的地为机器人手臂
-                    map.put("toStorge", sum50Storge);
-                    map.put("Data", sum50Storge);
-                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), sum50Storge, 1, TimeUnit.DAYS);
-                } else {
-                    //前序绑定的线边库
-                    Object xbkStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK + taskNode.getId());
-                    if (xbkStorge != null) {
-                        xbkStorge = (Storge) xbkStorge;
-                        //目的地为线边库
-                        map.put("toStorge", xbkStorge);
-                        map.put("Data", xbkStorge);
-                        //临时存放到了线边库的标志
-                        map.put(DemoLineConstant.DEMOLINE_XBKFLAG, "1");
-                        //临时存放到了智能单元的线边库
-                        map.put(DemoLineConstant.DEMOLINE_XBK_TYPE, DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK);
-                    }
-                }
-                //出入库类型-托盘夹具原材料出入库
-                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                //
-                map.put("result", true);
-            }
-
-            else if (DemoLineConstant.DEMOLINE_OP04_09.equals(taskNode.getNodeNo())) {
-                String jrqarr[] = {DemoLineConstant.JQR2};
-                List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
-                List<ProductionresourcePosition> xbkList = new ArrayList<>();
-
-                if (jqrList != null && jqrList.size() > 0) {
-                    //判断接驳位D\E是否为空
-                    String jbwarr[] = {DemoLineConstant.JBW_F, DemoLineConstant.JBW_G};
-                    Map plateMap = storgeService.getPlateStorgeByNo(jbwarr, task.getCompleteBatchNo());
-                    Storge plantStorge = plateMap.get("storge") == null ? null : (Storge) plateMap.get("storge");
-                    String jbwCode = plateMap.get("jbwCode") == null ? "" : plateMap.get("jbwCode").toString();
-                    Storge jbwStorge = plateMap.get("jbwStorge") == null ? null : (Storge) plateMap.get("jbwStorge");
-
-                    if (plantStorge != null) {//接驳位有空闲
-                        TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                        plantStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                        storgeService.lockStorge(plantStorge, nextTaskNode.getId());
-                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo(), jbwStorge, 1, TimeUnit.DAYS);
-                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo(), plantStorge, 1, TimeUnit.DAYS);
-                    } else {//设备忙碌,放置到线边库
-                        String znscdyXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK};
-                        xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(znscdyXBKarr);
-                        if (xbkList != null && xbkList.size() > 0) {
-                            //锁定线边库
-                            Storge xbkStorge = storgeService.getById(xbkList.get(0).getStorgeId());
-                            TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                            xbkStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(xbkStorge, nextTaskNode.getId());
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
-                        }
-                    }
-                    //满足条件--机器人空闲,设备或线边库有一个空闲
-                    if ((CollectionUtil.isNotEmpty(jqrList)) && ((plantStorge != null) || CollectionUtil.isNotEmpty(xbkList))) {
-                        Storge sum50Storge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
-                        sum50Storge = (Storge) sum50Storge;
-                        map.put("zkIp", ZK_ip_zndy);
-                        map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                        map.put("fromStorge", sum50Storge);
-                        map.put("Data", sum50Storge);
-                        //目的地为机器人手臂
-                        Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
-                        map.put("toStorge", jqrStorge);
-                        //出入库类型
-                        map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                        //锁定机器人
-                        jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                        storgeService.lockStorge(jqrStorge, taskNode.getId());
-                        //记录产品流转到的库位
-                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
-                        map.put("result", (CollectionUtil.isNotEmpty(jqrList)) && ((plantStorge != null) || CollectionUtil.isNotEmpty(xbkList)));
-                    }
-
-                }
-            }
-
-            else if (DemoLineConstant.DEMOLINE_OP04_10.equals(taskNode.getNodeNo())) {
-                Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
-                Storge plantStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo());
-                map.put("zkIp", ZK_ip_zndy);
-                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
-                map.put("fromStorge", jqrStorge);
-                map.put("toStorge", plantStorge);
-                map.put("Data", plantStorge);
-                //出入库类型-托盘夹具原材料出入库
-                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), plantStorge, 1, TimeUnit.DAYS);
-                //前一步已经锁定完毕,直接满足条件
-                map.put("result", true);
-            }
-
-            else if (DemoLineConstant.DEMOLINE_OP05_03.equals(taskNode.getNodeNo())) {
-                //取放到三坐标  从机器人手臂到三坐标
-                Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
-
-                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
-                map.put("zkIp", ZK_ip_zlzx);
-                map.put("fromStorge", jqrStorge);
-                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                //前序绑定的sum50
-                Object szbStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.Q3ZUOBIAO + taskNode.getId());
-                if (szbStorge != null) {//前序是绑定到托板
-                    szbStorge = (Storge) szbStorge;
-                    //目的地为机器人手臂
-                    map.put("toStorge", szbStorge);
-                    map.put("Data", szbStorge);
-                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), szbStorge, 1, TimeUnit.DAYS);
-                } else {
-                    //前序绑定的线边库
-                    Object xbkStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZLZX_XBK + taskNode.getId());
-                    if (xbkStorge != null) {
-                        xbkStorge = (Storge) xbkStorge;
-                        //目的地为线边库
-                        map.put("toStorge", xbkStorge);
-                        map.put("Data", xbkStorge);
-                        //出入库类型
-                        map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                        //临时存放到了线边库的标志
-                        map.put(DemoLineConstant.DEMOLINE_XBKFLAG, "1");
-                        //临时存放到了智能单元的线边库
-                        map.put(DemoLineConstant.DEMOLINE_XBK_TYPE, DemoLineConstant.NODE_RESOURCE_ZLZX_XBK);
-                        //搬运类型
-                        map.put(DemoLineConstant.DEMOLINE_XBK_CARRY_TYPE, BizConstant.MQ_TASK_NODE_TYPE_STORAGE_WAIT_ZLZX_SZB);
-                        //当前执行数量
-                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo(), 0, 1, TimeUnit.DAYS);
-                    }
-                }
-                map.put("result", true);
-            }
-
-        }
-        //柔性线机器人
-        else if(DemoLineConstant.JQR3.equals(robotType)){
-            if (DemoLineConstant.DEMOLINE_OP02_01.equals(taskNode.getNodeNo())) {
-                //当前步骤。骤有的节点会生产多步执行
-                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
-                //执行到第几步
-                map.put(taskNode.getId().toString() + "count", count);
-                map.put(DemoLineConstant.DEMOLINE_RXJQR_FLAG, "1");
-                map.put("zkIp", ZK_ip_rxx);
-                Storge plantStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo());
-
-                if (count == 0) {//第一步的时候锁定资源
-                    //判断机器人是否为空
-                    String jrqarr[] = {DemoLineConstant.JQR3};
-                    List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
-                    Map<String, List<ProductionresourcePosition>> jqrMap = jqrList.stream().collect(groupingBy(ProductionresourcePosition::getPointId));
-                    //判断设备是否空闲
-                    String sum50[] = {DemoLineConstant.DEMOLINE_SUM50_RXDY4};
-                    List<ProductionresourcePosition> sum50List = productionresourcePositionService.getFreeProductionresourcePositionByNos(sum50);
-                    List<ProductionresourcePosition> xbkList = new ArrayList<>();
-
-                    TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                    //机器人手抓没被锁定,并且有空闲未知
-                    if (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS)) {
-                        if (CollectionUtil.isNotEmpty(sum50List)) {//设备空闲
-                            Storge sum50Storge = storgeService.getById(sum50List.get(0).getStorgeId());
-                            //锁定加工设备库位
-                            sum50Storge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(sum50Storge, nextTaskNode.getId());
-                            //放入缓存,下个节点使用
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_SUM50_RXDY4 + nextTaskNode.getId(), sum50Storge, 1, TimeUnit.DAYS);
-
-                            //锁定机器人手抓
-                            Storge jqrStorge = storgeService.getById(jqrMap.get(DemoLineConstant.DEMOLINE_RJQR_ZS).get(0).getStorgeId());
-                            jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
-//                                //去掉抓手
-//                                jqrMap.remove(DemoLineConstant.DEMOLINE_RJQR_ZS);
-                            //锁定一个缓存位
-                            List<ProductionresourcePosition> hcwList = jqrMap.get(jqrMap.keySet().stream().filter(p -> !DemoLineConstant.DEMOLINE_RJQR_ZS.equals(p)).findFirst().get());
-                            Storge hcwStorge = storgeService.getById(hcwList.get(0).getStorgeId());
-                            hcwStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(hcwStorge, nextTaskNode.getId());
-
-
-                            //抓手缓存
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
-                            //缓存位缓存
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + nextTaskNode.getId(), hcwStorge, 1, TimeUnit.DAYS);
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId(), hcwStorge, 1, TimeUnit.DAYS);
-
-
-                        }
-                        else {//设备忙碌,放置到线边库
-                            String znscdyXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK};
-                            xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(znscdyXBKarr);
-                            if (xbkList != null && xbkList.size() > 0) {
-                                //锁定线边库
-                                Storge xbkStorge = storgeService.getById(xbkList.get(0).getStorgeId());
-
-                                xbkStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                                storgeService.lockStorge(xbkStorge, nextTaskNode.getId());
-                                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
-                            }
-                        }
-                        //满足条件--机器人空闲,设备或线边库有一个空闲
-                        if (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS) && ((CollectionUtil.isNotEmpty(sum50List) || CollectionUtil.isNotEmpty(xbkList)))) {//移动
-                            map.put("Data", plantStorge);
-                            map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "moveMaterial");
-                        }
-                    }
-                    map.put("result", (CollectionUtil.isNotEmpty(jqrList) && ((CollectionUtil.isNotEmpty(sum50List) || CollectionUtil.isNotEmpty(xbkList)))));
-
-                }
-            }
-
-            else if (DemoLineConstant.DEMOLINE_OP02_02.equals(taskNode.getNodeNo())) {
-                //当前步骤。骤有的节点会生产多步执行
-                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
-                //执行到第几步
-                map.put(taskNode.getId().toString() + "count", count);
-                map.put(DemoLineConstant.DEMOLINE_RXJQR_FLAG, "1");
-                map.put("zkIp", ZK_ip_rxx);
-                TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                if (count == 0) {//第一步移动
-                    Storge sum50Storge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_SUM50_RXDY4 + taskNode.getId());
-                    map.put("Data", sum50Storge);
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "moveMaterial");
-                } else if (count == 1) {//从缓存位拿出来
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                    Storge hcwStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId());
-                    map.put("Data", hcwStorge);
-                    map.put("fromStorge", hcwStorge);
-                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
-                    map.put("toStorge", jqrStorge);
-                    //出入库类型
-                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                } else if (count == 2) {
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
-                    //出入库类型
-                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                    Storge sum50Storge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_SUM50_RXDY4 + taskNode.getId());
-                    map.put("Data", sum50Storge);
-                    map.put("toStorge", sum50Storge);
-                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
-                    map.put("fromStorge", jqrStorge);
-                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), sum50Storge, 1, TimeUnit.DAYS);
-                }
-                map.put("result", true);
-            }
-
-            else if (DemoLineConstant.DEMOLINE_OP03_01.equals(taskNode.getNodeNo())) {
-                //当前步骤。骤有的节点会生产多步执行
-                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
-                //执行到第几步
-                map.put(taskNode.getId().toString() + "count", count);
-                map.put(DemoLineConstant.DEMOLINE_RXJQR_FLAG, "1");
-                map.put("zkIp", ZK_ip_rxx);
-
-                if (count == 0) {//第一步的时候锁定资源
-                    String JQR = DemoLineConstant.JQR3;
-                    //判断机器人是否为空
-                    String jrqarr[] = {JQR};
-                    List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
-                    Map<String, List<ProductionresourcePosition>> jqrMap = jqrList.stream().collect(groupingBy(ProductionresourcePosition::getPointId));
-                    //判断设备是否空闲
-                    List<ProductionresourcePosition> qxjList = new ArrayList<>();
-                    List<ProductionresourcePosition> xbkList = new ArrayList<>();
-                    Storge qxjStorge = null;
-
-                    TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                    //机器人手抓没被锁定,并且有空闲未知
-                    if (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS)) {
-                        //清洗机有空位
-                        String qxjarr[] = {DemoLineConstant.DEMOLINE_QINGXIJI};
-                        qxjList = productionresourcePositionService.getFreeProductionresourcePositionByNos(qxjarr);
-                        if (CollectionUtil.isNotEmpty(qxjList)) {//设备空闲
-                            qxjStorge = storgeService.getById(qxjList.get(0).getStorgeId());
-                            qxjStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(qxjStorge, nextTaskNode.getId());
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_QINGXIJI + nextTaskNode.getId(), qxjStorge, 1, TimeUnit.DAYS);
-
-                            //锁定机器人手抓
-                            Storge jqrStorge = storgeService.getById(jqrMap.get(DemoLineConstant.DEMOLINE_RJQR_ZS).get(0).getStorgeId());
-                            jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
-                            //锁定一个缓存位
-                            List<ProductionresourcePosition> hcwList = jqrMap.get(jqrMap.keySet().stream().filter(p -> !DemoLineConstant.DEMOLINE_RJQR_ZS.equals(p)).findFirst().get());
-                            Storge hcwStorge = storgeService.getById(hcwList.get(0).getStorgeId());
-                            hcwStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(hcwStorge, nextTaskNode.getId());
-
-                            //抓手缓存
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
-                            //缓存位缓存
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + nextTaskNode.getId(), hcwStorge, 1, TimeUnit.DAYS);
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId(), hcwStorge, 1, TimeUnit.DAYS);
-                        }
-                        else {//设备忙碌,放置到线边库
-                            String znscdyXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK};
-                            xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(znscdyXBKarr);
-                            if (xbkList != null && xbkList.size() > 0) {
-                                //锁定线边库
-                                Storge xbkStorge = storgeService.getById(xbkList.get(0).getStorgeId());
-
-                                xbkStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                                storgeService.lockStorge(xbkStorge, nextTaskNode.getId());
-                                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_RXSC_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
-                            }
-                        }
-                        //满足条件--机器人空闲,设备或线边库有一个空闲
-                        if (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS) && ((CollectionUtil.isNotEmpty(qxjList)) || (CollectionUtil.isNotEmpty(xbkList)))) {//移动
-                            //移动到sum50
-                            Storge sum50Storge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
-                            map.put("Data", sum50Storge);
-                            map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "moveMaterial");
-                        }
-                    }
-                    map.put("result", (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS) && ((CollectionUtil.isNotEmpty(qxjList)) || (CollectionUtil.isNotEmpty(xbkList)))));
-                } else if (count == 1) {
-                    Storge sum50Storge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                    map.put("fromStorge", sum50Storge);
-                    map.put("Data", sum50Storge);
-                    //出入库类型
-                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                    //目的地为机器人手臂
-                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
-                    map.put("toStorge", jqrStorge);
-                    map.put("result", true);
-                } else if (count == 2) {
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
-                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
-                    map.put("fromStorge", jqrStorge);
-                    //出入库类型
-                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                    //目的地为机器人手臂
-                    Storge hcwStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId());
-                    map.put("Data", hcwStorge);
-                    map.put("toStorge", hcwStorge);
-                    map.put("result", true);
-                }
-            }
-
-            else if (DemoLineConstant.DEMOLINE_OP03_02.equals(taskNode.getNodeNo())) {
-                //直接搬运到设备或线边库上
-                //当前步骤。骤有的节点会生产多步执行
-                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
-                //执行到第几步
-                map.put(taskNode.getId().toString() + "count", count);
-                map.put(DemoLineConstant.DEMOLINE_RXJQR_FLAG, "1");
-                map.put("zkIp", ZK_ip_rxx);
-                String JQR = DemoLineConstant.JQR3;
-                TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                if (count == 0) {//第一步移动
-                    Object qxjStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_QINGXIJI + taskNode.getId());
-                    if (qxjStorge != null) {
-                        map.put("Data", qxjStorge);
-                        map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "moveMaterial");
-                    } else {
-                        //前序绑定的线边库
-                        Object xbkStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK + taskNode.getId());
-                        if (xbkStorge != null) {
-                            xbkStorge = (Storge) xbkStorge;
-                            //目的地为线边库
-                            map.put("toStorge", xbkStorge);
-                            //临时存放到了线边库的标志
-                            map.put(DemoLineConstant.DEMOLINE_XBKFLAG, "1");
-                            //临时存放到了智能单元的线边库
-                            map.put(DemoLineConstant.DEMOLINE_XBK_TYPE, DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK);
-                            //当前执行数量
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo(), 0, 1, TimeUnit.DAYS);
-                        }
-                    }
-                } else if (count == 1) {//从缓存位拿出来
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                    Storge hcwStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId());
-                    map.put("Data", hcwStorge);
-                    map.put("fromStorge", hcwStorge);
-                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
-                    map.put("toStorge", jqrStorge);
-                    //出入库类型
-                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                } else if (count == 2) {
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
-                    //出入库类型
-                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                    Object qxjStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_QINGXIJI + taskNode.getId());
-                    map.put("Data", qxjStorge);
-                    map.put("toStorge", qxjStorge);
-                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
-                    map.put("fromStorge", jqrStorge);
-                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), qxjStorge, 1, TimeUnit.DAYS);
-                }
-                map.put("result", true);
-            }
-
-            else if (DemoLineConstant.DEMOLINE_OP04_01.equals(taskNode.getNodeNo())) {
-                //打标
-                //当前步骤。骤有的节点会生产多步执行
-                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
-                //执行到第几步
-                map.put(taskNode.getId().toString() + "count", count);
-                map.put(DemoLineConstant.DEMOLINE_RXJQR_FLAG, "1");
-                map.put("zkIp", ZK_ip_rxx);
-
-                if (count == 0) {//第一步的时候锁定资源
-                    String JQR = DemoLineConstant.JQR3;
-                    //判断机器人是否为空
-                    String jrqarr[] = {JQR};
-                    List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
-                    Map<String, List<ProductionresourcePosition>> jqrMap = jqrList.stream().collect(groupingBy(ProductionresourcePosition::getPointId));
-                    //判断设备是否空闲
-                    List<ProductionresourcePosition> dbjList = new ArrayList<>();
-                    List<ProductionresourcePosition> xbkList = new ArrayList<>();
-                    Storge dbjStorge = null;
-
-                    TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                    //机器人手抓没被锁定,并且有空闲未知
-                    if (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS)) {
-                        //打标机有空位
-                        String dbjarr[] = {DemoLineConstant.DEMOLINE_DABIAOJI};
-                        dbjList = productionresourcePositionService.getFreeProductionresourcePositionByNos(dbjarr);
-                        if (CollectionUtil.isNotEmpty(dbjList)) {//设备空闲
-                            dbjStorge = storgeService.getById(dbjList.get(0).getStorgeId());
-                            dbjStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(dbjStorge, nextTaskNode.getId());
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_DABIAOJI + nextTaskNode.getId(), dbjStorge, 1, TimeUnit.DAYS);
-
-                            //锁定机器人手抓
-                            Storge jqrStorge = storgeService.getById(jqrMap.get(DemoLineConstant.DEMOLINE_RJQR_ZS).get(0).getStorgeId());
-                            jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
-//                            //去掉抓手
-                            //锁定一个缓存位
-                            List<ProductionresourcePosition> hcwList = jqrMap.get(jqrMap.keySet().stream().filter(p -> !DemoLineConstant.DEMOLINE_RJQR_ZS.equals(p)).findFirst().get());
-                            Storge hcwStorge = storgeService.getById(hcwList.get(0).getStorgeId());
-                            hcwStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(hcwStorge, nextTaskNode.getId());
-
-
-                            //抓手缓存
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
-                            //缓存位缓存
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + nextTaskNode.getId(), hcwStorge, 1, TimeUnit.DAYS);
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId(), hcwStorge, 1, TimeUnit.DAYS);
-                        } else {//设备忙碌,放置到线边库
-                            String znscdyXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK};
-                            xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(znscdyXBKarr);
-                            if (xbkList != null && xbkList.size() > 0) {
-                                //锁定线边库
-                                Storge xbkStorge = storgeService.getById(xbkList.get(0).getStorgeId());
-
-                                xbkStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                                storgeService.lockStorge(xbkStorge, nextTaskNode.getId());
-                                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_RXSC_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
-                            }
-                        }
-                        //满足条件--机器人空闲,设备或线边库有一个空闲
-                        if (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS) && ((CollectionUtil.isNotEmpty(dbjList)) || (CollectionUtil.isNotEmpty(xbkList)))) {//移动
-                            //移动到sum50
-                            Storge qxjStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
-                            map.put("Data", qxjStorge);
-                            map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "moveMaterial");
-                        }
-                    }
-                    map.put("result", (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS) && ((CollectionUtil.isNotEmpty(dbjList)) || (CollectionUtil.isNotEmpty(xbkList)))));
-                }
-                else if (count == 1) {
-                    Storge dbjStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                    map.put("fromStorge", dbjStorge);
-                    map.put("Data", dbjStorge);
-                    //出入库类型
-                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                    //目的地为机器人手臂
-                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
-                    map.put("toStorge", jqrStorge);
-                    map.put("result", true);
-                }
-                else if (count == 2) {
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
-                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
-                    map.put("fromStorge", jqrStorge);
-                    //出入库类型
-                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                    //目的地为机器人手臂
-                    Storge hcwStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId());
-                    map.put("Data", hcwStorge);
-                    map.put("toStorge", hcwStorge);
-                    map.put("result", true);
-                }
-            }
-
-            else if (DemoLineConstant.DEMOLINE_OP04_02.equals(taskNode.getNodeNo())) {
-                //直接搬运到设备或线边库上
-                //当前步骤。骤有的节点会生产多步执行
-                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
-                //执行到第几步
-                map.put(taskNode.getId().toString() + "count", count);
-                map.put(DemoLineConstant.DEMOLINE_RXJQR_FLAG, "1");
-                map.put("zkIp", ZK_ip_rxx);
-                String JQR = DemoLineConstant.JQR3;
-                TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                if (count == 0) {//第一步移动
-                    Object dbjStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_DABIAOJI + taskNode.getId());
-                    if (dbjStorge != null) {
-                        map.put("Data", dbjStorge);
-                        map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "moveMaterial");
-                    } else {
-                        //前序绑定的线边库
-                        Object xbkStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK + taskNode.getId());
-                        if (xbkStorge != null) {
-                            xbkStorge = (Storge) xbkStorge;
-                            //目的地为线边库
-                            map.put("toStorge", xbkStorge);
-                            //临时存放到了线边库的标志
-                            map.put(DemoLineConstant.DEMOLINE_XBKFLAG, "1");
-                            //临时存放到了智能单元的线边库
-                            map.put(DemoLineConstant.DEMOLINE_XBK_TYPE, DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK);
-                            //当前执行数量
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo(), 0, 1, TimeUnit.DAYS);
-                        }
-                    }
-                } else if (count == 1) {//从缓存位拿出来
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                    Storge hcwStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId());
-                    map.put("Data", hcwStorge);
-                    map.put("fromStorge", hcwStorge);
-                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
-                    map.put("toStorge", jqrStorge);
-                    //出入库类型
-                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                } else if (count == 2) {
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
-                    //出入库类型
-                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                    Object dbjStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_DABIAOJI + taskNode.getId());
-                    map.put("Data", dbjStorge);
-                    map.put("toStorge", dbjStorge);
-                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
-                    map.put("fromStorge", jqrStorge);
-                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), dbjStorge, 1, TimeUnit.DAYS);
-                }
-                map.put("result", true);
-
-            }
-
-            //
-            else if (DemoLineConstant.DEMOLINE_OP04_09.equals(taskNode.getNodeNo())) {
-                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
-                //执行到第几步
-                map.put(taskNode.getId().toString() + "count", count);
-                map.put(DemoLineConstant.DEMOLINE_RXJQR_NOMOVE_FLAG, "1");
-                map.put("zkIp", ZK_ip_rxx);
-
-                Storge plantStorge = null;
-                List<ProductionresourcePosition> xbkList = new ArrayList<>();
-                String jbwCode = null;
-
-                if (count == 0) {//第一步的时候锁定资源
-                    //判断机器人是否为空
-                    String jrqarr[] = {DemoLineConstant.JQR3};
-                    List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
-                    Map<String, List<ProductionresourcePosition>> jqrMap = jqrList.stream().collect(groupingBy(ProductionresourcePosition::getPointId));
-                    //机器人手抓没被锁定,并且有空闲未知
-                    if (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS)) {
-                        TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                        //判断接驳位D\E是否为空
-                        String jbwarr[] = {DemoLineConstant.JBW_H, DemoLineConstant.JBW_I};
-                        Map plateMap = storgeService.getPlateStorgeByNo(jbwarr, task.getCompleteBatchNo());
-                        plantStorge = plateMap.get("storge") == null ? null : (Storge) plateMap.get("storge");
-                        jbwCode = plateMap.get("jbwCode") == null ? "" : plateMap.get("jbwCode").toString();
-                        Storge jbwStorge = plateMap.get("jbwStorge") == null ? null : (Storge) plateMap.get("jbwStorge");
-                        if (plantStorge != null) {//设备空闲
-                            plantStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(plantStorge, nextTaskNode.getId());
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo(), jbwStorge, 1, TimeUnit.DAYS);
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo(), plantStorge, 1, TimeUnit.DAYS);
-
-                            //锁定机器人手抓
-                            Storge jqrStorge = storgeService.getById(jqrMap.get(DemoLineConstant.DEMOLINE_RJQR_ZS).get(0).getStorgeId());
-                            jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
-                            //锁定一个缓存位
-                            List<ProductionresourcePosition> hcwList = jqrMap.get(jqrMap.keySet().stream().filter(p -> !DemoLineConstant.DEMOLINE_RJQR_ZS.equals(p)).findFirst().get());
-                            Storge hcwStorge = storgeService.getById(hcwList.get(0).getStorgeId());
-                            hcwStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                            storgeService.lockStorge(hcwStorge, nextTaskNode.getId());
-
-                            //抓手缓存
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
-                            //缓存位缓存
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + nextTaskNode.getId(), hcwStorge, 1, TimeUnit.DAYS);
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId(), hcwStorge, 1, TimeUnit.DAYS);
-
-                        } else {//设备忙碌,放置到线边库
-                            String znscdyXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK};
-                            xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(znscdyXBKarr);
-                            if (xbkList != null && xbkList.size() > 0) {
-                                //锁定线边库
-                                Storge xbkStorge = storgeService.getById(xbkList.get(0).getStorgeId());
-
-                                xbkStorge.setCompleteBatchNo(task.getCompleteBatchNo());
-                                storgeService.lockStorge(xbkStorge, nextTaskNode.getId());
-                                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
-                            }
-                        }
-                        //满足条件--机器人空闲,设备或线边库有一个空闲
-                        if (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS) && ((plantStorge != null || CollectionUtil.isNotEmpty(xbkList)))) {//移动
-                            Storge dbjStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
-                            map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                            map.put("fromStorge", dbjStorge);
-                            map.put("jbwCode", jbwCode);
-                            map.put("Data", dbjStorge);
-                            //出入库类型
-                            map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                            //目的地为机器人手臂
-                            Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
-                            map.put("toStorge", jqrStorge);
-                        }
-                    }
-                    map.put("result", (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS) && ((plantStorge != null || CollectionUtil.isNotEmpty(xbkList)))));
-                } else if (count == 1) {
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
-                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
-                    map.put("fromStorge", jqrStorge);
-                    map.put("jbwCode", jbwCode);
-                    //出入库类型
-                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                    //目的地为机器人手臂
-                    Storge hcwStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId());
-                    map.put("Data", hcwStorge);
-                    map.put("toStorge", hcwStorge);
-                    map.put("result", true);
-                }
-//                    else if(count == 2){
-//                        map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE,"putMaterial");
-//                        Storge jqrStorge = (Storge)msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
-//                        map.put("fromStorge", jqrStorge);
-//                        map.put("jbwCode", jbwCode);
+//            }
+//
+//            else if (DemoLineConstant.DEMOLINE_OP06_02.equals(taskNode.getNodeNo())) {
+//                //子盘,夹具,归还线边库
+//                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
+//                if (count == 0) {
+//                    Storge sxlzstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
+//                    //更换抓手尚未考虑
+//                    //判断上下料站
+//                    //根据工件获取所在的生产单元(产线)
+//                    String zoneNo = msgUtil.redis_get(DemoCacheKey.DEMOLINE_WORKOP_ZONE + task.getCompleteBatchNo()) == null ? ""
+//                            : msgUtil.redis_get(DemoCacheKey.DEMOLINE_WORKOP_ZONE + task.getCompleteBatchNo()).toString();
+//                    //线边库事宜的托盘类型
+//                    String fitTrayType = "1";
+//                    if (DemoLineConstant.DEMOLINE_WORK_SPACE1.equals(zoneNo)) {
+//                        fitTrayType = "0";
+//                    }
+//
+//                    String zlzxXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZLZX_XBK};
+//                    List<ProductionresourcePosition> xbkList = productionresourcePositionService.getFreeProductionresourcePositionByTrayTypeNos(zlzxXBKarr, fitTrayType);
+//                    //判断机器人是否为空
+//                    String jrqarr[] = {DemoLineConstant.JQR1};
+//                    List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
+//
+//
+//                    if (CollectionUtil.isNotEmpty(xbkList) && CollectionUtil.isNotEmpty(jqrList)) {
+//                        Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
+//                        //机器人库位锁定
+//                        jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                        //(由于搬运拆成两个节点),把锁定的节点放到缓存,便于下个节点使用
+//                        TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                        storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
+//                        //锁定放入缓存
+//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//
+//                        //锁定线边库
+//                        Storge xbkstorge = storgeService.getById(xbkList.get(0).getStorgeId());
+//                        xbkstorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                        storgeService.lockStorge(xbkstorge, nextTaskNode.getId());
+//                        //锁定放入缓存
+//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.XBK + nextTaskNode.getId(), xbkstorge, 1, TimeUnit.DAYS);
+//
+//                        map.put("zkIp", ZK_ip_zlzx);
+//                        Map handMap = taskService.checkChangeHand(task);
+//                        //需要换手抓
+//                        if ("1".equals(handMap.get("result").toString())) {
+//                            taskService.handleChangeHand(handMap, map);
+//                        } else {
+//                            map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                            map.put("fromStorge", sxlzstorge);
+//                            map.put("toStorge", jqrStorge);
+//                            map.put("Data", sxlzstorge);
+//                            map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_TRAY_CRK);
+//                        }
+//                        map.put(taskNode.getId().toString() + "count", count);
+//                    }
+//                    map.put("result", CollectionUtil.isNotEmpty(xbkList) && CollectionUtil.isNotEmpty(jqrList));
+//                } else if (count == 1) {//前面换手完成,机器人放子盘夹具到上下料站(从子盘到机械手),这一步可能不用走
+//                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId());
+//                    Storge sxlzstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                    map.put("fromStorge", sxlzstorge);
+//                    map.put("toStorge", jqrStorge);
+//                    map.put("Data", sxlzstorge);
+//                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_TRAY_CRK);
+//                }
+//            }
+//
+//            else if (DemoLineConstant.DEMOLINE_OP06_03.equals(taskNode.getNodeNo())) {
+//                //机器人放子盘夹具到上下料站(从机械手到上下料站)
+//                //节点4的任务都在节点3被锁定过了,只要从缓存拿出来对应的值即可
+//                //1、取出机器人
+//                Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR1 + taskNode.getId());
+////                //重新锁定一下机器人的库位,更新一下被锁定的业务ID(由于搬运拆成两个节点)
+////                storgeService.lockStorge(jqrStorge, taskNode.getId());
+//                //2、取出上下料站
+//                Storge xbkstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.XBK + taskNode.getId());
+//                map.put("zkIp", ZK_ip_zlzx);
+//                //3、把起始终点库位存放到map,用于接口
+//                map.put("fromStorge", jqrStorge);
+//                map.put("toStorge", xbkstorge);
+//                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_TRAY_CRK);
+//
+//                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
+//                map.put("Data", xbkstorge);
+//                //这个节点没有需要验证的内容,都在前一个节点验证并且锁定了
+//                map.put("result", true);
+//                //4、记录机器人的库位,下一个步骤使用
+////                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), sxlzstorge, 1, TimeUnit.DAYS);
+//            }
+//
+//        }
+//        //智能单元机器人
+//        else if(DemoLineConstant.JQR2.equals(robotType)){
+//            if (DemoLineConstant.DEMOLINE_OP02_01.equals(taskNode.getNodeNo())) {
+//                map.put("zkIp", ZK_ip_zndy);
+//                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                //判断机器人是否为空
+//                String jrqarr[] = {DemoLineConstant.JQR2};
+//                List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
+//
+//                Storge plantStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo());
+//
+//                //判断设备是否空闲
+//                String sum50[] = {DemoLineConstant.DEMOLINE_SUM50_ZNDY};
+//                List<ProductionresourcePosition> sum50List = productionresourcePositionService.getFreeProductionresourcePositionByNos(sum50);
+//                List<ProductionresourcePosition> xbkList = new ArrayList<>();
+//
+//                TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                if (CollectionUtil.isNotEmpty(jqrList)) {
+//                    if (CollectionUtil.isNotEmpty(sum50List)) {//设备空闲
+//                        Storge sum50Storge = storgeService.getById(sum50List.get(0).getStorgeId());
+//                        //锁定加工设备库位
+//                        sum50Storge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                        storgeService.lockStorge(sum50Storge, nextTaskNode.getId());
+//                        //放入缓存,下个节点使用
+//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_SUM50_ZNDY + nextTaskNode.getId(), sum50Storge, 1, TimeUnit.DAYS);
+//
+//                    }
+//                    else {//设备忙碌,放置到线边库
+//                        String znscdyXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK};
+//                        xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(znscdyXBKarr);
+//                        if (xbkList != null && xbkList.size() > 0) {
+//                            //锁定线边库
+//                            Storge xbkStorge = storgeService.getById(xbkList.get(0).getStorgeId());
+//
+//                            xbkStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(xbkStorge, nextTaskNode.getId());
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
+//                        }
+//                    }
+//                    //满足条件--机器人空闲,设备或线边库有一个空闲
+//                    if (CollectionUtil.isNotEmpty(jqrList) && ((CollectionUtil.isNotEmpty(sum50List) || CollectionUtil.isNotEmpty(xbkList)))) {
+//                        map.put("fromStorge", plantStorge);
+//                        map.put("Data", plantStorge);
 //                        //出入库类型
-//                        map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE,DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                        map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
 //                        //目的地为机器人手臂
-//                        Storge hcwStorge = (Storge)msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId());
-//                        map.put("Data", hcwStorge);
-//                        map.put("toStorge", hcwStorge);
-//                        map.put("result", true);
+//                        Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
+//                        map.put("toStorge", jqrStorge);
+//                        //锁定机器人
+//                        jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                        storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
+//                        //记录产品流转到的库位
+//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
+//
 //                    }
-            }
-
-            else if (DemoLineConstant.DEMOLINE_OP04_10.equals(taskNode.getNodeNo())) {
-                //当前步骤。骤有的节点会生产多步执行
-                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
-                //执行到第几步
-                map.put(taskNode.getId().toString() + "count", count);
-                map.put(DemoLineConstant.DEMOLINE_RXJQR_FLAG, "1");
-                map.put("zkIp", ZK_ip_rxx);
-//                    JQR = DemoLineConstant.JQR3;
+//                }
+//                map.put("result", (CollectionUtil.isNotEmpty(jqrList) && ((CollectionUtil.isNotEmpty(sum50List) || CollectionUtil.isNotEmpty(xbkList)))));
+//            }
+//
+//            else if (DemoLineConstant.DEMOLINE_OP02_02.equals(taskNode.getNodeNo())) {
+//                map.put("zkIp", ZK_ip_zndy);
+//                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
+//                //前序绑定的sum50
+//                Object sum50Storge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_SUM50_ZNDY + taskNode.getId());
+//                if (sum50Storge != null) {//前序是绑定到sum50
+//                    sum50Storge = (Storge) sum50Storge;
+//                    //目的地为机器人手臂
+//                    map.put("toStorge", sum50Storge);
+//                    map.put("Data", sum50Storge);
+//                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), sum50Storge, 1, TimeUnit.DAYS);
+//                } else {
+//                    //前序绑定的线边库
+//                    Object xbkStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK + taskNode.getId());
+//                    if (xbkStorge != null) {
+//                        xbkStorge = (Storge) xbkStorge;
+//                        //目的地为线边库
+//                        map.put("toStorge", xbkStorge);
+//                        map.put("Data", xbkStorge);
+//                        //临时存放到了线边库的标志
+//                        map.put(DemoLineConstant.DEMOLINE_XBKFLAG, "1");
+//                        //临时存放到了智能单元的线边库
+//                        map.put(DemoLineConstant.DEMOLINE_XBK_TYPE, DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK);
+//                    }
+//                }
+//                //出入库类型-托盘夹具原材料出入库
+//                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                //
+//                map.put("result", true);
+//            }
+//
+//            else if (DemoLineConstant.DEMOLINE_OP04_09.equals(taskNode.getNodeNo())) {
+//                String jrqarr[] = {DemoLineConstant.JQR2};
+//                List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
+//                List<ProductionresourcePosition> xbkList = new ArrayList<>();
+//
+//                if (jqrList != null && jqrList.size() > 0) {
+//                    //判断接驳位D\E是否为空
+//                    String jbwarr[] = {DemoLineConstant.JBW_F, DemoLineConstant.JBW_G};
+//                    Map plateMap = storgeService.getPlateStorgeByNo(jbwarr, task.getCompleteBatchNo());
+//                    Storge plantStorge = plateMap.get("storge") == null ? null : (Storge) plateMap.get("storge");
+//                    String jbwCode = plateMap.get("jbwCode") == null ? "" : plateMap.get("jbwCode").toString();
+//                    Storge jbwStorge = plateMap.get("jbwStorge") == null ? null : (Storge) plateMap.get("jbwStorge");
+//
+//                    if (plantStorge != null) {//接驳位有空闲
+//                        TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                        plantStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                        storgeService.lockStorge(plantStorge, nextTaskNode.getId());
+//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo(), jbwStorge, 1, TimeUnit.DAYS);
+//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo(), plantStorge, 1, TimeUnit.DAYS);
+//                    } else {//设备忙碌,放置到线边库
+//                        String znscdyXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK};
+//                        xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(znscdyXBKarr);
+//                        if (xbkList != null && xbkList.size() > 0) {
+//                            //锁定线边库
+//                            Storge xbkStorge = storgeService.getById(xbkList.get(0).getStorgeId());
+//                            TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                            xbkStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(xbkStorge, nextTaskNode.getId());
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
+//                        }
+//                    }
+//                    //满足条件--机器人空闲,设备或线边库有一个空闲
+//                    if ((CollectionUtil.isNotEmpty(jqrList)) && ((plantStorge != null) || CollectionUtil.isNotEmpty(xbkList))) {
+//                        Storge sum50Storge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
+//                        sum50Storge = (Storge) sum50Storge;
+//                        map.put("zkIp", ZK_ip_zndy);
+//                        map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                        map.put("fromStorge", sum50Storge);
+//                        map.put("Data", sum50Storge);
+//                        //目的地为机器人手臂
+//                        Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
+//                        map.put("toStorge", jqrStorge);
+//                        //出入库类型
+//                        map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                        //锁定机器人
+//                        jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                        storgeService.lockStorge(jqrStorge, taskNode.getId());
+//                        //记录产品流转到的库位
+//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
+//                        map.put("result", (CollectionUtil.isNotEmpty(jqrList)) && ((plantStorge != null) || CollectionUtil.isNotEmpty(xbkList)));
+//                    }
+//
+//                }
+//            }
+//
+//            else if (DemoLineConstant.DEMOLINE_OP04_10.equals(taskNode.getNodeNo())) {
+//                Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
+//                Storge plantStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo());
+//                map.put("zkIp", ZK_ip_zndy);
+//                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
+//                map.put("fromStorge", jqrStorge);
+//                map.put("toStorge", plantStorge);
+//                map.put("Data", plantStorge);
+//                //出入库类型-托盘夹具原材料出入库
+//                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), plantStorge, 1, TimeUnit.DAYS);
+//                //前一步已经锁定完毕,直接满足条件
+//                map.put("result", true);
+//            }
+//
+//            else if (DemoLineConstant.DEMOLINE_OP05_03.equals(taskNode.getNodeNo())) {
+//                //取放到三坐标  从机器人手臂到三坐标
+//                Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
+//
+//                map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
+//                map.put("zkIp", ZK_ip_zlzx);
+//                map.put("fromStorge", jqrStorge);
+//                map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                //前序绑定的sum50
+//                Object szbStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.Q3ZUOBIAO + taskNode.getId());
+//                if (szbStorge != null) {//前序是绑定到托板
+//                    szbStorge = (Storge) szbStorge;
+//                    //目的地为机器人手臂
+//                    map.put("toStorge", szbStorge);
+//                    map.put("Data", szbStorge);
+//                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), szbStorge, 1, TimeUnit.DAYS);
+//                } else {
+//                    //前序绑定的线边库
+//                    Object xbkStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZLZX_XBK + taskNode.getId());
+//                    if (xbkStorge != null) {
+//                        xbkStorge = (Storge) xbkStorge;
+//                        //目的地为线边库
+//                        map.put("toStorge", xbkStorge);
+//                        map.put("Data", xbkStorge);
+//                        //出入库类型
+//                        map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                        //临时存放到了线边库的标志
+//                        map.put(DemoLineConstant.DEMOLINE_XBKFLAG, "1");
+//                        //临时存放到了智能单元的线边库
+//                        map.put(DemoLineConstant.DEMOLINE_XBK_TYPE, DemoLineConstant.NODE_RESOURCE_ZLZX_XBK);
+//                        //搬运类型
+//                        map.put(DemoLineConstant.DEMOLINE_XBK_CARRY_TYPE, BizConstant.MQ_TASK_NODE_TYPE_STORAGE_WAIT_ZLZX_SZB);
+//                        //当前执行数量
+//                        msgUtil.redis_set(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo(), 0, 1, TimeUnit.DAYS);
+//                    }
+//                }
+//                map.put("result", true);
+//            }
+//
+//        }
+//        //柔性线机器人
+//        else if(DemoLineConstant.JQR3.equals(robotType)){
+//            if (DemoLineConstant.DEMOLINE_OP02_01.equals(taskNode.getNodeNo())) {
+//                //当前步骤。骤有的节点会生产多步执行
+//                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
+//                //执行到第几步
+//                map.put(taskNode.getId().toString() + "count", count);
+//                map.put(DemoLineConstant.DEMOLINE_RXJQR_FLAG, "1");
+//                map.put("zkIp", ZK_ip_rxx);
+//                Storge plantStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo());
+//
+//                if (count == 0) {//第一步的时候锁定资源
+//                    //判断机器人是否为空
+//                    String jrqarr[] = {DemoLineConstant.JQR3};
+//                    List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
+//                    Map<String, List<ProductionresourcePosition>> jqrMap = jqrList.stream().collect(groupingBy(ProductionresourcePosition::getPointId));
+//                    //判断设备是否空闲
+//                    String sum50[] = {DemoLineConstant.DEMOLINE_SUM50_RXDY4};
+//                    List<ProductionresourcePosition> sum50List = productionresourcePositionService.getFreeProductionresourcePositionByNos(sum50);
+//                    List<ProductionresourcePosition> xbkList = new ArrayList<>();
+//
 //                    TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                if (count == 0) {//第一步移动
-                    Storge plantStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo());
-                    if (plantStorge != null) {
-                        map.put("Data", plantStorge);
-                        map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "moveMaterial");
-                    } else {
-                        //前序绑定的线边库
-                        Object xbkStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK + taskNode.getId());
-                        if (xbkStorge != null) {
-                            xbkStorge = (Storge) xbkStorge;
-                            //目的地为线边库
-                            map.put("toStorge", xbkStorge);
-                            //临时存放到了线边库的标志
-                            map.put(DemoLineConstant.DEMOLINE_XBKFLAG, "1");
-                            //临时存放到了智能单元的线边库
-                            map.put(DemoLineConstant.DEMOLINE_XBK_TYPE, DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK);
-                            //当前执行数量
-                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo(), 0, 1, TimeUnit.DAYS);
-                        }
-                    }
-                }
-                else if (count == 1) {//从缓存位拿出来
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
-                    Storge hcwStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId());
-                    map.put("Data", hcwStorge);
-                    map.put("fromStorge", hcwStorge);
-                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
-                    map.put("toStorge", jqrStorge);
-                    //出入库类型
-                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                }
-                else if (count == 2) {
-                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
-                    //出入库类型-托盘夹具原材料出入库
-                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
-                    Storge plantStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo());
-                    map.put("Data", plantStorge);
-                    map.put("toStorge", plantStorge);
-                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
-                    map.put("fromStorge", jqrStorge);
-                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), plantStorge, 1, TimeUnit.DAYS);
-                }
-                map.put("result", true);
-            }
-
-        }
-        return map;
-    }
+//                    //机器人手抓没被锁定,并且有空闲未知
+//                    if (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS)) {
+//                        if (CollectionUtil.isNotEmpty(sum50List)) {//设备空闲
+//                            Storge sum50Storge = storgeService.getById(sum50List.get(0).getStorgeId());
+//                            //锁定加工设备库位
+//                            sum50Storge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(sum50Storge, nextTaskNode.getId());
+//                            //放入缓存,下个节点使用
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_SUM50_RXDY4 + nextTaskNode.getId(), sum50Storge, 1, TimeUnit.DAYS);
+//
+//                            //锁定机器人手抓
+//                            Storge jqrStorge = storgeService.getById(jqrMap.get(DemoLineConstant.DEMOLINE_RJQR_ZS).get(0).getStorgeId());
+//                            jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
+////                                //去掉抓手
+////                                jqrMap.remove(DemoLineConstant.DEMOLINE_RJQR_ZS);
+//                            //锁定一个缓存位
+//                            List<ProductionresourcePosition> hcwList = jqrMap.get(jqrMap.keySet().stream().filter(p -> !DemoLineConstant.DEMOLINE_RJQR_ZS.equals(p)).findFirst().get());
+//                            Storge hcwStorge = storgeService.getById(hcwList.get(0).getStorgeId());
+//                            hcwStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(hcwStorge, nextTaskNode.getId());
+//
+//
+//                            //抓手缓存
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//                            //缓存位缓存
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + nextTaskNode.getId(), hcwStorge, 1, TimeUnit.DAYS);
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId(), hcwStorge, 1, TimeUnit.DAYS);
+//
+//
+//                        }
+//                        else {//设备忙碌,放置到线边库
+//                            String znscdyXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK};
+//                            xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(znscdyXBKarr);
+//                            if (xbkList != null && xbkList.size() > 0) {
+//                                //锁定线边库
+//                                Storge xbkStorge = storgeService.getById(xbkList.get(0).getStorgeId());
+//
+//                                xbkStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                                storgeService.lockStorge(xbkStorge, nextTaskNode.getId());
+//                                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
+//                            }
+//                        }
+//                        //满足条件--机器人空闲,设备或线边库有一个空闲
+//                        if (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS) && ((CollectionUtil.isNotEmpty(sum50List) || CollectionUtil.isNotEmpty(xbkList)))) {//移动
+//                            map.put("Data", plantStorge);
+//                            map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "moveMaterial");
+//                        }
+//                    }
+//                    map.put("result", (CollectionUtil.isNotEmpty(jqrList) && ((CollectionUtil.isNotEmpty(sum50List) || CollectionUtil.isNotEmpty(xbkList)))));
+//
+//                }
+//            }
+//
+//            else if (DemoLineConstant.DEMOLINE_OP02_02.equals(taskNode.getNodeNo())) {
+//                //当前步骤。骤有的节点会生产多步执行
+//                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
+//                //执行到第几步
+//                map.put(taskNode.getId().toString() + "count", count);
+//                map.put(DemoLineConstant.DEMOLINE_RXJQR_FLAG, "1");
+//                map.put("zkIp", ZK_ip_rxx);
+//                TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                if (count == 0) {//第一步移动
+//                    Storge sum50Storge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_SUM50_RXDY4 + taskNode.getId());
+//                    map.put("Data", sum50Storge);
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "moveMaterial");
+//                } else if (count == 1) {//从缓存位拿出来
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                    Storge hcwStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId());
+//                    map.put("Data", hcwStorge);
+//                    map.put("fromStorge", hcwStorge);
+//                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
+//                    map.put("toStorge", jqrStorge);
+//                    //出入库类型
+//                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                } else if (count == 2) {
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
+//                    //出入库类型
+//                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                    Storge sum50Storge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_SUM50_RXDY4 + taskNode.getId());
+//                    map.put("Data", sum50Storge);
+//                    map.put("toStorge", sum50Storge);
+//                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
+//                    map.put("fromStorge", jqrStorge);
+//                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), sum50Storge, 1, TimeUnit.DAYS);
+//                }
+//                map.put("result", true);
+//            }
+//
+//            else if (DemoLineConstant.DEMOLINE_OP03_01.equals(taskNode.getNodeNo())) {
+//                //当前步骤。骤有的节点会生产多步执行
+//                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
+//                //执行到第几步
+//                map.put(taskNode.getId().toString() + "count", count);
+//                map.put(DemoLineConstant.DEMOLINE_RXJQR_FLAG, "1");
+//                map.put("zkIp", ZK_ip_rxx);
+//
+//                if (count == 0) {//第一步的时候锁定资源
+//                    String JQR = DemoLineConstant.JQR3;
+//                    //判断机器人是否为空
+//                    String jrqarr[] = {JQR};
+//                    List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
+//                    Map<String, List<ProductionresourcePosition>> jqrMap = jqrList.stream().collect(groupingBy(ProductionresourcePosition::getPointId));
+//                    //判断设备是否空闲
+//                    List<ProductionresourcePosition> qxjList = new ArrayList<>();
+//                    List<ProductionresourcePosition> xbkList = new ArrayList<>();
+//                    Storge qxjStorge = null;
+//
+//                    TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                    //机器人手抓没被锁定,并且有空闲未知
+//                    if (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS)) {
+//                        //清洗机有空位
+//                        String qxjarr[] = {DemoLineConstant.DEMOLINE_QINGXIJI};
+//                        qxjList = productionresourcePositionService.getFreeProductionresourcePositionByNos(qxjarr);
+//                        if (CollectionUtil.isNotEmpty(qxjList)) {//设备空闲
+//                            qxjStorge = storgeService.getById(qxjList.get(0).getStorgeId());
+//                            qxjStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(qxjStorge, nextTaskNode.getId());
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_QINGXIJI + nextTaskNode.getId(), qxjStorge, 1, TimeUnit.DAYS);
+//
+//                            //锁定机器人手抓
+//                            Storge jqrStorge = storgeService.getById(jqrMap.get(DemoLineConstant.DEMOLINE_RJQR_ZS).get(0).getStorgeId());
+//                            jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
+//                            //锁定一个缓存位
+//                            List<ProductionresourcePosition> hcwList = jqrMap.get(jqrMap.keySet().stream().filter(p -> !DemoLineConstant.DEMOLINE_RJQR_ZS.equals(p)).findFirst().get());
+//                            Storge hcwStorge = storgeService.getById(hcwList.get(0).getStorgeId());
+//                            hcwStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(hcwStorge, nextTaskNode.getId());
+//
+//                            //抓手缓存
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//                            //缓存位缓存
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + nextTaskNode.getId(), hcwStorge, 1, TimeUnit.DAYS);
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId(), hcwStorge, 1, TimeUnit.DAYS);
+//                        }
+//                        else {//设备忙碌,放置到线边库
+//                            String znscdyXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK};
+//                            xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(znscdyXBKarr);
+//                            if (xbkList != null && xbkList.size() > 0) {
+//                                //锁定线边库
+//                                Storge xbkStorge = storgeService.getById(xbkList.get(0).getStorgeId());
+//
+//                                xbkStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                                storgeService.lockStorge(xbkStorge, nextTaskNode.getId());
+//                                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_RXSC_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
+//                            }
+//                        }
+//                        //满足条件--机器人空闲,设备或线边库有一个空闲
+//                        if (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS) && ((CollectionUtil.isNotEmpty(qxjList)) || (CollectionUtil.isNotEmpty(xbkList)))) {//移动
+//                            //移动到sum50
+//                            Storge sum50Storge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
+//                            map.put("Data", sum50Storge);
+//                            map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "moveMaterial");
+//                        }
+//                    }
+//                    map.put("result", (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS) && ((CollectionUtil.isNotEmpty(qxjList)) || (CollectionUtil.isNotEmpty(xbkList)))));
+//                } else if (count == 1) {
+//                    Storge sum50Storge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                    map.put("fromStorge", sum50Storge);
+//                    map.put("Data", sum50Storge);
+//                    //出入库类型
+//                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                    //目的地为机器人手臂
+//                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
+//                    map.put("toStorge", jqrStorge);
+//                    map.put("result", true);
+//                } else if (count == 2) {
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
+//                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
+//                    map.put("fromStorge", jqrStorge);
+//                    //出入库类型
+//                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                    //目的地为机器人手臂
+//                    Storge hcwStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId());
+//                    map.put("Data", hcwStorge);
+//                    map.put("toStorge", hcwStorge);
+//                    map.put("result", true);
+//                }
+//            }
+//
+//            else if (DemoLineConstant.DEMOLINE_OP03_02.equals(taskNode.getNodeNo())) {
+//                //直接搬运到设备或线边库上
+//                //当前步骤。骤有的节点会生产多步执行
+//                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
+//                //执行到第几步
+//                map.put(taskNode.getId().toString() + "count", count);
+//                map.put(DemoLineConstant.DEMOLINE_RXJQR_FLAG, "1");
+//                map.put("zkIp", ZK_ip_rxx);
+//                String JQR = DemoLineConstant.JQR3;
+//                TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                if (count == 0) {//第一步移动
+//                    Object qxjStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_QINGXIJI + taskNode.getId());
+//                    if (qxjStorge != null) {
+//                        map.put("Data", qxjStorge);
+//                        map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "moveMaterial");
+//                    } else {
+//                        //前序绑定的线边库
+//                        Object xbkStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK + taskNode.getId());
+//                        if (xbkStorge != null) {
+//                            xbkStorge = (Storge) xbkStorge;
+//                            //目的地为线边库
+//                            map.put("toStorge", xbkStorge);
+//                            //临时存放到了线边库的标志
+//                            map.put(DemoLineConstant.DEMOLINE_XBKFLAG, "1");
+//                            //临时存放到了智能单元的线边库
+//                            map.put(DemoLineConstant.DEMOLINE_XBK_TYPE, DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK);
+//                            //当前执行数量
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo(), 0, 1, TimeUnit.DAYS);
+//                        }
+//                    }
+//                } else if (count == 1) {//从缓存位拿出来
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                    Storge hcwStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId());
+//                    map.put("Data", hcwStorge);
+//                    map.put("fromStorge", hcwStorge);
+//                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
+//                    map.put("toStorge", jqrStorge);
+//                    //出入库类型
+//                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                } else if (count == 2) {
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
+//                    //出入库类型
+//                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                    Object qxjStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_QINGXIJI + taskNode.getId());
+//                    map.put("Data", qxjStorge);
+//                    map.put("toStorge", qxjStorge);
+//                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
+//                    map.put("fromStorge", jqrStorge);
+//                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), qxjStorge, 1, TimeUnit.DAYS);
+//                }
+//                map.put("result", true);
+//            }
+//
+//            else if (DemoLineConstant.DEMOLINE_OP04_01.equals(taskNode.getNodeNo())) {
+//                //打标
+//                //当前步骤。骤有的节点会生产多步执行
+//                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
+//                //执行到第几步
+//                map.put(taskNode.getId().toString() + "count", count);
+//                map.put(DemoLineConstant.DEMOLINE_RXJQR_FLAG, "1");
+//                map.put("zkIp", ZK_ip_rxx);
+//
+//                if (count == 0) {//第一步的时候锁定资源
+//                    String JQR = DemoLineConstant.JQR3;
+//                    //判断机器人是否为空
+//                    String jrqarr[] = {JQR};
+//                    List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
+//                    Map<String, List<ProductionresourcePosition>> jqrMap = jqrList.stream().collect(groupingBy(ProductionresourcePosition::getPointId));
+//                    //判断设备是否空闲
+//                    List<ProductionresourcePosition> dbjList = new ArrayList<>();
+//                    List<ProductionresourcePosition> xbkList = new ArrayList<>();
+//                    Storge dbjStorge = null;
+//
+//                    TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                    //机器人手抓没被锁定,并且有空闲未知
+//                    if (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS)) {
+//                        //打标机有空位
+//                        String dbjarr[] = {DemoLineConstant.DEMOLINE_DABIAOJI};
+//                        dbjList = productionresourcePositionService.getFreeProductionresourcePositionByNos(dbjarr);
+//                        if (CollectionUtil.isNotEmpty(dbjList)) {//设备空闲
+//                            dbjStorge = storgeService.getById(dbjList.get(0).getStorgeId());
+//                            dbjStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(dbjStorge, nextTaskNode.getId());
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_DABIAOJI + nextTaskNode.getId(), dbjStorge, 1, TimeUnit.DAYS);
+//
+//                            //锁定机器人手抓
+//                            Storge jqrStorge = storgeService.getById(jqrMap.get(DemoLineConstant.DEMOLINE_RJQR_ZS).get(0).getStorgeId());
+//                            jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
+////                            //去掉抓手
+//                            //锁定一个缓存位
+//                            List<ProductionresourcePosition> hcwList = jqrMap.get(jqrMap.keySet().stream().filter(p -> !DemoLineConstant.DEMOLINE_RJQR_ZS.equals(p)).findFirst().get());
+//                            Storge hcwStorge = storgeService.getById(hcwList.get(0).getStorgeId());
+//                            hcwStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(hcwStorge, nextTaskNode.getId());
+//
+//
+//                            //抓手缓存
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//                            //缓存位缓存
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + nextTaskNode.getId(), hcwStorge, 1, TimeUnit.DAYS);
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId(), hcwStorge, 1, TimeUnit.DAYS);
+//                        } else {//设备忙碌,放置到线边库
+//                            String znscdyXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK};
+//                            xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(znscdyXBKarr);
+//                            if (xbkList != null && xbkList.size() > 0) {
+//                                //锁定线边库
+//                                Storge xbkStorge = storgeService.getById(xbkList.get(0).getStorgeId());
+//
+//                                xbkStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                                storgeService.lockStorge(xbkStorge, nextTaskNode.getId());
+//                                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_RXSC_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
+//                            }
+//                        }
+//                        //满足条件--机器人空闲,设备或线边库有一个空闲
+//                        if (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS) && ((CollectionUtil.isNotEmpty(dbjList)) || (CollectionUtil.isNotEmpty(xbkList)))) {//移动
+//                            //移动到sum50
+//                            Storge qxjStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
+//                            map.put("Data", qxjStorge);
+//                            map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "moveMaterial");
+//                        }
+//                    }
+//                    map.put("result", (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS) && ((CollectionUtil.isNotEmpty(dbjList)) || (CollectionUtil.isNotEmpty(xbkList)))));
+//                }
+//                else if (count == 1) {
+//                    Storge dbjStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                    map.put("fromStorge", dbjStorge);
+//                    map.put("Data", dbjStorge);
+//                    //出入库类型
+//                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                    //目的地为机器人手臂
+//                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
+//                    map.put("toStorge", jqrStorge);
+//                    map.put("result", true);
+//                }
+//                else if (count == 2) {
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
+//                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
+//                    map.put("fromStorge", jqrStorge);
+//                    //出入库类型
+//                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                    //目的地为机器人手臂
+//                    Storge hcwStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId());
+//                    map.put("Data", hcwStorge);
+//                    map.put("toStorge", hcwStorge);
+//                    map.put("result", true);
+//                }
+//            }
+//
+//            else if (DemoLineConstant.DEMOLINE_OP04_02.equals(taskNode.getNodeNo())) {
+//                //直接搬运到设备或线边库上
+//                //当前步骤。骤有的节点会生产多步执行
+//                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
+//                //执行到第几步
+//                map.put(taskNode.getId().toString() + "count", count);
+//                map.put(DemoLineConstant.DEMOLINE_RXJQR_FLAG, "1");
+//                map.put("zkIp", ZK_ip_rxx);
+//                String JQR = DemoLineConstant.JQR3;
+//                TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                if (count == 0) {//第一步移动
+//                    Object dbjStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_DABIAOJI + taskNode.getId());
+//                    if (dbjStorge != null) {
+//                        map.put("Data", dbjStorge);
+//                        map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "moveMaterial");
+//                    } else {
+//                        //前序绑定的线边库
+//                        Object xbkStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK + taskNode.getId());
+//                        if (xbkStorge != null) {
+//                            xbkStorge = (Storge) xbkStorge;
+//                            //目的地为线边库
+//                            map.put("toStorge", xbkStorge);
+//                            //临时存放到了线边库的标志
+//                            map.put(DemoLineConstant.DEMOLINE_XBKFLAG, "1");
+//                            //临时存放到了智能单元的线边库
+//                            map.put(DemoLineConstant.DEMOLINE_XBK_TYPE, DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK);
+//                            //当前执行数量
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo(), 0, 1, TimeUnit.DAYS);
+//                        }
+//                    }
+//                } else if (count == 1) {//从缓存位拿出来
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                    Storge hcwStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId());
+//                    map.put("Data", hcwStorge);
+//                    map.put("fromStorge", hcwStorge);
+//                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
+//                    map.put("toStorge", jqrStorge);
+//                    //出入库类型
+//                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                } else if (count == 2) {
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
+//                    //出入库类型
+//                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                    Object dbjStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_DABIAOJI + taskNode.getId());
+//                    map.put("Data", dbjStorge);
+//                    map.put("toStorge", dbjStorge);
+//                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
+//                    map.put("fromStorge", jqrStorge);
+//                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), dbjStorge, 1, TimeUnit.DAYS);
+//                }
+//                map.put("result", true);
+//
+//            }
+//
+//            //
+//            else if (DemoLineConstant.DEMOLINE_OP04_09.equals(taskNode.getNodeNo())) {
+//                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
+//                //执行到第几步
+//                map.put(taskNode.getId().toString() + "count", count);
+//                map.put(DemoLineConstant.DEMOLINE_RXJQR_NOMOVE_FLAG, "1");
+//                map.put("zkIp", ZK_ip_rxx);
+//
+//                Storge plantStorge = null;
+//                List<ProductionresourcePosition> xbkList = new ArrayList<>();
+//                String jbwCode = null;
+//
+//                if (count == 0) {//第一步的时候锁定资源
+//                    //判断机器人是否为空
+//                    String jrqarr[] = {DemoLineConstant.JQR3};
+//                    List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
+//                    Map<String, List<ProductionresourcePosition>> jqrMap = jqrList.stream().collect(groupingBy(ProductionresourcePosition::getPointId));
+//                    //机器人手抓没被锁定,并且有空闲未知
+//                    if (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS)) {
+//                        TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                        //判断接驳位D\E是否为空
+//                        String jbwarr[] = {DemoLineConstant.JBW_H, DemoLineConstant.JBW_I};
+//                        Map plateMap = storgeService.getPlateStorgeByNo(jbwarr, task.getCompleteBatchNo());
+//                        plantStorge = plateMap.get("storge") == null ? null : (Storge) plateMap.get("storge");
+//                        jbwCode = plateMap.get("jbwCode") == null ? "" : plateMap.get("jbwCode").toString();
+//                        Storge jbwStorge = plateMap.get("jbwStorge") == null ? null : (Storge) plateMap.get("jbwStorge");
+//                        if (plantStorge != null) {//设备空闲
+//                            plantStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(plantStorge, nextTaskNode.getId());
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo(), jbwStorge, 1, TimeUnit.DAYS);
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo(), plantStorge, 1, TimeUnit.DAYS);
+//
+//                            //锁定机器人手抓
+//                            Storge jqrStorge = storgeService.getById(jqrMap.get(DemoLineConstant.DEMOLINE_RJQR_ZS).get(0).getStorgeId());
+//                            jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(jqrStorge, nextTaskNode.getId());
+//                            //锁定一个缓存位
+//                            List<ProductionresourcePosition> hcwList = jqrMap.get(jqrMap.keySet().stream().filter(p -> !DemoLineConstant.DEMOLINE_RJQR_ZS.equals(p)).findFirst().get());
+//                            Storge hcwStorge = storgeService.getById(hcwList.get(0).getStorgeId());
+//                            hcwStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                            storgeService.lockStorge(hcwStorge, nextTaskNode.getId());
+//
+//                            //抓手缓存
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + nextTaskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId(), jqrStorge, 1, TimeUnit.DAYS);
+//                            //缓存位缓存
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + nextTaskNode.getId(), hcwStorge, 1, TimeUnit.DAYS);
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId(), hcwStorge, 1, TimeUnit.DAYS);
+//
+//                        } else {//设备忙碌,放置到线边库
+//                            String znscdyXBKarr[] = {DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK};
+//                            xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(znscdyXBKarr);
+//                            if (xbkList != null && xbkList.size() > 0) {
+//                                //锁定线边库
+//                                Storge xbkStorge = storgeService.getById(xbkList.get(0).getStorgeId());
+//
+//                                xbkStorge.setCompleteBatchNo(task.getCompleteBatchNo());
+//                                storgeService.lockStorge(xbkStorge, nextTaskNode.getId());
+//                                msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK + nextTaskNode.getId(), xbkStorge, 1, TimeUnit.DAYS);
+//                            }
+//                        }
+//                        //满足条件--机器人空闲,设备或线边库有一个空闲
+//                        if (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS) && ((plantStorge != null || CollectionUtil.isNotEmpty(xbkList)))) {//移动
+//                            Storge dbjStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
+//                            map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                            map.put("fromStorge", dbjStorge);
+//                            map.put("jbwCode", jbwCode);
+//                            map.put("Data", dbjStorge);
+//                            //出入库类型
+//                            map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                            //目的地为机器人手臂
+//                            Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
+//                            map.put("toStorge", jqrStorge);
+//                        }
+//                    }
+//                    map.put("result", (CollectionUtil.isNotEmpty(jqrList) && jqrList.size() > 1 && jqrMap.containsKey(DemoLineConstant.DEMOLINE_RJQR_ZS) && ((plantStorge != null || CollectionUtil.isNotEmpty(xbkList)))));
+//                } else if (count == 1) {
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
+//                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
+//                    map.put("fromStorge", jqrStorge);
+//                    map.put("jbwCode", jbwCode);
+//                    //出入库类型
+//                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                    //目的地为机器人手臂
+//                    Storge hcwStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId());
+//                    map.put("Data", hcwStorge);
+//                    map.put("toStorge", hcwStorge);
+//                    map.put("result", true);
+//                }
+////                    else if(count == 2){
+////                        map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE,"putMaterial");
+////                        Storge jqrStorge = (Storge)msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
+////                        map.put("fromStorge", jqrStorge);
+////                        map.put("jbwCode", jbwCode);
+////                        //出入库类型
+////                        map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE,DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+////                        //目的地为机器人手臂
+////                        Storge hcwStorge = (Storge)msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId());
+////                        map.put("Data", hcwStorge);
+////                        map.put("toStorge", hcwStorge);
+////                        map.put("result", true);
+////                    }
+//            }
+//
+//            else if (DemoLineConstant.DEMOLINE_OP04_10.equals(taskNode.getNodeNo())) {
+//                //当前步骤。骤有的节点会生产多步执行
+//                int count = dataMap.get(taskNode.getId().toString() + "count") == null ? 0 : Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count").toString());
+//                //执行到第几步
+//                map.put(taskNode.getId().toString() + "count", count);
+//                map.put(DemoLineConstant.DEMOLINE_RXJQR_FLAG, "1");
+//                map.put("zkIp", ZK_ip_rxx);
+////                    JQR = DemoLineConstant.JQR3;
+////                    TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
+//                if (count == 0) {//第一步移动
+//                    Storge plantStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo());
+//                    if (plantStorge != null) {
+//                        map.put("Data", plantStorge);
+//                        map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "moveMaterial");
+//                    } else {
+//                        //前序绑定的线边库
+//                        Object xbkStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK + taskNode.getId());
+//                        if (xbkStorge != null) {
+//                            xbkStorge = (Storge) xbkStorge;
+//                            //目的地为线边库
+//                            map.put("toStorge", xbkStorge);
+//                            //临时存放到了线边库的标志
+//                            map.put(DemoLineConstant.DEMOLINE_XBKFLAG, "1");
+//                            //临时存放到了智能单元的线边库
+//                            map.put(DemoLineConstant.DEMOLINE_XBK_TYPE, DemoLineConstant.NODE_RESOURCE_ZNSCDY_XBK);
+//                            //当前执行数量
+//                            msgUtil.redis_set(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo(), 0, 1, TimeUnit.DAYS);
+//                        }
+//                    }
+//                }
+//                else if (count == 1) {//从缓存位拿出来
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "fetchMaterial");
+//                    Storge hcwStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_RJQR_HCW + taskNode.getId());
+//                    map.put("Data", hcwStorge);
+//                    map.put("fromStorge", hcwStorge);
+//                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
+//                    map.put("toStorge", jqrStorge);
+//                    //出入库类型
+//                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                }
+//                else if (count == 2) {
+//                    map.put(DemoLineConstant.DEMOLINE_BIZ_TYPE, "putMaterial");
+//                    //出入库类型-托盘夹具原材料出入库
+//                    map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
+//                    Storge plantStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_TB_STORAGE + "_" + task.getCompleteBatchNo());
+//                    map.put("Data", plantStorge);
+//                    map.put("toStorge", plantStorge);
+//                    Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JQR3 + taskNode.getId());
+//                    map.put("fromStorge", jqrStorge);
+//                    msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), plantStorge, 1, TimeUnit.DAYS);
+//                }
+//                map.put("result", true);
+//            }
+//
+//        }
+//        return map;
 
     @Override
     public Map operation(JSONObject jsonObject, JSONObject bizJsonObject, Map<String, Object> map) {