소스 검색

后台处理上传程序卡顿问题

oyq28 1 일 전
부모
커밋
3bd23cc282

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

@@ -229,6 +229,7 @@ public class TaskWorkNode {
         }
 
         taskNode = taskNodeService.getById(taskNodeId);
+        if(null == taskNode || taskNode.getTaskId() == null) return;
         String repeatKey = taskNodeId + taskNode.getTaskId();
         String cacheUid = msgUtil.redis_get(repeatKey) == null ? "" : msgUtil.redis_get(repeatKey).toString();
         if(StringUtils.isNotEmpty(cacheUid)){
@@ -244,7 +245,7 @@ public class TaskWorkNode {
         }
 
         //丢弃节点
-        if(null == taskNode || taskNode.getExeStatus().equals("3")){
+        if(taskNode.getExeStatus().equals("3")){
             String key = "PRIORITY_" + consumerQueue.toUpperCase().replace(".", "_");
             if(priority > 0) {
                 msgUtil.redis_remove_list(key, taskNodeId+"_"+priority);
@@ -329,18 +330,10 @@ public class TaskWorkNode {
                 }
                 logger.info("=======================" + taskNodeId);
 
-        //
-                if (taskNode == null || taskNode.getTaskId() == null) {
-                    //模拟处理数据
-                    log.setExeResult("0").setManual("0").setFeedback("当前任务节点为空");
-                    autoNodeLogService.save(log);
-                    throw new RuntimeException("节点参数异常");
-                }
-
                 if (tTask == null || tTask.getStatus() == "3") {
                     log.setTaskNodeId(taskNode.getId()).setExeResult("0").setManual("0").setFeedback("当前任务为空");
                     autoNodeLogService.save(log);
-                    throw new RuntimeException("节点参数异常");
+                    return;
                 }
         //        //获取配置序数据
                 //任务初始化判断
@@ -396,12 +389,12 @@ public class TaskWorkNode {
                             autoNodeLogService.updateAllById(autoNodeLog);
                         }
                         //自定义订单后续处理
-                        if(order.getSingleTaskFlag().equals("1")){
+                        if(order.getSingleTaskFlag().equals("1") && order.getHasMaterial().equals("0")){
                             OrderTask orderTask = orderTaskService.getOne(new LbqWrapper<OrderTask>().eq(OrderTask::getOrderId, order.getId()).last("limit 1"));
                             taskNodeService.remove(new LbqWrapper<TaskNode>().eq(TaskNode::getCompleteBatchNo, taskNode.getCompleteBatchNo()));
                             taskMapper.deleteById(tTask.getId());
                             workpieceService.removeById(currWorkpiece.getId());
-                            planMapper.deleteById(order.getPlanId());
+                            planMapper.deleteById(plan.getId());
                             orderMapper.deleteById(order.getId());
                             if(StringUtils.isNotEmpty(orderTask.getConfBatchNo())){
                                 //删除自动生成零件库位信息
@@ -528,30 +521,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 **/
 
                                     String jsonObjectE = conMap.containsKey("data") ? conMap.get("data").toString() : "";
                                     if("打标业务".equals(resourceBusiness.getName()) && "SendServoStacker".equals(method)){
@@ -652,12 +621,14 @@ public class TaskWorkNode {
                     if(concurrency.equals("false")) {
                         //机床程序上传连续失败处理
                         if(isUpload.equals("true")){
-                             int uploadFailCount = (Integer) msgUtil.redis_get(CacheKey.TASK_UPLOAD_FAIL_COUNT+"_"+taskNode.getId());
-                             if(ObjectUtil.isEmpty(uploadFailCount)){
+                             int uploadFailCount = 0;
+                             Object uploadFailCountStr = msgUtil.redis_get(CacheKey.TASK_UPLOAD_FAIL_COUNT+"_"+taskNode.getId());
+                             if(ObjectUtil.isEmpty(uploadFailCountStr)){
                                  msgUtil.redis_set(CacheKey.TASK_UPLOAD_FAIL_COUNT+"_"+taskNode.getId(),0, 7, TimeUnit.DAYS);
                              }else{
+                                 uploadFailCount = (Integer)uploadFailCountStr;
                                  if(uploadFailCount < 5){
-                                     msgUtil.redis_set(CacheKey.TASK_UPLOAD_FAIL_COUNT+"_"+taskNode.getId(),uploadFailCount++, 7, TimeUnit.DAYS);
+                                     msgUtil.redis_set(CacheKey.TASK_UPLOAD_FAIL_COUNT+"_"+taskNode.getId(), ++uploadFailCount, 7, TimeUnit.DAYS);
                                  }else{
                                      //执行失败超过5次 直接改成暂存状态
                                      taskNode.setExeStatus("4");

+ 2 - 1
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/operationManagementCenter/OrderTaskController.java

@@ -31,6 +31,7 @@ import io.lettuce.core.dynamic.annotation.Param;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
@@ -125,7 +126,7 @@ public class OrderTaskController extends SuperController<OrderTaskService, Long,
         OrderTask orderTask = baseService.getOne(new LambdaQueryWrapper<OrderTask>().eq(OrderTask::getOrderId, orderId).last("limit 1"));
         if(orderTask==null || StringUtil.isEmpty(orderTask.getStart()) || StringUtil.isEmpty(orderTask.getGoal())) return R.fail("订单任务尚未配置");
         String CFTJ = (null == msgUtil.redis_get(DemoCacheKey.CFTJ)? "":msgUtil.redis_get(DemoCacheKey.CFTJ).toString());
-        if (!"".equals(CFTJ)) return fail("请勿重复提交");
+        if (StringUtils.isNotEmpty(CFTJ)) return fail("请勿重复提交");
         msgUtil.redis_set(DemoCacheKey.CFTJ  , data, 5, TimeUnit.SECONDS);
         boolean bool = baseService.prodNode(orderTask, planId);
         return bool? success(orderTask) : fail("保存失败");

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

@@ -1020,26 +1020,18 @@ public class ToolbarController {
         Storge startStorge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, startNameCondition[0]).eq(Storge::getPointId, startNameCondition[1]));
         if (null == startStorge) return fail("起始库位不存在");
 
-        if ((startNameCondition[0].equals("KT") && goalNameCondition[0].equals("CT")) || (startNameCondition[0].equals("CT") && goalNameCondition[0].equals("KT")))
-            return fail("无该产线工艺");
-        if ((startNameCondition[0].equals("KT") && goalNameCondition[0].equals("YP")) || (startNameCondition[0].equals("YP") && goalNameCondition[0].equals("KT")))
-            return fail("无该产线工艺");
-        if ((startNameCondition[0].equals("KT") && goalNameCondition[0].equals("ZC")) || (startNameCondition[0].equals("ZC") && goalNameCondition[0].equals("KT")))
-            return fail("无该产线工艺");
-        if ((startNameCondition[0].equals("CT") && goalNameCondition[0].equals("YP")) || (startNameCondition[0].equals("YP") && goalNameCondition[0].equals("CT")))
-            return fail("无该产线工艺");
-        if ((startNameCondition[0].equals("CT") && goalNameCondition[0].equals("ZC")) || (startNameCondition[0].equals("ZC") && goalNameCondition[0].equals("CT")))
-            return fail("无该产线工艺");
-        if ((startNameCondition[0].equals("YP") && goalNameCondition[0].equals("ZC")) || (startNameCondition[0].equals("ZC") && goalNameCondition[0].equals("YP")))
-            return fail("无该产线工艺");
-
         //防止重复提交
         String ZDYDDSCJD = (null == msgUtil.redis_get(DemoCacheKey.ZDYDDSCJD)? "":msgUtil.redis_get(DemoCacheKey.ZDYDDSCJD).toString());
         if (!"".equals(ZDYDDSCJD)) return fail("请勿重复提交");
-        msgUtil.redis_set(DemoCacheKey.ZDYDDSCJD  , model, 5, TimeUnit.SECONDS);
+        msgUtil.redis_set(DemoCacheKey.ZDYDDSCJD, model, 5, TimeUnit.SECONDS);
 
         //判断自定义订单是否跨线
         String hasMaterial = startNameCondition[0].equals(goalNameCondition[0]) ? "0" : "1";
+        if(hasMaterial.equals("1") && !start.contains("BZ") && !goal.contains("BZ")){
+            //跨产线不经过保障中心
+            return R.fail("无该产线工艺");
+        }
+
         ZZone zZone = zoneService.getOne(new LbqWrapper<ZZone>().eq(ZZone::getAka, startNameCondition[0]).last("limit 1"));
         if (zZone == null) return fail("产线不存在");
         TWorkpiece tWorkpiece = workpieceService.getOne(new LbqWrapper<TWorkpiece>().eq(TWorkpiece::getPointId, startNameCondition[1]).eq(TWorkpiece::getStorgeId, startStorge.getId()).eq(TWorkpiece::getIsEnd, "0").last("limit 1"));
@@ -1070,7 +1062,7 @@ public class ToolbarController {
                 }
                 Tray tray = trayService.getOne(new LbqWrapper<Tray>().eq(Tray::getNo, trayNo).last("LIMIT 1"));
                 //查询该工装绑定的零件OP10工艺
-                bom = bBomService.getOne(new LbqWrapper<BBom>().eq(BBom::getTrayId, tray.getId()).like(BBom::getName,"10").last("LIMIT 1"));
+                bom = bBomService.getOne(new LbqWrapper<BBom>().eq(BBom::getTrayId, tray.getId()).eq(BBom::getStatus, "1").like(BBom::getName,"10").orderByDesc(BBom::getUpdateTime).last("LIMIT 1"));
                 if(bom == null) return fail("该工装零件OP10工艺为空");
             } else if (!Long.valueOf("1").equals(tWorkpiece.getBomId())) {
                 bom = bBomService.getById(tWorkpiece.getBomId());

+ 1 - 1
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/productionReadyCenter/CuttingToolController.java

@@ -2,7 +2,6 @@ package com.github.zuihou.business.controller.productionReadyCenter;
 
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.github.zuihou.authority.dto.auth.UserPageDTO;
 import com.github.zuihou.authority.entity.core.Org;
 import com.github.zuihou.base.controller.SuperCacheController;
@@ -29,6 +28,7 @@ import com.github.zuihou.model.RemoteData;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;