|
@@ -3,18 +3,27 @@ package com.github.zuihou.business.productionResourceCenter.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.github.zuihou.base.R;
|
|
|
import com.github.zuihou.business.DemoLine.DemoCacheKey;
|
|
|
import com.github.zuihou.business.DemoLine.DemoLineConstant;
|
|
|
import com.github.zuihou.business.DemoLine.YunjianConstant;
|
|
|
+import com.github.zuihou.business.edgeLibrary.dao.StockInfoMapper;
|
|
|
+import com.github.zuihou.business.edgeLibrary.dao.StorgeMapper;
|
|
|
+import com.github.zuihou.business.edgeLibrary.entity.StockInfo;
|
|
|
import com.github.zuihou.business.edgeLibrary.entity.Storge;
|
|
|
import com.github.zuihou.business.edgeLibrary.service.StorgeService;
|
|
|
import com.github.zuihou.business.operationManagementCenter.entity.TTask;
|
|
|
+import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
|
|
|
import com.github.zuihou.business.operationManagementCenter.entity.TaskNode;
|
|
|
import com.github.zuihou.business.operationManagementCenter.service.TaskNodeService;
|
|
|
-import com.github.zuihou.business.operationManagementCenter.service.TaskService;
|
|
|
import com.github.zuihou.business.operationManagementCenter.service.WorkpieceService;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.dao.BomProcedureMapper;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.dao.BomProcedureTrayMapper;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.entity.BBom;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.entity.BomProcedure;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.entity.BomProcedureTray;
|
|
|
import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourcePositionMapper;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.dao.ZZoneProductionresourceMapper;
|
|
|
import com.github.zuihou.business.productionResourceCenter.entity.ProductionresourcePosition;
|
|
|
import com.github.zuihou.business.productionResourceCenter.entity.ResourceAutoCode;
|
|
|
import com.github.zuihou.business.productionResourceCenter.entity.ZZone;
|
|
@@ -28,24 +37,15 @@ import com.github.zuihou.common.constant.BizConstant;
|
|
|
import com.github.zuihou.common.constant.DictionaryKey;
|
|
|
import com.github.zuihou.common.util.StringUtil;
|
|
|
import com.github.zuihou.database.mybatis.conditions.Wraps;
|
|
|
-import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
|
|
|
-import com.github.zuihou.tenant.entity.Module;
|
|
|
-import com.github.zuihou.tenant.entity.Productionresource;
|
|
|
-import com.github.zuihou.tenant.entity.TenantResource;
|
|
|
-import com.github.zuihou.tenant.service.ModuleService;
|
|
|
-import com.github.zuihou.tenant.service.ProductionresourceService;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.checkerframework.checker.units.qual.C;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
import static java.util.stream.Collectors.groupingBy;
|
|
|
|
|
@@ -53,8 +53,6 @@ import static java.util.stream.Collectors.groupingBy;
|
|
|
@Service
|
|
|
public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
|
|
|
- private ProductionresourcePosition productionresourcePosition;
|
|
|
-
|
|
|
@Autowired
|
|
|
private ProductionresourcePositionService productionresourcePositionService;
|
|
|
|
|
@@ -67,9 +65,6 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
@Autowired
|
|
|
private StorgeService storgeService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private TaskService taskService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private MsgUtil msgUtil;
|
|
|
|
|
@@ -77,13 +72,18 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
private WorkpieceService workpieceService;
|
|
|
|
|
|
@Autowired
|
|
|
- private ProductionresourceService productionresourceService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ModuleService moduleService;
|
|
|
+ private ZZoneProductionresourceMapper zZoneProductionresourceMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private ZZoneProductionresourceService zZoneProductionresourceService;
|
|
|
+ @Autowired
|
|
|
+ private BomProcedureMapper bomProcedureMapper;
|
|
|
+ @Autowired
|
|
|
+ private BomProcedureTrayMapper bomProcedureTrayMapper;
|
|
|
+ @Autowired
|
|
|
+ private StockInfoMapper stockInfoMapper;
|
|
|
+ @Autowired
|
|
|
+ private StorgeMapper storgeMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private ZZoneService zoneService;
|
|
@@ -124,11 +124,11 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
//this.sxlzIdArr = new String[] {DemoLineConstant.JQR1};
|
|
|
String moduleName = dataMap.get("moduleName") == null ? "" : dataMap.get("moduleName").toString();
|
|
|
String robotType = dataMap.get("robotType") == null ? "" : dataMap.get("robotType").toString();
|
|
|
+ ZZoneProductionresource zoneProductionresource = zZoneProductionresourceMapper.selectOne(Wraps.<ZZoneProductionresource>lbQ().eq(ZZoneProductionresource::getResourceId,taskNode.getResourceId()));
|
|
|
if(StringUtil.isNotEmpty(moduleName)) {
|
|
|
//List<Module> modules = moduleService.list(new QueryWrapper<Module>().like("name", moduleName));
|
|
|
- Productionresource productionresource = productionresourceService.getOne(new QueryWrapper<Productionresource>().eq("id", taskNode.getResourceId()));
|
|
|
- if(productionresource!=null){
|
|
|
- deviceArr = new String[] {productionresource.getId().toString()};
|
|
|
+ if(zoneProductionresource!=null){
|
|
|
+ deviceArr = new String[] {zoneProductionresource.getResourceId().toString()};
|
|
|
robotList = productionresourcePositionService.getFreeProductionresourcePositionByIds(deviceArr);
|
|
|
}
|
|
|
}
|
|
@@ -140,8 +140,7 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
// jbwList = productionresourcePositionService.getFreeProductionresourcePositionByIds(jbwArr);
|
|
|
// }
|
|
|
//获取产线ID
|
|
|
- ZZoneProductionresource zZoneProductionresource = zZoneProductionresourceService.getOne(new LbqWrapper<ZZoneProductionresource>().eq(ZZoneProductionresource::getResourceId, taskNode.getResourceId()));
|
|
|
- zoneId = zZoneProductionresource.getZoneId();
|
|
|
+ zoneId = zoneProductionresource.getZoneId();
|
|
|
zZone = zoneService.getById(zoneId);
|
|
|
zoneName = zoneService.getById(zoneId).getName();
|
|
|
}
|
|
@@ -174,7 +173,31 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
// return map;
|
|
|
// }
|
|
|
//开始库位
|
|
|
- Storge currStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
|
|
|
+ // add by yejian on 20220329 for 区分上料逻辑,起点需要取判断托盘家具是否够用
|
|
|
+ // 查找工件所属产线
|
|
|
+ // 根据工序判断需要做什么任务
|
|
|
+ Storge currStore = null;
|
|
|
+ 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()));
|
|
|
+ // 判断夹具是否有可用的,查询330个库位信息中是否还有夹具
|
|
|
+ List<StockInfo> stockInfos = stockInfoMapper.selectList(Wraps.<StockInfo>lbQ().eq(StockInfo::getGoodsId,bomProcedureTray.getTrayId()).orderByAsc(StockInfo::getStorgeId));
|
|
|
+ if(stockInfos.size() <= 0){
|
|
|
+ map.put("result", false);
|
|
|
+ map.put("msg", DictionaryKey.NodeException.RUNNING_FALSE);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+ // 按照顺序将托盘移动到上下料站
|
|
|
+ // 获取抓取托盘起点及放设备重点
|
|
|
+ StockInfo metetailStockInfo = stockInfos.get(0);
|
|
|
+ ProductionresourcePosition startProductionresourcePosition = productionresourcePositionMapper.selectOne(Wraps.<ProductionresourcePosition>lbQ().eq(ProductionresourcePosition::getStorgeId, metetailStockInfo.getStorgeId()));
|
|
|
+ currStore = storgeMapper.selectById(startProductionresourcePosition.getStorgeId());
|
|
|
+ }else{
|
|
|
+ currStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
|
|
|
+ }
|
|
|
+
|
|
|
//目的库位
|
|
|
Storge jqrStorge = storgeService.getById(robotList.get(0).getStorgeId());
|
|
|
//目标地址判断
|