Forráskód Böngészése

fix: 三坐标检测启动时发送正确的报文

wang.sq@aliyun.com 6 hónapja
szülő
commit
9724591a97

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

@@ -618,47 +618,55 @@ 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"), DictionaryKey.ZEISS_LOCATION.get("L"))));
+        List<Storge> storgeList = baseMapper.selectList(new LbqWrapper<Storge>().in(Storge::getPointId, Arrays.asList(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()));
+//        List<StockInfo> lPointList = stockInfoMapper.selectList(new LbqWrapper<StockInfo>().eq(StockInfo::getStorgeId, storgeList.get(1).getId()));
 
         JSONObject params = new JSONObject();
         //三坐标中间位取操作
         if(isFetched) {
-            String fetchStatus = msgUtil.getCcsData("/api/GetMiddleThreeCoordinates", params, taskNode);
+            //todo wang.sq三坐标调用地址释放
+            // 查询三坐标是否允许取
+//            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);
             logger.warn("三坐标节点{}取查询接口返回{}", taskNode.getId(), fetchObject.toJSONString());
             //判断三坐标是否可取
             if (null != fetchObject && fetchObject.containsKey("result") && StringUtils.isNotEmpty(fetchObject.getString("result")) && !fetchObject.getString("result").trim().equals("false")) {
                 if (mPointList.size() > 0) return true;
                 // M位可取但无零件工装且L位有零件工装
-                if (lPointList.size() > 0 && mPointList.size() == 0) {
-                    List<Long> ids = lPointList.stream().map(StockInfo::getId).collect(toList());
-                    LambdaUpdateWrapper<StockInfo> lambdaUpdateWrapper = new LambdaUpdateWrapper<StockInfo>();
-                    //虚拟缓存位点位更新成为M点位
-                    lambdaUpdateWrapper.set(StockInfo::getStorgeId, storgeList.get(0).getId()).in(StockInfo::getId, ids);
-                    stockInfoMapper.update(null, lambdaUpdateWrapper);
-                    logger.warn("三坐标节点{}取操作,虚拟缓存位点位更新成为M点位", taskNode.getId());
-                    return true;
-                }
+//                if (lPointList.size() > 0 && mPointList.size() == 0) {
+//                    List<Long> ids = lPointList.stream().map(StockInfo::getId).collect(toList());
+//                    LambdaUpdateWrapper<StockInfo> lambdaUpdateWrapper = new LambdaUpdateWrapper<StockInfo>();
+//                    //虚拟缓存位点位更新成为M点位
+//                    lambdaUpdateWrapper.set(StockInfo::getStorgeId, storgeList.get(0).getId()).in(StockInfo::getId, ids);
+//                    stockInfoMapper.update(null, lambdaUpdateWrapper);
+//                    logger.warn("三坐标节点{}取操作,虚拟缓存位点位更新成为M点位", taskNode.getId());
+//                    return true;
+//                }
             }
         }else{
             //三坐标中间放操作
-            String sendStatus = msgUtil.getCcsData("/api/QueryThreeCoordinatesFreePos", params, taskNode);
+            // 查询三坐标是否允许放
+            //todo wang.sq三坐标调用地址释放
+//            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);
             logger.warn("三坐标节点{}放查询接口返回{}", taskNode.getId(), sendObject.toJSONString());
             if (null != sendObject && sendObject.containsKey("result") && StringUtils.isNotEmpty(sendObject.getString("result")) && !sendObject.getString("result").trim().equals("false")) {
                 if (mPointList.size() == 0) return true;
                 // M位可放但有零件工装更新到虚拟L位
-                if (mPointList.size() > 0 && lPointList.size() == 0) {
-                    List<Long> ids = mPointList.stream().map(StockInfo::getId).collect(toList());
-                    LambdaUpdateWrapper<StockInfo> lambdaUpdateWrapper = new LambdaUpdateWrapper<StockInfo>();
-                    //M点位更新为L虚拟点位
-                    lambdaUpdateWrapper.set(StockInfo::getStorgeId, storgeList.get(1).getId()).in(StockInfo::getId, ids);
-                    stockInfoMapper.update(null, lambdaUpdateWrapper);
-                    logger.warn("三坐标节点{}放操作,M点位更新为L虚拟点位", taskNode.getId());
-                    return true;
-                }
+//                if (mPointList.size() > 0 && lPointList.size() == 0) {
+//                    List<Long> ids = mPointList.stream().map(StockInfo::getId).collect(toList());
+//                    LambdaUpdateWrapper<StockInfo> lambdaUpdateWrapper = new LambdaUpdateWrapper<StockInfo>();
+//                    //M点位更新为L虚拟点位
+//                    lambdaUpdateWrapper.set(StockInfo::getStorgeId, storgeList.get(1).getId()).in(StockInfo::getId, ids);
+//                    stockInfoMapper.update(null, lambdaUpdateWrapper);
+//                    logger.warn("三坐标节点{}放操作,M点位更新为L虚拟点位", taskNode.getId());
+//                    return true;
+//                }
             }
         }
         logger.warn("三坐标节点{}取放条件不通过", taskNode.getId());

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

@@ -6,9 +6,12 @@ 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.authority.entity.auth.StationUserLoginInfo;
 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;
+import com.github.zuihou.business.edgeLibrary.service.StockInfoService;
 import com.github.zuihou.business.edgeLibrary.service.StorgeService;
 import com.github.zuihou.business.modelingCenter.entity.MModuleField;
 import com.github.zuihou.business.operationManagementCenter.dao.OrderMapper;
@@ -19,11 +22,9 @@ import com.github.zuihou.business.operationManagementCenter.service.TaskNodeServ
 import com.github.zuihou.business.operationManagementCenter.service.WorkpieceService;
 import com.github.zuihou.business.productionReadyCenter.dao.BBomMapper;
 import com.github.zuihou.business.productionReadyCenter.dao.BomProcedureProgramMapper;
-import com.github.zuihou.business.productionReadyCenter.entity.BBom;
-import com.github.zuihou.business.productionReadyCenter.entity.BomProcedure;
-import com.github.zuihou.business.productionReadyCenter.entity.BomProcedureMeterial;
-import com.github.zuihou.business.productionReadyCenter.entity.BomProcedureProgram;
+import com.github.zuihou.business.productionReadyCenter.entity.*;
 import com.github.zuihou.business.productionReadyCenter.service.BomProcedureService;
+import com.github.zuihou.business.productionReadyCenter.service.MToolClampService;
 import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourceBizMapper;
 import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourcePositionMapper;
 import com.github.zuihou.business.productionResourceCenter.entity.*;
@@ -103,6 +104,11 @@ public class MachineNodeServiceImpl implements NodeOperationService {
     private OrderMapper orderMapper;
     @Autowired
     private WorkpieceMapper workpieceMapper;
+    @Autowired
+    private StockInfoService stockInfoService;
+
+    @Autowired
+    private MToolClampService mToolClampService;
 
     private Map<String, Object> map = Maps.newHashMap();
 
@@ -490,13 +496,26 @@ public class MachineNodeServiceImpl implements NodeOperationService {
                         // end modify by yejian on 20220507 for 更新tasknode表中nodetype,方便三坐标测量完成后回调后快速查找测量结果
                     }
                     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", procedure.getThreeDimensionalDeviationPrograme());
+                        data.put("workType", toPlcPar);
+
                         // begin modify by yejian on 20220928 for 更新tasknode表中nodetype,方便三坐标工件坐标系测量后更新坐标系偏移量表
                         taskNode.setNodeType("5");
                         taskNodeService.updateById(taskNode);
                         // end modify by yejian on 20220928 for 更新tasknode表中nodetype,方便三坐标工件坐标系测量后更新坐标系偏移量表
                     }
+
 //                    String unionCode = workpieceService.getUnionCode(task.getCompleteBatchNo());
 
                     //map.put("data", JSONObject.toJSONString(queryMap));

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

@@ -189,10 +189,8 @@ public interface DictionaryKey {
 
     Map<String, String> ZEISS_LOCATION = new HashMap<String, String>(){
         {
-            // 云箭蔡司滑台点位对应关系
-            put("L", "372");
-            put("M", "373");
-            put("R", "374");
+            // 331三坐标
+            put("M", "CMM0000101");
         }
     };