Bläddra i källkod

修改策略模式初始化处理

oyq28 4 månader sedan
förälder
incheckning
ae9b4fe64f

+ 9 - 10
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/strategy/impl/CacheRobotStrategy.java

@@ -38,6 +38,7 @@ import com.github.zuihou.tenant.entity.Productionresource;
 import com.github.zuihou.tenant.service.ProductionresourceService;
 import com.google.common.collect.Maps;
 import lombok.extern.slf4j.Slf4j;
+import org.codehaus.groovy.util.SingleKeyHashMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -46,6 +47,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 @Component("CACHE")
 @Slf4j
@@ -96,25 +98,23 @@ public class CacheRobotStrategy implements RobotStrategy {
         TTask task = taskService.getById(taskNode.getTaskId());
         Productionresource robot = productionresourceService.getById(taskNode.getResourceId());
         ZZoneProductionresource zoneProductionresource = zZoneProductionresourceMapper.selectOne(Wraps.<ZZoneProductionresource>lbQ().eq(ZZoneProductionresource::getResourceId, taskNode.getResourceId()));
-        List<ProductionresourcePosition> robotList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[]{zoneProductionresource.getResourceId().toString()});
+        //List<ProductionresourcePosition> robotList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[]{zoneProductionresource.getResourceId().toString()});
         ZZone zZone = zoneService.getOne(new LbqWrapper<ZZone>().eq(ZZone::getName, zoneName).last("limit 1"));
         Plan orderPlan = planService.getById(Wraps.<Plan>lbQ().eq(Plan::getId, task.getPlanId()));
         BBom bom = bBomMapper.selectById(task.getBomId());
         ZZone bomzZone = zoneService.getById(bom.getZoneId());
 
-        String[] xbkArr = DictionaryKey.YJ_ZONE_XBK.get(zoneName).split(",");
-        List<ProductionresourcePosition> xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(xbkArr);
+        //String[] xbkArr = DictionaryKey.YJ_ZONE_XBK.get(zoneName).split(",");
 
         Map plcInfo = DictionaryKey.PLC_CATEGORY.get(zZone.getNo());
 
         robotInfo.put("robot", robot);
         robotInfo.put("zZone", zZone);
-        robotInfo.put("robotList", robotList);
         robotInfo.put("bom", bom);
         robotInfo.put("bomzZone", bomzZone);
         robotInfo.put("plcInfo", plcInfo);
         robotInfo.put("singleRunFlag", orderPlan.getSingleRunFlag());
-        robotInfo.put("xbkList", xbkList);
+        //robotInfo.put("xbkList", xbkList);
 
         return robotInfo;
     }
@@ -130,7 +130,8 @@ public class CacheRobotStrategy implements RobotStrategy {
         }
         String xbkFlag = "";
         //处理线边库库位
-        List<ProductionresourcePosition> xbkList = (List<ProductionresourcePosition>) robotInfo.get("xbkList");
+        String zoneName = robotInfo.get("zoneName").toString();
+        List<ProductionresourcePosition> xbkList = productionresourcePositionService.getFreeProductionresourcePositionByNos(DictionaryKey.YJ_ZONE_XBK.get(zoneName).split(","));
         //处理目标库位
         Map returnMap = this.robotTarget(taskNode, robotInfo, xbkList, bomProcedure);
 
@@ -145,10 +146,8 @@ public class CacheRobotStrategy implements RobotStrategy {
 
         //处理机器人库位
         List<ProductionresourcePosition> robotList = (List<ProductionresourcePosition>) robotInfo.get("robotList");
-        boolean isXbk = targetXbk.equals("1")? true:false;
-        this.robotPut(returnMap,taskNode, startStore, targetStorge,robotList, targetXbk, targetStorgeResourceId);
-
-        return null;
+        Map putMap = this.robotPut(returnMap,taskNode, startStore, targetStorge,robotList, targetXbk, targetStorgeResourceId);
+        return putMap;
     }
 
     @Override

+ 2 - 3
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/strategy/impl/NoCacheRobotStrategy.java

@@ -75,7 +75,7 @@ public class NoCacheRobotStrategy implements RobotStrategy {
         Productionresource robot = productionresourceService.getById(taskNode.getResourceId());
         ZZoneProductionresource zoneProductionresource = zZoneProductionresourceMapper.selectOne(Wraps.<ZZoneProductionresource>lbQ().eq(ZZoneProductionresource::getResourceId,taskNode.getResourceId()));
 
-        List<ProductionresourcePosition> robotList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[] {zoneProductionresource.getResourceId().toString()});
+        //List<ProductionresourcePosition> robotList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[] {zoneProductionresource.getResourceId().toString()});
         ZZone zZone = zoneService.getOne(new LbqWrapper<ZZone>().eq(ZZone::getName, zoneName).last("limit 1"));
 
         BBom bom = bBomMapper.selectById(task.getBomId());
@@ -84,8 +84,7 @@ public class NoCacheRobotStrategy implements RobotStrategy {
         Map plcInfo = DictionaryKey.PLC_CATEGORY.get(zZone.getNo());
 
         robotInfo.put("robot", robot);
-        robotInfo.put("zZone", zZone);
-        robotInfo.put("robotList", robotList.get(0));
+        robotInfo.put("zZone", zZone);        
         robotInfo.put("bom", bom);
         robotInfo.put("bomzZone", bomzZone);
         robotInfo.put("plcInfo", plcInfo);