Bladeren bron

加工执行前先将三坐标工件坐标系下发至机床

yejian016332 3 jaren geleden
bovenliggende
commit
0263c1e9ec

+ 45 - 3
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/MachineNodeServiceImpl.java

@@ -4,11 +4,14 @@ package com.github.zuihou.business.productionResourceCenter.service.impl;
 import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.zuihou.business.DemoLine.DemoCacheKey;
 import com.github.zuihou.business.DemoLine.DemoLineConstant;
 import com.github.zuihou.business.edgeLibrary.entity.Storge;
 import com.github.zuihou.business.edgeLibrary.service.StorgeService;
 import com.github.zuihou.business.modelingCenter.entity.MModuleField;
+import com.github.zuihou.business.operationManagementCenter.dao.OrderQualityMapper;
+import com.github.zuihou.business.operationManagementCenter.entity.OrderQuality;
 import com.github.zuihou.business.operationManagementCenter.entity.TTask;
 import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
 import com.github.zuihou.business.operationManagementCenter.service.TaskNodeService;
@@ -70,6 +73,8 @@ public class MachineNodeServiceImpl implements NodeOperationService {
 
     @Autowired
     private BomProcedureProgramMapper bomProcedureProgramMapper;
+    @Autowired
+    private OrderQualityMapper orderQualityMapper;
 
     //关联接驳位
     private String[] jbwarr = null;
@@ -221,8 +226,7 @@ public class MachineNodeServiceImpl implements NodeOperationService {
 
                     }
                     map.put("result", true);
-                }
-                else if ("SMU50_EXEC".equals(functionName)) {
+                } else if ("SMU50_EXEC".equals(functionName)) {
                     //执行程序,分多次执行
                     String zoneNo = msgUtil.redis_get(DemoCacheKey.DEMOLINE_WORKOP_ZONE + task.getCompleteBatchNo()) == null ? ""
                             : msgUtil.redis_get(DemoCacheKey.DEMOLINE_WORKOP_ZONE + task.getCompleteBatchNo()).toString();
@@ -250,7 +254,45 @@ public class MachineNodeServiceImpl implements NodeOperationService {
 //                fileMap.put("fileName", fileName);
                     map.put("Data", fileName);
                     map.put("result", true);
-                }
+                } else if ("writeOffset".equals(functionName)){
+                     // 加工前写入工件坐标系 根据taskid查找工件三坐标测量的工件坐标系,可能存在装夹一次未果的情况,所以取最后一条数据
+                     QueryWrapper<OrderQuality> orderQualityWrapper = new QueryWrapper<OrderQuality>();
+                     orderQualityWrapper.in("taskId", task.getId());
+                     orderQualityWrapper.in("measuringType", "2");
+                     orderQualityWrapper.orderByDesc("updateTime");
+                     orderQualityWrapper.last("limit 1");
+                     OrderQuality orderQuality = orderQualityMapper.selectOne(orderQualityWrapper);
+                     if(null == orderQuality){
+                         // 简单处理的方式,直接将坐标偏移全部设置成0
+                         queryMap.put("sketchyXaxisOffset", 0);
+                         queryMap.put("sketchyYaxisOffset", 0);
+                         queryMap.put("sketchyZaxisOffset", 0);
+                         queryMap.put("sketchyAaxisOffset", 0);
+                         queryMap.put("sketchyBaxisOffset", 0);
+                         queryMap.put("sketchyCaxisOffset", 0);
+                         queryMap.put("exactXaxisOffset", 0);
+                         queryMap.put("exactXaxisOffset", 0);
+                         queryMap.put("exactXaxisOffset", 0);
+                         queryMap.put("exactXaxisOffset", 0);
+                         queryMap.put("exactXaxisOffset", 0);
+                         queryMap.put("exactXaxisOffset", 0);
+                     }else{
+                         queryMap.put("sketchyXaxisOffset", orderQuality.getSketchyXaxisOffset());
+                         queryMap.put("sketchyYaxisOffset", orderQuality.getSketchyYaxisOffset());
+                         queryMap.put("sketchyZaxisOffset", orderQuality.getSketchyZaxisOffset());
+                         queryMap.put("sketchyAaxisOffset", orderQuality.getSketchyAaxisOffset());
+                         queryMap.put("sketchyBaxisOffset", orderQuality.getSketchyBaxisOffset());
+                         queryMap.put("sketchyCaxisOffset", orderQuality.getSketchyCaxisOffset());
+                         queryMap.put("exactXaxisOffset", orderQuality.getExactXaxisOffset());
+                         queryMap.put("exactXaxisOffset", orderQuality.getExactYaxisOffset());
+                         queryMap.put("exactXaxisOffset", orderQuality.getExactZaxisOffset());
+                         queryMap.put("exactXaxisOffset", orderQuality.getExactAaxisOffset());
+                         queryMap.put("exactXaxisOffset", orderQuality.getExactBaxisOffset());
+                         queryMap.put("exactXaxisOffset", orderQuality.getExactCaxisOffset());
+                     }
+                     map.put("Data", JSONObject.toJSONString(queryMap));
+                     map.put("result", true);
+                 }
 
 
                 break;