|
@@ -155,19 +155,6 @@ public class TaskWorkNode {
|
|
|
throw new InterruptedException("当前任务为空");
|
|
|
}
|
|
|
// //获取配置序数据
|
|
|
-// BomProcedureProductionresource bomProcedureProductionresource = bomProcedureProductionresourceService.getOne(new QueryWrapper<BomProcedureProductionresource>().eq("resourceId",tTask.getResourceId()).eq("procedureId", tTask.getProcedureId()));
|
|
|
-// if(bomProcedureProductionresource == null || bomProcedureProductionresource.getResourceBusinessId() == null){
|
|
|
-// throw new InterruptedException("自动化节点配置为空");
|
|
|
-// }
|
|
|
-// ResourceBusiness resourceBusiness = resourceBusinessService.getById(bomProcedureProductionresource.getResourceBusinessId());
|
|
|
-// if(resourceBusiness == null || resourceBusiness.getIsFinal() == null){
|
|
|
-// throw new InterruptedException("自动化节点配置有误");
|
|
|
-// }
|
|
|
-//
|
|
|
-// List<ResourceAutoCode> resourceAutoCodeList = resourceAutoCodeService.getTree(new LbqWrapper<ResourceAutoCode>().eq(ResourceAutoCode::getParentId, bomProcedureProductionresource.getResourceBusinessId()).eq(ResourceAutoCode::getStatus, "1").ne(ResourceAutoCode::getParentId, "0").orderByAsc(ResourceAutoCode::getWeight,ResourceAutoCode::getCreateTime));
|
|
|
-// if(resourceAutoCodeList == null || resourceAutoCodeList.size() == 0){
|
|
|
-// throw new InterruptedException("动作节点配置为空");
|
|
|
-// }
|
|
|
//任务初始化判断
|
|
|
if ("1".equals(tTask.getStatus())) {
|
|
|
//下发的数据才更新状态
|
|
@@ -318,37 +305,6 @@ public class TaskWorkNode {
|
|
|
bizJsonObject.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, stockType);
|
|
|
}
|
|
|
|
|
|
- /*
|
|
|
- //机器上下料相关
|
|
|
- if (DictionaryKey.INTERFACETYPE_PLC.equals(taskNode.getInterfaceType())) {
|
|
|
- //String location = conMap.get("location").toString();
|
|
|
- nodeOperationService = new RobotNodeServiceImpl();
|
|
|
- Map map = nodeOperationService.operation(jsonObject, bizJsonObject, conMap);
|
|
|
- jsonObject = (JSONObject) map.get("jsonObject");
|
|
|
- bizJsonObject = (JSONObject) map.get("bizJsonObject");
|
|
|
- }
|
|
|
- else if (DictionaryKey.INTERFACETYPE_PRO.equals(taskNode.getInterfaceType())) {
|
|
|
- //生产加工
|
|
|
- nodeOperationService = new MachineNodeServiceImpl();
|
|
|
- Map map = nodeOperationService.operation(jsonObject, bizJsonObject, conMap);
|
|
|
- jsonObject = (JSONObject) map.get("jsonObject");
|
|
|
- bizJsonObject = (JSONObject) map.get("bizJsonObject");
|
|
|
- }
|
|
|
- else if (DictionaryKey.INTERFACETYPE_AGV.equals(taskNode.getInterfaceType())) {
|
|
|
- //AGV取料
|
|
|
- nodeOperationService = new AGVNodeServiceImpl();
|
|
|
- Map map = nodeOperationService.operation(jsonObject, bizJsonObject, conMap);
|
|
|
- jsonObject = (JSONObject) map.get("jsonObject");
|
|
|
- bizJsonObject = (JSONObject) map.get("bizJsonObject");
|
|
|
- }
|
|
|
- else if (DictionaryKey.INTERFACETYPE_WMS.equals(taskNode.getInterfaceType())) {
|
|
|
- //WMS分出库和入库
|
|
|
- //通过自动化程序的CODE区分是上料还是下料
|
|
|
- conMap.put("NO_WMS", false);
|
|
|
- Map map = nodeOperationService.operation(jsonObject, bizJsonObject, conMap);
|
|
|
- jsonObject = (JSONObject) map.get("jsonObject");
|
|
|
- bizJsonObject = (JSONObject) map.get("bizJsonObject");
|
|
|
- } */
|
|
|
|
|
|
//业务回调数据,传给接口,接口再返回过来。
|
|
|
jsonObject.put("bizCallBackData", bizJsonObject.toJSONString());
|
|
@@ -453,166 +409,6 @@ 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");
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
if (bizType == "0") {//正常节点类型
|
|
|
BomProcedureProductionresource bomProcedureProductionresource = bomProcedureProductionresourceService.getOne(new QueryWrapper<BomProcedureProductionresource>().eq("resourceId",task.getResourceId()).eq("procedureId", task.getProcedureId()));
|
|
|
//List<ResourceAutoCode> resourceAutoCodeList = resourceAutoCodeService.getNodeList(resourceAutoCode);
|
|
@@ -662,9 +458,9 @@ public class TaskWorkNode {
|
|
|
//目标对象是接驳位上托盘的库位
|
|
|
String[] jbwarr = new String[]{productionresource.getCode()};
|
|
|
//获取托盘的库位
|
|
|
- Map plateMap = storgeService.getPlateStorgeByNo(jbwarr, task.getCompleteBatchNo());
|
|
|
- storge = plateMap.get("storge") == null ? null : (Storge) plateMap.get("storge");
|
|
|
- bool = bool && (storge!=null );
|
|
|
+// Map plateMap = storgeService.getPlateStorgeByNo(jbwarr, task.getCompleteBatchNo());
|
|
|
+// storge = plateMap.get("storge") == null ? null : (Storge) plateMap.get("storge");
|
|
|
+// bool = bool && (storge!=null );
|
|
|
}else{
|
|
|
//目标地址是加工设备
|
|
|
storge = storgeService.getById(resourcePosition.getStorgeId());
|