Przeglądaj źródła

fix: 修改产线运行模式存到redis,数据不一致情况

wang.sq@aliyun.com 11 miesięcy temu
rodzic
commit
b0e5b456b8

+ 1 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/externalApi/service/impl/PlcServiceImpl.java

@@ -164,6 +164,7 @@ public class PlcServiceImpl implements PlcService {
         cn.hutool.json.JSONObject  requestParamObj= JSONUtil.parseObj(requestParam);
         requestParamObj.put("resendFlag","1");
         String result = msgUtil.httpForPost(requestUrl, requestParamObj.toString());
+//        String result = "{\"result\": \"true\"}";
 
         if(StringUtil.isNotEmpty(result)){
             cn.hutool.json.JSONObject returnJson = JSONUtil.parseObj(result);

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

@@ -190,7 +190,7 @@ public class TaskWorkNode {
     public void updateTaskStatusJob(String data, String consumerQueue) throws InterruptedException {
 
         Object runMode = msgUtil.redis_get("RUN_MODE");
-        if(runMode !=null && !"2".equals(runMode.toString())){
+        if(runMode !=null && !"1".equals(runMode.toString())){
             throw new RuntimeException("当前模式非自动模式");
         }
 
@@ -511,7 +511,7 @@ public class TaskWorkNode {
                                         log.setRequestUrl(instructionUrl);
                                         HttpEntity<String> formEntity = new HttpEntity<String>(jsonParam, headers);
                                         returnData = restTemplate.postForObject(instructionUrl, formEntity, String.class);
-                                        //returnData = "{\"result\": \"true\"}";
+//                                        returnData = "{\"result\": \"true\"}";
 
 
                                     }
@@ -651,6 +651,7 @@ public class TaskWorkNode {
         callBackParam.put(taskNodeId + "HAND_TYPE",carryType);
         callBackParam.put("CHANGE_TARGET_HAND" + "_" + taskNodeId,handPonit);
         //回调参数
+        logger.info("写入redis参数key={},value={}", YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + taskNodeId, callBackParam.toString());
         msgUtil.redis_set(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + taskNodeId,callBackParam.toString(),10,TimeUnit.DAYS);
 
         //msgUtil.httpForPost("http://192.168.10.150",jsonObject.toString());
@@ -813,6 +814,7 @@ public class TaskWorkNode {
         jsonObject.put("code", "1");
         logger.info("节点请求参数" + jsonObject.toJSONString());
 
+        logger.info("写入redis参数key={},value={}", YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + taskNode.getId(), bizJsonObject.toString());
         msgUtil.redis_set(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + taskNode.getId(), bizJsonObject.toJSONString(), 10, TimeUnit.DAYS);
         //临时先把请求参数放出来
         msgUtil.redis_set("testParam", bizJsonObject.toJSONString(), 1, TimeUnit.DAYS);

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

@@ -1302,6 +1302,7 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
                 if(CollectionUtil.isNotEmpty(zoneList)){
                     ZZone zone = zoneList.get(0);
                     if("2".equals(zone.getRunMode())){
+                        log.info("手动模式,不下发mq,任务跳过");
                         continue;
                     }
                 }

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

@@ -3096,7 +3096,7 @@ planId));
     @Override
     public R callRobot(Map<String, Object> map) throws InterruptedException {
         Object runMode = msgUtil.redis_get("RUN_MODE");
-        if(runMode !=null && !"2".equals(runMode.toString())){
+        if(runMode !=null && !"1".equals(runMode.toString())){
             throw BizException.wrap(10002,"当前模式非自动模式");
         }
         String taskNodeId = map.get("taskNodeId").toString();

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

@@ -1214,7 +1214,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
     @Override
     public R updateTaskStatus(Map<String, Object> map) throws InterruptedException {
         Object runMode = msgUtil.redis_get("RUN_MODE");
-        if(runMode !=null && !"2".equals(runMode.toString())){
+        if(runMode !=null && !"1".equals(runMode.toString())){
             throw BizException.wrap(10002,"当前模式非自动模式");
         }
         TTask tTask = baseMapper.selectById(Long.valueOf(map.get("id").toString()));

+ 1 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/ToolRobotNodeServiceImpl.java

@@ -198,6 +198,7 @@ public class ToolRobotNodeServiceImpl implements ToolNodeOperationService {
             callBackParam.put("taskType",DictionaryKey.TASK_TYPE.get("CARRY"));
             callBackParam.put("carryType",DictionaryKey.CARRY_TYPE.get("TOOL"));
             //回调参数
+            log.info("写入redis参数key={},value={}", YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + toolTaskNode.getId(), callBackParam.toString());
             msgUtil.redis_set(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + toolTaskNode.getId(),callBackParam.toString(),10,TimeUnit.DAYS);
             msgUtil.redis_set(DemoLineConstant.TOOL_START_STORE + "_" + toolTaskNode.getId(),startStorge);
             msgUtil.redis_set(DemoLineConstant.TOOL_TARGET_STORE + "_" + toolTaskNode.getId(),targetStore);

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

@@ -254,7 +254,7 @@ public class ZZoneServiceImpl extends SuperServiceImpl<ZZoneMapper, ZZone> imple
             }
         }
 */
-        msgUtil.redis_set("RUN_MODE",oriRunMode);
+        msgUtil.redis_set("RUN_MODE",oriZone.getRunMode());
         return zZone;
     }
 

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

@@ -702,6 +702,7 @@ public class ToolbarController {
                 bizJsonObject.put("handMode", "");
                 bizJsonObject.put("aimStorge", "");
                 bizJsonObject.put("DEMOLINE_STOCK_TYPE", "DEMOLINE_STOCK_TYPE_ALL_CRK");
+                log.info("写入redis参数key={},value={}", YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + taskNodeId, bizJsonObject.toString());
                 msgUtil.redis_set(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + taskNodeId, bizJsonObject.toJSONString(), 7, TimeUnit.DAYS);
                 break;
             case "2":
@@ -720,6 +721,7 @@ public class ToolbarController {
                 bizJsonObject.put("DEMOLINE_STOCK_TYPE", "DEMOLINE_STOCK_TYPE_ALL_CRK");
                 bizJsonObject.put("srcPosition", storge.getId());
                 bizJsonObject.put("targetPostion", targetStorge.getId());
+                log.info("写入redis参数key={},value={}", YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + taskNodeId, bizJsonObject.toString());
                 msgUtil.redis_set(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + taskNodeId, bizJsonObject.toJSONString(), 7, TimeUnit.DAYS);
                 break;
             case "3":
@@ -740,6 +742,8 @@ public class ToolbarController {
                 bizJsonObject.put("srcPosition", storge.getId());
                 bizJsonObject.put("targetPostion", targetStorge.getId());
                 bizJsonObject.put(taskNodeId+"count", count);
+
+                log.info("写入redis参数key={},value={}", YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + taskNodeId, bizJsonObject.toString());
                 msgUtil.redis_set(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + taskNodeId, bizJsonObject.toJSONString(), 7, TimeUnit.DAYS);
                 break;
             case "4":
@@ -759,6 +763,8 @@ public class ToolbarController {
                 bizJsonObject.put("srcPosition", storge.getId());
                 bizJsonObject.put("targetPostion", targetStorge.getId());
                 bizJsonObject.put(taskNodeId+"count", count);
+
+                log.info("写入redis参数key={},value={}", YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + taskNodeId, bizJsonObject.toString());
                 msgUtil.redis_set(YunjianConstant.YUNJIAN_CALLBACK_PARAM + "_" + taskNodeId, bizJsonObject.toJSONString(), 7, TimeUnit.DAYS);
                 break;
             case "5":

+ 5 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/entity/TTask.java

@@ -412,6 +412,11 @@ public class TTask extends Entity<Long> implements Serializable,Comparable<TTask
     @Excel(name = "是否加工设备调整")
     private Integer isReload;
 
+//    @ApiModelProperty(value = "运行模式(1-自动模式2-手动模式3-半自动模式)")
+//    @TableField("run_model")
+//    @Excel(name = "运行模式")
+//    private String runModel;
+
     @ApiModelProperty(value="可执行设备(位置)")
     @TableField(exist = false)
     private List<BomProcedureProductionresource> productionresourceList;