Browse Source

Merge remote-tracking branch 'origin/master'

wudingsheng 2 months ago
parent
commit
03c9e346c9

+ 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());

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

@@ -643,7 +643,7 @@ public class TaskWorkNode {
                     String code = retJson.getString("result").trim();
                     String concurrency = retJson.containsKey("concurrency") ? retJson.getString("concurrency").trim() : "false";
                     if (code.equals("true")) {
-                        log.setExeStatus("2").setEndTime(new Date()).setSendStatus("1").setFeedback("");
+                        log.setExeStatus("2").setEndTime(new Date()).setSendStatus("1").setExeResult("").setFeedback("");
                         //回调处理
 //                    taskNode.setExeStatus("3").setEndTime(new Date()).setExeResult("1");
 //                    taskNodeService.updateAllById(taskNode);

+ 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));

+ 7 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RobotNodeServiceImpl2.java

@@ -1062,11 +1062,16 @@ public class RobotNodeServiceImpl2 implements NodeOperationService {
         List<Long> trayAndMToolClamplist = newTrayList.stream().map(t->t.getId()).collect(Collectors.toList());
         trayAndMToolClamplist.addAll(mToolClamplist.stream().map(t->t.getId()).collect(Collectors.toList()));
 
-        // 判断夹具是否有可用的,查询线边库位信息中是否还有夹具
+        // 判断夹具是否有可用的,查询线边库位信息中是否还有夹具,因为是通过匹配相同类型的托盘查询的,所以没有去除带物料的托盘
         List<StockInfo> allStockInfos = stockInfoMapper.selectList(Wraps.<StockInfo>lbQ().in(StockInfo::getGoodsId,trayAndMToolClamplist).in(StockInfo::getStorgeId,startProductionresourcePositionIds).eq(StockInfo::getLockStatus, "1").orderByAsc(StockInfo::getGoodsType));
 
+        List<Long> collect1 = allStockInfos.stream().map(StockInfo::getStorgeId).distinct().collect(toList());
+
+        // 根据库位ID 查询这个库位下最终有多少条数据,
+        List<StockInfo> newAllStockInfos = stockInfoMapper.selectList(Wraps.<StockInfo>lbQ().in(StockInfo::getStorgeId,collect1).in(StockInfo::getStorgeId,startProductionresourcePositionIds).eq(StockInfo::getLockStatus, "1").orderByAsc(StockInfo::getGoodsType));
+
         // 根据集合数据,比对根据零件配置的工装夹具数量是不相等
-        Map<Long, List<StockInfo>> collect = allStockInfos.stream().collect(groupingBy(StockInfo::getStorgeId));
+        Map<Long, List<StockInfo>> collect = newAllStockInfos.stream().collect(groupingBy(StockInfo::getStorgeId));
         collect.forEach((aLong, stockInfos) -> {
             if(stockInfos.size() == trayList.size()){
                 returnList.addAll(stockInfos);

+ 1 - 1
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/edgeLibrary/ShelvesController.java

@@ -48,7 +48,7 @@ public class ShelvesController extends SuperCacheController<ShelvesService, Long
 
         wrapper.like(Shelves::getName,shelves.getName())
                 .eq(Shelves::getStatus,shelves.getStatus())
-                .orderByDesc(Shelves::getCreateTime);
+                .orderByAsc(Shelves::getWeight).orderByAsc(Shelves::getCreateTime);
         baseService.pageList(page, wrapper);
     }
 

+ 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");
         }
     };