Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master' into master

yejian 3 gadi atpakaļ
vecāks
revīzija
6000229354

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

@@ -235,7 +235,7 @@ public class TaskWorkNode {
                 //运行条件验证
                 Map conMap = checkCon(taskNode, tTask, queryMap);
 
-                if(null == taskNode.getResourceId()){
+                if("03".equals(taskNode.getInterfaceType())){
                     // agv搬运
                     Map agvData = new HashMap();
                     agvData.put("start",beforTaskNode.getTargetResourceId());

+ 35 - 25
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RobotNodeServiceImpl.java

@@ -183,32 +183,31 @@ public class RobotNodeServiceImpl implements NodeOperationService {
         // add by yejian on 20220329 for 区分上料逻辑,起点需要取判断托盘家具是否够用
         // 查找工件所属产线
         // 根据工序判断需要做什么任务
+
+
+        List<StockInfo> flikustockInfos = null;//获取初始立库库存
+
         Storge currStore = null;
         BBom bom = bBomMapper.selectOne(Wraps.<BBom>lbQ().eq(BBom::getId,task.getBomId()));
-        BomProcedure bomProcedure = bomProcedureMapper.selectOne(Wraps.<BomProcedure>lbQ().eq(BomProcedure::getId,task.getProcedureId()));
         // 人工序只有上下料
-        if("上料".equals(bomProcedure.getType())){
-            // 判断当前任务所属产品,找出相应的子盘夹具
-            BomProcedureTray bomProcedureTray = bomProcedureTrayMapper.selectOne(Wraps.<BomProcedureTray>lbQ().eq(BomProcedureTray::getProcedureId,task.getProcedureId()).eq(BomProcedureTray::getBizType,"1"));
-
+        if(taskNode.getCompleteBatchSort()==1){
             List<Productionresource> productionresources = productionresourceBizMapper.selectList(Wraps.<Productionresource>lbQ().like(Productionresource::getName,"立库"));
             List<Long> productionresourceIds = productionresources.stream().map(t->t.getId()).collect(Collectors.toList());
             List<ProductionresourcePosition> startProductionresourcePositions = productionresourcePositionMapper.selectList(Wraps.<ProductionresourcePosition>lbQ().in(ProductionresourcePosition::getResourceId, productionresourceIds));
             List<Long> startProductionresourcePositionIds = startProductionresourcePositions.stream().map(t->t.getStorgeId()).collect(Collectors.toList());
 
             // 判断夹具是否有可用的,查询330个库位信息中是否还有夹具
-            List<StockInfo> stockInfos = stockInfoMapper.selectList(Wraps.<StockInfo>lbQ().eq(StockInfo::getGoodsId,bom.getTrayId()).in(StockInfo::getStorgeId,startProductionresourcePositionIds).orderByAsc(StockInfo::getStorgeId));
-            if(stockInfos.size() <= 0){
-                map.put("result", false);
-                map.put("msg", DictionaryKey.NodeException.RUNNING_FALSE);
-                return map;
-            }
+            flikustockInfos = stockInfoMapper.selectList(Wraps.<StockInfo>lbQ().eq(StockInfo::getGoodsId,bom.getTrayId()).in(StockInfo::getStorgeId,startProductionresourcePositionIds).orderByAsc(StockInfo::getStorgeId));
+//            if(flikustockInfos.size() <= 0){
+//                map.put("result", false);
+//                map.put("msg", DictionaryKey.NodeException.RUNNING_FALSE);
+//                return map;
+//            }
             // 按照顺序将托盘移动到上下料站
             // 获取抓取托盘起点及放设备重点
-            StockInfo metetailStockInfo = stockInfos.get(0);
-            currStore = storgeMapper.selectById(metetailStockInfo.getStorgeId());
+//            StockInfo metetailStockInfo = flikustockInfos.get(0);
+//            currStore = storgeMapper.selectById(metetailStockInfo.getStorgeId());
         }else{
-            currStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
             // 先判断上一指令是否为是否为设备指令,在判断工序最后一个指令是agv动作时锁定锁定agv接驳位
             TaskNode beforTaskNode = taskNodeService.getNextNTaskNode(taskNode,-1);
             TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode,1);
@@ -217,6 +216,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
             beforTaskNode.setAutoNode(resourceAutoCodeMapper.selectById(beforTaskNode.getAutoNode().getId()));
             //前序是设备序并且最后一个节点是agv搬运,锁定agv相关库位信息
             if(beforTaskNode.getTaskId().equals(taskNode.getTaskId()) && "1".equals(beforTaskNode.getAutoNode().getCategory()) && null == lastOperationTaskNode.getResourceId()){
+                currStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
                 ProductionresourcePosition startProductionresourcePosition = null;
                 ProductionresourcePosition endProductionresourcePosition = null;
                 Storge agvStartStationStorge = null;
@@ -299,26 +299,26 @@ public class RobotNodeServiceImpl implements NodeOperationService {
             case "柔性线机器人":
                 //操作柔性线边库 具有取、移动、放三种指令
                 //取放加工设备  设备存在缓存位
-                map = this.commandHandle(map, currStore, functionName);
+                map = this.commandHandle(map, currStore,flikustockInfos,functionName);
                 map.put("deviceUrl", ZK_ip_rxx);
                 break;
             case "智能单元机器人":
                 //操作智能单元线边库 具有取、移动、放三种指令
                 //取放加工设备 无缓存位处理
-                map = this.commandHandle(map, currStore, functionName);
+                map = this.commandHandle(map, currStore , flikustockInfos,functionName);
                 map.put("deviceUrl", ZK_ip_zndy);
                 break;
             case "舱体类加工单元":
                 //操作舱体线边库 具有取、移动、放三种指令
                 //取放加工设备
-                map = this.commandHandle(map, currStore, functionName);
+                map = this.commandHandle(map, currStore,flikustockInfos, functionName);
                 break;
             case "智能生产保障系统":
-                map = this.commandHandle(map, currStore, functionName);
+                map = this.commandHandle(map, currStore,flikustockInfos, functionName);
                 map.put("deviceUrl", ZK_ip_rxx);
                 break;
             case "框体类加工单元":
-                map = this.commandHandle(map, currStore, functionName);
+                map = this.commandHandle(map, currStore,flikustockInfos, functionName);
                 map.put("deviceUrl", ZK_ip_rxx);
                 break;
         }
@@ -346,7 +346,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
     }
 
     //机器人功能操作
-    private Map<String, Object>  commandHandle(Map<String, Object> dataMap, Storge startStore, String functionName){
+    private Map<String, Object>  commandHandle(Map<String, Object> dataMap, Storge startStore,List<StockInfo>flikustockInfos, String functionName){
         TaskNode taskNode = (TaskNode) dataMap.get("taskNode");
         TTask task = (TTask) dataMap.get("task");
         int count = Integer.parseInt(dataMap.get(taskNode.getId().toString() + "count") == null ? "0" : dataMap.get(taskNode.getId().toString() + "count").toString());
@@ -365,7 +365,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
 
                     TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
                     //目标库位,可能是
-                    Map returnMap = getTargetStorge(nextTaskNode);
+                    Map returnMap = getTargetStorge(nextTaskNode,flikustockInfos);
                     //目标地址和类型
                     Storge targetStorge = returnMap.get("store")==null?null:(Storge)returnMap.get("store");
                     String targetxbk = returnMap.get("targetxbk")==null?null:(String)returnMap.get("targetxbk");
@@ -429,7 +429,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                 }
             }else if (BizConstant.ROBOT_TYPE_NOCACHE.equals(zoneService.getRobotTypebyZone(zoneName))) {
                 TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode, 1);
-                Map returnMap = getTargetStorge(nextTaskNode);
+                Map returnMap = getTargetStorge(nextTaskNode,flikustockInfos);
 
                 //目标地址和类型
                 Storge targetStorge = returnMap.get("store")==null?null:(Storge)returnMap.get("store");
@@ -538,11 +538,22 @@ public class RobotNodeServiceImpl implements NodeOperationService {
     }
 
 
-    public Map getTargetStorge(TaskNode taskNode){
+    public Map getTargetStorge(TaskNode taskNode,List<StockInfo> flikustockInfos){
         Map returnMap = new HashMap();
         Storge targetStorge = null;
         Long resourceId = taskNode.getTargetResourceId();
         String xbkFlag = "";
+
+        //
+        if(taskNode.getCompleteBatchSort()==1){
+            if(CollectionUtil.isNotEmpty(flikustockInfos)){
+                targetStorge = storgeMapper.selectById(flikustockInfos.get(0));
+            }
+            returnMap.put("store",targetStorge);
+            returnMap.put("targetxbk","0");
+            return returnMap;
+        }
+
         //目标设备
         if(resourceId!=null){
             targetList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[] {resourceId.toString()});
@@ -574,8 +585,6 @@ public class RobotNodeServiceImpl implements NodeOperationService {
                 returnMap.put("store",targetStorge);
                 returnMap.put("targetxbk","1");
             }
-
-
         }
         return returnMap;
     }
@@ -587,6 +596,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
      * @return
      */
     public ProductionresourcePosition logical(List<ProductionresourcePosition> robotList,Storge targetStorge){
+
         //设备不存在
         if(!checkRobot()){
 //            map.put("msg", DictionaryKey.NodeException.NO_RESOURCE);

+ 4 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/statisticalAnalysis/impl/ProductLinePerformanceServiceImpl.java

@@ -63,9 +63,11 @@ public class ProductLinePerformanceServiceImpl extends SuperCacheServiceImpl<Pro
             int monthHour = calCalendar.getActualMaximum(Calendar.DATE) * 24;
             params.setMonthHour(monthHour);
         }else{
-            Date SearchDate = com.github.zuihou.common.util.DateUtil.stringToDate0(params.getStatisticalDate(),"yyyy-MM");
+            Date searchDate = com.github.zuihou.common.util.DateUtil.stringToDate0(params.getStatisticalDate(),"yyyy-MM");
             Calendar calCalendar = Calendar.getInstance();
-            calCalendar.setTime(SearchDate);
+            if(searchDate != null){
+                calCalendar.setTime(searchDate);
+            }
             int monthHour = calCalendar.getActualMaximum(Calendar.DATE) * 24;
             params.setMonthHour(monthHour);
         }