@ -16,6 +16,7 @@
* /
package com.logpm.warehouse.service.impl ;
import com.alibaba.fastjson.JSONObject ;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper ;
import com.baomidou.mybatisplus.core.toolkit.Wrappers ;
import com.logpm.basicdata.entity.* ;
@ -102,731 +103,131 @@ public class WarehouseUpdownStockupAreaServiceImpl extends BaseServiceImpl<Wareh
private final IWarehouseTaryAllocationService warehouseTaryAllocationService ;
/ * *
* @param code
* @param stockUpAllocationId
* @param warehouseId
* @param orderPackageCode
* @param typ e
* @return
* /
@Override
public UpDownStockupAreaVO upShelfScanPackage ( Long warehouseId , String orderPackageCode ) {
String method = "###############WarehouseUpdownStockupAreaServiceImpl.upShelfScanPackage," ;
//这里有可能会查询出订制品包件和有数据的库存品包件
DistributionParcelListEntity parcelListEntity = parcelListClient . findByPacketBarCodeAndWarehouseId ( orderPackageCode , warehouseId ) ;
if ( Func . isNotEmpty ( parcelListEntity ) ) {
DistributionStockArticleEntity entityByStockArticleId = distributionStockArticleClient . findEntityByStockArticleId ( parcelListEntity . getStockArticleId ( ) ) ;
UpDownStockupAreaVO stockupAreaVo = Func . copy ( parcelListEntity , UpDownStockupAreaVO . class ) ;
stockupAreaVo . setIsMay ( 1 ) ;
if ( Func . isNotEmpty ( parcelListEntity . getMallId ( ) ) ) {
stockupAreaVo . setMarketId ( parcelListEntity . getMallId ( ) ) ;
}
if ( Func . isNotEmpty ( parcelListEntity . getMallName ( ) ) ) {
stockupAreaVo . setMarketName ( parcelListEntity . getMallName ( ) ) ;
}
if ( ! OrderPackageStatusConstant . yiruku . getValue ( ) . equals ( parcelListEntity . getOrderPackageStatus ( ) ) ) {
stockupAreaVo . setIsMay ( 0 ) ;
}
stockupAreaVo . setGoodsType ( "1" ) ;
stockupAreaVo . setOrderId ( parcelListEntity . getStockArticleId ( ) ) ;
stockupAreaVo . setAssociationId ( parcelListEntity . getId ( ) ) ;
stockupAreaVo . setAssociationValue ( parcelListEntity . getOrderPackageCode ( ) ) ;
stockupAreaVo . setNum ( parcelListEntity . getQuantity ( ) ) ;
stockupAreaVo . setMarketId ( entityByStockArticleId . getMallId ( ) ) ;
stockupAreaVo . setMarketName ( entityByStockArticleId . getMallName ( ) ) ;
if ( 1 = = parcelListEntity . getConditions ( ) ) {
stockupAreaVo . setAssociationType ( "2" ) ;
} else {
stockupAreaVo . setAssociationType ( "3" ) ;
stockupAreaVo . setIncomingBatch ( parcelListEntity . getOrderCode ( ) ) ;
stockupAreaVo . setMaterielCode ( parcelListEntity . getMaterialCode ( ) ) ;
stockupAreaVo . setMaterielName ( parcelListEntity . getMaterialName ( ) ) ;
}
return stockupAreaVo ;
}
if ( Func . isEmpty ( parcelListEntity ) ) {
//查询无数据已备货库存品包件
UpDownStockupAreaVO stockupAreaVo = disStockListDetailClient . findByPacketBarCodeAndWarehouseId ( warehouseId , orderPackageCode ) ;
//按照无数据进行上架数据整理
if ( Func . isNotEmpty ( stockupAreaVo ) ) {
return stockupAreaVo ;
}
}
log . warn ( method + "未查询到数据" ) ;
return null ;
}
/ * *
* @param upStockupAreaPackageDTOS
* @param allocationId
* @param warehouseId
* @return
* /
@Override
@Transactional
public R upStockupAreaPackage ( List < UpStockupAreaPackageDTO > upStockupAreaPackageDTOS , Long allocationId , Long warehouseId ) {
String method = "###############WarehouseUpdownStockupAreaServiceImpl.upStockupAreaPackage," ;
BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient . getEntityByAllocationId ( allocationId ) ;
if ( Objects . isNull ( goodsAllocationEntity ) ) {
log . warn ( "##############upShelfPackage: 库位不存在 allocationId={}" , allocationId ) ;
return R . fail ( 403 , "库位不存在" ) ;
}
String enableStatus = goodsAllocationEntity . getEnableStatus ( ) ;
Long goodsShelfId = goodsAllocationEntity . getGoodsShelfId ( ) ;
if ( "2" . equals ( enableStatus ) ) {
log . warn ( "##############upShelfPackage: 库位已被禁用 allocationId={}" , allocationId ) ;
return R . fail ( 403 , "库位已被禁用" ) ;
}
BasicdataGoodsShelfEntity goodsShelfEntity = basicdataGoodsShelfClient . getEntityByGoodsShelfId ( goodsShelfId ) ;
if ( Objects . isNull ( goodsShelfEntity ) ) {
log . warn ( "##############upShelfPackage: 货架不存在 goodsShelfId={}" , goodsShelfId ) ;
return R . fail ( 403 , "货架不存在" ) ;
}
Long goodsAreaId = goodsShelfEntity . getGoodsAreaId ( ) ;
BasicdataGoodsAreaEntity goodsAreaEntity = basicdataGoodsAreaClient . getEntityByGoodsAreaId ( goodsAreaId ) ;
if ( Objects . isNull ( goodsAreaEntity ) ) {
log . warn ( "##############upShelfPackage: 货区不存在 goodsAreaId={}" , goodsAreaId ) ;
return R . fail ( 403 , "货区不存在" ) ;
}
String areaType = goodsAreaEntity . getAreaType ( ) ;
if ( ! "1" . equals ( areaType ) ) {
log . warn ( "#################upShelfPackage: 备货区不能上下架 goodsAreaId={}" , goodsAreaId ) ;
throw new CustomerException ( 403 , "请扫描备货库位" ) ;
}
Long wid = goodsAreaEntity . getWarehouseId ( ) ;
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient . getEntityWarehouseId ( wid ) ;
if ( Objects . isNull ( warehouseEntity ) ) {
log . warn ( "##############upShelfPackage: 仓库不存在 warehouseId={}" , wid ) ;
return R . fail ( 403 , "仓库不存在" ) ;
}
if ( ! wid . equals ( warehouseId ) ) {
log . warn ( "##############upShelfPackage: 库位不属于本仓库 wid={}" , wid ) ;
return R . fail ( 403 , "库位不属于本仓库" ) ;
}
List < UpShelfPackageDTO > waitUpShelfPackageDTO = new ArrayList < > ( ) ;
List < WarehouseUpdownStockupAreaEntity > waitSaveWarehouseUpdownStockupAreaEntity = new ArrayList < > ( ) ;
List < WarehouseUpdownStockupAreaLogEntity > waitSaveWarehouseUpdownStockupAreaLogEntity = new ArrayList < > ( ) ;
for ( UpStockupAreaPackageDTO upStockupAreaPackageDTO : upStockupAreaPackageDTOS ) {
if ( "1" . equals ( upStockupAreaPackageDTO . getGoodsType ( ) ) ) {
//查询是否存在上架操作
WarehouseUpdownGoodsEntity updownGoodsEntity = warehouseUpdownGoodsService . getOne ( Wrappers . < WarehouseUpdownGoodsEntity > query ( ) . lambda ( )
. eq ( WarehouseUpdownGoodsEntity : : getWarehouseId , warehouseId )
. eq ( WarehouseUpdownGoodsEntity : : getAssociationValue , upStockupAreaPackageDTO . getAssociationValue ( ) )
public Boolean upStockUpShelf ( String code , Long stockUpAllocationId , Long warehouseId , Integer type , Integer num ) {
String method = "######################WarehouseUpdownStockupAreaServiceImpl.upStockUpShelf" ;
//查询备货库位
BasicdataGoodsAllocationEntity allocationEntity = basicdataGoodsAllocationClient . findStockUpAllocationById ( warehouseId , stockUpAllocationId ) ;
if ( Func . isEmpty ( allocationEntity ) ) {
log . error ( method + "备货库位不存在" ) ;
return false ;
}
WarehouseUpdownStockupAreaEntity warehouseUpdownStockupArea = new WarehouseUpdownStockupAreaEntity ( ) ;
warehouseUpdownStockupArea . setWarehouseId ( warehouseId ) ;
warehouseUpdownStockupArea . setUpdownType ( "1" ) ;
warehouseUpdownStockupArea . setAreaId ( allocationEntity . getGoodsAreaId ( ) ) ;
warehouseUpdownStockupArea . setAreaTitle ( allocationEntity . getGoodsAllocationName ( ) ) ;
warehouseUpdownStockupArea . setShelfId ( allocationEntity . getGoodsShelfId ( ) ) ;
warehouseUpdownStockupArea . setAllocationId ( allocationEntity . getId ( ) ) ;
warehouseUpdownStockupArea . setAllocationTitle ( allocationEntity . getGoodsAllocationName ( ) ) ;
warehouseUpdownStockupArea . setPositionCode ( allocationEntity . getQrCode ( ) ) ;
switch ( type ) {
case 1 :
//包条
DistributionParcelListEntity parcelListEntity = parcelListClient . findByPacketBarCodeAndWarehouseId ( code , warehouseId ) ;
if ( Func . isEmpty ( parcelListEntity ) ) {
//查询订制品包件
log . error ( method + "订制品包件查询失败" ) ;
return false ;
}
//查询订单
DistributionStockArticleEntity entityByStockArticleId = distributionStockArticleClient . findEntityByStockArticleId ( parcelListEntity . getStockArticleId ( ) ) ;
warehouseUpdownStockupArea . setAssociationValue ( parcelListEntity . getOrderPackageCode ( ) ) ;
warehouseUpdownStockupArea . setAssociationId ( parcelListEntity . getId ( ) ) ;
warehouseUpdownStockupArea . setAssociationType ( "2" ) ;
warehouseUpdownStockupArea . setNum ( parcelListEntity . getQuantity ( ) ) ;
warehouseUpdownStockupArea . setMarketName ( entityByStockArticleId . getMallName ( ) ) ;
warehouseUpdownStockupArea . setMarketId ( entityByStockArticleId . getMallId ( ) ) ;
warehouseUpdownStockupArea . setGoodsType ( "1" ) ;
this . save ( warehouseUpdownStockupArea ) ;
break ;
case 2 :
UpDownStockupAreaVO byPacketBarCodeAndWarehouseId = disStockListDetailClient . findByPacketBarCodeAndWarehouseId ( warehouseId , code ) ;
warehouseUpdownStockupArea . setAssociationValue ( byPacketBarCodeAndWarehouseId . getAssociationValue ( ) ) ;
warehouseUpdownStockupArea . setAssociationId ( byPacketBarCodeAndWarehouseId . getAssociationId ( ) ) ;
warehouseUpdownStockupArea . setAssociationType ( "2" ) ;
warehouseUpdownStockupArea . setNum ( byPacketBarCodeAndWarehouseId . getNum ( ) ) ;
warehouseUpdownStockupArea . setGoodsName ( byPacketBarCodeAndWarehouseId . getGoodsName ( ) ) ;
warehouseUpdownStockupArea . setMarketName ( byPacketBarCodeAndWarehouseId . getMarketName ( ) ) ;
warehouseUpdownStockupArea . setMarketId ( byPacketBarCodeAndWarehouseId . getMarketId ( ) ) ;
warehouseUpdownStockupArea . setIncomingBatch ( byPacketBarCodeAndWarehouseId . getIncomingBatch ( ) ) ;
warehouseUpdownStockupArea . setMaterielCode ( byPacketBarCodeAndWarehouseId . getMaterielCode ( ) ) ;
warehouseUpdownStockupArea . setMaterielName ( byPacketBarCodeAndWarehouseId . getMaterielName ( ) ) ;
warehouseUpdownStockupArea . setGoodsType ( "2" ) ;
this . save ( warehouseUpdownStockupArea ) ;
//库存品
break ;
case 3 :
//查询是否存在有上架数据
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient . findZeroByOrderCodeAndWarehouseId ( code , warehouseId ) ;
WarehouseUpdownStockupAreaEntity updownStockupAreaEntity = this . getOne ( Wrappers . < WarehouseUpdownStockupAreaEntity > query ( ) . lambda ( )
. eq ( WarehouseUpdownStockupAreaEntity : : getWarehouseId , warehouseId )
. eq ( WarehouseUpdownStockupAreaEntity : : getAssociationId , stockArticleEntity . getId ( ) )
. eq ( WarehouseUpdownStockupAreaEntity : : getAssociationValue , stockArticleEntity . getOrderCode ( ) )
. eq ( WarehouseUpdownStockupAreaEntity : : getAssociationValue , "3" )
) ;
if ( ! Objects . isNull ( updownGoodsEntity ) ) {
//进行下架解托操作
UpShelfPackageDTO upShelfPackageDTO = new UpShelfPackageDTO ( ) ;
upShelfPackageDTO . setOrderPackageCode ( updownGoodsEntity . getAssociationValue ( ) ) ;
waitUpShelfPackageDTO . add ( upShelfPackageDTO ) ;
if ( Func . isEmpty ( updownStockupAreaEntity ) ) {
warehouseUpdownStockupArea . setAssociationValue ( stockArticleEntity . getOrderCode ( ) ) ;
warehouseUpdownStockupArea . setAssociationId ( stockArticleEntity . getId ( ) ) ;
warehouseUpdownStockupArea . setAssociationType ( "2" ) ;
warehouseUpdownStockupArea . setNum ( num ) ;
warehouseUpdownStockupArea . setGoodsName ( stockArticleEntity . getDescriptionGoods ( ) ) ;
warehouseUpdownStockupArea . setMarketName ( stockArticleEntity . getMallName ( ) ) ;
warehouseUpdownStockupArea . setMarketId ( stockArticleEntity . getMallId ( ) ) ;
warehouseUpdownStockupArea . setGoodsType ( "2" ) ;
this . save ( warehouseUpdownStockupArea ) ;
} else {
int newNum = updownStockupAreaEntity . getNum ( ) + num ;
updownStockupAreaEntity . setNum ( newNum ) ;
this . updateById ( updownStockupAreaEntity ) ;
}
}
//查询是否已经进行上架了 如果进行上架了则不需要进行重复添加
WarehouseUpdownStockupAreaEntity isHave = this . getOne ( Wrappers . < WarehouseUpdownStockupAreaEntity > query ( ) . lambda ( )
. eq ( WarehouseUpdownStockupAreaEntity : : getWarehouseId , warehouseId )
. eq ( WarehouseUpdownStockupAreaEntity : : getAssociationValue , upStockupAreaPackageDTO . getAssociationValue ( ) )
. eq ( WarehouseUpdownStockupAreaEntity : : getAssociationType , upStockupAreaPackageDTO . getAssociationType ( ) )
. eq ( WarehouseUpdownStockupAreaEntity : : getAssociationId , upStockupAreaPackageDTO . getAssociationId ( ) )
. eq ( WarehouseUpdownStockupAreaEntity : : getGoodsType , upStockupAreaPackageDTO . getGoodsType ( ) )
) ;
if ( Objects . isNull ( isHave ) ) {
WarehouseUpdownStockupAreaEntity updownStockupAreaEntity = BeanUtil . copy ( upStockupAreaPackageDTO , WarehouseUpdownStockupAreaEntity . class ) ;
updownStockupAreaEntity . setAreaTitle ( goodsAreaEntity . getHeadline ( ) ) ;
updownStockupAreaEntity . setAreaId ( goodsAreaEntity . getId ( ) ) ;
updownStockupAreaEntity . setShelfId ( goodsShelfEntity . getId ( ) ) ;
updownStockupAreaEntity . setShelfTitle ( goodsShelfEntity . getGoodsShelfName ( ) ) ;
updownStockupAreaEntity . setAllocationId ( goodsAllocationEntity . getId ( ) ) ;
updownStockupAreaEntity . setAllocationTitle ( goodsAllocationEntity . getGoodsAllocationName ( ) ) ;
updownStockupAreaEntity . setPositionCode ( goodsAllocationEntity . getQrCode ( ) ) ;
updownStockupAreaEntity . setWarehouseId ( warehouseId ) ;
updownStockupAreaEntity . setUpdownType ( "包条" ) ;
waitSaveWarehouseUpdownStockupAreaEntity . add ( updownStockupAreaEntity ) ;
WarehouseUpdownStockupAreaLogEntity warehouseUpdownStockupAreaLogEntity = BeanUtil . copy ( updownStockupAreaEntity , WarehouseUpdownStockupAreaLogEntity . class ) ;
warehouseUpdownStockupAreaLogEntity . setRemark ( "扫描上架:包条上架" ) ;
warehouseUpdownStockupAreaLogEntity . setBindingType ( 1 ) ;
waitSaveWarehouseUpdownStockupAreaLogEntity . add ( warehouseUpdownStockupAreaLogEntity ) ;
} else {
return Resp . scanFail ( "包件已上架" , "包件已上架" ) ;
}
//查询是否进行了上架,如果进行了上架需要进行对原库位进行下架,
}
if ( Func . isNotEmpty ( waitUpShelfPackageDTO ) ) {
//存在需要进行下架操作的包件
R r = warehouseUpdownTypeService . downPackageOrDelTray ( waitUpShelfPackageDTO , warehouseId , "备货下架解托" ) ;
if ( 200 ! = r . getCode ( ) ) {
//进行异常保证事务回滚
log . warn ( method + "执行下架失败" ) ;
throw new RuntimeException ( "执行下架失败" ) ;
}
}
if ( ! waitSaveWarehouseUpdownStockupAreaLogEntity . isEmpty ( ) ) {
warehouseUpdownStockupAreaLogService . saveBatch ( waitSaveWarehouseUpdownStockupAreaLogEntity ) ;
}
return R . status ( this . saveBatch ( waitSaveWarehouseUpdownStockupAreaEntity ) ) ;
}
/ * *
* @param allocationId
* @param warehouseId
* @return
* /
@Override
public UpShelfAllocationVO upShelfScanAllocation ( Long allocationId , Long warehouseId ) {
BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient . getEntityByAllocationId ( allocationId ) ;
if ( Objects . isNull ( goodsAllocationEntity ) ) {
log . warn ( "#############upShelfScanAllocation: 库位信息不存在 allocationId={}" , allocationId ) ;
throw new CustomerException ( 403 , "库位信息不存在" ) ;
}
String goodsAllocationName = goodsAllocationEntity . getGoodsAllocationName ( ) ;
Long goodsShelfId = goodsAllocationEntity . getGoodsShelfId ( ) ;
BasicdataGoodsShelfEntity basicdataGoodsShelfEntity = basicdataGoodsShelfClient . getEntityByGoodsShelfId ( goodsShelfId ) ;
if ( Objects . isNull ( basicdataGoodsShelfEntity ) ) {
log . warn ( "#################upShelfScanAllocation: 货架信息不存在 goodsShelfId={}" , goodsShelfId ) ;
throw new CustomerException ( 403 , "货架信息不存在" ) ;
}
String goodsShelfName = basicdataGoodsShelfEntity . getGoodsShelfName ( ) ;
Long goodsAreaId = basicdataGoodsShelfEntity . getGoodsAreaId ( ) ; //货区id
BasicdataGoodsAreaEntity basicdataGoodsAreaEntity = basicdataGoodsAreaClient . getEntityByGoodsAreaId ( goodsAreaId ) ;
if ( Objects . isNull ( basicdataGoodsAreaEntity ) ) {
log . warn ( "#################upShelfScanAllocation: 货区信息不存在 goodsAreaId={}" , goodsAreaId ) ;
throw new CustomerException ( 403 , "货区信息不存在" ) ;
}
String areaType = basicdataGoodsAreaEntity . getAreaType ( ) ;
if ( ! "1" . equals ( areaType ) ) {
log . warn ( "#################upShelfScanAllocation: 备货区不能上下架 goodsAreaId={}" , goodsAreaId ) ;
throw new CustomerException ( 403 , "请扫描备货库位" ) ;
}
Long wid = basicdataGoodsAreaEntity . getWarehouseId ( ) ;
String goodsAreaName = basicdataGoodsAreaEntity . getHeadline ( ) ; //货区名称
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient . getEntityWarehouseId ( wid ) ;
if ( Objects . isNull ( basicdataWarehouseEntity ) ) {
log . warn ( "#################upShelfScanAllocation: 仓库信息不存在 wid={}" , wid ) ;
throw new CustomerException ( 403 , "仓库信息不存在" ) ;
}
if ( ! wid . equals ( warehouseId ) ) {
log . warn ( "#################upShelfScanAllocation: 库位不在当前仓" ) ;
throw new CustomerException ( 403 , "库位不在当前仓" ) ;
}
String warehouseName = basicdataWarehouseEntity . getName ( ) ; //仓库名称
UpShelfAllocationVO upShelfAllocationVO = new UpShelfAllocationVO ( ) ;
upShelfAllocationVO . setWarehouseId ( warehouseId ) ;
upShelfAllocationVO . setWarehouseName ( warehouseName ) ;
upShelfAllocationVO . setAreaId ( goodsAreaId ) ;
upShelfAllocationVO . setAreaTitle ( goodsAreaName ) ;
upShelfAllocationVO . setShelfId ( goodsShelfId ) ;
upShelfAllocationVO . setShelfTitle ( goodsShelfName ) ;
upShelfAllocationVO . setAllocationId ( allocationId ) ;
upShelfAllocationVO . setAllocationTitle ( goodsAllocationName ) ;
//查询已上架的包件列表
List < WarehouseUpdownStockupAreaEntity > list = this . list ( Wrappers . < WarehouseUpdownStockupAreaEntity > query ( ) . lambda ( )
. eq ( WarehouseUpdownStockupAreaEntity : : getWarehouseId , warehouseId )
. eq ( WarehouseUpdownStockupAreaEntity : : getAllocationId , allocationId )
) ;
//查询库位订单总数
Integer orderTotal = baseMapper . selectOrderTotal ( allocationId ) ;
//查询库位单子总数
Integer packageTotal = baseMapper . selectPackageTotal ( allocationId ) ;
//查询库位库存品总数
Integer stockListTotal = baseMapper . selectStockListTotal ( allocationId ) ;
//查询库位库存品总数
Integer inventoryTotal = baseMapper . selectInventoryTotal ( allocationId ) ;
if ( Func . isEmpty ( stockListTotal ) ) {
upShelfAllocationVO . setStockTotalNum ( 0 ) ;
} else {
upShelfAllocationVO . setStockTotalNum ( stockListTotal ) ;
}
upShelfAllocationVO . setTotalNum ( orderTotal ) ;
upShelfAllocationVO . setOrderNum ( packageTotal ) ;
upShelfAllocationVO . setStockNum ( inventoryTotal ) ;
return upShelfAllocationVO ;
}
/ * *
* @param warehouseId
* @param allocationId
* @return
* /
@Override
public R upShelfPackageData ( Long warehouseId , Long allocationId ) {
List < WarehouseUpdownStockupAreaEntity > warehouseUpdownStockupAreaEntities = this . list ( Wrappers . < WarehouseUpdownStockupAreaEntity > query ( ) . lambda ( )
. eq ( WarehouseUpdownStockupAreaEntity : : getWarehouseId , warehouseId )
. eq ( WarehouseUpdownStockupAreaEntity : : getAllocationId , allocationId )
) ;
List < Map < String , Object > > maps = new ArrayList < > ( ) ;
if ( Func . isNotEmpty ( warehouseUpdownStockupAreaEntities ) ) {
//备货库位上存在上架数据,这里进行数据的处理然后给前端数据
//处理有数据的包件
List < WarehouseUpdownStockupAreaEntity > haveSourceData = warehouseUpdownStockupAreaEntities . stream ( ) . filter ( f - > "1" . equals ( f . getGoodsType ( ) ) ) . collect ( Collectors . toList ( ) ) ;
if ( Func . isNotEmpty ( haveSourceData ) ) {
List < Map < String , Object > > packageMap = baseMapper . selectStockUpAreaOrder ( warehouseId , allocationId ) ;
maps . addAll ( packageMap ) ;
}
//查询无数据库存品信息
List < WarehouseUpdownStockupAreaEntity > notSourceInventoryData = warehouseUpdownStockupAreaEntities . stream ( ) . filter ( f - > "2" . equals ( f . getGoodsType ( ) ) & & "3" . equals ( f . getAssociationType ( ) ) ) . collect ( Collectors . toList ( ) ) ;
if ( Func . isNotEmpty ( notSourceInventoryData ) ) {
List < Map < String , Object > > inventoryMap = baseMapper . selectStockUpAreaStockList ( warehouseId , allocationId ) ;
maps . addAll ( inventoryMap ) ;
}
//查询无数据零担订单信息
List < WarehouseUpdownStockupAreaEntity > notSourceOrderData = warehouseUpdownStockupAreaEntities . stream ( ) . filter ( f - > "2" . equals ( f . getGoodsType ( ) ) & & "1" . equals ( f . getAssociationType ( ) ) ) . collect ( Collectors . toList ( ) ) ;
if ( Func . isNotEmpty ( notSourceOrderData ) ) {
List < Map < String , Object > > zeroStockArticleMap = baseMapper . selectStockUpAreaZeroStockArticle ( warehouseId , allocationId ) ;
maps . addAll ( zeroStockArticleMap ) ;
}
}
return R . data ( maps ) ;
}
/ * *
* @param stockType
* @param value
* @param marketId
* @param warehouseId
* @return
* /
@Override
public List < UpdownStockVO > getStockByParam ( Integer stockType , String value , Long marketId , Long warehouseId ) {
List < UpdownStockVO > ls = new ArrayList < > ( ) ;
//1物料编码 2物料名称
if ( 1 = = stockType ) {
//物料编码
String materialCode = value ;
List < DistributionStockListEntity > stockListEntityList = distributionStockListClient . getListByMarketIdAndMaterialCode ( marketId , materialCode , warehouseId ) ;
if ( ! Objects . isNull ( stockListEntityList ) & & stockListEntityList . size ( ) > 0 ) {
for ( DistributionStockListEntity stockListEntity : stockListEntityList ) {
UpdownStockVO vo = stockToUpdownStockVO ( stockListEntity , warehouseId ) ;
ls . add ( vo ) ;
//订单
break ;
case 4 :
//托盘
//查询托盘
QueryWrapper < WarehouseTrayTypeEntity > trayTypeEntityQueryWrapper = new QueryWrapper < > ( ) ;
trayTypeEntityQueryWrapper . eq ( "tray_code" , code )
. eq ( "is_deleted" , 0 ) ;
WarehouseTrayTypeEntity trayTypeEntity = warehouseTrayTypeService . getOne ( trayTypeEntityQueryWrapper ) ;
if ( Func . isEmpty ( trayTypeEntity ) ) {
warehouseUpdownStockupArea . setAssociationValue ( trayTypeEntity . getTrayCode ( ) ) ;
warehouseUpdownStockupArea . setAssociationId ( trayTypeEntity . getTrayId ( ) ) ;
warehouseUpdownStockupArea . setAssociationType ( "4" ) ;
warehouseUpdownStockupArea . setNum ( trayTypeEntity . getOrderTotalNum ( ) ) ;
}
}
} else if ( 2 = = stockType ) {
//物料名称
String materialName = value ;
List < DistributionStockListEntity > stockListList = distributionStockListClient . getEntityByMarketIdAndMaterialName ( marketId , materialName , warehouseId ) ;
for ( DistributionStockListEntity stockListEntity : stockListList ) {
ls . add ( stockToUpdownStockVO ( stockListEntity , warehouseId ) ) ;
}
} else {
log . warn ( "#################getStockByParam: 未知的库存品查询类型" ) ;
}
return ls ;
}
this . save ( warehouseUpdownStockupArea ) ;
/ * *
* @param allList
* @param allocationId
* @param warehouseId
* @return
* /
@Override
@Transactional
public R upShelfStockList ( List < UpShelfStockDTO > allList , Long allocationId , Long warehouseId ) {
String collected = allList . stream ( ) . filter ( f - > f . getEnterNum ( ) < = 0 ) . map ( UpShelfStockDTO : : getMaterialCode ) . collect ( Collectors . joining ( "," ) ) ;
if ( Func . isNotBlank ( collected ) ) {
return Resp . scanFail ( collected + "请输入正确的上架数量" , "请输入正确的上架数量, 物料编码为" ) ;
}
List < UpShelfStockDTO > upShelfStockList = allList ;
BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient . getEntityByAllocationId ( allocationId ) ;
if ( Objects . isNull ( goodsAllocationEntity ) ) {
log . warn ( "##############upShelfOrder: 库位不存在 allocationId={}" , allocationId ) ;
return R . fail ( 403 , "库位不存在" ) ;
break ;
default :
log . error ( method + "未知type:{}" , type ) ;
return false ;
}
String enableStatus = goodsAllocationEntity . getEnableStatus ( ) ;
Long goodsShelfId = goodsAllocationEntity . getGoodsShelfId ( ) ;
if ( "2" . equals ( enableStatus ) ) {
log . warn ( "##############upShelfOrder: 库位已被禁用 allocationId={}" , allocationId ) ;
return R . fail ( 403 , "库位已被禁用" ) ;
}
BasicdataGoodsShelfEntity goodsShelfEntity = basicdataGoodsShelfClient . getEntityByGoodsShelfId ( goodsShelfId ) ;
if ( Objects . isNull ( goodsShelfEntity ) ) {
log . warn ( "##############upShelfOrder: 货架不存在 goodsShelfId={}" , goodsShelfId ) ;
return R . fail ( 403 , "货架不存在" ) ;
}
Long goodsAreaId = goodsShelfEntity . getGoodsAreaId ( ) ;
BasicdataGoodsAreaEntity goodsAreaEntity = basicdataGoodsAreaClient . getEntityByGoodsAreaId ( goodsAreaId ) ;
if ( Objects . isNull ( goodsAreaEntity ) ) {
log . warn ( "##############upShelfOrder: 货区不存在 goodsAreaId={}" , goodsAreaId ) ;
return R . fail ( 403 , "货区不存在" ) ;
}
String areaType = goodsAreaEntity . getAreaType ( ) ;
if ( ! "1" . equals ( areaType ) ) {
log . warn ( "#################upShelfOrder: 备货区不能上下架 goodsAreaId={}" , goodsAreaId ) ;
throw new CustomerException ( 403 , "请扫描备货库位" ) ;
}
Long wid = goodsAreaEntity . getWarehouseId ( ) ;
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient . getEntityWarehouseId ( wid ) ;
if ( Objects . isNull ( warehouseEntity ) ) {
log . warn ( "##############upShelfOrder: 仓库不存在 wid={}" , wid ) ;
return R . fail ( 403 , "仓库不存在" ) ;
}
if ( ! wid . equals ( warehouseId ) ) {
log . warn ( "##############upShelfOrder: 库位不在本仓库中 warehouseId={}" , warehouseId ) ;
return R . fail ( 403 , "库位不在本仓库中" ) ;
}
QueryWrapper < WarehouseUpdownStockupAreaEntity > updownTypeQueryWrapper = new QueryWrapper < > ( ) ;
updownTypeQueryWrapper
. eq ( "allocation_id" , allocationId )
. eq ( "shelf_id" , goodsShelfId )
. eq ( "area_id" , goodsAreaId )
. eq ( "is_deleted" , 0 ) ;
List < WarehouseUpdownStockupAreaEntity > newUpShelfInventoryList = new ArrayList < > ( ) ;
List < WarehouseUpdownStockupAreaLogEntity > newUpShelfInventoryLogList = new ArrayList < > ( ) ;
for ( UpShelfStockDTO upShelfStockDTO : upShelfStockList ) {
updownTypeQueryWrapper . eq ( "materiel_code" , upShelfStockDTO . getMaterialCode ( ) ) ;
updownTypeQueryWrapper . eq ( "association_value" , upShelfStockDTO . getMaterialCode ( ) ) ;
updownTypeQueryWrapper . eq ( "incoming_batch" , upShelfStockDTO . getIncomingBatch ( ) ) ;
WarehouseUpdownStockupAreaEntity updownStockupAreaEntity = this . getOne ( updownTypeQueryWrapper ) ;
if ( Func . isEmpty ( updownStockupAreaEntity ) ) {
//不存在备货库位上架,这里需要进行构建新的数据进行保存
WarehouseUpdownStockupAreaEntity warehouseUpdownStockupArea = createdNewUpShelfInventory ( allocationId , warehouseId , upShelfStockDTO , updownStockupAreaEntity , goodsAreaId , goodsAreaEntity , goodsShelfId , goodsShelfEntity , goodsAllocationEntity ) ;
newUpShelfInventoryList . add ( warehouseUpdownStockupArea ) ;
WarehouseUpdownStockupAreaLogEntity warehouseUpdownStockupAreaLogEntity = Func . copy ( warehouseUpdownStockupArea , WarehouseUpdownStockupAreaLogEntity . class ) ;
warehouseUpdownStockupAreaLogEntity . setBindingType ( 1 ) ;
newUpShelfInventoryLogList . add ( warehouseUpdownStockupAreaLogEntity ) ;
} else {
//存在,需要进行新的上架数量维护
int updateNum = updownStockupAreaEntity . getNum ( ) + upShelfStockDTO . getEnterNum ( ) ;
updownStockupAreaEntity . setNum ( updateNum ) ;
this . updateById ( updownStockupAreaEntity ) ;
WarehouseUpdownStockupAreaLogEntity warehouseUpdownStockupAreaLogEntity = Func . copy ( updownStockupAreaEntity , WarehouseUpdownStockupAreaLogEntity . class ) ;
warehouseUpdownStockupAreaLogEntity . setBindingType ( 1 ) ;
warehouseUpdownStockupAreaLogEntity . setId ( null ) ;
warehouseUpdownStockupAreaLogEntity . setNum ( upShelfStockDTO . getEnterNum ( ) ) ;
newUpShelfInventoryLogList . add ( warehouseUpdownStockupAreaLogEntity ) ;
}
}
if ( Func . isNotEmpty ( newUpShelfInventoryList ) ) {
this . saveBatch ( newUpShelfInventoryList ) ;
}
if ( Func . isNotEmpty ( newUpShelfInventoryLogList ) ) {
warehouseUpdownStockupAreaLogService . saveBatch ( newUpShelfInventoryLogList ) ;
}
int upShelfNum = newUpShelfInventoryLogList . stream ( ) . mapToInt ( WarehouseUpdownStockupAreaLogEntity : : getNum ) . sum ( ) ;
String msg = "上架成功" ;
//更新货位缓存
warehouseGoodsAllocationClient . updateAllocationCache ( allocationId . toString ( ) ) ;
// if (sum>0){msg =msg+sum+"超出输入数量,或输入数量为0,请输入正确数量再进行操作";}
return Resp . scanSuccess ( msg , "成功上架" + upShelfNum + "件" ) ;
}
/ * *
* @param zeroStockArticleCode
* @return
* /
@Override
public R scanZeroStockArticle ( String zeroStockArticleCode , Long warehouseId ) {
String method = "####################WarehouseUpdownStockupAreaServiceImpl.scanZeroStockArticle" ;
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient . findStockArticleByOrderCodeAndWarehouseId ( zeroStockArticleCode , warehouseId ) ;
if ( Func . isEmpty ( stockArticleEntity ) ) {
log . error ( method + "查询订单失败" ) ;
return R . fail ( "请扫描正确订单" ) ;
}
if ( stockArticleEntity . getIsZero ( ) . equals ( IsOrNoConstant . no . getValue ( ) ) ) {
log . error ( method + "此订单不是零担类型" ) ;
return R . fail ( "此订单不是零担类型,请扫描包条进行上架" ) ;
}
//满足条件的零担订单,这里需要进行零担信息整理后返回
UpDownStockupAreaVO upDownStockupZeroByOrderCodeAndWarehouseId = distributionStockArticleClient . findUpDownStockupZeroByOrderCodeAndWarehouseId ( zeroStockArticleCode , warehouseId ) ;
if ( Func . isEmpty ( upDownStockupZeroByOrderCodeAndWarehouseId ) ) {
log . error ( method + "查询零担订单失败" ) ;
return R . fail ( "请扫描正确订单" ) ;
}
//查询该零担订单是否具备有在备货库位上架的条件
Integer a = warehouseTrayTypeService . getZeroOrderByOrderId ( upDownStockupZeroByOrderCodeAndWarehouseId . getOrderId ( ) , warehouseId ) ;
if ( a > 0 ) {
return R . data ( upDownStockupZeroByOrderCodeAndWarehouseId ) ;
} else if ( a = = 0 ) {
return R . fail ( 403 , "请先对该订单进行下架操作" ) ;
} else {
log . error ( method + "此订单数量异常" ) ;
return R . fail ( 403 , "数据异常" ) ;
}
WarehouseUpdownStockupAreaLogEntity warehouseUpdownStockupAreaLogEntity = Func . copy ( warehouseUpdownStockupArea , WarehouseUpdownStockupAreaLogEntity . class ) ;
warehouseUpdownStockupAreaLogEntity . setBindingType ( 1 ) ;
warehouseUpdownStockupAreaLogEntity . setNum ( num ) ;
warehouseUpdownStockupAreaLogService . save ( warehouseUpdownStockupAreaLogEntity ) ;
}
/ * *
* @param upShelfZeroOrderDTOS
* @param allocationId
* @param id
* @return
* /
@Override
public R upShelfZeroOrder ( List < UpShelfZeroOrderDTO > upShelfZeroOrderDTOS , Long allocationId , Long id ) {
//这里目前的上架方式仅仅是进行订单自编码的上架方式和托盘暂时没有绑定关系
//这里进行上架需要进行上架
return null ;
}
/ * *
* @param upShelfZeroOrderList
* @param allocationId
* @return
* /
@Override
public R upShelfZeroStockeArticle ( List < UpShelfZeroOrderDTO > upShelfZeroOrderList , Long allocationId , Long warehouseId ) {
String collected = upShelfZeroOrderList . stream ( ) . filter ( f - > f . getEnterNum ( ) < = 0 ) . map ( UpShelfZeroOrderDTO : : getOrderCode ) . collect ( Collectors . joining ( "," ) ) ;
if ( Func . isNotBlank ( collected ) ) {
return Resp . scanFail ( collected + "请输入正确的上架数量" , "请输入正确的上架数量, 物料编码为" ) ;
}
List < UpShelfZeroOrderDTO > upShelfZeroOrderDTOS = upShelfZeroOrderList ;
BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient . getEntityByAllocationId ( allocationId ) ;
if ( Objects . isNull ( goodsAllocationEntity ) ) {
log . warn ( "##############upShelfOrder: 库位不存在 allocationId={}" , allocationId ) ;
return R . fail ( 403 , "库位不存在" ) ;
}
String enableStatus = goodsAllocationEntity . getEnableStatus ( ) ;
Long goodsShelfId = goodsAllocationEntity . getGoodsShelfId ( ) ;
if ( "2" . equals ( enableStatus ) ) {
log . warn ( "##############upShelfOrder: 库位已被禁用 allocationId={}" , allocationId ) ;
return R . fail ( 403 , "库位已被禁用" ) ;
}
BasicdataGoodsShelfEntity goodsShelfEntity = basicdataGoodsShelfClient . getEntityByGoodsShelfId ( goodsShelfId ) ;
if ( Objects . isNull ( goodsShelfEntity ) ) {
log . warn ( "##############upShelfOrder: 货架不存在 goodsShelfId={}" , goodsShelfId ) ;
return R . fail ( 403 , "货架不存在" ) ;
}
Long goodsAreaId = goodsShelfEntity . getGoodsAreaId ( ) ;
BasicdataGoodsAreaEntity goodsAreaEntity = basicdataGoodsAreaClient . getEntityByGoodsAreaId ( goodsAreaId ) ;
if ( Objects . isNull ( goodsAreaEntity ) ) {
log . warn ( "##############upShelfOrder: 货区不存在 goodsAreaId={}" , goodsAreaId ) ;
return R . fail ( 403 , "货区不存在" ) ;
}
String areaType = goodsAreaEntity . getAreaType ( ) ;
if ( ! "1" . equals ( areaType ) ) {
log . warn ( "#################upShelfOrder: 备货区不能上下架 goodsAreaId={}" , goodsAreaId ) ;
throw new CustomerException ( 403 , "请扫描备货库位" ) ;
}
Long wid = goodsAreaEntity . getWarehouseId ( ) ;
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient . getEntityWarehouseId ( wid ) ;
if ( Objects . isNull ( warehouseEntity ) ) {
log . warn ( "##############upShelfOrder: 仓库不存在 wid={}" , wid ) ;
return R . fail ( 403 , "仓库不存在" ) ;
}
if ( ! wid . equals ( warehouseId ) ) {
log . warn ( "##############upShelfOrder: 库位不在本仓库中 warehouseId={}" , warehouseId ) ;
return R . fail ( 403 , "库位不在本仓库中" ) ;
}
List < WarehouseUpdownStockupAreaEntity > warehouseUpdownStockupAreaEntities = new ArrayList < > ( ) ;
List < WarehouseUpdownStockupAreaLogEntity > warehouseUpdownStockupAreaLogEntities = new ArrayList < > ( ) ;
QueryWrapper < WarehouseUpdownStockupAreaEntity > updownTypeQueryWrapper = new QueryWrapper < > ( ) ;
updownTypeQueryWrapper
. eq ( "allocation_id" , allocationId )
. eq ( "shelf_id" , goodsShelfId )
. eq ( "area_id" , goodsAreaId )
. eq ( "is_deleted" , 0 ) ;
for ( UpShelfZeroOrderDTO upShelfZeroOrderDTO : upShelfZeroOrderDTOS ) {
updownTypeQueryWrapper . eq ( "association_value" , upShelfZeroOrderDTO . getAssociationValue ( ) ) ;
updownTypeQueryWrapper . eq ( "association_type" , upShelfZeroOrderDTO . getAssociationType ( ) ) ;
updownTypeQueryWrapper . eq ( "association_id" , upShelfZeroOrderDTO . getAssociationId ( ) ) ;
updownTypeQueryWrapper . eq ( "goods_type" , upShelfZeroOrderDTO . getGoodsType ( ) ) ;
WarehouseUpdownStockupAreaEntity updownStockupAreaEntity = this . getOne ( updownTypeQueryWrapper ) ;
if ( Func . isNotEmpty ( updownStockupAreaEntity ) ) {
//备货库位上数量增加
//存在,需要进行新的上架数量维护
int updateNum = updownStockupAreaEntity . getNum ( ) + upShelfZeroOrderDTO . getEnterNum ( ) ;
updownStockupAreaEntity . setNum ( updateNum ) ;
this . updateById ( updownStockupAreaEntity ) ;
WarehouseUpdownStockupAreaLogEntity warehouseUpdownStockupAreaLogEntity = Func . copy ( updownStockupAreaEntity , WarehouseUpdownStockupAreaLogEntity . class ) ;
warehouseUpdownStockupAreaLogEntity . setBindingType ( 1 ) ;
warehouseUpdownStockupAreaLogEntity . setId ( null ) ;
warehouseUpdownStockupAreaLogEntity . setNum ( upShelfZeroOrderDTO . getEnterNum ( ) ) ;
warehouseUpdownStockupAreaLogEntities . add ( warehouseUpdownStockupAreaLogEntity ) ;
} else {
//在该备货库位上第一次进行上架操作
WarehouseUpdownStockupAreaEntity warehouseUpdownStockupArea = createdNewUpShelfZeroOrder ( allocationId , warehouseId , upShelfZeroOrderDTO , goodsAreaId , goodsAreaEntity , goodsShelfId , goodsShelfEntity , goodsAllocationEntity ) ;
warehouseUpdownStockupAreaEntities . add ( warehouseUpdownStockupArea ) ;
WarehouseUpdownStockupAreaLogEntity warehouseUpdownStockupAreaLogEntity = Func . copy ( warehouseUpdownStockupArea , WarehouseUpdownStockupAreaLogEntity . class ) ;
warehouseUpdownStockupAreaLogEntity . setBindingType ( 1 ) ;
warehouseUpdownStockupAreaLogEntities . add ( warehouseUpdownStockupAreaLogEntity ) ;
}
}
warehouseUpdownStockupAreaLogService . saveBatch ( warehouseUpdownStockupAreaLogEntities ) ;
return R . status ( this . saveBatch ( warehouseUpdownStockupAreaEntities ) ) ;
}
/ * *
* @param warehouseId
* @param trayCode
* @return
* /
@Override
@Transactional
public R upShelfScanTray ( Long warehouseId , String trayCode ) {
List < WarehouseTrayGoodsEntity > entityList = warehouseTrayGoodsService . list ( Wrappers . < WarehouseTrayGoodsEntity > query ( ) . lambda ( )
. eq ( WarehouseTrayGoodsEntity : : getTrayCode , trayCode )
. eq ( WarehouseTrayGoodsEntity : : getWarehouseId , warehouseId )
) ;
Map < String , Object > map = new HashMap < > ( ) ;
TrayTypeDataVO trayData = warehouseTrayTypeService . getEntityByTrayCode ( trayCode , warehouseId ) ;
if ( ! Objects . isNull ( trayData ) ) {
map . put ( "trayData" , trayData ) ;
}
if ( ! entityList . isEmpty ( ) ) {
//存在托盘,进行托盘货物查询
Map < String , List < WarehouseTrayGoodsEntity > > collect = entityList . stream ( ) . filter ( f - > Func . isNotEmpty ( f . getAssociationType ( ) ) ) . collect ( Collectors . groupingBy ( WarehouseTrayGoodsEntity : : getAssociationType ) ) ;
if ( ! collect . isEmpty ( ) ) {
collect . forEach ( ( k , v ) - > {
switch ( k ) {
case "1" :
//零担
List < UpDownStockupAreaVO > zeroOrder = handelZeroOrder ( v , warehouseId ) ;
if ( ! zeroOrder . isEmpty ( ) ) {
map . put ( "zeroOrder" , zeroOrder ) ;
}
break ;
case "2" :
//运单号
break ;
case "3" :
//包件
//组装包件数据进行上架
List < UpDownStockupAreaVO > packageData = handelPackage ( v , warehouseId ) ;
if ( ! packageData . isEmpty ( ) ) {
map . put ( "packageData" , packageData ) ;
}
break ;
case "4" :
//库存品
List < UpdownStockVO > inventoryData = handelInventory ( v , warehouseId ) ;
if ( ! inventoryData . isEmpty ( ) ) {
map . put ( "inventoryData" , inventoryData ) ;
}
break ;
default :
log . info ( "##################未知打托方式,k:{}" , k ) ;
break ;
}
} ) ;
}
}
return R . data ( map ) ;
}
private List < UpDownStockupAreaVO > handelZeroOrder ( List < WarehouseTrayGoodsEntity > zeroOrderGoods , Long warehouseId ) {
List < UpDownStockupAreaVO > zeroOrderData = new ArrayList < > ( ) ;
for ( WarehouseTrayGoodsEntity zeroOrderGood : zeroOrderGoods ) {
UpDownStockupAreaVO upDownStockupZeroByOrderCodeAndWarehouseId = distributionStockArticleClient . findUpDownStockupZeroByOrderCodeAndWarehouseId ( zeroOrderGood . getAssociationValue ( ) , warehouseId ) ;
if ( Func . isNotEmpty ( upDownStockupZeroByOrderCodeAndWarehouseId ) ) {
Integer a = warehouseTrayTypeService . getZeroOrderByOrderId ( upDownStockupZeroByOrderCodeAndWarehouseId . getOrderId ( ) , warehouseId ) ;
if ( a > 0 ) {
zeroOrderData . add ( upDownStockupZeroByOrderCodeAndWarehouseId ) ;
}
}
}
return zeroOrderData ;
}
private List < UpdownStockVO > handelInventory ( List < WarehouseTrayGoodsEntity > inventoryGoods , Long warehouseId ) {
List < UpdownStockVO > inventoryData = new ArrayList < > ( ) ;
for ( WarehouseTrayGoodsEntity warehouseTrayGoodsEntity : inventoryGoods ) {
List < UpdownStockVO > stockByParam = this . getStockByParam ( 1 , warehouseTrayGoodsEntity . getAssociationValue ( ) , warehouseTrayGoodsEntity . getMarketId ( ) , warehouseId ) ;
if ( ! stockByParam . isEmpty ( ) ) {
inventoryData . addAll ( stockByParam ) ;
}
}
return inventoryData ;
}
private List < UpDownStockupAreaVO > handelPackage ( List < WarehouseTrayGoodsEntity > packageGoods , Long warehouseId ) {
List < UpDownStockupAreaVO > packageData = new ArrayList < > ( ) ;
for ( WarehouseTrayGoodsEntity packageGood : packageGoods ) {
UpDownStockupAreaVO upDownStockupAreaVO = this . upShelfScanPackage ( warehouseId , packageGood . getAssociationValue ( ) ) ;
if ( Func . isNotEmpty ( upDownStockupAreaVO ) ) {
packageData . add ( upDownStockupAreaVO ) ;
}
}
return packageData ;
}
private WarehouseUpdownStockupAreaEntity createdNewUpShelfInventory ( Long allocationId , Long warehouseId , UpShelfStockDTO upShelfStockDTO , WarehouseUpdownStockupAreaEntity updownTypeEntity , Long goodsAreaId , BasicdataGoodsAreaEntity goodsAreaEntity , Long goodsShelfId , BasicdataGoodsShelfEntity goodsShelfEntity , BasicdataGoodsAllocationEntity goodsAllocationEntity ) {
WarehouseUpdownStockupAreaEntity updownStockupAreaEntity = new WarehouseUpdownStockupAreaEntity ( ) ;
updownStockupAreaEntity . setWarehouseId ( warehouseId ) ;
updownStockupAreaEntity . setAreaId ( goodsAreaId ) ;
updownStockupAreaEntity . setAreaTitle ( goodsAreaEntity . getHeadline ( ) ) ;
updownStockupAreaEntity . setShelfId ( goodsShelfId ) ;
updownStockupAreaEntity . setShelfTitle ( goodsShelfEntity . getGoodsShelfName ( ) ) ;
updownStockupAreaEntity . setAllocationId ( allocationId ) ;
updownStockupAreaEntity . setAllocationTitle ( goodsAllocationEntity . getGoodsAllocationName ( ) ) ;
updownStockupAreaEntity . setPositionCode ( goodsAllocationEntity . getQrCode ( ) ) ;
updownStockupAreaEntity . setAssociationValue ( upShelfStockDTO . getMaterialCode ( ) ) ;
updownStockupAreaEntity . setIncomingBatch ( upShelfStockDTO . getIncomingBatch ( ) ) ;
updownStockupAreaEntity . setAssociationType ( "3" ) ;
updownStockupAreaEntity . setUpdownType ( "物料" ) ;
updownStockupAreaEntity . setGoodsType ( "2" ) ;
updownStockupAreaEntity . setNum ( upShelfStockDTO . getEnterNum ( ) ) ;
updownStockupAreaEntity . setMarketId ( upShelfStockDTO . getMarketId ( ) ) ;
updownStockupAreaEntity . setMaterielCode ( upShelfStockDTO . getMaterialCode ( ) ) ;
updownStockupAreaEntity . setMaterielName ( upShelfStockDTO . getMaterialName ( ) ) ;
return updownStockupAreaEntity ;
}
private WarehouseUpdownStockupAreaEntity createdNewUpShelfZeroOrder ( Long allocationId , Long warehouseId , UpShelfZeroOrderDTO upShelfZeroOrderDTO , Long goodsAreaId , BasicdataGoodsAreaEntity goodsAreaEntity , Long goodsShelfId , BasicdataGoodsShelfEntity goodsShelfEntity , BasicdataGoodsAllocationEntity goodsAllocationEntity ) {
WarehouseUpdownStockupAreaEntity updownStockupAreaEntity = new WarehouseUpdownStockupAreaEntity ( ) ;
updownStockupAreaEntity . setWarehouseId ( warehouseId ) ;
updownStockupAreaEntity . setAreaId ( goodsAreaId ) ;
updownStockupAreaEntity . setAreaTitle ( goodsAreaEntity . getHeadline ( ) ) ;
updownStockupAreaEntity . setShelfId ( goodsShelfId ) ;
updownStockupAreaEntity . setShelfTitle ( goodsShelfEntity . getGoodsShelfName ( ) ) ;
updownStockupAreaEntity . setAllocationId ( allocationId ) ;
updownStockupAreaEntity . setAllocationTitle ( goodsAllocationEntity . getGoodsAllocationName ( ) ) ;
updownStockupAreaEntity . setPositionCode ( goodsAllocationEntity . getQrCode ( ) ) ;
updownStockupAreaEntity . setAssociationValue ( upShelfZeroOrderDTO . getAssociationValue ( ) ) ;
updownStockupAreaEntity . setAssociationId ( Long . parseLong ( upShelfZeroOrderDTO . getAssociationId ( ) ) ) ;
updownStockupAreaEntity . setAssociationType ( "1" ) ;
updownStockupAreaEntity . setUpdownType ( "订单" ) ;
updownStockupAreaEntity . setGoodsType ( "2" ) ;
updownStockupAreaEntity . setGoodsName ( upShelfZeroOrderDTO . getGoodsName ( ) ) ;
updownStockupAreaEntity . setNum ( upShelfZeroOrderDTO . getEnterNum ( ) ) ;
updownStockupAreaEntity . setMarketId ( Long . parseLong ( upShelfZeroOrderDTO . getMarketId ( ) ) ) ;
updownStockupAreaEntity . setMarketName ( upShelfZeroOrderDTO . getMarketName ( ) ) ;
return updownStockupAreaEntity ;
}
private UpdownStockVO stockToUpdownStockVO ( DistributionStockListEntity stockListEntity , Long warehouseId ) {
Long marketId = stockListEntity . getMarketId ( ) ;
// Long materialId = stockListEntity.getMaterialId();
Integer quantityStock = stockListEntity . getQuantityStock ( ) ;
String cargoNumber = stockListEntity . getCargoNumber ( ) ; //物料编码
String descriptionGoods = stockListEntity . getDescriptionGoods ( ) ; //物料名称
String incomingBatch = stockListEntity . getIncomingBatch ( ) ; //批次号
UpdownStockVO updownStockVO = new UpdownStockVO ( ) ;
updownStockVO . setMaterialCode ( cargoNumber ) ;
updownStockVO . setMaterialName ( descriptionGoods ) ;
updownStockVO . setIncomingBatch ( incomingBatch ) ;
updownStockVO . setWaybillCode ( "" ) ;
updownStockVO . setOrderCode ( stockListEntity . getOrderCode ( ) ) ;
updownStockVO . setTotalNumber ( stockListEntity . getQuantityStock ( ) ) ;
List < PositionVO > updownGoodsByStock = warehouseUpdownGoodsService . getUpdownGoodsByStock ( marketId , cargoNumber , incomingBatch , warehouseId ) ;
List < PositionVO > trayGoodsByStock = warehouseTrayGoodsService . getTrayGoodsByStockNoAllocationId ( marketId , cargoNumber , incomingBatch , warehouseId ) ;
updownGoodsByStock . addAll ( trayGoodsByStock ) ;
for ( PositionVO positionVO : updownGoodsByStock ) {
Integer num = positionVO . getNum ( ) ;
quantityStock = quantityStock - num ;
}
updownStockVO . setResidueNumber ( quantityStock ) ;
updownStockVO . setList ( updownGoodsByStock ) ;
updownStockVO . setGoodsType ( 3 ) ;
return updownStockVO ;
public BasicdataGoodsAllocationEntity upShelfScanAllocation ( Long allocationId , Long warehouseId ) {
BasicdataGoodsAllocationEntity stockUpAllocationById = basicdataGoodsAllocationClient . findStockUpAllocationById ( warehouseId , allocationId ) ;
return stockUpAllocationById ;
}
}