| | |
| | | package com.vincent.rsf.server.api.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.api.service.AgvService; |
| | | import com.vincent.rsf.server.manager.entity.BasStation; |
| | | import com.vincent.rsf.server.manager.entity.WaitPakin; |
| | | import com.vincent.rsf.server.manager.entity.WaitPakinItem; |
| | | import com.vincent.rsf.server.manager.entity.WarehouseAreas; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.enums.LocStsType; |
| | | import com.vincent.rsf.server.manager.enums.PakinIOStatus; |
| | | import com.vincent.rsf.server.manager.enums.StaUseStatusType; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.vincent.rsf.server.manager.utils.LocManageUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private WarehouseAreasService warehouseAreasService; |
| | | @Autowired |
| | | private TaskService taskService; |
| | | @Autowired |
| | | private BasContainerService basContainerService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | } |
| | | BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, sta) |
| | | .eq(BasStation::getUseStatus,StaUseStatusType.TYPE_O.type) |
| | | .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) |
| | | ); |
| | | if (Cools.isEmpty(basStation)){ |
| | | throw new CoolException("未找到接驳站点信息,请检查站点状态"); |
| | |
| | | } |
| | | BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, sta) |
| | | .eq(BasStation::getUseStatus,StaUseStatusType.TYPE_F.type) |
| | | .eq(BasStation::getUseStatus,LocStsType.LOC_STS_TYPE_F.type) |
| | | ); |
| | | if (Cools.isEmpty(basStation)){ |
| | | throw new CoolException("未找到接驳站点信息,请检查站点状态"); |
| | |
| | | |
| | | taskService.generateAGVTasks(waitPakin,targetLoc,sta,loginUserId); |
| | | |
| | | basStation.setUseStatus(StaUseStatusType.TYPE_R.type); |
| | | basStation.setUseStatus(LocStsType.LOC_STS_TYPE_R.type); |
| | | if (!basStationService.updateById(basStation)){ |
| | | throw new CoolException("更新站点状态失败"); |
| | | } |
| | |
| | | } |
| | | BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, sta) |
| | | .eq(BasStation::getUseStatus,StaUseStatusType.TYPE_F.type) |
| | | .eq(BasStation::getUseStatus,LocStsType.LOC_STS_TYPE_F.type) |
| | | ); |
| | | if (Cools.isEmpty(basStation)){ |
| | | throw new CoolException("未找到接驳站点信息,请检查站点状态"); |
| | |
| | | throw new CoolException("未找到组托数据,请检查状态"); |
| | | } |
| | | basStation.setBarcode(null); |
| | | basStation.setUseStatus(StaUseStatusType.TYPE_O.type); |
| | | basStation.setUseStatus(LocStsType.LOC_STS_TYPE_O.type); |
| | | if (!basStationService.updateById(basStation)){ |
| | | throw new CoolException("更新站点状态失败"); |
| | | } |
| | |
| | | } |
| | | BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, sta) |
| | | .eq(BasStation::getUseStatus,StaUseStatusType.TYPE_F.type) |
| | | .eq(BasStation::getUseStatus,LocStsType.LOC_STS_TYPE_F.type) |
| | | ); |
| | | if (Cools.isEmpty(basStation)){ |
| | | throw new CoolException("未找到接驳站点信息,请检查站点状态"); |
| | |
| | | //验证基础信息 |
| | | BasStation basStation = checkStaStatus(barcode, sta); |
| | | //更新站点状态 |
| | | basStation.setUseStatus(StaUseStatusType.TYPE_F.type); |
| | | basStation.setUseStatus(LocStsType.LOC_STS_TYPE_F.type); |
| | | basStation.setBarcode(barcode); |
| | | if (!basStationService.updateById(basStation)){ |
| | | throw new CoolException("更新站点状态失败"); |
| | |
| | | if (!basStation.getUseStatus().equals("O")){ |
| | | throw new CoolException("站点状态不为空闲"); |
| | | } |
| | | if (!Cools.isEmpty(basStation.getContainerType())){ |
| | | List<Long> longs1 = JSONObject.parseArray(basStation.getContainerType(), Long.class); |
| | | List<BasContainer> containers = basContainerService.list( |
| | | new LambdaQueryWrapper<BasContainer>() |
| | | .in(BasContainer::getContainerType, longs1) |
| | | ); |
| | | boolean matches = containers.stream() |
| | | .map(BasContainer::getCodeType) |
| | | .anyMatch(codeType -> barcode.matches(codeType)); |
| | | if (!matches) { |
| | | throw new CoolException("条码与站点不匹配"); |
| | | } |
| | | } |
| | | |
| | | return basStation; |
| | | } |
| | | } |