Ver código fonte

其他业务plc动态访问修改

yejian 3 anos atrás
pai
commit
014f0912e3

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

@@ -973,7 +973,9 @@ public class TaskWorkNode {
             }
         }else {
             //
-            if(bomProcedureType.equals("下料")){
+            TaskNode beforTaskNode = taskNodeService.getNextNTaskNode(taskNode,-1);
+            TaskNode baitingTaskNode = taskNodeService.getNextNTaskNode(beforTaskNode,-1);
+            if(bomProcedureType.equals("下料") && "04".equals(baitingTaskNode.getInterfaceType())){
                 // 下料特殊处理,动态查找可用立库位子存放下料后的子盘夹具
                 Long storgeId = getLikuStockInList();
                 targetStorge = storgeService.getById(storgeId);

+ 23 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/service/impl/MachineCuttingToolServiceImpl.java

@@ -12,10 +12,15 @@ import com.github.zuihou.business.productionReadyCenter.dto.MachineCuttingToolSa
 import com.github.zuihou.business.productionReadyCenter.entity.CuttingTool;
 import com.github.zuihou.business.productionReadyCenter.entity.MachineCuttingTool;
 import com.github.zuihou.business.productionReadyCenter.service.MachineCuttingToolService;
+import com.github.zuihou.business.productionResourceCenter.dao.ZZoneProductionresourceMapper;
 import com.github.zuihou.business.productionResourceCenter.entity.ResourceBusiness;
+import com.github.zuihou.business.productionResourceCenter.entity.ZZone;
 import com.github.zuihou.business.productionResourceCenter.entity.ZZoneProductionresource;
+import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
+import com.github.zuihou.business.util.MsgUtil;
 import com.github.zuihou.common.constant.CacheKey;
 import com.github.zuihou.common.constant.DictionaryKey;
+import com.github.zuihou.common.constant.ParameterKey;
 import com.github.zuihou.common.util.DateUtil;
 import com.github.zuihou.context.BaseContextHandler;
 import com.github.zuihou.database.mybatis.auth.DataScope;
@@ -62,6 +67,13 @@ public class MachineCuttingToolServiceImpl extends SuperCacheServiceImpl<Machine
     private CuttingToolMapper cuttingToolMapper;
     @Resource
     private RestTemplate restTemplate;
+    @Autowired
+    private ZZoneProductionresourceMapper zZoneProductionresourceMapper;
+
+    @Autowired
+    private ZZoneService zoneService;
+    @Autowired
+    private MsgUtil msgUtil;
 
     @Override
     @InjectionResult
@@ -83,6 +95,17 @@ public class MachineCuttingToolServiceImpl extends SuperCacheServiceImpl<Machine
         HttpHeaders headers = new HttpHeaders();
         headers.setContentType(MediaType.APPLICATION_JSON);
         for(long resourceId : data.getIds()){
+
+            ZZoneProductionresource zoneProductionresource = zZoneProductionresourceMapper.selectOne(Wraps.<ZZoneProductionresource>lbQ().eq(ZZoneProductionresource::getResourceId,resourceId));
+            ZZone zZone = zoneService.getById(zoneProductionresource.getZoneId());
+            // 判断该节点使用那条线的plc
+            Map<String, String>  plcInfo = DictionaryKey.PLC_CATEGORY.get(zZone.getNo());
+            String paramKey = zZone.getNo() + "_plc";
+            String plcUrl = (null == msgUtil.redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)msgUtil.redis_get(ParameterKey.PARAMETERS)).get(paramKey).toString());
+
+            // TODO 后续删除代码,目前条用模拟接口
+            plcUrl = plcUrl.replace("8081","8083");
+
             Productionresource productionresource =  productionresourceviewMapper.selectById(resourceId);
             // 访问ccs接口查询设备刀具
             JSONObject jsonObject = new JSONObject();

+ 27 - 1
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/dispatchRecord/DispatchExceptionController.java

@@ -19,12 +19,18 @@ import com.github.zuihou.business.dispatchRecord.service.DispatchRecordService;
 import com.github.zuihou.business.operationManagementCenter.entity.Order;
 import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
 import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
+import com.github.zuihou.business.operationManagementCenter.service.TaskNodeService;
 import com.github.zuihou.business.operationManagementCenter.service.WorkpieceService;
 import com.github.zuihou.business.productionReadyCenter.entity.AAutoNodeLog;
 import com.github.zuihou.business.productionReadyCenter.service.AAutoNodeLogService;
+import com.github.zuihou.business.productionResourceCenter.dao.ZZoneProductionresourceMapper;
+import com.github.zuihou.business.productionResourceCenter.entity.ZZone;
+import com.github.zuihou.business.productionResourceCenter.entity.ZZoneProductionresource;
+import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
 import com.github.zuihou.business.util.MsgUtil;
 import com.github.zuihou.common.constant.CacheKey;
 import com.github.zuihou.common.constant.DictionaryKey;
+import com.github.zuihou.common.constant.ParameterKey;
 import com.github.zuihou.common.util.DateUtil;
 import com.github.zuihou.context.BaseContextHandler;
 import com.github.zuihou.database.mybatis.conditions.Wraps;
@@ -74,6 +80,15 @@ public class DispatchExceptionController extends SuperSimpleController<AAutoNode
     @Autowired
     private RestTemplate restTemplate;
 
+    @Autowired
+    private TaskNodeService taskNodeService;
+
+    @Autowired
+    private ZZoneProductionresourceMapper zZoneProductionresourceMapper;
+
+    @Autowired
+    private ZZoneService zoneService;
+
     @ApiOperation(value = "查询对话调度异常", notes = "查询对话调度异常")
     @PostMapping("/page")
     public R<IPage<AAutoNodeLog>> page(@RequestBody @Validated PageParams<AAutoNodeLog> params) {
@@ -168,11 +183,22 @@ public class DispatchExceptionController extends SuperSimpleController<AAutoNode
             return R.fail("指令请求不存在");
         }
 
+        TaskNode taskNode = taskNodeService.getById(taskNodeId);
+        ZZoneProductionresource zoneProductionresource = zZoneProductionresourceMapper.selectOne(Wraps.<ZZoneProductionresource>lbQ().eq(ZZoneProductionresource::getResourceId,taskNode.getResourceId()));
+        ZZone zZone = zoneService.getById(zoneProductionresource.getZoneId());
+        // 判断该节点使用那条线的plc
+        Map<String, String>  plcInfo = DictionaryKey.PLC_CATEGORY.get(zZone.getNo());
+        String paramKey = zZone.getNo() + "_plc";
+        String plcUrl = (null == msgUtil.redis_get(ParameterKey.PARAMETERS)? "": ((Map<String,String>)msgUtil.redis_get(ParameterKey.PARAMETERS)).get(paramKey).toString());
+
+        // TODO 后续删除代码,目前条用模拟接口
+        plcUrl = plcUrl.replace("8081","8083");
+
         HttpHeaders headers = new HttpHeaders();
         headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
         HttpEntity<String> formEntity = new HttpEntity<String>(jsonParam, headers);
 
-        String instructionUrl = DictionaryKey.INSTRUCTION_URL +"/api/"+ autoNodeLog.getMethod().toString() ;
+        String instructionUrl = plcUrl +"/api/"+ autoNodeLog.getMethod().toString() ;
         String returnData = restTemplate.postForObject(instructionUrl, formEntity, String.class);
         JSONObject retJson = JSONObject.parseObject(returnData);
         String code = retJson.getString("code").trim();