| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.common.domain.dto.LocTypeDto; |
| | | import com.zy.asrs.common.domain.dto.StartupDto; |
| | | import com.zy.asrs.common.domain.entity.StaDesc; |
| | | import com.zy.asrs.common.sys.service.StaDescService; |
| | | import com.zy.asrs.common.wms.entity.*; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | |
| | | * @return workNo(工作号) |
| | | */ |
| | | public int getWorkNo(Integer wrkMk) { |
| | | WrkLastno wrkLastno = wrkLastnoService.getById(wrkMk); |
| | | WrkLastno wrkLastno = wrkLastnoService.getOne(new LambdaQueryWrapper<WrkLastno>().eq(WrkLastno::getWrkMk, wrkMk)); |
| | | if (Cools.isEmpty(wrkLastno)) { |
| | | throw new CoolException("数据异常,请联系管理员"); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 检索库位号 |
| | | * |
| | | * @param whsType 类型 1:双深式货架 |
| | | * @param staDescId 路径ID |
| | | * @param sourceStaNo 源站 |
| | | * @param matnr 物料号集合 |
| | | * @return locNo 检索到的库位号 |
| | | */ |
| | | @Transactional |
| | | public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) { |
| | | public StartupDto getLocNo(Integer staDescId, Integer sourceStaNo, Long hostId, LocTypeDto locTypeDto, int times) { |
| | | // 目标库位 |
| | | LocMast locMast = null; |
| | | |
| | |
| | | // } |
| | | |
| | | //搜索整个空库位组 |
| | | locMast = getLocNoStepSingle(locTypeDto, staDescId, sourceStaNo); |
| | | locMast = getLocNoStepSingle(locTypeDto, staDescId, sourceStaNo, hostId); |
| | | if (locMast != null) { |
| | | //找到库位,返回dto |
| | | return getLocNoStep6(staDescId, sourceStaNo, locMast);//返回dto |
| | |
| | | List<LocMast> locMasts = locMastService.list(new LambdaQueryWrapper<LocMast>() |
| | | .eq(LocMast::getLocSts, "O") |
| | | .eq(LocMast::getLocType1, 1) |
| | | .eq(LocMast::getCrnNo, staDesc.getCrnNo()) |
| | | .eq(LocMast::getCrnNo, staDesc.getDeviceNo()) |
| | | .orderByAsc(LocMast::getLev1, LocMast::getBay1, LocMast::getRow1)); |
| | | if (!locMasts.isEmpty()) { |
| | | for (LocMast loc : locMasts) { |
| | |
| | | } |
| | | |
| | | // 搜索单品(整个库位组) |
| | | private LocMast getLocNoStepSingle(LocTypeDto locTypeDto, Integer staDescId, Integer sourceStaNo) { |
| | | private LocMast getLocNoStepSingle(LocTypeDto locTypeDto, Integer staDescId, Integer sourceStaNo, Long hostId) { |
| | | LocMast locMast = null; |
| | | // 获取目标站 |
| | | LambdaQueryWrapper<StaDesc> wrapper = new LambdaQueryWrapper<StaDesc>() |
| | | .eq(StaDesc::getTypeNo, staDescId) |
| | | .eq(StaDesc::getStnNo, sourceStaNo); |
| | | .eq(StaDesc::getStnNo, sourceStaNo) |
| | | .eq(StaDesc::getHostId, hostId); |
| | | StaDesc staDesc = staDescService.getOne(wrapper); |
| | | if (staDesc == null) { |
| | | throw new CoolException("入库路径不存在"); |
| | | } |
| | | |
| | | List<LocMast> locMasts = locMastService.list(new LambdaQueryWrapper<LocMast>().eq(LocMast::getLocSts, "O"));//搜索货物 |
| | | List<LocMast> locMasts = locMastService.list(new LambdaQueryWrapper<LocMast>().eq(LocMast::getLocSts, "O").eq(LocMast::getHostId, hostId));//搜索货物 |
| | | |
| | | if (locMasts == null) { |
| | | return null; |
| | |
| | | // 获取目标站 |
| | | LambdaQueryWrapper<StaDesc> wrapper = new LambdaQueryWrapper<StaDesc>() |
| | | .eq(StaDesc::getTypeNo, staDescId) |
| | | .eq(StaDesc::getStnNo, sourceStaNo) |
| | | .eq(StaDesc::getCrnNo,locMast.getCrnNo()); |
| | | .eq(StaDesc::getStnNo, sourceStaNo); |
| | | StaDesc staDesc = staDescService.getOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | log.error("入库路径不存在, staDescId={}, sourceStaNo={}", staDescId, sourceStaNo); |
| | |
| | | } |
| | | |
| | | // 检测目标站 |
| | | BasDevp staNo = basDevpService.getById(staDesc.getCrnStn()); |
| | | BasDevp staNo = basDevpService.getById(staDesc.getDeviceStn()); |
| | | if (!staNo.getAutoing().equals("Y")) { |
| | | throw new CoolException("目标站" + staDesc.getCrnStn() + "不可用"); |
| | | throw new CoolException("目标站" + staDesc.getDeviceStn() + "不可用"); |
| | | } |
| | | |
| | | // 生成工作号 |
| | |
| | | startupDto.setSourceStaNo(sourceStaNo); |
| | | startupDto.setStaNo(staNo.getDevNo()); |
| | | startupDto.setLocNo(locMast.getLocNo()); |
| | | startupDto.setCrnNo(staDesc.getCrnNo()); |
| | | return startupDto; |
| | | } |
| | | } |