|
@@ -12,13 +12,16 @@ import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
|
|
|
import com.github.zuihou.business.operationManagementCenter.service.TaskNodeService;
|
|
|
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.common.constant.BizConstant;
|
|
|
import com.github.zuihou.common.util.StringUtil;
|
|
|
import com.github.zuihou.database.mybatis.conditions.Wraps;
|
|
|
+import com.github.zuihou.tenant.entity.ModuleInstruction;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.compress.utils.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -73,110 +76,137 @@ public class AGVNodeServiceImpl implements NodeOperationService {
|
|
|
map.put("task", task);
|
|
|
map.put("bizType", bizType);
|
|
|
|
|
|
- if (BizConstant.MQ_TASK_NODE_TYPE_COMMON.equals(bizType)) {
|
|
|
- if (DemoLineConstant.DEMOLINE_OP01_02.equals(taskNode.getNodeNo())) {
|
|
|
- //agv从wms接驳口A取料运到质量中心的接驳位B或C
|
|
|
- //节点2的任务都在节点1被锁定过了,只要从缓存拿出来对应的值即可
|
|
|
- Storge jbwAstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
|
|
|
- //2、取出接驳位
|
|
|
- Storge jbwstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JBW + taskNode.getId().toString());
|
|
|
- //3、把起始终点库位存放到map,用于接口
|
|
|
- map.put("fromStorge", jbwAstorge);
|
|
|
- map.put("toStorge", jbwstorge);
|
|
|
- //这个节点没有需要验证的内容,都在前一个节点验证并且锁定了
|
|
|
- map.put("result", true);
|
|
|
- //出入库类型-原料出入库
|
|
|
- map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_METERIAL_CRK);
|
|
|
- //4、记录机器人的库位,下一个步骤使用
|
|
|
- msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jbwstorge, 1, TimeUnit.DAYS);
|
|
|
- }
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP01_08.equals(taskNode.getNodeNo())){
|
|
|
- //agv运输到产线接驳位
|
|
|
- //根据工件获取所在的生产单元(产线)
|
|
|
- zoneNo = msgUtil.redis_get(DemoCacheKey.DEMOLINE_WORKOP_ZONE + task.getCompleteBatchNo()) == null ? ""
|
|
|
- : msgUtil.redis_get(DemoCacheKey.DEMOLINE_WORKOP_ZONE + task.getCompleteBatchNo()).toString();
|
|
|
- if (DemoLineConstant.DEMOLINE_WORK_SPACE1.equals(zoneNo)) {//智能生产单元
|
|
|
- jbwarr = new String[] {DemoLineConstant.JBW_F, DemoLineConstant.JBW_G};
|
|
|
- } else if (DemoLineConstant.DEMOLINE_WORK_SPACE2.equals(zoneNo)) {//柔性智能加工生产区
|
|
|
- jbwarr = new String[] {DemoLineConstant.JBW_H, DemoLineConstant.JBW_I};
|
|
|
- }
|
|
|
- //当前毛坯所预占的接驳位
|
|
|
- Storge jbwFromStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo());
|
|
|
- //查询是否被锁定
|
|
|
- Storge jbwdbStorge = storgeService.getById(jbwFromStorge.getId());
|
|
|
-
|
|
|
- List<ProductionresourcePosition> jbwList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jbwarr);
|
|
|
- //接驳位有空闲
|
|
|
- if (CollectionUtil.isNotEmpty(jbwList) && "1".equals(jbwdbStorge.getLockStatus())) {
|
|
|
- map.put("fromStorge", jbwFromStorge);
|
|
|
- //锁定接驳位库位
|
|
|
- Storge jbwstorge = storgeService.getById(jbwList.get(0).getStorgeId());
|
|
|
- //锁定接驳位库位
|
|
|
- jbwstorge.setCompleteBatchNo(task.getCompleteBatchNo());
|
|
|
- storgeService.lockStorge(jbwstorge, taskNode.getId());
|
|
|
- TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
|
|
|
- msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JBW + nextTaskNode.getId(), jbwstorge, 1, TimeUnit.DAYS);
|
|
|
- //目的地为接驳位
|
|
|
- map.put("toStorge", jbwstorge);
|
|
|
- //出入库类型-托板出入库
|
|
|
- map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_PLATE_CRK);
|
|
|
- //记录产品流转到的库位
|
|
|
- msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo(), jbwstorge, 1, TimeUnit.DAYS);
|
|
|
- }
|
|
|
- //判断接驳位是否为空
|
|
|
- map.put("result", (CollectionUtil.isNotEmpty(jbwList)));
|
|
|
- }
|
|
|
-
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP05_01.equals(taskNode.getNodeNo())) {
|
|
|
- //接驳位有一个为空
|
|
|
- jbwarr = new String[] {DemoLineConstant.JBW_D, DemoLineConstant.JBW_E};
|
|
|
- List<ProductionresourcePosition> jbwList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jbwarr);
|
|
|
- if (jbwList != null && jbwList.size() > 0) {
|
|
|
- //取出前一步骤存放的上下料站库位
|
|
|
- Storge jbwFromStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo());
|
|
|
- map.put("fromStorge", jbwFromStorge);
|
|
|
- //锁定其中一个
|
|
|
- ProductionresourcePosition jbwp = jbwList.get(0);
|
|
|
- //预占库位为下个节点准备
|
|
|
- Storge jbwstorge = storgeService.getById(jbwp.getStorgeId());
|
|
|
- //锁定接驳位库位
|
|
|
- jbwstorge.setCompleteBatchNo(task.getCompleteBatchNo());
|
|
|
- storgeService.lockStorge(jbwstorge, taskNode.getId());
|
|
|
- TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
|
|
|
- msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JBW + nextTaskNode.getId(), jbwstorge, 1, TimeUnit.DAYS);
|
|
|
- //目的地为接驳位
|
|
|
- map.put("toStorge", jbwstorge);
|
|
|
- //出入库类型-托板出入库
|
|
|
- map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_PLATE_CRK);
|
|
|
- //记录产品流转到的库位
|
|
|
-// msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" +task.getCompleteBatchNo(), jbwstorge, 1, TimeUnit.DAYS);
|
|
|
- msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo(), jbwstorge, 1, TimeUnit.DAYS);
|
|
|
- }
|
|
|
- map.put("result", (CollectionUtil.isNotEmpty(jbwList)));
|
|
|
- }
|
|
|
-
|
|
|
- else if (DemoLineConstant.DEMOLINE_OP06_04.equals(taskNode.getNodeNo())) {
|
|
|
- //节点4的任务都在节点3被锁定过了,只要从缓存拿出来对应的值即可
|
|
|
- //1、取出机器人
|
|
|
- jbwarr = new String[] {DemoLineConstant.JBW_A};
|
|
|
- List<ProductionresourcePosition> jbwAList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jbwarr);
|
|
|
- if (CollectionUtil.isNotEmpty(jbwAList)) {
|
|
|
- Storge jbwAstorge = storgeService.getById(jbwAList.get(0).getStorgeId());
|
|
|
- map.put("toStorge", jbwAstorge);
|
|
|
- }
|
|
|
- //临时这样写
|
|
|
- String jbwarrB[] = {DemoLineConstant.JBW_B};
|
|
|
- queryMap.put("codes", StringUtil.changeIdsArrToSubQueryStr(jbwarrB));
|
|
|
- List<ProductionresourcePosition> jbwBList = productionresourcePositionMapper.getPPList(queryMap);
|
|
|
- if (CollectionUtil.isNotEmpty(jbwBList)) {
|
|
|
- Storge jbwBstorge = storgeService.getById(jbwBList.get(0).getStorgeId());
|
|
|
- map.put("fromStorge", jbwBstorge);
|
|
|
- }
|
|
|
- //出入库类型-原料出入库
|
|
|
- map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_METERIAL_CRK);
|
|
|
- map.put("result", true);
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ String moduleName = dataMap.get("moduleName").toString();
|
|
|
+ List<ModuleInstruction> instructions = dataMap.get("instructions") == null ? Lists.newArrayList() : (List<ModuleInstruction>)dataMap.get("instructions");
|
|
|
+ ResourceAutoCode resourceAutoCode = taskNode.getAutoNode();
|
|
|
+ String functionName = resourceAutoCode.getCommand();
|
|
|
+
|
|
|
+
|
|
|
+ //目标位置
|
|
|
+ Long targetId = resourceAutoCode.getTargetId();
|
|
|
+ Storge targetStore = storgeService.getById(targetId);
|
|
|
+
|
|
|
+ //开始位置
|
|
|
+ Long startId = resourceAutoCode.getStartId();
|
|
|
+ Storge startStore = storgeService.getById(startId);
|
|
|
+
|
|
|
+
|
|
|
+ //3、把起始终点库位存放到map,用于接口
|
|
|
+ map.put("fromStorge", startStore);
|
|
|
+ map.put("toStorge", targetStore);
|
|
|
+ //这个节点没有需要验证的内容,都在前一个节点验证并且锁定了
|
|
|
+ map.put("result", true);
|
|
|
+ //出入库类型-原料出入库
|
|
|
+ map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_METERIAL_CRK);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// if (BizConstant.MQ_TASK_NODE_TYPE_COMMON.equals(bizType)) {
|
|
|
+// if (DemoLineConstant.DEMOLINE_OP01_02.equals(taskNode.getNodeNo())) {
|
|
|
+// //agv从wms接驳口A取料运到质量中心的接驳位B或C
|
|
|
+// //节点2的任务都在节点1被锁定过了,只要从缓存拿出来对应的值即可
|
|
|
+// Storge jbwAstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
|
|
|
+// //2、取出接驳位
|
|
|
+// Storge jbwstorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JBW + taskNode.getId().toString());
|
|
|
+// //3、把起始终点库位存放到map,用于接口
|
|
|
+// map.put("fromStorge", jbwAstorge);
|
|
|
+// map.put("toStorge", jbwstorge);
|
|
|
+// //这个节点没有需要验证的内容,都在前一个节点验证并且锁定了
|
|
|
+// map.put("result", true);
|
|
|
+// //出入库类型-原料出入库
|
|
|
+// map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_METERIAL_CRK);
|
|
|
+// //4、记录机器人的库位,下一个步骤使用
|
|
|
+// msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jbwstorge, 1, TimeUnit.DAYS);
|
|
|
+// }
|
|
|
+// else if (DemoLineConstant.DEMOLINE_OP01_08.equals(taskNode.getNodeNo())){
|
|
|
+// //agv运输到产线接驳位
|
|
|
+// //根据工件获取所在的生产单元(产线)
|
|
|
+// zoneNo = msgUtil.redis_get(DemoCacheKey.DEMOLINE_WORKOP_ZONE + task.getCompleteBatchNo()) == null ? ""
|
|
|
+// : msgUtil.redis_get(DemoCacheKey.DEMOLINE_WORKOP_ZONE + task.getCompleteBatchNo()).toString();
|
|
|
+// if (DemoLineConstant.DEMOLINE_WORK_SPACE1.equals(zoneNo)) {//智能生产单元
|
|
|
+// jbwarr = new String[] {DemoLineConstant.JBW_F, DemoLineConstant.JBW_G};
|
|
|
+// } else if (DemoLineConstant.DEMOLINE_WORK_SPACE2.equals(zoneNo)) {//柔性智能加工生产区
|
|
|
+// jbwarr = new String[] {DemoLineConstant.JBW_H, DemoLineConstant.JBW_I};
|
|
|
+// }
|
|
|
+// //当前毛坯所预占的接驳位
|
|
|
+// Storge jbwFromStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo());
|
|
|
+// //查询是否被锁定
|
|
|
+// Storge jbwdbStorge = storgeService.getById(jbwFromStorge.getId());
|
|
|
+//
|
|
|
+// List<ProductionresourcePosition> jbwList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jbwarr);
|
|
|
+// //接驳位有空闲
|
|
|
+// if (CollectionUtil.isNotEmpty(jbwList) && "1".equals(jbwdbStorge.getLockStatus())) {
|
|
|
+// map.put("fromStorge", jbwFromStorge);
|
|
|
+// //锁定接驳位库位
|
|
|
+// Storge jbwstorge = storgeService.getById(jbwList.get(0).getStorgeId());
|
|
|
+// //锁定接驳位库位
|
|
|
+// jbwstorge.setCompleteBatchNo(task.getCompleteBatchNo());
|
|
|
+// storgeService.lockStorge(jbwstorge, taskNode.getId());
|
|
|
+// TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
|
|
|
+// msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JBW + nextTaskNode.getId(), jbwstorge, 1, TimeUnit.DAYS);
|
|
|
+// //目的地为接驳位
|
|
|
+// map.put("toStorge", jbwstorge);
|
|
|
+// //出入库类型-托板出入库
|
|
|
+// map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_PLATE_CRK);
|
|
|
+// //记录产品流转到的库位
|
|
|
+// msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo(), jbwstorge, 1, TimeUnit.DAYS);
|
|
|
+// }
|
|
|
+// //判断接驳位是否为空
|
|
|
+// map.put("result", (CollectionUtil.isNotEmpty(jbwList)));
|
|
|
+// }
|
|
|
+//
|
|
|
+// else if (DemoLineConstant.DEMOLINE_OP05_01.equals(taskNode.getNodeNo())) {
|
|
|
+// //接驳位有一个为空
|
|
|
+// jbwarr = new String[] {DemoLineConstant.JBW_D, DemoLineConstant.JBW_E};
|
|
|
+// List<ProductionresourcePosition> jbwList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jbwarr);
|
|
|
+// if (jbwList != null && jbwList.size() > 0) {
|
|
|
+// //取出前一步骤存放的上下料站库位
|
|
|
+// Storge jbwFromStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo()) == null ? null : (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo());
|
|
|
+// map.put("fromStorge", jbwFromStorge);
|
|
|
+// //锁定其中一个
|
|
|
+// ProductionresourcePosition jbwp = jbwList.get(0);
|
|
|
+// //预占库位为下个节点准备
|
|
|
+// Storge jbwstorge = storgeService.getById(jbwp.getStorgeId());
|
|
|
+// //锁定接驳位库位
|
|
|
+// jbwstorge.setCompleteBatchNo(task.getCompleteBatchNo());
|
|
|
+// storgeService.lockStorge(jbwstorge, taskNode.getId());
|
|
|
+// TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
|
|
|
+// msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.JBW + nextTaskNode.getId(), jbwstorge, 1, TimeUnit.DAYS);
|
|
|
+// //目的地为接驳位
|
|
|
+// map.put("toStorge", jbwstorge);
|
|
|
+// //出入库类型-托板出入库
|
|
|
+// map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_PLATE_CRK);
|
|
|
+// //记录产品流转到的库位
|
|
|
+//// msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" +task.getCompleteBatchNo(), jbwstorge, 1, TimeUnit.DAYS);
|
|
|
+// msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_JBW_STORAGE + "_" + task.getCompleteBatchNo(), jbwstorge, 1, TimeUnit.DAYS);
|
|
|
+// }
|
|
|
+// map.put("result", (CollectionUtil.isNotEmpty(jbwList)));
|
|
|
+// }
|
|
|
+//
|
|
|
+// else if (DemoLineConstant.DEMOLINE_OP06_04.equals(taskNode.getNodeNo())) {
|
|
|
+// //节点4的任务都在节点3被锁定过了,只要从缓存拿出来对应的值即可
|
|
|
+// //1、取出机器人
|
|
|
+// jbwarr = new String[] {DemoLineConstant.JBW_A};
|
|
|
+// List<ProductionresourcePosition> jbwAList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jbwarr);
|
|
|
+// if (CollectionUtil.isNotEmpty(jbwAList)) {
|
|
|
+// Storge jbwAstorge = storgeService.getById(jbwAList.get(0).getStorgeId());
|
|
|
+// map.put("toStorge", jbwAstorge);
|
|
|
+// }
|
|
|
+// //临时这样写
|
|
|
+// String jbwarrB[] = {DemoLineConstant.JBW_B};
|
|
|
+// queryMap.put("codes", StringUtil.changeIdsArrToSubQueryStr(jbwarrB));
|
|
|
+// List<ProductionresourcePosition> jbwBList = productionresourcePositionMapper.getPPList(queryMap);
|
|
|
+// if (CollectionUtil.isNotEmpty(jbwBList)) {
|
|
|
+// Storge jbwBstorge = storgeService.getById(jbwBList.get(0).getStorgeId());
|
|
|
+// map.put("fromStorge", jbwBstorge);
|
|
|
+// }
|
|
|
+// //出入库类型-原料出入库
|
|
|
+// map.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_METERIAL_CRK);
|
|
|
+// map.put("result", true);
|
|
|
+// }
|
|
|
+// }
|
|
|
return map;
|
|
|
}
|
|
|
|