Browse Source

fix: 增加调用ccs区域数据维护

wang.sq@aliyun.com 6 tháng trước cách đây
mục cha
commit
844eb11a7a

+ 3 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/dao/StorgeTypeMapper.java

@@ -3,6 +3,7 @@ package com.github.zuihou.business.edgeLibrary.dao;
 import com.baomidou.mybatisplus.annotation.SqlParser;
 import com.github.zuihou.base.mapper.SuperMapper;
 import com.github.zuihou.business.edgeLibrary.entity.StorgeType;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 /**
@@ -17,4 +18,6 @@ import org.springframework.stereotype.Repository;
 @Repository
 public interface StorgeTypeMapper extends SuperMapper<StorgeType> {
 
+    StorgeType findOneByPointId( String pointId);
+
 }

+ 6 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/StorgeTypeService.java

@@ -53,4 +53,10 @@ public interface StorgeTypeService extends SuperCacheService<StorgeType> {
      */
     Boolean delete(StorgeType model);
 
+    /**
+     * 根据点位查询分类
+     * @return
+     */
+    StorgeType findOneByPointId(String pointId);
+
 }

+ 6 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/impl/StorgeTypeServiceImpl.java

@@ -70,4 +70,10 @@ public class StorgeTypeServiceImpl extends SuperCacheServiceImpl<StorgeTypeMappe
         return removeById(model);
     }
 
+    @Override
+    public StorgeType findOneByPointId(String pointId) {
+
+        return baseMapper.findOneByPointId(pointId);
+    }
+
 }

+ 17 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/ToolRobotNodeServiceImpl.java

@@ -13,7 +13,9 @@ import com.github.zuihou.business.centralToolMagazine.service.ToolStorgeService;
 import com.github.zuihou.business.centralToolMagazine.service.ToolTaskExecuteService;
 import com.github.zuihou.business.edgeLibrary.entity.StockInfo;
 import com.github.zuihou.business.edgeLibrary.entity.Storge;
+import com.github.zuihou.business.edgeLibrary.entity.StorgeType;
 import com.github.zuihou.business.edgeLibrary.service.StorgeService;
+import com.github.zuihou.business.edgeLibrary.service.StorgeTypeService;
 import com.github.zuihou.business.operationManagementCenter.entity.*;
 import com.github.zuihou.business.operationManagementCenter.service.ToolTaskNodeService;
 import com.github.zuihou.business.operationManagementCenter.service.ToolTaskService;
@@ -100,6 +102,9 @@ public class ToolRobotNodeServiceImpl implements ToolNodeOperationService {
 
     private String instructionUrl;
 
+    @Autowired
+    private StorgeTypeService storgeTypeService;
+
     private static String URL = "http://192.168.0.0.1:8099/api/RobotAction";
 
     @Autowired
@@ -414,7 +419,19 @@ public class ToolRobotNodeServiceImpl implements ToolNodeOperationService {
                 toolStorgeService.lockStorge(startStore, taskNode.getId());
 
 
+                // 根据起始点位,获取点位属于的类型
+                StorgeType locationStorgeType  = null;
+                StorgeType ltargetStorgeType = null;
+                if(!startStore.getPointId().isEmpty()){
+                    locationStorgeType = storgeTypeService.findOneByPointId(startStore.getPointId());
+                }
+                if(!tartgetToolStorge.getPointId().isEmpty()){
+                    ltargetStorgeType = storgeTypeService.findOneByPointId(tartgetToolStorge.getPointId());
+                }
+
                 Map locationMap = new HashMap();
+                locationMap.put("locationArea", locationStorgeType==null?"": locationStorgeType.getStorgeType());  //当前区域
+                locationMap.put("destLocationArea", ltargetStorgeType ==null?"": ltargetStorgeType.getStorgeType());  //目的区域
                 locationMap.put("location", startStore.getPointId());
                 locationMap.put("destLocation", tartgetToolStorge.getPointId());
                 dataMap.put("data", locationMap);

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

@@ -8,7 +8,9 @@ import com.github.zuihou.business.DemoLine.DemoLineConstant;
 import com.github.zuihou.business.DemoLine.YunjianConstant;
 import com.github.zuihou.business.edgeLibrary.entity.StockInfo;
 import com.github.zuihou.business.edgeLibrary.entity.Storge;
+import com.github.zuihou.business.edgeLibrary.entity.StorgeType;
 import com.github.zuihou.business.edgeLibrary.service.StorgeService;
+import com.github.zuihou.business.edgeLibrary.service.StorgeTypeService;
 import com.github.zuihou.business.operationManagementCenter.entity.Plan;
 import com.github.zuihou.business.operationManagementCenter.entity.TTask;
 import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
@@ -89,6 +91,9 @@ public class CacheRobotStrategy implements RobotStrategy {
     @Autowired
     private MsgUtil msgUtil;
 
+    @Autowired
+    private StorgeTypeService storgeTypeService;
+
     @Override
     public Map robotInfo(TaskNode taskNode, String zoneName) {
         Map<String, Object> robotInfo = Maps.newConcurrentMap();
@@ -225,8 +230,23 @@ public class CacheRobotStrategy implements RobotStrategy {
             returnMap.put(DemoLineConstant.DEMOLINE_STOCK_TYPE, DemoLineConstant.DEMOLINE_STOCK_TYPE_ALL_CRK);
         }
 
+        // 根据起始点位,获取点位属于的类型
+        StorgeType locationStorgeType  = null;
+        StorgeType ltargetStorgeType = null;
+        if(!targetStorge.getPointId().isEmpty()){
+
+            locationStorgeType = storgeTypeService.findOneByPointId(startStorge.getPointId());
+        }
+
+        if(!targetStorge.getPointId().isEmpty()){
+            ltargetStorgeType = storgeTypeService.findOneByPointId(targetStorge.getPointId());
+        }
+
+
         //满足条件--机器人空闲,设备或线边库有一个空闲
         Map locationMap = new HashMap();
+        locationMap.put("locationArea", locationStorgeType==null?"": locationStorgeType.getStorgeType());  //当前区域
+        locationMap.put("destLocationArea", ltargetStorgeType ==null?"": ltargetStorgeType.getStorgeType());  //目的区域
         locationMap.put("location", startStorge.getPointId());  //零件当前位置
         locationMap.put("destLocation", targetStorge.getPointId()); //机器人缓存位
         locationMap.put("taskType", DictionaryKey.TASK_TYPE.get("CARRY"));

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

@@ -4,7 +4,9 @@ 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.entity.StorgeType;
 import com.github.zuihou.business.edgeLibrary.service.StorgeService;
+import com.github.zuihou.business.edgeLibrary.service.StorgeTypeService;
 import com.github.zuihou.business.operationManagementCenter.entity.TTask;
 import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
 import com.github.zuihou.business.operationManagementCenter.service.TaskNodeService;
@@ -67,6 +69,9 @@ public class NoCacheRobotStrategy implements RobotStrategy {
     @Autowired
     private MsgUtil msgUtil;
 
+    @Autowired
+    private StorgeTypeService storgeTypeService;
+
 
     @Override
     public Map robotInfo(TaskNode taskNode, String zoneName) {
@@ -127,8 +132,21 @@ public class NoCacheRobotStrategy implements RobotStrategy {
         returnMap.put("method", "RobotAction");
         returnMap.put("fromStorge", startStore);
 
+
+        // 根据起始点位,获取点位属于的类型
+        StorgeType locationStorgeType  = null;
+        StorgeType ltargetStorgeType = null;
+        if(!startStore.getPointId().isEmpty()){
+            locationStorgeType = storgeTypeService.findOneByPointId(startStore.getPointId());
+        }
+        if(!targetStorge.getPointId().isEmpty()){
+            ltargetStorgeType = storgeTypeService.findOneByPointId(targetStorge.getPointId());
+        }
+
         //目的地为缓存位
         Map locationMap = new HashMap();
+        locationMap.put("locationArea", locationStorgeType==null?"": locationStorgeType.getStorgeType());  //当前区域
+        locationMap.put("destLocationArea", ltargetStorgeType ==null?"": ltargetStorgeType.getStorgeType());  //目的区域
         locationMap.put("location",startStore.getPointId());
         locationMap.put("destLocation",targetStorge.getPointId());
         returnMap.put("data", locationMap);

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

@@ -32,7 +32,7 @@ public class ManualTaskOperatorUtil {
     //框体
     private static String ZK_ip_rxx = "192.168.11.170";
     //舱体
-    private static String ZK_ip_zndy = "192.168.11.150";
+    private static String ZK_ip_zndy = "192.168.0.106";
 
     // 障平台PLC端口
     private static String ZK_ip_zlzx_port = "102";

+ 11 - 0
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/edgeLibrary/StorgeTypeMapper.xml

@@ -10,6 +10,7 @@
         <result column="create_user" jdbcType="BIGINT" property="createUser"/>
         <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
         <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="storge_type" jdbcType="VARCHAR" property="storgeType"/>
         <result column="status" jdbcType="VARCHAR" property="status"/>
     </resultMap>
 
@@ -19,4 +20,14 @@
         name, status
     </sql>
 
+
+    <select id="findOneByPointId" parameterType="String" resultMap="BaseResultMap">
+        SELECT
+            *
+        FROM
+            imcs_s_storge a
+            LEFT JOIN imcs_s_storge_type b ON a.storge_type_id = b.id
+        WHERE a.point_id = #{pointId}
+    </select>
+
 </mapper>

+ 7 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/edgeLibrary/dto/StorgeTypeUpdateDTO.java

@@ -1,5 +1,7 @@
 package com.github.zuihou.business.edgeLibrary.dto;
 
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import javax.validation.constraints.NotEmpty;
@@ -47,6 +49,11 @@ public class StorgeTypeUpdateDTO implements Serializable {
     @NotEmpty(message = "仓库名称不能为空")
     @Length(max = 128, message = "仓库名称长度不能超过128")
     private String name;
+
+    @ApiModelProperty(value = "仓库类别(使用在与ccs交互的时候可以知道点位属于那个区域,与plc交互使用)")
+    @Length(max = 128, message = "仓库名称长度不能超过128")
+    private String storgeType;
+
     @ApiModelProperty(value = "")
     @Length(max = 4, message = "长度不能超过4")
     private String status;

+ 7 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/edgeLibrary/entity/StorgeType.java

@@ -49,6 +49,13 @@ public class StorgeType extends Entity<Long> {
     @Excel(name = "仓库名称")
     private String name;
 
+    @ApiModelProperty(value = "仓库类别(使用在与ccs交互的时候可以知道点位属于那个区域,与plc交互使用)")
+    @NotEmpty(message = "仓库名称不能为空")
+    @Length(max = 128, message = "仓库名称长度不能超过128")
+    @TableField(value = "storge_type", condition = LIKE)
+    @Excel(name = "仓库类别")
+    private String storgeType;
+
     @ApiModelProperty(value = "状态")
     @Length(max = 4, message = "长度不能超过4")
     @TableField(value = "status", condition = LIKE)