|
|
|
@ -924,11 +924,12 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
|
|
|
|
|
if(Objects.isNull(updownTypeEntity)){ |
|
|
|
|
updownTypeEntity = createUpdownType("100",goodsAllocationEntity,goodsShelfEntity,goodsAreaEntity,warehouseId); |
|
|
|
|
} |
|
|
|
|
String s = bindingAllocationAndStockAndLog(upShelfStockList, updownTypeEntity); |
|
|
|
|
Map<String,Object> 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<WarehouseUpd
|
|
|
|
|
detailVO.setTotalNumber(stockArticleEntity.getTotalNumber()); |
|
|
|
|
|
|
|
|
|
//根据订单自编码查询已上架的数据
|
|
|
|
|
ParcelListVO updownParcelListVO = warehouseUpdownGoodsService.findAllUpShelfDataByOrderCode(orderCode); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
List<ParcelListVO> 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<WarehouseUpd
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R moveAllocationByAllocation(Long allocationId, Long targetAllocationId, Long warehouseId) { |
|
|
|
|
BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient.getEntityByAllocationId(allocationId); |
|
|
|
|
if(Objects.isNull(goodsAllocationEntity)){ |
|
|
|
|
log.warn("#############moveAllocationByAllocation: 库位信息不存在 allocationId={}",allocationId); |
|
|
|
|
return Resp.scanFail(403,"库位信息不存在","库位信息不存在"); |
|
|
|
|
} |
|
|
|
|
Long wid = goodsAllocationEntity.getWarehouseId(); |
|
|
|
|
if(wid.equals(warehouseId)){ |
|
|
|
|
log.warn("#############moveAllocationByAllocation: 库位不在当前仓 allocationId={}",allocationId); |
|
|
|
|
return Resp.scanFail(403,"库位不在当前仓","库位不在当前仓"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
BasicdataGoodsAllocationEntity targetGoodsAllocationEntity = basicdataGoodsAllocationClient.getEntityByAllocationId(targetAllocationId); |
|
|
|
|
if(Objects.isNull(targetGoodsAllocationEntity)){ |
|
|
|
|
log.warn("#############moveAllocationByAllocation: 目标库位信息不存在 targetAllocationId={}",targetAllocationId); |
|
|
|
|
return Resp.scanFail(403,"目标库位信息不存在","目标库位信息不存在"); |
|
|
|
|
} |
|
|
|
|
Long targetWid = targetGoodsAllocationEntity.getWarehouseId(); |
|
|
|
|
if(targetWid.equals(warehouseId)){ |
|
|
|
|
log.warn("#############moveAllocationByAllocation: 目标库位不在当前仓 targetAllocationId={}",targetAllocationId); |
|
|
|
|
return Resp.scanFail(403,"目标库位不在当前仓","目标库位不在当前仓"); |
|
|
|
|
} |
|
|
|
|
QueryWrapper<WarehouseUpdownGoodsEntity> targetUpdownGoodsQueryWapper = new QueryWrapper<>(); |
|
|
|
|
targetUpdownGoodsQueryWapper.eq("allocation_id",targetAllocationId); |
|
|
|
|
List<WarehouseUpdownGoodsEntity> targetList = warehouseUpdownGoodsService.list(targetUpdownGoodsQueryWapper); |
|
|
|
|
if(!targetList.isEmpty()){ |
|
|
|
|
log.warn("#############moveAllocationByAllocation: 目标库位已有数据 targetAllocationId={}",targetAllocationId); |
|
|
|
|
return Resp.scanFail(403,"目标库位已有数据","目标库位已有数据"); |
|
|
|
|
} |
|
|
|
|
//查询需要移库的库位是否有货物
|
|
|
|
|
QueryWrapper<WarehouseUpdownGoodsEntity> updownGoodsQueryWapper = new QueryWrapper<>(); |
|
|
|
|
updownGoodsQueryWapper.eq("allocation_id",allocationId); |
|
|
|
|
List<WarehouseUpdownGoodsEntity> list = warehouseUpdownGoodsService.list(updownGoodsQueryWapper); |
|
|
|
|
if(list.isEmpty()){ |
|
|
|
|
log.warn("#############moveAllocationByAllocation: 来源库位没有数据 allocationId={}",allocationId); |
|
|
|
|
return Resp.scanFail(403,"来源库位没有数据","来源库位没有数据"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QueryWrapper<WarehouseUpdownTypeEntity> 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<WarehouseUpdownGoodsEntity> 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<WarehouseUpdownGoodsEntity> updownGoodsList, int residue, String bindingType, Integer isAlltrays, String remark,Long warehouseId) { |
|
|
|
|
List<WarehouseUpdownGoodsLogEntity> updownGoodsLogList = new ArrayList<>(); |
|
|
|
@ -1682,10 +1800,11 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
|
|
|
|
|
warehouseUpdownGoodsLogService.saveBatch(updownGoodsLogList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String bindingAllocationAndStockAndLog(List<UpShelfStockDTO> upShelfStockList, WarehouseUpdownTypeEntity updownTypeEntity) { |
|
|
|
|
private Map<String,Object> bindingAllocationAndStockAndLog(List<UpShelfStockDTO> upShelfStockList, WarehouseUpdownTypeEntity updownTypeEntity) { |
|
|
|
|
List<WarehouseUpdownGoodsEntity> updownGoodsList = new ArrayList<>(); |
|
|
|
|
List<WarehouseUpdownGoodsEntity> 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<WarehouseUpd
|
|
|
|
|
updownGoodsList.add(updownGoodsEntity); |
|
|
|
|
updownGoodsLogList.add(updownGoodsEntity); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
allNum = allNum + enterNum; |
|
|
|
|
} |
|
|
|
|
warehouseUpdownGoodsService.saveOrUpdateBatch(updownGoodsList); |
|
|
|
|
|
|
|
|
|
saveUpdownGoodsLog(updownGoodsLogList,"1",0,"扫描上架:库存品上架",updownTypeEntity.getWarehouseId()); |
|
|
|
|
return stringBuffer.toString(); |
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
map.put("allNum",allNum); |
|
|
|
|
map.put("s",stringBuffer.toString()); |
|
|
|
|
|
|
|
|
|
return map; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private UpdownStockVO stockToUpdownStockVO(DistributionStockListEntity stockListEntity) { |
|
|
|
|