Просмотр исходного кода

后端产线调度功能处理

oyq28 7 месяцев назад
Родитель
Сommit
c329d485d3

+ 1 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/impl/StorgeServiceImpl.java

@@ -561,7 +561,7 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
     public long getLikuStockInList() {
         List <StockInfo> returnList = null;
 
-        List<Productionresource> productionresources = productionresourceBizMapper.selectList(Wraps.<Productionresource>lbQ().like(Productionresource::getCode,DictionaryKey.YJ_ZONE_XBK.get("plateAndClamp")));
+        List<Productionresource> productionresources = productionresourceBizMapper.selectList(Wraps.<Productionresource>lbQ().in(Productionresource::getCode,DictionaryKey.YJ_ZONE_XBK.get("plateAndClamp").split(",")));
         List<Long> productionresourceIds = productionresources.stream().map(t->t.getId()).collect(Collectors.toList());
 
         if(CollectionUtil.isEmpty(productionresourceIds)){

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

@@ -187,6 +187,8 @@ public class TaskWorkNode {
 
     private boolean lockCondition = true;
 
+    private String feedback;
+
     public void updateTaskStatusJob(String data, String consumerQueue) throws InterruptedException {
 
         String returnData = "";
@@ -243,7 +245,7 @@ public class TaskWorkNode {
         tTask = taskMapper.selectById(taskNode.getTaskId());
         //初始化业务日志
         log = getBusinessLog(tTask, taskNode);
-
+        feedback = log.getFeedback();
         try {
             lockFlag = lock.tryLock();
             lockCondition = checkFlowCondition(tTask);
@@ -476,30 +478,6 @@ public class TaskWorkNode {
                                     }
                                     msgUtil.pushToNextMq(taskNode, 3);
                                 } else {
-                                    /**
-                                     String zoneType = (null == msgUtil.redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)msgUtil.redis_get(ParameterKey.PARAMETERS)).get(ParameterKey.ZONE_TYPE).toString());
-                                     if(zoneType.equals(ParameterKey.ZONE_YJ)){
-                                     if("3".equals(taskNode.getNodeType()) || "5".equals(taskNode.getNodeType())){
-                                     // 云箭三坐标启动不由总控系统发起,节点跳过执行
-                                     specialCallBackMyselfFlag = true;
-                                     String jsonParam = getRequestParam(conMap);
-                                     //缓存执行当前节点传参
-                                     msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), jsonParam);
-                                     JSONObject ret = new JSONObject();
-                                     ret.put("result","true");
-                                     returnData = ret.toJSONString();
-                                     }
-                                     }
-                                     if(resourceBusiness.getName().indexOf("三坐标")>-1 && "SendServoStacker".equals(method)){
-                                     // 判断三坐标质检或者三坐标偏置量检测 假放节点
-                                     specialCallBackMyselfFlag = true;
-                                     String jsonParam = getRequestParam(conMap);
-                                     //缓存执行当前节点传参
-                                     msgUtil.redis_set(CacheKey.TASK_CURRENT_NODE_PARAMS + "_" + taskNode.getId(), jsonParam);
-                                     JSONObject ret = new JSONObject();
-                                     ret.put("result","true");
-                                     returnData = ret.toJSONString();
-                                     }else **/
 
                                     if ("打标业务".equals(resourceBusiness.getName()) && "SendServoStacker".equals(method)) {
                                         // 打标业务无需放
@@ -577,9 +555,9 @@ public class TaskWorkNode {
             //插入执行日志
             e.printStackTrace();
             logger.warn("节点{},逻辑出现异常:{}", taskNode.getId(), e.getMessage());
-            log.setStatus("0").setExeResult("0").setManual("1").setFeedback("节点" + taskNode.getId() + "逻辑出现异常:" + conMap.get("resultmsg") + ":" + e.getMessage());
+            log.setStatus("0").setExeResult("0").setManual("1").setFeedback("节点" + taskNode.getId() + "异常:" + conMap.get("resultmsg") + ":" + e.getMessage());
             //插入执行日志
-            autoNodeLogMapper.updateAllById(log);
+            //autoNodeLogMapper.updateAllById(log);
 
         } finally {
             logger.info("returnData={}", returnData);
@@ -600,7 +578,7 @@ public class TaskWorkNode {
                     // 释放之前占用的资源 并发延迟带来的异常不释放锁定资源
                     if (concurrency.equals("false")) {
                         // begin modify by yejian on 20220520 for 解决资源抢占时机器人是空闲状态但是实际上面有料不能操作的时候请求指令接口返回失败后进入死循环问题
-                        log.setExeResult("0").setManual("0").setFeedback("设备资源和条件判断不通过");
+                        log.setExeResult("0").setManual("0");
                         taskNodeService.freeLock(taskNode.getCompleteBatchNo());
                         logger.warn("{}设备资源不通过释放节点=============================", taskNode.getCompleteBatchNo());
                     }
@@ -626,8 +604,11 @@ public class TaskWorkNode {
             if (log.getId() == null) {
                 autoNodeLogService.save(log);
             } else {
-                log.setExecuteTime(new Date());
-                autoNodeLogService.updateAllById(log);
+                //回调错误变更更新数据库
+                if(feedback!=log.getFeedback()) {
+                    log.setExecuteTime(new Date());
+                    autoNodeLogService.updateAllById(log);
+                }
             }
             logger.info("specialCallBackMyselfFlag={}", specialCallBackMyselfFlag);
             if (specialCallBackMyselfFlag) {
@@ -651,15 +632,6 @@ public class TaskWorkNode {
             if (!(boolean) conMap.get("result")) {
                 throw new InterruptedException("设备资源不通过,消息重新进入队尾");
             }
-            /*Object autoCallbackFlag = msgUtil.redis_get("auto_callback_flag"); //自动回调开关
-            if(!"人工上料".equals(taskNode.getNodeName()) && !"人工下料".equals(taskNode.getNodeName())
-                    &&  autoCallbackFlag!=null && "1".equals(autoCallbackFlag.toString())){
-                this.autoCallBack(taskNode);
-            }*/
-
-            /*if("人工下料".equals(taskNode.getNodeName())){
-                this.autoSLXL(tTask,taskNode);
-            }*/
         }
     }
 

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

@@ -1674,7 +1674,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
         if(null == tray){
             return Lists.newArrayList();
         }
-        List<Long> productionresourceIds = productionresourceBizMapper.selectList(new LbqWrapper<Productionresource>().like(Productionresource::getCode,DictionaryKey.YJ_ZONE_XBK.get("plateAndClamp"))).stream().map(Productionresource::getId).collect(Collectors.toList());
+        List<Long> productionresourceIds = productionresourceBizMapper.selectList(new LbqWrapper<Productionresource>().in(Productionresource::getCode,DictionaryKey.YJ_ZONE_XBK.get("plateAndClamp").split(","))).stream().map(Productionresource::getId).collect(Collectors.toList());
         //获取设备点位
         List<Long> startProductionresourcePositionIds = productionresourcePositionMapper.selectList(new LbqWrapper<ProductionresourcePosition>().in(ProductionresourcePosition::getResourceId, productionresourceIds).eq(ProductionresourcePosition::getStatus,"0")).stream().map(ProductionresourcePosition::getStorgeId).collect(Collectors.toList());
         //获取设备库位

+ 9 - 0
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/operationManagementCenter/ToolbarController.java

@@ -20,8 +20,10 @@ import com.github.zuihou.business.externalApi.service.AgvHikOrderInfoService;
 import com.github.zuihou.business.operationManagementCenter.dto.OrderUpdateDTO;
 import com.github.zuihou.business.operationManagementCenter.entity.*;
 import com.github.zuihou.business.operationManagementCenter.service.*;
+import com.github.zuihou.business.productionReadyCenter.entity.AAutoNodeLog;
 import com.github.zuihou.business.productionReadyCenter.entity.BBom;
 import com.github.zuihou.business.productionReadyCenter.entity.BomProcedureProductionresource;
+import com.github.zuihou.business.productionReadyCenter.service.AAutoNodeLogService;
 import com.github.zuihou.business.productionReadyCenter.service.BBomService;
 import com.github.zuihou.business.productionReadyCenter.service.BomProcedureProductionresourceService;
 import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourceBizMapper;
@@ -43,6 +45,7 @@ import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.compress.utils.Lists;
 import org.apache.commons.lang3.StringUtils;
+import org.joda.time.LocalDateTime;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -107,6 +110,8 @@ public class ToolbarController {
     private PlanService planService;
     @Autowired
     private OrderTaskService orderTaskService;
+    @Autowired
+    private AAutoNodeLogService autoNodeLogService;
 
 
     @ApiOperation(value = "更新库位位置", notes = "更新库位位置")
@@ -520,6 +525,10 @@ public class ToolbarController {
             taskNodeList = taskNodeService.list(new LambdaQueryWrapper<TaskNode>().eq(TaskNode::getCompleteBatchNo, completeBatchNo).ge(TaskNode::getCompleteBatchSort, currentNode.getCompleteBatchSort()).orderByAsc(TaskNode::getCompleteBatchSort));
             taskList = taskService.list(new LambdaQueryWrapper<TTask>().eq(TTask::getCompleteBatchNo, completeBatchNo).ge(TTask::getProcedureSort, tTask.getProcedureSort()).orderByAsc(TTask::getProcedureSort));
 
+            //节点日志状态更新
+            AAutoNodeLog autoNodeLog = autoNodeLogService.getOne(new LbqWrapper<AAutoNodeLog>().eq(AAutoNodeLog::getTaskNodeId, currentNode.getId()).eq(AAutoNodeLog::getExeStatus, "2").last("limit 1"));
+            autoNodeLog.setSendStatus("2").setExecuteTime(new Date());
+            autoNodeLogService.updateAllById(autoNodeLog);
         }
         workpieceService.update(null, workpieceUpdateWrapper);
         //更新节点