Pārlūkot izejas kodu

刀具取放功能处理

oyq28 3 mēneši atpakaļ
vecāks
revīzija
4b60e2f06d

+ 1 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/DemoLine/DemoLineConstant.java

@@ -42,6 +42,7 @@ public interface DemoLineConstant {
     // 柔性线配置
     String DEMOLINE_RJQR_ZS = "124";
     String DEMOLINE_RJQR_SIX = "900";
+    String DEMOLINE_RJQR_TOOL = "168";
 
     String DEMOLINE_RJQR_KW1 = "126";
     String DEMOLINE_RJQR_KW2 = "125";

+ 3 - 3
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/OrderTaskServiceImpl.java

@@ -102,9 +102,9 @@ public class OrderTaskServiceImpl extends SuperServiceImpl<OrderTaskMapper, Orde
         String[] startNameCondition = orderTask.getStart().split("_");
         String[] goalNameCondition = orderTask.getGoal().split("_");
         if(startNameCondition.length != 2 || goalNameCondition.length != 2) return false;
-        Storge startStorge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, startNameCondition[0]).likeLeft(Storge::getName, startNameCondition[1]).eq(Storge::getPointId, startNameCondition[1]));
+        Storge startStorge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, startNameCondition[0]).eq(Storge::getPointId, startNameCondition[1]));
         if(null == startStorge) return false;
-        Storge goalStorge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, goalNameCondition[0]).likeLeft(Storge::getName, goalNameCondition[1]).eq(Storge::getPointId, goalNameCondition[1]));
+        Storge goalStorge = storgeService.getOne(new LbqWrapper<Storge>().likeRight(Storge::getName, goalNameCondition[0]).eq(Storge::getPointId, goalNameCondition[1]));
 
         Long startResourceId = productionresourcePositionService.getOne(new LbqWrapper<ProductionresourcePosition>().eq(ProductionresourcePosition::getStorgeId, startStorge.getId()).last("limit 1")).getResourceId();
         Long endResourceId = (null==goalStorge) ? null : productionresourcePositionService.getOne(new LbqWrapper<ProductionresourcePosition>().eq(ProductionresourcePosition::getStorgeId, goalStorge.getId()).last("limit 1")).getResourceId();
@@ -250,7 +250,7 @@ public class OrderTaskServiceImpl extends SuperServiceImpl<OrderTaskMapper, Orde
         }
 
         BeanUtil.copyProperties(plan, initPlan, "id");
-        initPlan.setOrderId(order.getId()).setOrderNo(order.getOrderNo());
+        initPlan.setOrderId(order.getId()).setOrderNo(order.getOrderNo()).setPlanNo(codeRuleService.getBillCode(CodeRuleModule.CODE_RULE_PLAN));
         //orderProductService.save(initProduct);
         planService.save(initPlan);
         initTask.setPlanId(initPlan.getId());

+ 3 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskNodeServiceImpl.java

@@ -3369,13 +3369,15 @@ planId));
                     // 放,判断后一个动作节点是否是agv搬运,如果是,这个targetResourceId设置成空
                     if ("2".equals(command)) {
                         // 最后一个节点
+                        /*
                         if (count == childResourceAutoCodeList.size() - 1) {
                             taskNode.setTargetResourceId(t.getResourceId());
                         } else {
                             if (null == nextAutoCode.getResourceId()) {
                                 taskNode.setTargetResourceId(null);
                             }
-                        }
+                        } */
+                        taskNode.setTargetResourceId(t.getResourceId());
                     }
 
                     if (null != autoCode.getResourceId()) {

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

@@ -1452,8 +1452,11 @@ public class RobotNodeServiceImpl2 implements NodeOperationService {
      * @param robotList
      * @return
      */
-    public ProductionresourcePosition logical(List<ProductionresourcePosition> robotList,List<StockInfo>flikustockInfos,TaskNode taskNode){
+    public ProductionresourcePosition logical(List<ProductionresourcePosition> robotList,List<StockInfo> flikustockInfos,TaskNode taskNode){
         if(taskNode.getCompleteBatchSort()==1){
+            boolean flag = robotList.size() == 1 && robotList.get(0).getPointId().equals(DemoLineConstant.DEMOLINE_RJQR_TOOL);
+            //天轨机器人判断处理
+            if(flag) return robotList.get(0);
             if(CollectionUtil.isEmpty(flikustockInfos)){
                 return null;
             }
@@ -1461,21 +1464,8 @@ public class RobotNodeServiceImpl2 implements NodeOperationService {
 
         //设备不存在
         if(!checkRobot()){
-//            map.put("msg", DictionaryKey.NodeException.NO_RESOURCE);
             return null;
         }
-        //资源临界判断
-//        int current_running_num = storgeService.getstorgeByZone(zoneId.toString());
-//        if(current_running_num == DictionaryKey.RESOURCE_MAX_NUM){
-////            map.put("msg", DictionaryKey.NodeException.NO_RESOURCE);
-//            return null;
-//        }
-
-//        if(targetStorge==null){
-////            map.put("msg", DictionaryKey.NodeException.NO_RESOURCE);
-//            return null;
-//        }
-
         return robotList.get(0);
     }
 

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

@@ -29,6 +29,7 @@ import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.tenant.service.ProductionresourceService;
 import com.google.common.collect.Maps;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -39,6 +40,7 @@ import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 @Component("TOOLROBOT")
+@Slf4j
 public class ToolRobotStrategy implements RobotStrategy {
 
     @Autowired
@@ -88,10 +90,10 @@ public class ToolRobotStrategy implements RobotStrategy {
         TTask task = taskService.getById(taskNode.getTaskId());
         //获取天轨机器人
         //com.github.zuihou.business.productionResourceCenter.entity.Productionresource robot = productionresourceBizMapper.selectById(taskNode.getResourceId());
-        Productionresource cutToolRobot = productionresourceBizMapper.selectOne(new LbqWrapper<Productionresource>().likeRight(Productionresource::getCode, "jqr2").last("limit 1"));
+        Productionresource cutToolRobot = productionresourceBizMapper.selectOne(new LbqWrapper<Productionresource>().likeLeft(Productionresource::getCode, "jqr2").last("limit 1"));
         ZZone zZone = zoneService.getOne(new LbqWrapper<ZZone>().eq(ZZone::getName, zoneName).last("limit 1"));
         BBom bom = bBomMapper.selectById(task.getBomId());
-        OrderTask orderTask = orderTaskService.getById(task.getOrderId());
+        OrderTask orderTask = orderTaskService.getOne(new LbqWrapper<OrderTask>().eq(OrderTask::getOrderId, task.getOrderId()).last("LIMIT 1"));
 
         Map plcInfo = DictionaryKey.PLC_CATEGORY.get(zZone.getNo());
 
@@ -100,7 +102,8 @@ public class ToolRobotStrategy implements RobotStrategy {
         robotInfo.put("bom", bom);
         robotInfo.put("plcInfo", plcInfo);
         robotInfo.put("orderTask", orderTask);
-        robotInfo.put("singleRunFlag", "1");
+        robotInfo.put("singleTaskFlag", 1);
+        robotInfo.put("singleRunFlag", 1);
         return robotInfo;
     }
 
@@ -110,13 +113,14 @@ public class ToolRobotStrategy implements RobotStrategy {
         dataMap.put(taskNode.getId().toString() + "count", 0);
         dataMap.put(YunjianConstant.YUNJIAN_ROBORT_CACHE_FLAG, "0");
         Storge startStore = null;
+        TTask task = taskService.getById(taskNode.getTaskId());
         OrderTask orderTask = (OrderTask) robotInfo.get("orderTask");
         if (CollectionUtil.isNotEmpty(flikustockInfos)) {
             //刀具线边库查询
             startStore = storgeService.getById(flikustockInfos.get(0).getStorgeId());
         }else {
             //硬件设备库位
-            List<ProductionresourcePosition> storgeList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[]{taskNode.getResourceId().toString()});
+            List<ProductionresourcePosition> storgeList = productionresourcePositionService.getFreeProductionresourcePositionByIds(new String[]{task.getResourceId().toString()});
             startStore = storgeService.getById(storgeList.get(0).getStorgeId());
         }
         //CCS判断取条件是否满足
@@ -151,7 +155,7 @@ public class ToolRobotStrategy implements RobotStrategy {
     public Map robotPut(Map returnMap, TaskNode taskNode, Storge startStorge, Storge targetStorge, List<ProductionresourcePosition> robotList, String targetxbk, Long targetStorgeResourceId) {
         Map<String, List<ProductionresourcePosition>> jqrMap = robotList.stream().collect(Collectors.groupingBy(ProductionresourcePosition::getPointId));
         Storge jqrStorge = null;
-        List<ProductionresourcePosition> jqrList = jqrMap.get(DemoLineConstant.DEMOLINE_RJQR_ZS);
+        List<ProductionresourcePosition> jqrList = jqrMap.get(DemoLineConstant.DEMOLINE_RJQR_TOOL);
         if(jqrList.size() == 0){
             returnMap.put("result", false);
             return returnMap;
@@ -188,7 +192,6 @@ public class ToolRobotStrategy implements RobotStrategy {
 
         locationMap.put("taskType", DictionaryKey.TASK_TYPE.get("CARRY"));
         locationMap.put("carryType", "1");
-        returnMap.put(YunjianConstant.YUNJIAN_ROBORT_CACHE_FLAG, "1");
         returnMap.put("data", locationMap);
         returnMap.put("method", "RobotAction");
         returnMap.put("result", true);

+ 4 - 3
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/productionResourceCenter/StationUserController.java

@@ -30,6 +30,7 @@ import com.github.zuihou.business.productionResourceCenter.dto.StationUserUpdate
 import com.github.zuihou.business.productionResourceCenter.entity.Productionresource;
 import com.github.zuihou.business.productionResourceCenter.entity.StationUser;
 import com.github.zuihou.business.productionResourceCenter.service.StationUserService;
+import com.github.zuihou.common.util.DateUtil;
 import com.github.zuihou.common.util.StringUtil;
 import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
@@ -192,9 +193,9 @@ public class StationUserController extends SuperController<StationUserService, L
         BBom bom = bBomService.getOne(new LbqWrapper<BBom>().eq(BBom::getStatus, "1").orderByDesc(BBom::getCreateTime).last("limit 1"));
         Map<String, Object> params = new HashMap<String, Object>(){
             {
-                put("deliveryTime", new Date());
+                put("deliveryTime", DateUtil.dateToString(new Date()));
                 put("hasMaterial", "0");
-                put("orderTime", new Date());
+                put("orderTime", DateUtil.dateToString(new Date()));
                 put("singleTaskFlag", "1");
                 put("status", "1");
                 put("zoneId", bom.getZoneId());
@@ -206,7 +207,7 @@ public class StationUserController extends SuperController<StationUserService, L
                 put("id", bom.getMeterialId());
                 put("bomId", bom.getId());
                 put("bomNum", "1");
-                put("deliveryTime", new Date());
+                put("deliveryTime", DateUtil.dateToString(new Date()));
             }
         };
         MMeterialReceiveLog mMeterialReceiveLog = meterialReceiveLogService.getOne(new LbqWrapper<MMeterialReceiveLog>().eq(MMeterialReceiveLog::getMeterialId, bom.getMeterialId()).last("limit 1"));

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

@@ -95,6 +95,7 @@ public interface DictionaryKey {
 //            put("3", "框体_机器人");
             // 331
             put("1", "涡轴线_线前地轨机器人");
+            put("4", "涡轴线_线后天轨机器人");
             // 示范线配置
 //            put("1", "柔性线_机器人_手抓");
 //            put("2", "质量中心_机器人");