diff --git a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseLocationServiceImpl.java b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseLocationServiceImpl.java index 999410c..c42b430 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseLocationServiceImpl.java +++ b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseLocationServiceImpl.java @@ -178,7 +178,7 @@ public class BaseLocationServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper().in(BaseLocation::getId, ids) .eq(BaseLocation::getBranchId, SecurityUtils.getCurrentBranchId()); - return this.update(del, wrapper)==true ?Result.ok().msg("启用/禁用货位成功"):Result.err().msg("启用/禁用货位失败"); + return this.update(del, wrapper) == true ? Result.ok().msg("启用/禁用货位成功") : Result.err().msg("启用/禁用货位失败"); } @@ -815,7 +815,7 @@ public class BaseLocationServiceImpl extends ServiceImpl assignEmptyLocationAll(AssingEmptyLocBo assingEmptyLocBo,String lcoatinTunnel) { + public synchronized Result assignEmptyLocationAll(AssingEmptyLocBo assingEmptyLocBo, String lcoatinTunnel) { BaseLocationVo locationVo = null; //bo等于空时,是空治具分配货位,否则是保险杠分配货位 if (assingEmptyLocBo == null) { @@ -912,7 +912,7 @@ public class BaseLocationServiceImpl extends ServiceImpl baseLocationVos = this.baseMapper.queryBaseLocationListByGoods(bo); - if (StringUtils.isEmpty(assingEmptyLocBo.getTunnel())){ + if (StringUtils.isEmpty(assingEmptyLocBo.getTunnel())) { if (baseLocationVos.size() == 0) { //查看缓冲区是否还有货位 Long bufferArea = Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.buffer_area)); @@ -1313,9 +1313,11 @@ public class BaseLocationServiceImpl extends ServiceImpl0) { + if (businDataTaskGoodsVos != null && businDataTaskGoodsVos.size() > 0) { //判断与双深位的保险杠是否一样 long count = sysStockDetailVoList.stream().filter(val -> businDataTaskGoodsVos.stream().anyMatch(o -> Objects.equals(val.getGoodsNo(), o.getGoodsNo()))).count(); if (count == 0) { @@ -1348,7 +1350,7 @@ public class BaseLocationServiceImpl extends ServiceImpl locationVoResult = this.assignEmptyLocationAll(assingEmptyLocBo,null); + Result locationVoResult = this.assignEmptyLocationAll(assingEmptyLocBo, null); if (Result.isOk(locationVoResult)) { BaseLocationVo baseLocationVo = locationVoResult.getData(); baseLocation = BeanUtil.toBean(baseLocationVo, BaseLocation.class); @@ -1359,7 +1361,7 @@ public class BaseLocationServiceImpl extends ServiceImpl locationVoResult = this.assignEmptyLocationAll(assingEmptyLocBo,businDataTask.getTunnel()); + Result locationVoResult = this.assignEmptyLocationAll(assingEmptyLocBo, businDataTask.getTunnel()); if (Result.isOk(locationVoResult)) { BaseLocationVo baseLocationVo = locationVoResult.getData(); baseLocation = BeanUtil.toBean(baseLocationVo, BaseLocation.class); @@ -1367,11 +1369,60 @@ public class BaseLocationServiceImpl extends ServiceImpl() + .eq(BaseLocation::getLocationRow, locationRow) + .eq(BaseLocation::getLocationColumn, locationColumn) + .eq(BaseLocation::getLayer, layer)); + String oneLocationStatus = oneLocation.getLocationStatus(); + Boolean checkLoc = false; + if (oneLocationStatus.equals("1") || oneLocationStatus.equals("2") || oneLocationStatus.equals("5")) { + //入库货位是双深位,单深位有货,重新分配货位 + checkLoc = true; + } + + if (locationStatus.equals("1") || locationStatus.equals("2") || locationStatus.equals("5")) { + //入库是双深位时,此货位有货,重新分配货位 + checkLoc = true; + } + + if (checkLoc) { + if (businDataTaskGoodsVos != null && businDataTaskGoodsVos.size() > 0) { + String goodsNo = businDataTaskGoodsVos.get(0).getGoodsNo(); + BaseGoodsData baseGoodsData = iBaseGoodsDataService.getBaseGoodsByBarcodes(goodsNo); + AssingEmptyLocBo assingEmptyLocBo = new AssingEmptyLocBo(); + assingEmptyLocBo.setBusinDataTaskGoodsVos(businDataTaskGoodsVos); + assingEmptyLocBo.setBatch(DateUtils.getDate()); + assingEmptyLocBo.setGoodsNo(goodsNo); + assingEmptyLocBo.setVehicheModel(baseGoodsData.getVehicheModel()); + assingEmptyLocBo.setTunnel(baseLocation.getTunnel()); + Result locationVoResult = this.assignEmptyLocationAll(assingEmptyLocBo, null); + if (Result.isOk(locationVoResult)) { + BaseLocationVo baseLocationVo = locationVoResult.getData(); + baseLocation = BeanUtil.toBean(baseLocationVo, BaseLocation.class); + } + } else { + //无数据是空托,重新分配货位 + AssingEmptyLocBo assingEmptyLocBo = null; + Result locationVoResult = this.assignEmptyLocationAll(assingEmptyLocBo, businDataTask.getTunnel()); + if (Result.isOk(locationVoResult)) { + BaseLocationVo baseLocationVo = locationVoResult.getData(); + baseLocation = BeanUtil.toBean(baseLocationVo, BaseLocation.class); + } + } + } + } else if (tunnel.equals("06") && locationRow.equals("13")) { if ("1".equals(locationStatus) || "2".equals(locationStatus) || "5".equals(locationStatus)) { AssingEmptyLocBo assingEmptyLocBo = null; - if (businDataTaskGoodsVos != null && businDataTaskGoodsVos.size()>0) { + if (businDataTaskGoodsVos != null && businDataTaskGoodsVos.size() > 0) { String goodsNo = businDataTaskGoodsVos.get(0).getGoodsNo(); BaseGoodsData baseGoodsData = iBaseGoodsDataService.getBaseGoodsByBarcodes(goodsNo); assingEmptyLocBo = new AssingEmptyLocBo(); @@ -1381,7 +1432,7 @@ public class BaseLocationServiceImpl extends ServiceImpl locationVoResult = this.assignEmptyLocationAll(assingEmptyLocBo,businDataTask.getTunnel()); + Result locationVoResult = this.assignEmptyLocationAll(assingEmptyLocBo, businDataTask.getTunnel()); if (Result.isOk(locationVoResult)) { BaseLocationVo baseLocationVo = locationVoResult.getData(); baseLocation = BeanUtil.toBean(baseLocationVo, BaseLocation.class);