|
@@ -36,6 +36,7 @@ import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
|
|
|
import com.github.zuihou.injection.annonation.InjectionResult;
|
|
import com.github.zuihou.injection.annonation.InjectionResult;
|
|
|
import com.github.zuihou.utils.BeanPlusUtil;
|
|
import com.github.zuihou.utils.BeanPlusUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -261,6 +262,11 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
|
|
|
//返回的map
|
|
//返回的map
|
|
|
Map returnMap = new HashMap();
|
|
Map returnMap = new HashMap();
|
|
|
|
|
|
|
|
|
|
+ String tempAgvTaskEndPoint = "";
|
|
|
|
|
+ String tempAgvTaskStartPoint = "";
|
|
|
|
|
+ Storge tempAgvTaskStartPointStorge = null;
|
|
|
|
|
+ Storge tempAgvTaskEndPointStorge = null;
|
|
|
|
|
+
|
|
|
Storge storge = null;
|
|
Storge storge = null;
|
|
|
String resourceId = null;
|
|
String resourceId = null;
|
|
|
String jbwCode = "";
|
|
String jbwCode = "";
|
|
@@ -270,7 +276,7 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
|
|
|
map.put("codes",StringUtil.changeIdsArrToSubQueryStr(jbw));
|
|
map.put("codes",StringUtil.changeIdsArrToSubQueryStr(jbw));
|
|
|
map.put("haveGoods","1");
|
|
map.put("haveGoods","1");
|
|
|
map.put("findAgvStation","1");
|
|
map.put("findAgvStation","1");
|
|
|
- List<ProductionresourcePosition>jbwList = productionresourcePositionMapper.getPPList(map);
|
|
|
|
|
|
|
+ List<ProductionresourcePosition> jbwList = productionresourcePositionMapper.getPPList(map);
|
|
|
log.info("查找起点接驳位{}",jbwList);
|
|
log.info("查找起点接驳位{}",jbwList);
|
|
|
if(jbwList!=null&&jbwList.size()>0){
|
|
if(jbwList!=null&&jbwList.size()>0){
|
|
|
// //查出当前工件属于产线的托板
|
|
// //查出当前工件属于产线的托板
|
|
@@ -278,9 +284,12 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
|
|
|
//根据接驳位分组
|
|
//根据接驳位分组
|
|
|
Map<String,List<ProductionresourcePosition>> jbwMap = jbwList.stream().collect(groupingBy(ProductionresourcePosition::getNo));
|
|
Map<String,List<ProductionresourcePosition>> jbwMap = jbwList.stream().collect(groupingBy(ProductionresourcePosition::getNo));
|
|
|
List<ProductionresourcePosition> tbList = new ArrayList<>();
|
|
List<ProductionresourcePosition> tbList = new ArrayList<>();
|
|
|
|
|
+
|
|
|
for(String key:jbwMap.keySet()){
|
|
for(String key:jbwMap.keySet()){
|
|
|
List<ProductionresourcePosition> list = jbwMap.get(key);
|
|
List<ProductionresourcePosition> list = jbwMap.get(key);
|
|
|
- if(list!=null&&list.size()==1){//必须是存放了1个托板
|
|
|
|
|
|
|
+ // 无托板
|
|
|
|
|
+ if(list!=null&&list.size()==1){
|
|
|
|
|
+ // 必须是存放了1个托板
|
|
|
ProductionresourcePosition p = list.get(0);
|
|
ProductionresourcePosition p = list.get(0);
|
|
|
if(BizConstant.STOCK_GOODS_TYPE_5.equals(p.getCategory())){
|
|
if(BizConstant.STOCK_GOODS_TYPE_5.equals(p.getCategory())){
|
|
|
// if(BizConstant.STOCK_GOODS_TYPE_5.equals(p.getCategory())&&plateMap.containsKey(p.getGoodsId())){
|
|
// if(BizConstant.STOCK_GOODS_TYPE_5.equals(p.getCategory())&&plateMap.containsKey(p.getGoodsId())){
|
|
@@ -290,6 +299,7 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//拼凑出托板列表,一起查询提高效率,避免循环查询
|
|
//拼凑出托板列表,一起查询提高效率,避免循环查询
|
|
|
log.info("查找起点可用接驳位{}",tbList);
|
|
log.info("查找起点可用接驳位{}",tbList);
|
|
|
if(tbList!=null&&tbList.size()>0){
|
|
if(tbList!=null&&tbList.size()>0){
|
|
@@ -321,6 +331,18 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
|
|
|
resourceId = position.getResourceId()==null?"":position.getResourceId().toString();
|
|
resourceId = position.getResourceId()==null?"":position.getResourceId().toString();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ }else{
|
|
|
|
|
+ Map storgeParams = new HashMap();
|
|
|
|
|
+ storgeParams.put("codes",StringUtil.changeIdsArrToSubQueryStr(jbw));
|
|
|
|
|
+ storgeParams.put("freeFlag","1");
|
|
|
|
|
+ storgeParams.put("findAgvStation","1");
|
|
|
|
|
+ List<ProductionresourcePosition> productionresourcePositions = productionresourcePositionMapper.getPPList(storgeParams);
|
|
|
|
|
+
|
|
|
|
|
+ if(productionresourcePositions.size() > 0){
|
|
|
|
|
+ ProductionresourcePosition productionresourcePosition = productionresourcePositions.get(0);
|
|
|
|
|
+ tempAgvTaskEndPoint = productionresourcePosition.getCode();
|
|
|
|
|
+ tempAgvTaskEndPointStorge = baseMapper.selectById(productionresourcePosition.getStorgeId());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(storge!=null){
|
|
if(storge!=null){
|
|
@@ -328,6 +350,41 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
|
|
|
storge.setResourceNo(jbwCode);
|
|
storge.setResourceNo(jbwCode);
|
|
|
returnMap.put("jbwCode",jbwCode);
|
|
returnMap.put("jbwCode",jbwCode);
|
|
|
returnMap.put("resourceId",resourceId);
|
|
returnMap.put("resourceId",resourceId);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ if(StringUtils.isNotBlank(tempAgvTaskEndPoint)){
|
|
|
|
|
+// begin add by yejian on 20220802 for 判断如果接驳位起始不可用时判断是否有可用的空托盘,如果有,先让agv搬运到需放料所在位子
|
|
|
|
|
+ // 查找未被锁定并且空的托盘所在位子
|
|
|
|
|
+ List<String> includeJbwList = new ArrayList(Arrays.asList(jbw.split(",")));
|
|
|
|
|
+ String allJbw = DictionaryKey.YJ_ZONE_JBW.get("allJbw");
|
|
|
|
|
+
|
|
|
|
|
+ List<String> allJbwList = new ArrayList(Arrays.asList(allJbw.split(",")));
|
|
|
|
|
+ allJbwList.removeAll(includeJbwList);
|
|
|
|
|
+ Map usableJbwPlateMap = new HashMap();
|
|
|
|
|
+
|
|
|
|
|
+ usableJbwPlateMap.put("codes",StringUtil.changeIdsArrToSubQueryStr(allJbwList));
|
|
|
|
|
+ usableJbwPlateMap.put("haveGoods","1");
|
|
|
|
|
+ usableJbwPlateMap.put("findAgvStation","1");
|
|
|
|
|
+ List<ProductionresourcePosition> tempAgvStartList = productionresourcePositionMapper.getPPList(usableJbwPlateMap);
|
|
|
|
|
+
|
|
|
|
|
+ if(tempAgvStartList.size() > 0){
|
|
|
|
|
+ Map<String,List<ProductionresourcePosition>> tempAgvStartMap = tempAgvStartList.stream().collect(groupingBy(ProductionresourcePosition::getNo));
|
|
|
|
|
+ for(String key:tempAgvStartMap.keySet()){
|
|
|
|
|
+ List<ProductionresourcePosition> list = tempAgvStartMap.get(key);
|
|
|
|
|
+ // 无托板
|
|
|
|
|
+ if(list!=null && list.size()==1 && StringUtils.isBlank(tempAgvTaskStartPoint)){
|
|
|
|
|
+ // 必须是存放了1个托板
|
|
|
|
|
+ tempAgvTaskStartPoint = list.get(0).getCode();
|
|
|
|
|
+ tempAgvTaskStartPointStorge = baseMapper.selectById(list.get(0).getStorgeId());
|
|
|
|
|
+ returnMap.put("tempAgvTaskStartPoint",tempAgvTaskStartPoint);
|
|
|
|
|
+ returnMap.put("tempAgvTaskEndPoint",tempAgvTaskEndPoint);
|
|
|
|
|
+ returnMap.put("tempAgvTaskStartPointStorge",tempAgvTaskStartPointStorge);
|
|
|
|
|
+ returnMap.put("tempAgvTaskEndPointStorge",tempAgvTaskEndPointStorge);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ // end add by yejian on 20220802 for 判断如果接驳位起始不可用时判断是否有可用的空托盘,如果有,先让agv搬运到需放料所在位子
|
|
|
}
|
|
}
|
|
|
return returnMap;
|
|
return returnMap;
|
|
|
}
|
|
}
|