|
@@ -17,21 +17,15 @@ 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.WorkpieceService;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.dao.BBomMapper;
|
|
|
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;
|
|
|
-import com.github.zuihou.business.productionResourceCenter.entity.ZZoneProductionresource;
|
|
|
-import com.github.zuihou.business.productionResourceCenter.service.NodeOperationService;
|
|
|
-import com.github.zuihou.business.productionResourceCenter.service.ProductionresourcePositionService;
|
|
|
-import com.github.zuihou.business.productionResourceCenter.service.ZZoneProductionresourceService;
|
|
|
-import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.dao.*;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.entity.*;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.service.*;
|
|
|
import com.github.zuihou.business.util.MsgUtil;
|
|
|
import com.github.zuihou.common.constant.BizConstant;
|
|
|
import com.github.zuihou.common.constant.DictionaryKey;
|
|
@@ -46,6 +40,7 @@ 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;
|
|
|
|
|
@@ -84,6 +79,14 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
private StockInfoMapper stockInfoMapper;
|
|
|
@Autowired
|
|
|
private StorgeMapper storgeMapper;
|
|
|
+ @Autowired
|
|
|
+ private ProductionresourceBizMapper productionresourceBizMapper;
|
|
|
+ @Autowired
|
|
|
+ private ResourceAutoCodeMapper resourceAutoCodeMapper;
|
|
|
+ @Autowired
|
|
|
+ private ZZoneMapper zZoneMapper;
|
|
|
+ @Autowired
|
|
|
+ private BBomMapper bBomMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private ZZoneService zoneService;
|
|
@@ -118,6 +121,8 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
|
|
|
private ZZone zZone;
|
|
|
|
|
|
+ private Long bomZzoneId;
|
|
|
+
|
|
|
@Override
|
|
|
public void initResource(TaskNode taskNode, TTask task, Map dataMap) {
|
|
|
//productionresourcePosition = getResourcePosition(taskNode);
|
|
@@ -143,6 +148,9 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
zoneId = zoneProductionresource.getZoneId();
|
|
|
zZone = zoneService.getById(zoneId);
|
|
|
zoneName = zoneService.getById(zoneId).getName();
|
|
|
+ BBom bom = bBomMapper.selectById(task.getBomId());
|
|
|
+ bomZzoneId = bom.getZoneId();
|
|
|
+ task.getBomId();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -198,6 +206,62 @@ public class RobotNodeServiceImpl implements NodeOperationService {
|
|
|
currStore = workpieceService.getWorkPieceStock(taskNode.getId(), false);
|
|
|
}
|
|
|
|
|
|
+ // 先判断上一指令是否为是否为设备指令,在判断工序最后一个指令是agv动作时锁定锁定agv接驳位
|
|
|
+ TaskNode beforTaskNode = taskNodeService.getNextNTaskNode(taskNode,-1);
|
|
|
+ TaskNode nextTaskNode = taskNodeService.getNextNTaskNode(taskNode,1);
|
|
|
+ TaskNode lastOperationTaskNode = taskNodeService.getOne(Wraps.<TaskNode>lbQ().eq(TaskNode::getTaskId,taskNode.getTaskId()).orderByDesc(TaskNode::getCompleteBatchSort).last("limit 1"));
|
|
|
+
|
|
|
+ Productionresource productionresource = productionresourceBizMapper.selectById(beforTaskNode.getResourceId());
|
|
|
+ beforTaskNode.setAutoNode(resourceAutoCodeMapper.selectById(beforTaskNode.getAutoNode().getId()));
|
|
|
+ //前序是设备序并且最后一个节点是agv搬运,锁定agv相关库位信息
|
|
|
+ if(beforTaskNode.getTaskId().equals(taskNode.getTaskId()) && "1".equals(beforTaskNode.getAutoNode().getCategory()) && null == lastOperationTaskNode.getResourceId()){
|
|
|
+ ProductionresourcePosition startProductionresourcePosition = null;
|
|
|
+ ProductionresourcePosition endProductionresourcePosition = null;
|
|
|
+ Storge agvStartStationStorge = null;
|
|
|
+ Storge agvEndStationStorge = null;
|
|
|
+ // 判断agv接驳位是可用
|
|
|
+ ZZoneProductionresource zZoneProductionresource = zZoneProductionresourceMapper.selectOne(Wraps.<ZZoneProductionresource>lbQ().eq(ZZoneProductionresource::getResourceId,taskNode.getResourceId()));
|
|
|
+ Map queryParams = new HashMap();
|
|
|
+ queryParams.put("zoneId",zZoneProductionresource.getZoneId());
|
|
|
+ queryParams.put("resourceName","接驳");
|
|
|
+ List<Productionresource> agvStartStationsResources = productionresourceBizMapper.selectResouces(queryParams);
|
|
|
+
|
|
|
+ // 遍历开始接驳位判断是否有可用的接驳位
|
|
|
+ for(Productionresource agvStation : agvStartStationsResources){
|
|
|
+ startProductionresourcePosition = productionresourcePositionMapper.selectOne(Wraps.<ProductionresourcePosition>lbQ().eq(ProductionresourcePosition::getResourceId, agvStation.getId()));
|
|
|
+ List<StockInfo> agvStationMeterails = stockInfoMapper.selectList(Wraps.<StockInfo>lbQ().eq(StockInfo::getStorgeId,endProductionresourcePosition.getStorgeId()));
|
|
|
+ List<String> meterails = agvStationMeterails.stream().map(p -> p.getGoodsType()).collect(Collectors.toList());
|
|
|
+ agvStartStationStorge = storgeService.getById(startProductionresourcePosition.getStorgeId());
|
|
|
+ // 有托板但是没有托盘认为可放
|
|
|
+ if(meterails.contains("5") && !meterails.contains("2") && agvStartStationStorge.getStatus().equals("1")){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ queryParams.clear();
|
|
|
+ queryParams.put("zoneId",bomZzoneId);
|
|
|
+ queryParams.put("resourceName","接驳");
|
|
|
+ List<Productionresource> agvEndStationsResources = productionresourceBizMapper.selectResouces(queryParams);
|
|
|
+
|
|
|
+ // 遍历开始接驳位判断是否有可用的接驳位
|
|
|
+ for(Productionresource agvStation : agvEndStationsResources){
|
|
|
+ endProductionresourcePosition = productionresourcePositionMapper.selectOne(Wraps.<ProductionresourcePosition>lbQ().eq(ProductionresourcePosition::getResourceId, agvStation.getId()));
|
|
|
+ List<StockInfo> agvStationMeterails = stockInfoMapper.selectList(Wraps.<StockInfo>lbQ().eq(StockInfo::getStorgeId,endProductionresourcePosition.getStorgeId()));
|
|
|
+ List<String> meterails = agvStationMeterails.stream().map(p -> p.getGoodsType()).collect(Collectors.toList());
|
|
|
+ agvEndStationStorge = storgeService.getById(endProductionresourcePosition.getStorgeId());
|
|
|
+ // 有托板但是没有托盘认为可放
|
|
|
+ if(meterails.contains("5") && !meterails.contains("2") && agvEndStationStorge.getStatus().equals("1")){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != agvStartStationStorge && null != agvEndStationStorge){
|
|
|
+ storgeService.lockStorge(agvStartStationStorge, nextTaskNode.getId());
|
|
|
+ storgeService.lockStorge(agvEndStationStorge, lastOperationTaskNode.getId());
|
|
|
+ }else{
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//目的库位
|
|
|
Storge jqrStorge = storgeService.getById(robotList.get(0).getStorgeId());
|
|
|
//目标地址判断
|