@ -328,9 +328,20 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
String trayCode = null ;
//判断货位是否有托盘
BasicdataTrayEntity trayEntity = warehouseTaryAllocationService . getTrayByAllocationId ( allocationId ) ;
String trayType = null ;
if ( ! Objects . isNull ( trayEntity ) ) {
trayCode = trayEntity . getPalletCode ( ) ;
//如果有托盘
TrayTypeDataVO entityByTrayCode = warehouseTrayTypeService . getEntityByTrayCode ( trayCode ) ;
trayType = entityByTrayCode . getTrayType ( ) ;
String type = entityByTrayCode . getType ( ) ; //数据类型 1订制品 2零担 3 4 库存品
if ( ! "1" . equals ( type ) ) {
log . warn ( "##############upShelfOrder: 库位上的托盘是定制品类型 allocationId={}" , allocationId ) ;
return R . fail ( 403 , "库位上的托盘是定制品类型" ) ;
}
}
BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient . getEntityByAllocationId ( allocationId ) ;
if ( Objects . isNull ( goodsAllocationEntity ) ) {
log . warn ( "##############upShelfOrder: 库位不存在 allocationId={}" , allocationId ) ;
@ -375,9 +386,7 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
//包件级别的上架
upShelfPackageNoTray ( parcelListEntity , goodsAllocationEntity , goodsShelfEntity , goodsAreaEntity ) ;
if ( StringUtil . hasLength ( trayCode ) ) {
//如果有托盘
TrayTypeDataVO entityByTrayCode = warehouseTrayTypeService . getEntityByTrayCode ( trayCode ) ;
String trayType = entityByTrayCode . getTrayType ( ) ;
//存入托盘信息
warehouseTrayTypeService . orderScanOrderPackageCode ( trayType , trayCode , orderPackageCode ) ;
}
@ -398,10 +407,19 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
public R upShelfPackage ( List < UpShelfPackageDTO > upShelfPackageList , Long allocationId ) {
int num = 0 ;
String trayCode = null ;
String trayType = null ;
//判断货位是否有托盘
BasicdataTrayEntity trayEntity = warehouseTaryAllocationService . getTrayByAllocationId ( allocationId ) ;
if ( ! Objects . isNull ( trayEntity ) ) {
trayCode = trayEntity . getPalletCode ( ) ;
//如果有托盘
TrayTypeDataVO entityByTrayCode = warehouseTrayTypeService . getEntityByTrayCode ( trayCode ) ;
trayType = entityByTrayCode . getTrayType ( ) ;
String type = entityByTrayCode . getType ( ) ; //数据类型 1订制品 2零担 3 4 库存品
if ( ! "1" . equals ( type ) ) {
log . warn ( "##############upShelfOrder: 库位上的托盘是定制品类型 allocationId={}" , allocationId ) ;
return R . fail ( 403 , "库位上的托盘是定制品类型" ) ;
}
}
BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient . getEntityByAllocationId ( allocationId ) ;
if ( Objects . isNull ( goodsAllocationEntity ) ) {
@ -441,9 +459,6 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
//包件级别的上架
upShelfPackageNoTray ( parcelListEntity , goodsAllocationEntity , goodsShelfEntity , goodsAreaEntity ) ;
if ( StringUtil . hasLength ( trayCode ) ) {
//如果有托盘
TrayTypeDataVO entityByTrayCode = warehouseTrayTypeService . getEntityByTrayCode ( trayCode ) ;
String trayType = entityByTrayCode . getTrayType ( ) ;
//存入托盘信息
warehouseTrayTypeService . orderScanOrderPackageCode ( trayType , trayCode , orderPackageCode ) ;
}
@ -524,10 +539,19 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
public R upShelfZeroOrder ( List < UpShelfZeroOrderDTO > upShelfZeroOrderList , Long allocationId ) {
int num = 0 ;
String trayCode = null ;
String trayType = null ;
//判断货位是否有托盘
BasicdataTrayEntity trayEntity = warehouseTaryAllocationService . getTrayByAllocationId ( allocationId ) ;
if ( ! Objects . isNull ( trayEntity ) ) {
trayCode = trayEntity . getPalletCode ( ) ;
//如果有托盘
TrayTypeDataVO entityByTrayCode = warehouseTrayTypeService . getEntityByTrayCode ( trayCode ) ;
trayType = entityByTrayCode . getTrayType ( ) ;
String type = entityByTrayCode . getType ( ) ; //数据类型 1订制品 2零担 3 4 库存品
if ( ! "2" . equals ( type ) ) {
log . warn ( "##############upShelfOrder: 库位上的托盘是零担类型 allocationId={}" , allocationId ) ;
return R . fail ( 403 , "库位上的托盘是零担类型" ) ;
}
}
BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient . getEntityByAllocationId ( allocationId ) ;
if ( Objects . isNull ( goodsAllocationEntity ) ) {
@ -579,8 +603,6 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
zeroOrderVO . setNum ( upShelfZeroOrderDTO . getEnterNum ( ) ) ;
zeroOrderVOList . add ( zeroOrderVO ) ;
}
TrayTypeDataVO trayTypeDataVO = warehouseTrayTypeService . getEntityByTrayCode ( trayCode ) ;
String trayType = trayTypeDataVO . getTrayType ( ) ;
R r = warehouseTrayTypeService . enterZeroOrderByTrayCode ( trayType , trayCode , zeroOrderVOList ) ;
int code = r . getCode ( ) ;
if ( code ! = 200 ) {
@ -621,10 +643,12 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
if ( 1 = = stockType ) {
//物料编码
String materialCode = value ;
DistributionStockListEntity stockListEntity = distributionStockListClient . getEntityByMarketIdAndMaterialCode ( marketId , materialCode ) ;
if ( ! Objects . isNull ( stockListEntity ) ) {
UpdownStockVO vo = stockToUpdownStockVO ( stockListEntity ) ;
ls . add ( vo ) ;
List < DistributionStockListEntity > stockListEntityList = distributionStockListClient . getListByMarketIdAndMaterialCode ( marketId , materialCode ) ;
if ( ! Objects . isNull ( stockListEntityList ) & & stockListEntityList . size ( ) > 0 ) {
for ( DistributionStockListEntity stockListEntity : stockListEntityList ) {
UpdownStockVO vo = stockToUpdownStockVO ( stockListEntity ) ;
ls . add ( vo ) ;
}
}
} else if ( 2 = = stockType ) {
//物料名称
@ -643,10 +667,19 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
public R upShelfStockList ( List < UpShelfStockDTO > upShelfStockList , Long allocationId ) {
int num = 0 ;
String trayCode = null ;
String trayType = null ;
//判断货位是否有托盘
BasicdataTrayEntity trayEntity = warehouseTaryAllocationService . getTrayByAllocationId ( allocationId ) ;
if ( ! Objects . isNull ( trayEntity ) ) {
trayCode = trayEntity . getPalletCode ( ) ;
//如果有托盘
TrayTypeDataVO entityByTrayCode = warehouseTrayTypeService . getEntityByTrayCode ( trayCode ) ;
trayType = entityByTrayCode . getTrayType ( ) ;
String type = entityByTrayCode . getType ( ) ; //数据类型 1订制品 2零担 3 4 库存品
if ( ! "3" . equals ( type ) & & ! "4" . equals ( type ) ) {
log . warn ( "##############upShelfOrder: 库位上的托盘是库存品类型 allocationId={}" , allocationId ) ;
return R . fail ( 403 , "库位上的托盘是库存品类型" ) ;
}
}
BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient . getEntityByAllocationId ( allocationId ) ;
if ( Objects . isNull ( goodsAllocationEntity ) ) {
@ -690,10 +723,8 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
updateUpdownTypeNum ( updownTypeEntity ) ;
if ( ! StringUtil . isBlank ( trayCode ) ) {
TrayTypeDataVO trayTypeDataVO = warehouseTrayTypeService . getEntityByTrayCode ( trayCode ) ;
String trayType = trayTypeDataVO . getTrayType ( ) ;
for ( UpShelfStockDTO upShelfStockDTO : upShelfStockList ) {
R r = warehouseTrayTypeService . enterStockNoDataMaterialCode ( trayCode , trayType , upShelfStockDTO . getMaterialCode ( ) , upShelfStockDTO . getMarketId ( ) , upShelfStockDTO . getEnterNum ( ) ) ;
R r = warehouseTrayTypeService . enterStockNoDataMaterialCode ( trayCode , trayType , upShelfStockDTO . getMaterialCode ( ) , upShelfStockDTO . getMarketId ( ) , upShelfStockDTO . getEnterNum ( ) , upShelfStockDTO . getIncomingBatch ( ) ) ;
int code = r . getCode ( ) ;
if ( code ! = 200 ) {
throw new CustomerException ( code , r . getMsg ( ) ) ;
@ -1065,15 +1096,44 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
public R moveAllocationScanTrayCode ( String trayCode ) {
BasicdataTrayEntity trayEntity = basicdataTrayClient . getTrayByTrayCode ( trayCode ) ; //托盘信息
if ( Objects . isNull ( trayEntity ) ) {
log . warn ( "#################findUpShelfScanGoods : 托盘信息不存在 trayCode={}" , trayCode ) ;
log . warn ( "#################moveAllocationScanTrayCode : 托盘信息不存在 trayCode={}" , trayCode ) ;
return R . fail ( 403 , "托盘信息不存在" ) ;
}
Long allocationId = warehouseTaryAllocationService . getAllocationIdByTrayId ( trayEntity . getId ( ) ) ;
if ( Objects . isNull ( allocationId ) ) {
log . warn ( "#################findUpShelfScanGoods : 托盘未上架 trayCode={}" , trayCode ) ;
log . warn ( "#################moveAllocationScanTrayCode : 托盘未上架 trayCode={}" , trayCode ) ;
return R . fail ( 403 , "托盘未上架" ) ;
}
BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient . getEntityByAllocationId ( allocationId ) ;
if ( Objects . isNull ( goodsAllocationEntity ) ) {
log . warn ( "##############moveAllocationScanTrayCode: 库位不存在 allocationId={}" , allocationId ) ;
return R . fail ( 403 , "库位不存在" ) ;
}
String enableStatus = goodsAllocationEntity . getEnableStatus ( ) ;
Long goodsShelfId = goodsAllocationEntity . getGoodsShelfId ( ) ;
if ( "2" . equals ( enableStatus ) ) {
log . warn ( "##############moveAllocationScanTrayCode: 库位已被禁用 allocationId={}" , allocationId ) ;
return R . fail ( 403 , "库位已被禁用" ) ;
}
BasicdataGoodsShelfEntity goodsShelfEntity = basicdataGoodsShelfClient . getEntityByGoodsShelfId ( goodsShelfId ) ;
if ( Objects . isNull ( goodsShelfEntity ) ) {
log . warn ( "##############moveAllocationScanTrayCode: 货架不存在 goodsShelfId={}" , goodsShelfId ) ;
return R . fail ( 403 , "货架不存在" ) ;
}
Long goodsAreaId = goodsShelfEntity . getGoodsAreaId ( ) ;
BasicdataGoodsAreaEntity goodsAreaEntity = basicdataGoodsAreaClient . getEntityByGoodsAreaId ( goodsAreaId ) ;
if ( Objects . isNull ( goodsAreaEntity ) ) {
log . warn ( "##############moveAllocationScanTrayCode: 货区不存在 goodsAreaId={}" , goodsAreaId ) ;
return R . fail ( 403 , "货区不存在" ) ;
}
Long warehouseId = goodsAreaEntity . getWarehouseId ( ) ;
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient . getEntityWarehouseId ( warehouseId ) ;
if ( Objects . isNull ( warehouseEntity ) ) {
log . warn ( "##############moveAllocationScanTrayCode: 仓库不存在 warehouseId={}" , warehouseId ) ;
return R . fail ( 403 , "仓库不存在" ) ;
}
Long trayId = trayEntity . getId ( ) ;
QueryWrapper < WarehouseTrayTypeEntity > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "tray_id" , trayId )
@ -1085,6 +1145,7 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
}
Long trayTypeId = trayTypeEntity . getId ( ) ; //打托方式id
String type = trayTypeEntity . getType ( ) ; //打托分类
List < UpShelfDataVO > listByTrayTypeId = null ;
if ( PalletProductTypeConstant . CUSTOMIZED . equals ( type ) ) {
listByTrayTypeId = warehouseTrayGoodsService . getUpListByTrayTypeId ( trayTypeId ) ;
@ -1095,7 +1156,17 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
} else if ( PalletProductTypeConstant . STOCKNODATA . equals ( type ) ) {
listByTrayTypeId = warehouseTrayGoodsService . getStockUpListByTrayTypeId ( trayTypeId ) ;
}
return R . data ( listByTrayTypeId ) ;
Map < String , Object > map = new HashMap < > ( ) ;
map . put ( "warehouseId" , warehouseId ) ;
map . put ( "warehouseName" , warehouseEntity . getName ( ) ) ;
map . put ( "areaId" , goodsAreaId ) ;
map . put ( "areaName" , goodsAreaEntity . getHeadline ( ) ) ;
map . put ( "shelfId" , goodsShelfId ) ;
map . put ( "shelfName" , goodsShelfEntity . getGoodsShelfName ( ) ) ;
map . put ( "allocationId" , allocationId ) ;
map . put ( "allocationName" , goodsAllocationEntity . getGoodsAllocationName ( ) ) ;
map . put ( "list" , listByTrayTypeId ) ;
return R . data ( map ) ;
}
@Override
@ -1130,7 +1201,8 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
Long marketId = upShelfStockDTO . getMarketId ( ) ;
String materialCode = upShelfStockDTO . getMaterialCode ( ) ;
Integer enterNum = upShelfStockDTO . getEnterNum ( ) ;
DistributionStockListEntity stockListEntity = distributionStockListClient . getEntityByMarketIdAndMaterialCode ( marketId , materialCode ) ;
String incomingBatch = upShelfStockDTO . getIncomingBatch ( ) ;
DistributionStockListEntity stockListEntity = distributionStockListClient . getEntityByMarketIdAndMaterialCodeAndIncomingBatch ( marketId , materialCode , incomingBatch ) ;
WarehouseUpdownGoodsEntity updownGoodsEntity = new WarehouseUpdownGoodsEntity ( ) ;
updownGoodsEntity . setUpdownTypeId ( updownTypeEntity . getId ( ) ) ;
updownGoodsEntity . setAreaId ( updownTypeEntity . getAreaId ( ) ) ;
@ -1145,6 +1217,9 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
updownGoodsEntity . setAssociationType ( "4" ) ;
updownGoodsEntity . setGoodsName ( stockListEntity . getDescriptionGoods ( ) ) ;
updownGoodsEntity . setNum ( enterNum ) ;
updownGoodsEntity . setMarketId ( stockListEntity . getMarketId ( ) ) ;
updownGoodsEntity . setMarketName ( stockListEntity . getMarketName ( ) ) ;
updownGoodsEntity . setIncomingBatch ( stockListEntity . getIncomingBatch ( ) ) ;
updownGoodsList . add ( updownGoodsEntity ) ;
}
warehouseUpdownGoodsService . saveBatch ( updownGoodsList ) ;
@ -1156,7 +1231,13 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
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 ( ) ) ;
@ -1164,6 +1245,7 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
QueryWrapper < WarehouseUpdownGoodsEntity > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "association_type" , "4" )
. eq ( "association_id" , materialId )
. eq ( "incoming_batch" , incomingBatch )
. eq ( "market_id" , marketId ) ;
List < WarehouseUpdownGoodsEntity > list = warehouseUpdownGoodsService . list ( queryWrapper ) ;
Integer useNum = 0 ;
@ -1286,6 +1368,7 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
updownGoodsEntity . setNum ( trayGoodsEntity . getNum ( ) ) ;
updownGoodsEntity . setMarketId ( trayGoodsEntity . getMarketId ( ) ) ;
updownGoodsEntity . setMarketName ( trayGoodsEntity . getMarketName ( ) ) ;
updownGoodsEntity . setIncomingBatch ( trayGoodsEntity . getIncomingBatch ( ) ) ;
updownGoodsList . add ( updownGoodsEntity ) ;
}
warehouseUpdownGoodsService . saveBatch ( updownGoodsList ) ;
@ -1351,6 +1434,7 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
String associationValue = updownGoodsEntity . getAssociationValue ( ) ;
Long marketId = updownGoodsEntity . getMarketId ( ) ;
Integer num = updownGoodsEntity . getNum ( ) ;
String incomingBatch = updownGoodsEntity . getIncomingBatch ( ) ;
if ( "1" . equals ( associationType ) ) {
//零担订单数据
String orderCode = associationValue ;
@ -1373,7 +1457,7 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
}
totalNum = totalNum + num ;
} else if ( "4" . equals ( associationType ) ) {
DistributionStockListEntity stockListEntity = distributionStockListClient . getEntityByMarketIdAndMaterialId ( marketId , associationId ) ;
DistributionStockListEntity stockListEntity = distributionStockListClient . getEntityByMarketIdAndMaterialId ( marketId , associationId , incomingBatch ) ;
Integer quantityStock = stockListEntity . getQuantityStock ( ) ;
stockNum = stockNum + num ;
stockTotalNum = stockTotalNum + quantityStock ;