|
|
@@ -12,8 +12,10 @@ import com.github.zuihou.business.operationManagementCenter.dao.PlanMapper;
|
|
|
import com.github.zuihou.business.operationManagementCenter.dao.TTaskMapper;
|
|
|
import com.github.zuihou.business.operationManagementCenter.dao.TaskNodeMapper;
|
|
|
import com.github.zuihou.business.operationManagementCenter.entity.TTask;
|
|
|
+import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
|
|
|
import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
|
|
|
import com.github.zuihou.business.operationManagementCenter.service.TaskNodeService;
|
|
|
+import com.github.zuihou.business.operationManagementCenter.service.WorkpieceService;
|
|
|
import com.github.zuihou.business.productionReadyCenter.dao.AAutoNodeLogMapper;
|
|
|
import com.github.zuihou.business.productionReadyCenter.entity.AAutoNodeLog;
|
|
|
import com.github.zuihou.business.productionReadyCenter.entity.BomProcedureProductionresource;
|
|
|
@@ -87,6 +89,9 @@ public class TaskWorkNode {
|
|
|
@Autowired
|
|
|
private StorgeService storgeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private WorkpieceService workpieceService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ProductionresourcePositionService productionresourcePositionService;
|
|
|
|
|
|
@@ -523,173 +528,175 @@ public class TaskWorkNode {
|
|
|
nodeOperationService.initResource(taskNode, task, map);
|
|
|
|
|
|
//线边库轮询两个机械手和接驳位资源。如果两个都有空则从线边库搬运到接驳位
|
|
|
- if (BizConstant.MQ_TASK_NODE_TYPE_STORAGE_WAIT_ZLZX.equals(bizType)) {
|
|
|
- //执行线边库队列标志
|
|
|
- map.put(DemoLineConstant.DEMOLINE_EXEXBKFLAG, "1");
|
|
|
- if (BizConstant.MQ_TASK_NODE_TYPE_STORAGE_WAIT_ZLZX_JBW.equals(carryType)) {
|
|
|
- int currCount = msgUtil.redis_get(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo()) == null ? 0 : Integer.parseInt(msgUtil.redis_get(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo()).toString());
|
|
|
- if (currCount == 1) {
|
|
|
- //判断接驳位D\E是否为空
|
|
|
- String jbwarr[] = {DemoLineConstant.JBW_D, DemoLineConstant.JBW_E};
|
|
|
- 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();
|
|
|
-
|
|
|
- //判断机器人库位是否为空
|
|
|
- String jrqarr[] = {DemoLineConstant.JQR1};
|
|
|
- List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
|
|
|
- if (plantStorge != null && CollectionUtil.isNotEmpty(jqrList)) {
|
|
|
- //锁定其中一个
|
|
|
- //获取下一个节点,用于锁定
|
|
|
- TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
|
|
|
- //锁定库位,锁定的业务ID是下一个节点的ID
|
|
|
- plantStorge.setCompleteBatchNo(task.getCompleteBatchNo());
|
|
|
- storgeService.lockStorge(plantStorge, nextTaskNode.getId());
|
|
|
- msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.TB + taskNode.getId(), plantStorge, 1, TimeUnit.DAYS);
|
|
|
-
|
|
|
- Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
|
|
|
- map.put("toStorge", jqrStorge);
|
|
|
- //机器人库位锁定
|
|
|
- jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
|
|
|
- storgeService.lockStorge(jqrStorge, taskNode.getId());
|
|
|
-
|
|
|
- //线边库库位ID
|
|
|
- String storgeId = dataMap.get("storgeId").toString();
|
|
|
- Storge xbkstorge = storgeService.getById(storgeId);
|
|
|
- //把参数传芳map
|
|
|
- map.put("fromStorge", xbkstorge);
|
|
|
- //所属接驳位
|
|
|
- map.put("jbwCode", jbwCode);
|
|
|
- //记录产品流转到的库位
|
|
|
- msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
|
|
|
- map.put("result", (plantStorge != null && jqrList != null && jqrList.size() > 0));
|
|
|
- msgUtil.redis_set(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo(), ++currCount, 1, TimeUnit.DAYS);
|
|
|
- }
|
|
|
- //机器人和托板有空位
|
|
|
- map.put("result", plantStorge != null && CollectionUtil.isNotEmpty(jqrList));
|
|
|
- }
|
|
|
- else if (currCount == 2) {
|
|
|
- Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
|
|
|
- Object plantStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.TB + taskNode.getId());
|
|
|
- map.put("fromStorge", jqrStorge);
|
|
|
- map.put("toStorge", plantStorge);
|
|
|
- msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), plantStorge, 1, TimeUnit.DAYS);
|
|
|
- //前一步已经锁定完毕,直接满足条件
|
|
|
- map.put("result", true);
|
|
|
- }
|
|
|
- }
|
|
|
- else if (BizConstant.MQ_TASK_NODE_TYPE_STORAGE_WAIT_ZLZX_SZB.equals(carryType)) {//从线边库到三坐标
|
|
|
- int currCount = msgUtil.redis_get(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo()) == null ? 0 : Integer.parseInt(msgUtil.redis_get(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo()).toString());
|
|
|
- if (currCount == 1) {
|
|
|
- //判断接驳位D\E是否为空
|
|
|
- String szbarr[] = {DemoLineConstant.Q3ZUOBIAO};
|
|
|
- List<ProductionresourcePosition> szbList = productionresourcePositionService.getFreeProductionresourcePositionByNos(szbarr);
|
|
|
-
|
|
|
- //判断机器人库位是否为空
|
|
|
- String jrqarr[] = {DemoLineConstant.JQR1};
|
|
|
- List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
|
|
|
-
|
|
|
- Storge szbStorge = null;
|
|
|
- if (CollectionUtil.isNotEmpty(szbList) && CollectionUtil.isNotEmpty(jqrList)) {
|
|
|
- //锁定其中一个
|
|
|
- //获取下一个节点,用于锁定
|
|
|
- TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
|
|
|
- //锁定库位,锁定的业务ID是下一个节点的ID
|
|
|
- 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);
|
|
|
-
|
|
|
- Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
|
|
|
- map.put("toStorge", jqrStorge);
|
|
|
- //机器人库位锁定
|
|
|
- jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
|
|
|
- storgeService.lockStorge(jqrStorge, taskNode.getId());
|
|
|
-
|
|
|
- //线边库库位ID
|
|
|
- String storgeId = dataMap.get("storgeId").toString();
|
|
|
- Storge xbkstorge = storgeService.getById(storgeId);
|
|
|
- //把参数传芳map
|
|
|
- map.put("fromStorge", xbkstorge);
|
|
|
- //记录产品流转到的库位
|
|
|
- msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
|
|
|
- msgUtil.redis_set(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo(), ++currCount, 1, TimeUnit.DAYS);
|
|
|
- }
|
|
|
- //机器人和托板有空位
|
|
|
- map.put("result", (CollectionUtil.isNotEmpty(szbList) && CollectionUtil.isNotEmpty(jqrList)));
|
|
|
- } else if (currCount == 2) {
|
|
|
- Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
|
|
|
- Object szbStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.Q3ZUOBIAO + taskNode.getId());
|
|
|
- map.put("fromStorge", jqrStorge);
|
|
|
- map.put("toStorge", szbStorge);
|
|
|
- msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), szbStorge, 1, TimeUnit.DAYS);
|
|
|
- //前一步已经锁定完毕,直接满足条件
|
|
|
- map.put("result", true);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- else if (BizConstant.MQ_TASK_NODE_TYPE_STORAGE_WAIT_ZNDY.equals(bizType)) {
|
|
|
- //智能单元
|
|
|
- //执行线边库队列标志
|
|
|
- map.put(DemoLineConstant.DEMOLINE_EXEXBKFLAG, "1");
|
|
|
- int currCount = msgUtil.redis_get(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo()) == null ? 0 : Integer.parseInt(msgUtil.redis_get(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo()).toString());
|
|
|
- if (currCount == 1) {
|
|
|
- //判断接驳位D\E是否为空
|
|
|
- String sum50[] = {DemoLineConstant.DEMOLINE_SUM50_ZNDY};
|
|
|
- List<ProductionresourcePosition> sum50List = productionresourcePositionService.getFreeProductionresourcePositionByNos(sum50);
|
|
|
-
|
|
|
- //判断机器人库位是否为空
|
|
|
- String jrqarr[] = {DemoLineConstant.JQR2};
|
|
|
- List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
|
|
|
-
|
|
|
- if (sum50List != null && sum50List.size() > 0 && jqrList != null && jqrList.size() > 0) {
|
|
|
- Storge sum50Storge = storgeService.getById(sum50List.get(0).getStorgeId());
|
|
|
- sum50Storge.setCompleteBatchNo(task.getCompleteBatchNo());
|
|
|
- storgeService.lockStorge(sum50Storge, taskNode.getId());
|
|
|
- //放入缓存,下个节点使用
|
|
|
- msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_SUM50_ZNDY + taskNode.getId(), sum50Storge, 1, TimeUnit.DAYS);
|
|
|
-
|
|
|
- //线边库库位ID
|
|
|
- String storgeId = dataMap.get("storgeId").toString();
|
|
|
- Storge xbkstorge = storgeService.getById(storgeId);
|
|
|
- //把参数传芳map
|
|
|
- map.put("fromStorge", xbkstorge);
|
|
|
-
|
|
|
- Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
|
|
|
- map.put("toStorge", jqrStorge);
|
|
|
- //记录产品流转到的库位
|
|
|
- msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
|
|
|
- //机器人库位锁定
|
|
|
- jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
|
|
|
- storgeService.lockStorge(jqrStorge, taskNode.getId());
|
|
|
- map.put("result", (sum50List != null && sum50List.size() > 0 && jqrList != null && jqrList.size() > 0));
|
|
|
- msgUtil.redis_set(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo(), ++currCount, 1, TimeUnit.DAYS);
|
|
|
- }
|
|
|
- } else if (currCount == 2) {
|
|
|
- Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
|
|
|
- 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);
|
|
|
- msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), sum50Storge, 1, TimeUnit.DAYS);
|
|
|
- }
|
|
|
- map.put("fromStorge", jqrStorge);
|
|
|
- map.put("result", true);
|
|
|
- logger.error("12");
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- else {//正常节点类型
|
|
|
+// if (BizConstant.MQ_TASK_NODE_TYPE_STORAGE_WAIT_ZLZX.equals(bizType)) {
|
|
|
+// //执行线边库队列标志
|
|
|
+// map.put(DemoLineConstant.DEMOLINE_EXEXBKFLAG, "1");
|
|
|
+// if (BizConstant.MQ_TASK_NODE_TYPE_STORAGE_WAIT_ZLZX_JBW.equals(carryType)) {
|
|
|
+// int currCount = msgUtil.redis_get(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo()) == null ? 0 : Integer.parseInt(msgUtil.redis_get(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo()).toString());
|
|
|
+// if (currCount == 1) {
|
|
|
+// //判断接驳位D\E是否为空
|
|
|
+// String jbwarr[] = {DemoLineConstant.JBW_D, DemoLineConstant.JBW_E};
|
|
|
+// 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();
|
|
|
+//
|
|
|
+// //判断机器人库位是否为空
|
|
|
+// String jrqarr[] = {DemoLineConstant.JQR1};
|
|
|
+// List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
|
|
|
+// if (plantStorge != null && CollectionUtil.isNotEmpty(jqrList)) {
|
|
|
+// //锁定其中一个
|
|
|
+// //获取下一个节点,用于锁定
|
|
|
+// TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
|
|
|
+// //锁定库位,锁定的业务ID是下一个节点的ID
|
|
|
+// plantStorge.setCompleteBatchNo(task.getCompleteBatchNo());
|
|
|
+// storgeService.lockStorge(plantStorge, nextTaskNode.getId());
|
|
|
+// msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.TB + taskNode.getId(), plantStorge, 1, TimeUnit.DAYS);
|
|
|
+//
|
|
|
+// Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
|
|
|
+// map.put("toStorge", jqrStorge);
|
|
|
+// //机器人库位锁定
|
|
|
+// jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
|
|
|
+// storgeService.lockStorge(jqrStorge, taskNode.getId());
|
|
|
+//
|
|
|
+// //线边库库位ID
|
|
|
+// String storgeId = dataMap.get("storgeId").toString();
|
|
|
+// Storge xbkstorge = storgeService.getById(storgeId);
|
|
|
+// //把参数传芳map
|
|
|
+// map.put("fromStorge", xbkstorge);
|
|
|
+// //所属接驳位
|
|
|
+// map.put("jbwCode", jbwCode);
|
|
|
+// //记录产品流转到的库位
|
|
|
+// msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
|
|
|
+// map.put("result", (plantStorge != null && jqrList != null && jqrList.size() > 0));
|
|
|
+// msgUtil.redis_set(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo(), ++currCount, 1, TimeUnit.DAYS);
|
|
|
+// }
|
|
|
+// //机器人和托板有空位
|
|
|
+// map.put("result", plantStorge != null && CollectionUtil.isNotEmpty(jqrList));
|
|
|
+// }
|
|
|
+// else if (currCount == 2) {
|
|
|
+// Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
|
|
|
+// Object plantStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.TB + taskNode.getId());
|
|
|
+// map.put("fromStorge", jqrStorge);
|
|
|
+// map.put("toStorge", plantStorge);
|
|
|
+// msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), plantStorge, 1, TimeUnit.DAYS);
|
|
|
+// //前一步已经锁定完毕,直接满足条件
|
|
|
+// map.put("result", true);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// else if (BizConstant.MQ_TASK_NODE_TYPE_STORAGE_WAIT_ZLZX_SZB.equals(carryType)) {//从线边库到三坐标
|
|
|
+// int currCount = msgUtil.redis_get(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo()) == null ? 0 : Integer.parseInt(msgUtil.redis_get(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo()).toString());
|
|
|
+// if (currCount == 1) {
|
|
|
+// //判断接驳位D\E是否为空
|
|
|
+// String szbarr[] = {DemoLineConstant.Q3ZUOBIAO};
|
|
|
+// List<ProductionresourcePosition> szbList = productionresourcePositionService.getFreeProductionresourcePositionByNos(szbarr);
|
|
|
+//
|
|
|
+// //判断机器人库位是否为空
|
|
|
+// String jrqarr[] = {DemoLineConstant.JQR1};
|
|
|
+// List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
|
|
|
+//
|
|
|
+// Storge szbStorge = null;
|
|
|
+// if (CollectionUtil.isNotEmpty(szbList) && CollectionUtil.isNotEmpty(jqrList)) {
|
|
|
+// //锁定其中一个
|
|
|
+// //获取下一个节点,用于锁定
|
|
|
+// TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
|
|
|
+// //锁定库位,锁定的业务ID是下一个节点的ID
|
|
|
+// 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);
|
|
|
+//
|
|
|
+// Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
|
|
|
+// map.put("toStorge", jqrStorge);
|
|
|
+// //机器人库位锁定
|
|
|
+// jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
|
|
|
+// storgeService.lockStorge(jqrStorge, taskNode.getId());
|
|
|
+//
|
|
|
+// //线边库库位ID
|
|
|
+// String storgeId = dataMap.get("storgeId").toString();
|
|
|
+// Storge xbkstorge = storgeService.getById(storgeId);
|
|
|
+// //把参数传芳map
|
|
|
+// map.put("fromStorge", xbkstorge);
|
|
|
+// //记录产品流转到的库位
|
|
|
+// msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
|
|
|
+// msgUtil.redis_set(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo(), ++currCount, 1, TimeUnit.DAYS);
|
|
|
+// }
|
|
|
+// //机器人和托板有空位
|
|
|
+// map.put("result", (CollectionUtil.isNotEmpty(szbList) && CollectionUtil.isNotEmpty(jqrList)));
|
|
|
+// } else if (currCount == 2) {
|
|
|
+// Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
|
|
|
+// Object szbStorge = msgUtil.redis_get(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.Q3ZUOBIAO + taskNode.getId());
|
|
|
+// map.put("fromStorge", jqrStorge);
|
|
|
+// map.put("toStorge", szbStorge);
|
|
|
+// msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), szbStorge, 1, TimeUnit.DAYS);
|
|
|
+// //前一步已经锁定完毕,直接满足条件
|
|
|
+// map.put("result", true);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// else if (BizConstant.MQ_TASK_NODE_TYPE_STORAGE_WAIT_ZNDY.equals(bizType)) {
|
|
|
+// //智能单元
|
|
|
+// //执行线边库队列标志
|
|
|
+// map.put(DemoLineConstant.DEMOLINE_EXEXBKFLAG, "1");
|
|
|
+// int currCount = msgUtil.redis_get(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo()) == null ? 0 : Integer.parseInt(msgUtil.redis_get(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo()).toString());
|
|
|
+// if (currCount == 1) {
|
|
|
+// //判断接驳位D\E是否为空
|
|
|
+// String sum50[] = {DemoLineConstant.DEMOLINE_SUM50_ZNDY};
|
|
|
+// List<ProductionresourcePosition> sum50List = productionresourcePositionService.getFreeProductionresourcePositionByNos(sum50);
|
|
|
+//
|
|
|
+// //判断机器人库位是否为空
|
|
|
+// String jrqarr[] = {DemoLineConstant.JQR2};
|
|
|
+// List<ProductionresourcePosition> jqrList = productionresourcePositionService.getFreeProductionresourcePositionByNos(jrqarr);
|
|
|
+//
|
|
|
+// if (sum50List != null && sum50List.size() > 0 && jqrList != null && jqrList.size() > 0) {
|
|
|
+// Storge sum50Storge = storgeService.getById(sum50List.get(0).getStorgeId());
|
|
|
+// sum50Storge.setCompleteBatchNo(task.getCompleteBatchNo());
|
|
|
+// storgeService.lockStorge(sum50Storge, taskNode.getId());
|
|
|
+// //放入缓存,下个节点使用
|
|
|
+// msgUtil.redis_set(DemoCacheKey.DEMOLINE_CAMP + "_" + DemoLineConstant.DEMOLINE_SUM50_ZNDY + taskNode.getId(), sum50Storge, 1, TimeUnit.DAYS);
|
|
|
+//
|
|
|
+// //线边库库位ID
|
|
|
+// String storgeId = dataMap.get("storgeId").toString();
|
|
|
+// Storge xbkstorge = storgeService.getById(storgeId);
|
|
|
+// //把参数传芳map
|
|
|
+// map.put("fromStorge", xbkstorge);
|
|
|
+//
|
|
|
+// Storge jqrStorge = storgeService.getById(jqrList.get(0).getStorgeId());
|
|
|
+// map.put("toStorge", jqrStorge);
|
|
|
+// //记录产品流转到的库位
|
|
|
+// msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), jqrStorge, 1, TimeUnit.DAYS);
|
|
|
+// //机器人库位锁定
|
|
|
+// jqrStorge.setCompleteBatchNo(task.getCompleteBatchNo());
|
|
|
+// storgeService.lockStorge(jqrStorge, taskNode.getId());
|
|
|
+// map.put("result", (sum50List != null && sum50List.size() > 0 && jqrList != null && jqrList.size() > 0));
|
|
|
+// msgUtil.redis_set(DemoCacheKey.DEMOLINE_XBK_CURRCOUNT + task.getCompleteBatchNo(), ++currCount, 1, TimeUnit.DAYS);
|
|
|
+// }
|
|
|
+// } else if (currCount == 2) {
|
|
|
+// Storge jqrStorge = (Storge) msgUtil.redis_get(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo());
|
|
|
+// 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);
|
|
|
+// msgUtil.redis_set(DemoCacheKey.DEMOLINE_CIRCULATION_STORAGE + "_" + task.getCompleteBatchNo(), sum50Storge, 1, TimeUnit.DAYS);
|
|
|
+// }
|
|
|
+// map.put("fromStorge", jqrStorge);
|
|
|
+// map.put("result", true);
|
|
|
+// logger.error("12");
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+ if (bizType == "0") {//正常节点类型
|
|
|
BomProcedureProductionresource bomProcedureProductionresource = bomProcedureProductionresourceService.getOne(new QueryWrapper<BomProcedureProductionresource>().eq("resourceId",task.getResourceId()).eq("procedureId", task.getProcedureId()));
|
|
|
//List<ResourceAutoCode> resourceAutoCodeList = resourceAutoCodeService.getNodeList(resourceAutoCode);
|
|
|
//业务序列节点
|
|
|
//ResourceAutoCode parentAutoCode = resourceAutoCodeService.getById(resourceAutoCode.getParentId());
|
|
|
logger.info("=============进入自动化节点条件检测==============" + resourceAutoCode.getName() );
|
|
|
map = nodeOperationService.checkCondition(taskNode, task, map);
|
|
|
-
|
|
|
+ }else{
|
|
|
+ logger.info("=============进入线边库条件检测==============" + resourceAutoCode.getName() );
|
|
|
+ map = checkXbkCon(taskNode, task, map);
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
@@ -716,5 +723,49 @@ public class TaskWorkNode {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 线边库条件处理判断
|
|
|
+ * @param map
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map checkXbkCon(TaskNode taskNode,TTask task, Map<String, Object> map){
|
|
|
+ Storge xbkStorage = workpieceService.getWorkPieceStock(taskNode.getId(),false);
|
|
|
+ if(xbkStorage.getLockStatus()=="1"){
|
|
|
+ map.put("msg", DictionaryKey.NodeException.RUNNING_FALSE);
|
|
|
+ map.put("result", false);
|
|
|
+ }else{
|
|
|
+ // 获取锁定节点设备ID
|
|
|
+ //Long campId = xbkStorage.getCampId();
|
|
|
+ Long targetId = xbkStorage.getTargetId();
|
|
|
+ if(!taskNodeService.getRunStatus(targetId)){
|
|
|
+ map.put("result", false);
|
|
|
+ map.put("msg", DictionaryKey.NodeException.RUNNING_FALSE);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+ ProductionresourcePosition resourcePosition = productionresourcePositionService.getOne(new LbqWrapper<ProductionresourcePosition>().eq(ProductionresourcePosition::getResourceId, targetId));
|
|
|
+ Productionresource productionresource = productionresourceService.getOne(new QueryWrap<Productionresource>().eq("id", targetId));
|
|
|
+ //任意设备条件判断
|
|
|
+ boolean bool = resourcePosition!=null && resourcePosition.getLockStatus() == "1" && resourcePosition.getStatus() == "1" && resourcePosition.getHaveGoods() == "0";
|
|
|
+ if(productionresource.getModuleDesc()=="接驳位"){
|
|
|
+ //锁定对象是接驳位
|
|
|
+ String[] jbwarr = new String[]{productionresource.getCode()};
|
|
|
+ Map plateMap = storgeService.getPlateStorgeByNo(jbwarr, task.getCompleteBatchNo());
|
|
|
+ Storge plantStorge = plateMap.get("storge") == null ? null : (Storge) plateMap.get("storge");
|
|
|
+ bool = bool && (plantStorge!=null );
|
|
|
+ }
|
|
|
+ if(bool){
|
|
|
+ //实现移动操作到具体设备
|
|
|
+
|
|
|
+ //线边库解锁
|
|
|
+ storgeService.unlockStorge(xbkStorage);
|
|
|
+ }else{
|
|
|
+ map.put("msg", DictionaryKey.NodeException.RESOURCE_LOCK);
|
|
|
+ }
|
|
|
+ map.put("result", bool);
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|