瀏覽代碼

fix: 优化三坐标运行逻辑

wang.sq@aliyun.com 6 月之前
父節點
當前提交
fddb076408

+ 8 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/impl/StorgeServiceImpl.java

@@ -43,6 +43,7 @@ import com.github.zuihou.common.util.StringUtil;
 import com.github.zuihou.database.mybatis.auth.DataScope;
 import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
+import com.github.zuihou.exception.BizException;
 import com.github.zuihou.injection.annonation.InjectionResult;
 import com.github.zuihou.utils.BeanPlusUtil;
 import lombok.extern.slf4j.Slf4j;
@@ -619,6 +620,11 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
     @Override
     public boolean szbStockHandle(boolean isFetched, TaskNode taskNode){
         List<Storge> storgeList = baseMapper.selectList(new LbqWrapper<Storge>().in(Storge::getPointId, Arrays.asList(DictionaryKey.ZEISS_LOCATION.get("M"))));
+
+        if(storgeList.isEmpty()){
+            throw new BizException("没有查询到可用的三坐标数据,点位"+DictionaryKey.ZEISS_LOCATION.get("M") );
+        }
+
         List<StockInfo> mPointList = stockInfoMapper.selectList(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, storgeList.get(0).getId()));
 //        List<StockInfo> lPointList = stockInfoMapper.selectList(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, storgeList.get(1).getId()));
 
@@ -627,7 +633,7 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
         if(isFetched) {
             //todo wang.sq三坐标调用地址释放
             // 查询三坐标是否允许取
-//            String fetchStatus = msgUtil.getCcsData("/api/GetMiddleThreeCoordinates", params, taskNode);
+            //String fetchStatus = msgUtil.getCcsData("/api/GetMiddleThreeCoordinates", params, taskNode);
             String fetchStatus = "{\"taskID\":null,\"taskNodeID\":null,\"result\":\"true\",\"resultMsg\":\"设备已离线:192.168.0.10\",\"concurrency\":\"false\",\"data\":null}";
 
             JSONObject fetchObject = JSONObject.parseObject(fetchStatus);
@@ -650,7 +656,7 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
             //三坐标中间放操作
             // 查询三坐标是否允许放
             //todo wang.sq三坐标调用地址释放
-//            String sendStatus = msgUtil.getCcsData("/api/QueryThreeCoordinatesFreePos", params, taskNode);
+            //String sendStatus = msgUtil.getCcsData("/api/QueryThreeCoordinatesFreePos", params, taskNode);
             String sendStatus = "{\"taskID\":null,\"taskNodeID\":null,\"result\":\"true\",\"resultMsg\":\"设备已离线:192.168.0.10\",\"concurrency\":\"false\",\"data\":null}";
 
             JSONObject sendObject = JSONObject.parseObject(sendStatus);

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

@@ -598,8 +598,8 @@ public class TaskWorkNode {
                                                 }
 
                                                 HttpEntity<String> formEntity = new HttpEntity<String>(jsonParam, headers);
-                                                //returnData = restTemplate.postForObject(instructionUrl, formEntity, String.class);
-                                                returnData = "{\"result\": \"true\"}";
+                                                returnData = restTemplate.postForObject(instructionUrl, formEntity, String.class);
+                                                //returnData = "{\"result\": \"true\"}";
                                             }
 
                                         }

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

@@ -480,9 +480,20 @@ public class MachineNodeServiceImpl implements NodeOperationService {
                     BomProcedure procedure = bomProcedureService.getById(task.getProcedureId());
                     JSONObject data = new JSONObject();
                     // 判断是工件坐标系还是质量测量
+                    BBom bBom = bBomMapper.selectById(procedure.getBomId());
+                    TWorkpiece tWorkpiece = workpieceMapper.selectOne(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getCompleteBatchNo, task.getCompleteBatchNo()));
+                    // 根据库位id查询存储在此库位的信息工装夹具信息,查询工装所需要的检测程序名
+                    List<StockInfo> list = stockInfoService.list(Wraps.<StockInfo>lbQ().eq(StockInfo::getStorgeId, tWorkpiece.getStorgeId()));
+                    List<Long> getGoodsIds = list.stream().map(StockInfo::getGoodsId).collect(Collectors.toList());
+
+                    List<MToolClamp> mToolClamps = mToolClampService.listByIds(getGoodsIds);
+
                     if("1".equals(procedure.getThreeDimensionalConf())){
                         /*data.put("workId", task.getCompleteBatchNo() + "-" + task.getProcedureNo());*/
                         //data.put("workId", task.getCompleteBatchNo() + "_" + taskNode.getId());
+                        String toPlcPar = bBom.getDrawingNo()+"&"+tWorkpiece.getUniqueCode()+"&"+bBom.getNo()+"&"+"2"+"&0";
+
+                        data.put("workType", toPlcPar);
                         data.put("workId", taskNode.getCompleteBatchNo());
                         data.put("procedureNo",task.getProcedureNo());
                         /*data.put("workType", procedure.getThreeDimensionalPrograme());*/
@@ -497,18 +508,10 @@ public class MachineNodeServiceImpl implements NodeOperationService {
                     }
                     if("1".equals(procedure.getThreeDimensionalDeviationConf())){
                         // 拼接上传给plc的参数, 图号-零件号-源工序号-是否毛坯件-使用的检测程序
-                        BBom bBom = bBomMapper.selectById(procedure.getBomId());
-                        TWorkpiece tWorkpiece = workpieceMapper.selectOne(Wraps.<TWorkpiece>lbQ().eq(TWorkpiece::getCompleteBatchNo, task.getCompleteBatchNo()));
-                        // 根据库位id查询存储在此库位的信息工装夹具信息,查询工装所需要的检测程序名
-                        List<StockInfo> list = stockInfoService.list(Wraps.<StockInfo>lbQ().eq(StockInfo::getStorgeId, tWorkpiece.getStorgeId()));
-                        List<Long> getGoodsIds = list.stream().map(StockInfo::getGoodsId).collect(Collectors.toList());
-
-                        List<MToolClamp> mToolClamps = mToolClampService.listByIds(getGoodsIds);
-
                         String toPlcPar = bBom.getDrawingNo()+"&"+tWorkpiece.getUniqueCode()+"&"+bBom.getNo()+"&"+"1"+"&"+mToolClamps.get(0).getDetectionProgram();
 
-                        data.put("workId", task.getCompleteBatchNo() + "-" + task.getProcedureNo());
                         data.put("workType", toPlcPar);
+                        data.put("workId", task.getCompleteBatchNo() + "-" + task.getProcedureNo());
 
                         // begin modify by yejian on 20220928 for 更新tasknode表中nodetype,方便三坐标工件坐标系测量后更新坐标系偏移量表
                         taskNode.setNodeType("5");

+ 1 - 1
imcs-admin-boot/imcs-common/src/main/java/com/github/zuihou/common/constant/DictionaryKey.java

@@ -190,7 +190,7 @@ public interface DictionaryKey {
     Map<String, String> ZEISS_LOCATION = new HashMap<String, String>(){
         {
             // 331三坐标
-            put("M", "CMM0000101");
+            put("M", "CMM0000102");
         }
     };