Ver código fonte

后台业务代码更新

oyq28 1 ano atrás
pai
commit
d56ab1d4d0

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

@@ -514,12 +514,12 @@ public class TaskWorkNode {
                 } else if (code.equals("false")) {
                     //需要人工处理解决警报异常
 //                    log.setExeResult("0").setManual("1").setFeedback(retJson.getString("msg"));
-                    // begin modify by yejian on 20220520 for 解决资源抢占时机器人是空闲状态但是实际上面有料不能操作的时候请求指令接口返回失败后进入死循环问题
-                    log.setExeResult("0").setManual("0").setFeedback("设备资源不通过");
                     // 释放之前占用的资源 并发延迟带来的异常不释放锁定资源
                     if(concurrency.equals("false")) {
+                        // begin modify by yejian on 20220520 for 解决资源抢占时机器人是空闲状态但是实际上面有料不能操作的时候请求指令接口返回失败后进入死循环问题
+                        log.setExeResult("0").setManual("0").setFeedback("设备资源和条件判断不通过");
                         taskNodeService.freeLock(taskNode.getCompleteBatchNo());
-                        logger.warn("{}设备资源不通过freeLock节点", taskNode.getCompleteBatchNo());
+                        logger.warn("{}设备资源不通过释放节点", taskNode.getCompleteBatchNo());
                     }
                     conMap.put("result", false);
                     // end  modify by yejian on 20220520 for 解决资源抢占时机器人是空闲状态但是实际上面有料不能操作的时候请求指令接口返回失败后进入死循环问题
@@ -533,7 +533,7 @@ public class TaskWorkNode {
                 logger.info("节点{}名称{}类型{}",taskNode.getId(),taskNode.getNodeName(),taskNode.getInterfaceType());
                 if (!"04".equals(taskNode.getInterfaceType())) {
                     if((boolean)conMap.get("result")){
-                        log.setExeResult("0").setManual("0").setFeedback("接口响应超时");
+                        log.setExeResult("0").setManual("0").setFeedback("节点"+taskNode.getId()+"操作响应超时");
                     }else{
                         //设备不在线默认存储为空
                         log.setExeResult("0").setManual("0").setFeedback(null);

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

@@ -1415,7 +1415,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
      */
     @Override
     public R taskNodeCallback(TaskNodeCallBackDTO bean) {
-        log.warn("[CCS指令回调]回调参数======================" + JSONObject.toJSONString(bean));
+        log.info("[CCS指令回调]回调参数======================" + JSONObject.toJSONString(bean));
 
         BaseContextHandler.setTenant("0000");
         String taskId = bean.getTaskId() == null ? "" : bean.getTaskId().toString();
@@ -1441,7 +1441,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
 
         String cacheUid = msgUtil.redis_get(repeatKey) == null ? "" : msgUtil.redis_get(repeatKey).toString();
         if (StringUtil.isNotEmpty(cacheUid)) {//排除掉重复回调
-            log.info("回调重复了======================" + cacheUid);
+            log.warn("回调重复了======================" + cacheUid);
             //回调重复去除
             msgUtil.redis_del(cacheUid);
             return R.fail(-5,"节点"+bean.getTaskNodeId()+"已有回调");

+ 41 - 15
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/operationManagementCenter/TTaskMapper.xml

@@ -257,35 +257,61 @@
 
     <select id="getTaskCountStatistics" resultType="map" parameterType="java.util.Map">
         <if test="type=='1'.toString()">
-      select DATE_FORMAT(create_time,'%H')date,count(1)cnt from imcs_t_task t
-            where t.create_time> DATE_FORMAT(SYSDATE(),'%Y-%m-%d') and t.status = '2'
-      GROUP BY DATE_FORMAT(create_time,'%H')
+            SELECT s.date, COUNT(1) cnt from (
+            SELECT
+             t.start_time, t.end_time, DATE_FORMAT(t.start_time,'%H') AS date FROM imcs_t_task t
+             WHERE t.start_time IS NOT NULL AND t.end_time IS NOT NULL
+             AND t.`status` = 3 AND TO_DAYS(t.start_time) = TO_DAYS(NOW())
+             <if test="machine != null">
+                 AND t.procedure_no like 'OP%0'
+             </if>
+            ) s GROUP BY s.date
         </if>
         <if test="type=='2'.toString()">
-            select DATE_FORMAT(create_time,'%m-%d')date,count(1)cnt from imcs_t_task t
-            where YEARWEEK(date_format(create_time,'%Y-%m-%d')) = YEARWEEK(now()) and t.status = '2'
-            GROUP BY DATE_FORMAT(create_time,'%m-%d')
+            SELECT s.date, COUNT(1) cnt from (
+            SELECT t.start_time, t.end_time, DATE_FORMAT(t.start_time,'%m-%d') AS date FROM imcs_t_task t
+            WHERE t.start_time IS NOT NULL AND t.end_time IS NOT NULL
+            AND t.`status` = 3 AND YEARWEEK(DATE_FORMAT(create_time,'%Y-%m-%d')) = YEARWEEK(NOW())
+            <if test="machine != null">
+                AND t.procedure_no like 'OP%0'
+            </if>
+            ) s GROUP BY s.date
         </if>
         <if test="type=='3'.toString()">
-            select DATE_FORMAT(create_time,'%m-%d')date,count(1)cnt from imcs_t_task t
-            where DATE_FORMAT(t.create_time,'%Y-%m') = DATE_FORMAT(SYSDATE(),'%Y-%m') and t.status = '2'
-            GROUP BY DATE_FORMAT(create_time,'%m-%d')
+            SELECT s.date, COUNT(1) cnt from (
+            SELECT t.start_time, t.end_time, DATE_FORMAT(t.start_time,'%m-%d') AS date FROM imcs_t_task t
+            WHERE t.start_time IS NOT NULL AND t.end_time IS NOT NULL
+            AND t.`status` = 3 AND DATE_FORMAT(t.start_time,'%Y-%m') = DATE_FORMAT(SYSDATE(),'%Y-%m')
+            <if test="machine != null">
+                AND t.procedure_no like 'OP%0'
+            </if>
+            ) s GROUP BY s.date
         </if>
         <if test="type=='4'.toString()">
-            select DATE_FORMAT(create_time,'%m')date,count(1)cnt from imcs_t_task t
-            where DATE_FORMAT(t.create_time,'%Y') = DATE_FORMAT(SYSDATE(),'%Y') and t.status = '2'
-            GROUP BY DATE_FORMAT(create_time,'%m')
+            SELECT s.date, COUNT(1) cnt from (
+            SELECT t.start_time, t.end_time, DATE_FORMAT(t.start_time,'%m') AS date FROM imcs_t_task t
+            WHERE t.start_time IS NOT NULL AND t.end_time IS NOT NULL
+            AND t.`status` = 3 AND DATE_FORMAT(t.start_time,'%Y') = DATE_FORMAT(SYSDATE(),'%Y')
+            <if test="machine != null">
+                AND t.procedure_no like 'OP%0'
+            </if>
+            ) s GROUP BY s.date
         </if>
         <if test="type=='5'.toString()">
-            select DATE_FORMAT(create_time,'%m-%d')date,count(1)cnt from imcs_t_task t
-            where t.status = '2'
+            SELECT s.date, COUNT(1) cnt from (
+            SELECT t.start_time, t.end_time, DATE_FORMAT(t.start_time,'%m-%d') AS date FROM imcs_t_task t
+            WHERE t.start_time IS NOT NULL AND t.end_time IS NOT NULL
+            AND t.`status` = 3 AND DATE_FORMAT(t.start_time,'%Y') = DATE_FORMAT(SYSDATE(),'%Y')
+            <if test="machine != null">
+                AND t.procedure_no like 'OP%0'
+            </if>
             <if test="startTime != null">
                 and t.create_time > ${startTime}
             </if>
             <if test="endTime != null">
                 and ${endTime} > t.create_time
             </if>
-            GROUP BY DATE_FORMAT(create_time,'%m-%d')
+            ) s GROUP BY s.date
         </if>
     </select>
 

+ 4 - 2
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionReadyCenter/AAutoNodeLogMapper.xml

@@ -24,14 +24,16 @@
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
         id,create_time ,create_user,update_time,update_user,method, execute_time,manual,zone_id,org_id,task_id, task_node_id,category,zoneName,
-        auto_node_id, exe_status, exe_result, start_time, end_time, feedback, feedback_file, status, resourceName,instructionName,procedureName,nodeNo
+        auto_node_id, exe_status, exe_result, start_time, end_time, feedback, feedback_file, status, resourceName,robotName,instructionName,procedureName,nodeNo
     </sql>
 
     <select id="pageList" resultMap="BaseResultMap" parameterType="String">
         select
         <include refid="Base_Column_List"/>
         from (
-        select l.*, a.category, a.name as nodeNo, c.name as resourceName, i.name as instructionName, p.name as procedureName, z.org_id, z.name as zoneName from imcs_a_auto_node_log l
+        select l.*, a.category, a.name as nodeNo, c.name as resourceName,
+        (CASE WHEN a.resource_id='1' THEN '舱体机器人' WHEN a.resource_id='2' THEN '伺服舵机' WHEN a.resource_id='3' THEN '框体机器人' END) AS robotName,
+        i.name as instructionName, p.name as procedureName, z.org_id, z.name as zoneName from imcs_a_auto_node_log l
         left join imcs_resource_autocode a ON l.auto_node_id = a.id
         left join imcs_t_task d ON l.task_id = d.id
         left join imcs_tenant_productionresource c ON d.resource_id = c.id

+ 14 - 1
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/externalApi/SynProductionStatus.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.github.zuihou.base.R;
+import com.github.zuihou.business.DemoLine.DemoCacheKey;
 import com.github.zuihou.business.DemoLine.DemoLineConstant;
 import com.github.zuihou.business.edgeLibrary.entity.StockInfo;
 import com.github.zuihou.business.edgeLibrary.entity.Storge;
@@ -18,6 +19,7 @@ import com.github.zuihou.business.operationManagementCenter.service.TaskService;
 import com.github.zuihou.business.productionReadyCenter.entity.AAutoNodeLog;
 import com.github.zuihou.business.productionReadyCenter.service.AAutoNodeLogService;
 import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourceBizMapper;
+import com.github.zuihou.business.productionResourceCenter.entity.ProductionresourcePosition;
 import com.github.zuihou.business.productionResourceCenter.service.ProductionresourcePositionService;
 import com.github.zuihou.business.util.MsgUtil;
 import com.github.zuihou.common.util.DateUtil;
@@ -86,7 +88,7 @@ public class SynProductionStatus {
     @ApiOperation(value = "设备状态同步", notes = "设备状态同步")
     @PostMapping("/synProductionStatus")
     public R agvCallback(@RequestBody Map<String, String> data) {
-        log.info("接收到设备状态集合信息,参数是{}", data.toString());
+        log.debug("接收到设备状态集合信息,参数是{}", data.toString());
 
         String productionStatus = data.get("productionStatus");
         List<Productionresource> productionResources = JSONArray.parseArray(productionStatus,Productionresource.class);
@@ -212,12 +214,23 @@ public class SynProductionStatus {
                                         dyChangedInfo.put("fromResource", taskNode.getResourceId());
                                     }
                                     taskNode.setResourceId(updatedTask.getResourceId());
+                                }else if(null!= taskNode.getTargetResourceId()){
+                                    //更新redis缓存目标库位地址信息
+                                    Storge targetStorge = msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + taskNode.getId())==null?null:(Storge)msgUtil.redis_get(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + taskNode.getId());
+                                    if(null!= targetStorge){
+                                        long storgeId = productionresourcePositionService.getOne(new LbqWrapper<ProductionresourcePosition>().eq(ProductionresourcePosition::getResourceId, updatedTask.getResourceId())).getStorgeId();
+                                        Storge updatedStorge = storgeService.getById(storgeId);
+                                        msgUtil.redis_set(DemoCacheKey.YUNJIAN_CAMP + "_" + DemoLineConstant.YUNJIAN_TARGET_STORE + taskNode.getId(), updatedStorge);
+                                        log.warn("{}节点更新redis缓存目标库位地址信息从{}为{}",taskNode.getId(), targetStorge.getResourceId(), updatedStorge.getResourceId());
+                                    }
                                 }
                                 taskNode.setTargetResourceId(updatedTask.getResourceId());
                             }
                         });
+                        // 更新零件地址
                         taskService.updateById(updatedTask);
                         taskNodeService.updateBatchById(taskNodes);
+
                         dyChangedInfo.put("toResource", updatedTask.getResourceId());
                         dyChangedInfo.put("time", DateUtil.formatTime(new Date()));
 

+ 6 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/entity/AAutoNodeLog.java

@@ -194,6 +194,12 @@ public class AAutoNodeLog extends Entity<Long> {
     @TableField(exist = false)
     private String resourceName;
 
+    /**
+     * 搬运设备名称
+     */
+    @TableField(exist = false)
+    private String robotName;
+
     /**
      * 指令名称
      */