@ -85,19 +85,28 @@ public class WarehouseGoodsAllocationServiceImpl extends BaseServiceImpl<Warehou
}
@Override
public List < WarehouseGoodsAllocationVO > selectVisualization ( WarehouseGoodsAllocationVO warehouseGoodsAllocation ) {
public WarehouseShelfVO selectVisualization ( WarehouseGoodsAllocationVO warehouseGoodsAllocation ) {
//获取当前登录人仓库
//BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getMyCurrentWarehouse();
WarehouseShelfVO warehouseShelfVO = new WarehouseShelfVO ( ) ;
Long goodsAreaId = warehouseGoodsAllocation . getGoodsAreaId ( ) ;
Long goodsShelfId = warehouseGoodsAllocation . getGoodsShelfId ( ) ;
//查询所有货位
List < WarehouseGoodsAllocationEntity > warehouseGoodsAllocationEntities = baseMapper . selectList ( new QueryWrapper < WarehouseGoodsAllocationEntity > ( ) . lambda ( )
. eq ( WarehouseGoodsAllocationEntity : : getIsDeleted , 0 )
//.eq(null != basicdataWarehouseEntity,WarehouseGoodsAllocationEntity::getWarehouseId,basicdataWarehouseEntity.getId())
. eq ( WarehouseGoodsAllocationEntity : : getGoodsAreaId , warehouseGoodsAllocation . getG oodsAreaId ( ) )
. eq ( WarehouseGoodsAllocationEntity : : getGoodsShelfId , warehouseGoodsAllocation . getG oodsShelfId ( ) )
. eq ( WarehouseGoodsAllocationEntity : : getGoodsAreaId , goodsAreaId )
. eq ( WarehouseGoodsAllocationEntity : : getGoodsShelfId , goodsShelfId )
. orderByAsc ( WarehouseGoodsAllocationEntity : : getLayerNum )
. orderByAsc ( WarehouseGoodsAllocationEntity : : getColumnNum )
) ;
//获取货架的所有货位
//查询该货区下的总货位
locationsnubVO num1 = this . getNum ( goodsAreaId , goodsShelfId ) ;
Func . copy ( num1 , warehouseShelfVO ) ;
//查询所有包件数量
Integer num = warehouseUpdownGoodsService . selectCountNumByshelf ( goodsAreaId , goodsShelfId ) ;
warehouseShelfVO . setGoodsNub ( null = = num ? 0 : num ) ;
//使用HashMap进行二维List分割
ArrayList < WarehouseGoodsAllocationVO > warehouseGoodsAllocationVOS = new ArrayList < > ( ) ;
//HashMap<Integer, List<WarehouseGoodsAllocationVO>> map = new HashMap<>();
@ -107,13 +116,14 @@ public class WarehouseGoodsAllocationServiceImpl extends BaseServiceImpl<Warehou
// map.put(layerNum, new ArrayList<>());
// }
WarehouseGoodsAllocationVO warehouseGoodsAllocationVO = this . convert ( warehouseGoodsAllocationEntity ) ;
log . info ( "List>>>>>>>>>>>>>>>>>{}" , warehouseGoodsAllocationVO ) ;
// map.get(layerNum).add(warehouseGoodsAllocationVO);
warehouseGoodsAllocationVOS . add ( warehouseGoodsAllocationVO ) ;
}
warehouseShelfVO . setList ( warehouseGoodsAllocationVOS ) ;
log . info ( "list>>>>>>>>>>>>>>>>>>>>{}" , warehouseShelfVO ) ;
// ArrayList<List<WarehouseGoodsAllocationVO>> arrayListTwo = new ArrayList<>(map.values());
//log.info("排序后>>>>>>>>>>>>>>{}",map);
return warehouseGoodsAllocationVOS ;
return warehouseShelfVO ;
}
@Override
@ -284,26 +294,54 @@ public class WarehouseGoodsAllocationServiceImpl extends BaseServiceImpl<Warehou
@Override
public locationsnubVO selectlocationsnub ( ) {
locationsnubVO locationsnubVO = this . getNum ( null , null ) ;
return locationsnubVO ;
}
@Override
public List < WarehouseCargoSumVO > selectcargoNub ( ) {
//查询所有货区id
List < Long > ids = baseMapper . selectCargoSumId ( ) ;
ArrayList < WarehouseCargoSumVO > list = new ArrayList < > ( ) ;
for ( Long id : ids ) {
WarehouseCargoSumVO warehouseCargoSumVO = new WarehouseCargoSumVO ( ) ;
locationsnubVO locationsnubVO = this . getNum ( id , null ) ;
Func . copy ( locationsnubVO , warehouseCargoSumVO ) ;
warehouseCargoSumVO . setId ( id ) ;
list . add ( warehouseCargoSumVO ) ;
}
return list ;
}
public locationsnubVO getNum ( Long areaId , Long shelfId ) {
locationsnubVO locationsnubVO = new locationsnubVO ( ) ;
//查询所有货位
//查询该货区下的总 货位
Integer cargoNub = baseMapper . selectCount ( new QueryWrapper < WarehouseGoodsAllocationEntity > ( ) . lambda ( )
. eq ( WarehouseGoodsAllocationEntity : : getIsDeleted , 0 )
. eq ( null ! = areaId , WarehouseGoodsAllocationEntity : : getGoodsAreaId , areaId )
. eq ( null ! = shelfId , WarehouseGoodsAllocationEntity : : getGoodsShelfId , shelfId )
) . intValue ( ) ;
//查询所有使用货位
Integer employNub = baseMapper . selectCount ( new QueryWrapper < WarehouseGoodsAllocationEntity > ( ) . lambda ( )
. eq ( WarehouseGoodsAllocationEntity : : getIsDeleted , 0 )
. eq ( WarehouseGoodsAllocationEntity : : getAllocationStatus , 2 )
. eq ( null ! = areaId , WarehouseGoodsAllocationEntity : : getGoodsAreaId , areaId )
. eq ( null ! = shelfId , WarehouseGoodsAllocationEntity : : getGoodsShelfId , shelfId )
) . intValue ( ) ;
//查询所有禁用
Integer disableNub = baseMapper . selectCount ( new QueryWrapper < WarehouseGoodsAllocationEntity > ( ) . lambda ( )
. eq ( WarehouseGoodsAllocationEntity : : getIsDeleted , 0 )
. eq ( WarehouseGoodsAllocationEntity : : getEnableStatus , 2 )
. eq ( null ! = areaId , WarehouseGoodsAllocationEntity : : getGoodsAreaId , areaId )
. eq ( null ! = shelfId , WarehouseGoodsAllocationEntity : : getGoodsShelfId , shelfId )
) . intValue ( ) ;
//查询可用货位
Integer unusedNub = baseMapper . selectCount ( new QueryWrapper < WarehouseGoodsAllocationEntity > ( ) . lambda ( )
. eq ( WarehouseGoodsAllocationEntity : : getIsDeleted , 0 )
. eq ( WarehouseGoodsAllocationEntity : : getEnableStatus , 1 )
. eq ( WarehouseGoodsAllocationEntity : : getAllocationStatus , 1 )
. eq ( null ! = areaId , WarehouseGoodsAllocationEntity : : getGoodsAreaId , areaId )
. eq ( null ! = shelfId , WarehouseGoodsAllocationEntity : : getGoodsShelfId , shelfId )
) . intValue ( ) ;
locationsnubVO . setCargoNub ( cargoNub ) ;
locationsnubVO . setEmployNub ( employNub ) ;
@ -312,46 +350,6 @@ public class WarehouseGoodsAllocationServiceImpl extends BaseServiceImpl<Warehou
return locationsnubVO ;
}
@Override
public List < WarehouseCargoSumVO > selectcargoNub ( ) {
//查询所有货区id
List < WarehouseCargoSumVO > list = baseMapper . selectCargoSumId ( ) ;
for ( WarehouseCargoSumVO warehouseCargoSumVO : list ) {
Long id = warehouseCargoSumVO . getId ( ) ;
//查询该货区下的总货位
Integer cargoNub = baseMapper . selectCount ( new QueryWrapper < WarehouseGoodsAllocationEntity > ( ) . lambda ( )
. eq ( WarehouseGoodsAllocationEntity : : getIsDeleted , 0 )
. eq ( WarehouseGoodsAllocationEntity : : getGoodsAreaId , id )
) . intValue ( ) ;
//查询所有使用货位
Integer employNub = baseMapper . selectCount ( new QueryWrapper < WarehouseGoodsAllocationEntity > ( ) . lambda ( )
. eq ( WarehouseGoodsAllocationEntity : : getIsDeleted , 0 )
. eq ( WarehouseGoodsAllocationEntity : : getAllocationStatus , 2 )
. eq ( WarehouseGoodsAllocationEntity : : getGoodsAreaId , id )
) . intValue ( ) ;
//查询所有禁用
Integer disableNub = baseMapper . selectCount ( new QueryWrapper < WarehouseGoodsAllocationEntity > ( ) . lambda ( )
. eq ( WarehouseGoodsAllocationEntity : : getIsDeleted , 0 )
. eq ( WarehouseGoodsAllocationEntity : : getEnableStatus , 2 )
. eq ( WarehouseGoodsAllocationEntity : : getGoodsAreaId , id )
) . intValue ( ) ;
//查询可用货位
Integer unusedNub = baseMapper . selectCount ( new QueryWrapper < WarehouseGoodsAllocationEntity > ( ) . lambda ( )
. eq ( WarehouseGoodsAllocationEntity : : getIsDeleted , 0 )
. eq ( WarehouseGoodsAllocationEntity : : getEnableStatus , 1 )
. eq ( WarehouseGoodsAllocationEntity : : getAllocationStatus , 1 )
. eq ( WarehouseGoodsAllocationEntity : : getGoodsAreaId , id )
) . intValue ( ) ;
warehouseCargoSumVO . setCargoNub ( cargoNub ) ;
warehouseCargoSumVO . setEmployNub ( employNub ) ;
warehouseCargoSumVO . setDisableNub ( disableNub ) ;
warehouseCargoSumVO . setUnusedNub ( unusedNub ) ;
}
return list ;
}
@Override
public Boolean updateAllocationCache ( String ids ) {
//查询货位
@ -360,16 +358,27 @@ public class WarehouseGoodsAllocationServiceImpl extends BaseServiceImpl<Warehou
. in ( WarehouseGoodsAllocationEntity : : getId , ids )
) ;
for ( WarehouseGoodsAllocationEntity warehouseGoodsAllocationEntity : warehouseGoodsAllocationEntities ) {
Long goodsAreaId = warehouseGoodsAllocationEntity . getGoodsAreaId ( ) ;
Long goodsShelfId = warehouseGoodsAllocationEntity . getGoodsShelfId ( ) ;
if ( null ! = bladeRedis . get ( Url + "/" + warehouseGoodsAllocationEntity . getGoodsShelfId ( ) ) ) {
//查询所有包件数量
//转换当前货位的信息
WarehouseGoodsAllocationVO warehouseGoodsAllocationVO = this . convert ( warehouseGoodsAllocationEntity ) ;
List < WarehouseGoodsAllocationVO > warehouseGoodsAllocationVOList = bladeRedis . get ( Url + "/" + warehouseGoodsAllocationEntity . getGoodsShelfId ( ) ) ;
WarehouseShelfVO warehouseShelfVO = bladeRedis . get ( Url + "/" + warehouseGoodsAllocationEntity . getGoodsShelfId ( ) ) ;
List < WarehouseGoodsAllocationVO > warehouseGoodsAllocationVOList = warehouseShelfVO . getList ( ) ;
//替换货位
warehouseGoodsAllocationVOList = warehouseGoodsAllocationVOList . stream ( )
. map ( obj - > obj . getId ( ) . equals ( warehouseGoodsAllocationVO . getId ( ) ) ? warehouseGoodsAllocationVO : obj )
. collect ( Collectors . toList ( ) ) ;
warehouseGoodsAllocationVOList = warehouseGoodsAllocationVOList . stream ( ) . map ( obj - > obj . getId ( ) . equals ( warehouseGoodsAllocationVO . getId ( ) ) ? warehouseGoodsAllocationVO : obj ) . collect ( Collectors . toList ( ) ) ;
//计算数量
//查询该货区下的总货位
locationsnubVO num1 = this . getNum ( goodsAreaId , goodsShelfId ) ;
Func . copy ( num1 , warehouseShelfVO ) ;
Integer num = warehouseUpdownGoodsService . selectCountNumByshelf ( goodsAreaId , goodsShelfId ) ;
warehouseShelfVO . setGoodsNub ( null = = num ? 0 : num ) ;
warehouseShelfVO . setList ( warehouseGoodsAllocationVOList ) ;
//重新存入缓存
bladeRedis . setEx ( Url + "/" + warehouseGoodsAllocationEntity . getGoodsShelfId ( ) , warehouseGoodsAllocationVOList , 600L ) ;
bladeRedis . setEx ( Url + "/" + warehouseGoodsAllocationEntity . getGoodsShelfId ( ) , warehouseShelfVO , 600L ) ;
log . info ( "货位缓存更新成功" ) ;
}
}