From 4785123cdd4af9d9398149d79d38b8518cf1292f Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Fri, 22 Sep 2023 18:07:45 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=BA=93=E5=86=85=E4=BD=9C=E4=B8=9Abug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=202.=E5=BA=93=E5=86=85=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E9=9C=80=E6=B1=82=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/logpm/warehouse/vo/ParcelListVO.java | 1 + .../api/WarehouseUpdownTypeApiController.java | 36 +++++ .../logpm/warehouse/dto/UpdownTypeDTO.java | 2 +- .../service/IWarehouseUpdownTypeService.java | 2 + .../impl/WarehouseTrayTypeServiceImpl.java | 30 ++-- .../impl/WarehouseUpdownTypeServiceImpl.java | 147 ++++++++++++++++-- 6 files changed, 194 insertions(+), 24 deletions(-) diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/ParcelListVO.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/ParcelListVO.java index 5137cfb90..02d3d8791 100644 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/ParcelListVO.java +++ b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/ParcelListVO.java @@ -20,5 +20,6 @@ public class ParcelListVO implements Serializable { private String shelfTitle;//货架 private String allocationTitle;//货位 private Integer isFleeing;//是否窜货 0否 1是 + private Integer deletedStatus;//是否可删除 0否 1是 } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseUpdownTypeApiController.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseUpdownTypeApiController.java index 48312aacf..ef75ab83f 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseUpdownTypeApiController.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseUpdownTypeApiController.java @@ -909,4 +909,40 @@ public class WarehouseUpdownTypeApiController { } + @ResponseBody + @PostMapping("/moveAllocationByAllocation") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "移库库位", notes = "传入trayTypeDTO") + public R moveAllocationByAllocation(@RequestBody UpdownTypeDTO updownTypeDTO) { + String method = "###########moveAllocationByAllocation: "; + log.info(method + "移库库位 updownTypeDTO={}", updownTypeDTO); + Long allocationId = updownTypeDTO.getAllocationId();//目标库位码 + Long targetAllocationId = updownTypeDTO.getTargetAllocationId(); + + try{ + + BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); + if(Objects.isNull(myCurrentWarehouse)){ + log.warn(method+"仓库信息不能为空"); + return R.fail(403,"仓库信息不能为空"); + } + if(Objects.isNull(targetAllocationId)){ + log.warn(method+"目标库位码不能为空 targetAllocationId={}",targetAllocationId); + return R.fail(403,"目标库位码不能为空"); + } + if(Objects.isNull(allocationId)){ + log.warn(method+"库位码不能为空 allocationId={}",allocationId); + return R.fail(403,"库位码不能为空"); + } + //查询该库位的货物信息 + return warehouseUpdownTypeService.moveAllocationByAllocation(allocationId,targetAllocationId,myCurrentWarehouse.getId()); + }catch (CustomerException e){ + log.warn(e.message); + return R.fail(e.code,e.message); + }catch (Exception e){ + log.error(method+"系统异常,联系管理员",e); + return R.fail(500,"系统异常,联系管理员"); + } + } + } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/UpdownTypeDTO.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/UpdownTypeDTO.java index 6f59a499e..04d819b42 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/UpdownTypeDTO.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/UpdownTypeDTO.java @@ -17,7 +17,7 @@ public class UpdownTypeDTO implements Serializable { @ApiModelProperty(name = "来源库位码",notes = "来源库位码") private String sourceAllocation;//来源库位码 @ApiModelProperty(name = "目标库位码",notes = "目标库位码") - private String targetAllocation;//目标库位码 + private Long targetAllocationId;//目标库位码 @ApiModelProperty(name = "移库方式",notes = "移库方式 1货物 2托盘") private Integer moveType;//移库方式 1货物 2托盘 @ApiModelProperty(name = "移库方式",notes = "上架扫描类型 1服务号 2订单自编码 3包条码 4托盘码") diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownTypeService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownTypeService.java index 7d79268b9..6479673b5 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownTypeService.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownTypeService.java @@ -62,4 +62,6 @@ public interface IWarehouseUpdownTypeService extends BaseService updownGoodsEntityQueryWrapper = new QueryWrapper<>(); @@ -346,41 +346,41 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl list = warehouseTrayGoodsService.findAllPackageDetailByOrderCode(orderCode); + for (ParcelListVO parcelListVO:list){ + String trayName = parcelListVO.getTrayName(); + if(trayCode.equals(trayName)){ + parcelListVO.setDeletedStatus(1); + }else{ + parcelListVO.setDeletedStatus(0); + } + } orderDetailVO.setParcelList(list); return orderDetailVO; } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java index 8f9383b9a..55a60cab3 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java @@ -924,11 +924,12 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl map = bindingAllocationAndStockAndLog(upShelfStockList, updownTypeEntity); - updateUpdownTypeNum(updownTypeEntity); + num = (Integer)map.get("allNum"); + String s = (String) map.get("s"); - num = updownTypeEntity.getStockNum(); + updateUpdownTypeNum(updownTypeEntity); if(!StringUtil.isBlank(trayCode)){ for (UpShelfStockDTO upShelfStockDTO:upShelfStockList){ @@ -1591,12 +1592,12 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl list = warehouseTrayGoodsService.findAllPackageDetailByOrderCode(orderCode); + for (ParcelListVO parcelListVO:list){ + parcelListVO.setDeletedStatus(0); + } + detailVO.setList(list); + return detailVO; } @Override @@ -1666,6 +1667,123 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl targetUpdownGoodsQueryWapper = new QueryWrapper<>(); + targetUpdownGoodsQueryWapper.eq("allocation_id",targetAllocationId); + List targetList = warehouseUpdownGoodsService.list(targetUpdownGoodsQueryWapper); + if(!targetList.isEmpty()){ + log.warn("#############moveAllocationByAllocation: 目标库位已有数据 targetAllocationId={}",targetAllocationId); + return Resp.scanFail(403,"目标库位已有数据","目标库位已有数据"); + } + //查询需要移库的库位是否有货物 + QueryWrapper updownGoodsQueryWapper = new QueryWrapper<>(); + updownGoodsQueryWapper.eq("allocation_id",allocationId); + List list = warehouseUpdownGoodsService.list(updownGoodsQueryWapper); + if(list.isEmpty()){ + log.warn("#############moveAllocationByAllocation: 来源库位没有数据 allocationId={}",allocationId); + return Resp.scanFail(403,"来源库位没有数据","来源库位没有数据"); + } + + QueryWrapper updownTypeEntityQueryWrapper = new QueryWrapper<>(); + updownTypeEntityQueryWrapper.eq("allocation_id",allocationId) + .eq("is_deleted",0); + WarehouseUpdownTypeEntity updownTypeEntity = getOne(updownTypeEntityQueryWrapper); + + + BasicdataTrayEntity trayEntity = warehouseTaryAllocationService.getTrayByAllocationId(allocationId); + if(Objects.isNull(trayEntity)){ + //没有托盘就直接修改库位数据 + changeUpdownGoodsToNewAllocation(list,targetAllocationId,updownTypeEntity); + + //修改绑定数据的库位信息到新库位 + downAllocation(allocationId); + }else{ + String trayCode = trayEntity.getPalletCode(); + moveAllocationByTrayCode(trayCode,targetAllocationId,warehouseId); + } + return Resp.scanSuccess("整库移库成功","整库移库成功"); + } + + private void changeUpdownGoodsToNewAllocation(List list, Long allocationId,WarehouseUpdownTypeEntity updownTypeEntity) { + BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient.getEntityByAllocationId(allocationId); + if(Objects.isNull(goodsAllocationEntity)){ + log.warn("##############changeUpdownGoodsToNewAllocation: 库位不存在 allocationId={}",allocationId); + throw new CustomerException(403,"库位不存在"); + } + String enableStatus = goodsAllocationEntity.getEnableStatus(); + Long goodsShelfId = goodsAllocationEntity.getGoodsShelfId(); + if("2".equals(enableStatus)){ + log.warn("##############changeUpdownGoodsToNewAllocation: 库位已被禁用 allocationId={}",allocationId); + throw new CustomerException(403,"库位已被禁用"); + } + BasicdataGoodsShelfEntity goodsShelfEntity = basicdataGoodsShelfClient.getEntityByGoodsShelfId(goodsShelfId); + if(Objects.isNull(goodsShelfEntity)){ + log.warn("##############changeUpdownGoodsToNewAllocation: 货架不存在 goodsShelfId={}",goodsShelfId); + throw new CustomerException(403,"货架不存在"); + } + Long goodsAreaId = goodsShelfEntity.getGoodsAreaId(); + BasicdataGoodsAreaEntity goodsAreaEntity = basicdataGoodsAreaClient.getEntityByGoodsAreaId(goodsAreaId); + if(Objects.isNull(goodsAreaEntity)){ + log.warn("##############changeUpdownGoodsToNewAllocation: 货区不存在 goodsAreaId={}",goodsAreaId); + throw new CustomerException(403,"货区不存在"); + } + Long wid = goodsAreaEntity.getWarehouseId(); + BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(wid); + if(Objects.isNull(warehouseEntity)){ + log.warn("##############changeUpdownGoodsToNewAllocation: 仓库不存在 wid={}",wid); + throw new CustomerException(403,"仓库不存在"); + } + + WarehouseUpdownTypeEntity targetUpdownTypeEntity = new WarehouseUpdownTypeEntity(); + BeanUtil.copy(updownTypeEntity,targetUpdownTypeEntity); + targetUpdownTypeEntity.setId(null); + targetUpdownTypeEntity.setAreaId(goodsAreaId); + targetUpdownTypeEntity.setAreaTitle(goodsAreaEntity.getHeadline()); + targetUpdownTypeEntity.setShelfId(goodsShelfId); + targetUpdownTypeEntity.setShelfTitle(goodsShelfEntity.getGoodsShelfName()); + targetUpdownTypeEntity.setAllocationId(allocationId); + targetUpdownTypeEntity.setAllocationTitle(goodsAllocationEntity.getGoodsAllocationName()); + save(targetUpdownTypeEntity); + + for(WarehouseUpdownGoodsEntity updownGoodsEntity:list){ + + updownGoodsEntity.setAreaId(goodsAreaId); + updownGoodsEntity.setAreaTitle(goodsAreaEntity.getHeadline()); + updownGoodsEntity.setShelfId(goodsShelfId); + updownGoodsEntity.setShelfTitle(goodsShelfEntity.getGoodsShelfName()); + updownGoodsEntity.setAllocationId(allocationId); + updownGoodsEntity.setAllocationTitle(goodsAllocationEntity.getGoodsAllocationName()); + updownGoodsEntity.setPositionCode(goodsAreaEntity.getHeadline()+"-"+goodsShelfEntity.getGoodsShelfName()+"-"+goodsAllocationEntity.getGoodsAllocationName()); + + } + //货物重新绑定 + warehouseUpdownGoodsService.saveOrUpdateBatch(list); + + saveUpdownGoodsLog(list,"1",0,"移库:整库移库",targetUpdownTypeEntity.getWarehouseId()); + } + private void saveUpdownGoodsLogPart(List updownGoodsList, int residue, String bindingType, Integer isAlltrays, String remark,Long warehouseId) { List updownGoodsLogList = new ArrayList<>(); @@ -1682,10 +1800,11 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl upShelfStockList, WarehouseUpdownTypeEntity updownTypeEntity) { + private Map bindingAllocationAndStockAndLog(List upShelfStockList, WarehouseUpdownTypeEntity updownTypeEntity) { List updownGoodsList = new ArrayList<>(); List updownGoodsLogList = new ArrayList<>(); StringBuffer stringBuffer = new StringBuffer(); + Integer allNum = 0; for (UpShelfStockDTO upShelfStockDTO:upShelfStockList){ Long marketId = upShelfStockDTO.getMarketId(); Long allocationId = updownTypeEntity.getAllocationId(); @@ -1745,12 +1864,16 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl map = new HashMap<>(); + map.put("allNum",allNum); + map.put("s",stringBuffer.toString()); + + return map; } private UpdownStockVO stockToUpdownStockVO(DistributionStockListEntity stockListEntity) {