@ -148,6 +148,10 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
return list ;
} else if ( upshelfScanType = = 2 ) {
DistributionParcelListEntity parcelListEntity = distributionParcelListClient . findByPacketBarCode ( code ) ;
if ( Objects . isNull ( parcelListEntity ) ) {
log . warn ( "#################findUpShelfScanGoods: 包件信息不存在 orderPackageCode={}" , code ) ;
throw new CustomerException ( 403 , "包件信息不存在" ) ;
}
String orderCode = parcelListEntity . getOrderCode ( ) ;
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient . findStockArticleByOrderCode ( orderCode ) ;
if ( Objects . isNull ( stockArticleEntity ) ) {
@ -303,18 +307,23 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
}
Long trayTypeId = trayTypeEntity . getId ( ) ; //打托方式id
String type = trayTypeEntity . getType ( ) ; //打托分类
upShelfAllocationVO . setTotalNum ( trayTypeEntity . getTotalNum ( ) ) ;
upShelfAllocationVO . setOrderTotalnum ( trayTypeEntity . getOrderTotalNum ( ) ) ;
upShelfAllocationVO . setStockNum ( trayTypeEntity . getStockNum ( ) ) ;
upShelfAllocationVO . setStockTotalNum ( trayTypeEntity . getStockTotalNum ( ) ) ;
if ( "1" . equals ( type ) | | "2" . equals ( type ) ) {
upShelfAllocationVO . setTrayNum ( trayTypeEntity . getTotalNum ( ) ) ;
} else if ( "3" . equals ( type ) | | "4" . equals ( type ) ) {
upShelfAllocationVO . setTrayNum ( trayTypeEntity . getStockNum ( ) ) ;
}
List < UpShelfDataVO > listByTrayTypeId = null ;
if ( PalletProductTypeConstant . CUSTOMIZED . equals ( type ) ) {
upShelfAllocationVO . setTotalNum ( trayTypeEntity . getTotalNum ( ) ) ;
listByTrayTypeId = warehouseTrayGoodsService . getUpListByTrayTypeId ( trayTypeId ) ;
} else if ( PalletProductTypeConstant . ARTIFICIAL . equals ( type ) ) {
upShelfAllocationVO . setTotalNum ( trayTypeEntity . getTotalNum ( ) ) ;
listByTrayTypeId = warehouseTrayGoodsService . getZeroUpListByTrayTypeId ( trayTypeId ) ;
} else if ( PalletProductTypeConstant . STOCKDATA . equals ( type ) ) {
upShelfAllocationVO . setStockTotalNum ( trayTypeEntity . getTotalNum ( ) ) ;
listByTrayTypeId = warehouseTrayGoodsService . getStockUpListByTrayTypeId ( trayTypeId ) ;
} else if ( PalletProductTypeConstant . STOCKNODATA . equals ( type ) ) {
upShelfAllocationVO . setStockTotalNum ( trayTypeEntity . getTotalNum ( ) ) ;
listByTrayTypeId = warehouseTrayGoodsService . getStockUpListByTrayTypeId ( trayTypeId ) ;
}
upShelfAllocationVO . setList ( listByTrayTypeId ) ;
@ -413,9 +422,12 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
if ( ! Objects . isNull ( trayEntity ) ) {
trayCode = trayEntity . getPalletCode ( ) ;
//如果有托盘
TrayTypeDataVO entityByTrayCode = warehouseTrayTypeService . getEntityByTrayCode ( trayCode ) ;
trayType = entityByTrayCode . getTrayType ( ) ;
String type = entityByTrayCode . getType ( ) ; //数据类型 1订制品 2零担 3 4 库存品
QueryWrapper < WarehouseTrayTypeEntity > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "tray_code" , trayCode )
. eq ( "is_deleted" , 0 ) ;
WarehouseTrayTypeEntity trayTypeEntity = warehouseTrayTypeService . getOne ( queryWrapper ) ;
trayType = trayTypeEntity . getTrayType ( ) ;
String type = trayTypeEntity . getType ( ) ; //数据类型 1订制品 2零担 3 4 库存品
if ( ! "1" . equals ( type ) ) {
log . warn ( "##############upShelfOrder: 库位上的托盘是定制品类型 allocationId={}" , allocationId ) ;
return R . fail ( 403 , "库位上的托盘是定制品类型" ) ;
@ -454,14 +466,31 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
String orderPackageCode = upShelfPackageDTO . getOrderPackageCode ( ) ;
log . info ( "##############upShelfPackage: 当前处理的包件码 orderPackageCode={}" , orderPackageCode ) ;
try {
//判断包件是否已经上架
QueryWrapper < WarehouseUpdownGoodsEntity > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "association_value" , orderPackageCode ) ;
WarehouseUpdownGoodsEntity updownGoodsEntity = warehouseUpdownGoodsService . getOne ( queryWrapper ) ;
if ( ! Objects . isNull ( updownGoodsEntity ) ) {
log . warn ( "##############upShelfPackage: 包件已上架 orderPackageCode={}" , orderPackageCode ) ;
continue ;
}
//判断包件是否有绑托盘,
QueryWrapper < WarehouseTrayGoodsEntity > trayGoodsQueryWrapper = new QueryWrapper < > ( ) ;
trayGoodsQueryWrapper . eq ( "association_value" , orderPackageCode ) ;
WarehouseTrayGoodsEntity trayGoodsEntity = warehouseTrayGoodsService . getOne ( trayGoodsQueryWrapper ) ;
if ( ! Objects . isNull ( trayGoodsEntity ) ) {
//已打托的数据需要取消托盘绑定
warehouseTrayTypeService . downPackageByOrderPackageCode ( orderPackageCode , "扫描上架:包件下托" ) ;
}
DistributionParcelListEntity parcelListEntity = distributionParcelListClient . findByPacketBarCode ( orderPackageCode ) ;
//包件级别的上架
upShelfPackageNoTray ( parcelListEntity , goodsAllocationEntity , goodsShelfEntity , goodsAreaEntity ) ;
if ( StringUtil . hasLength ( trayCode ) ) {
//存入托盘信息
warehouseTrayTypeService . orderScanOrderPackageCode ( trayType , trayCode , orderPackageCode ) ;
}
//包件级别的上架
upShelfPackageNoTray ( parcelListEntity , goodsAllocationEntity , goodsShelfEntity , goodsAreaEntity ) ;
num + + ;
} catch ( CustomerException e ) {
log . warn ( e . message ) ;
@ -760,21 +789,12 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
if ( 1 = = zeroType ) {
//零担订单号
String orderCode = code ;
QueryWrapper < WarehouseUpdownGoodsEntity > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "association_value" , orderCode ) ;
List < WarehouseUpdownGoodsEntity > list = warehouseUpdownGoodsService . list ( queryWrapper ) ;
List < WarehouseUpdownGoodsVO > list = warehouseUpdownGoodsService . getZeroOrderList ( orderCode ) ;
return R . data ( list ) ;
} else if ( 2 = = zeroType ) {
//零担运单号
String waybillNumber = code ;
List < WarehouseUpdownGoodsEntity > list = new ArrayList < > ( ) ;
List < DistributionStockArticleEntity > listByWaybillNumber = distributionStockArticleClient . findListByWaybillNumber ( waybillNumber ) ;
for ( DistributionStockArticleEntity stockArticleEntity : listByWaybillNumber ) {
String orderCode = stockArticleEntity . getOrderCode ( ) ;
QueryWrapper < WarehouseUpdownGoodsEntity > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "association_value" , orderCode ) ;
list . addAll ( warehouseUpdownGoodsService . list ( queryWrapper ) ) ;
}
List < WarehouseUpdownGoodsVO > list = warehouseUpdownGoodsService . getZeroOrderListByWaybillNumber ( waybillNumber ) ;
return R . data ( list ) ;
} else {
log . warn ( "#################getZeroOrderByCode: 未知的订单查询类型" ) ;
@ -892,23 +912,14 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
List < WarehouseUpdownGoodsEntity > list = warehouseUpdownGoodsService . list ( queryWrapper ) ;
return R . data ( list ) ;
} else if ( 2 = = stockType ) {
// //2物料名称
// String materialName = code;
// List<WarehouseUpdownGoodsEntity> list = new ArrayList<>();
// List<DistributionStockArticleEntity> listByWaybillNumber = distributionStockArticleClient.findListByWaybillNumber(waybillNumber);
// for (DistributionStockArticleEntity stockArticleEntity:listByWaybillNumber){
// String orderCode = stockArticleEntity.getOrderCode();
// QueryWrapper<WarehouseUpdownGoodsEntity> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("association_value",orderCode);
// list.addAll(warehouseUpdownGoodsService.list(queryWrapper));
// }
// return R.data(list);
//2物料名称
String materialName = code ;
List < WarehouseUpdownGoodsEntity > list = warehouseUpdownGoodsService . findUpdownStockByMaterialName ( materialName , marketId ) ;
return R . data ( list ) ;
} else {
log . warn ( "#################getZeroOrderByCode: 未知的订单查询类型" ) ;
return R . fail ( 403 , "未知的订单查询类型" ) ;
}
return null ;
}
@Override
@ -919,10 +930,12 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
String materialCode = upShelfStockDTO . getMaterialCode ( ) ; //物料编码
Long allocationId = upShelfStockDTO . getAllocationId ( ) ; //库位id
Integer enterNum = upShelfStockDTO . getEnterNum ( ) ; //下架数量
String incomingBatch = upShelfStockDTO . getIncomingBatch ( ) ;
BasicdataTrayEntity trayEntity = warehouseTaryAllocationService . getTrayByAllocationId ( allocationId ) ;
QueryWrapper < WarehouseUpdownGoodsEntity > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "association_value" , materialCode )
. eq ( "incoming_batch" , incomingBatch )
. eq ( "allocation_id" , allocationId ) ;
WarehouseUpdownGoodsEntity updownGoodsEntity = warehouseUpdownGoodsService . getOne ( queryWrapper ) ;
Integer num = updownGoodsEntity . getNum ( ) ;
@ -1245,34 +1258,56 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
private void bindingAllocationAndStockAndLog ( List < UpShelfStockDTO > upShelfStockList , WarehouseUpdownTypeEntity updownTypeEntity ) {
List < WarehouseUpdownGoodsEntity > updownGoodsList = new ArrayList < > ( ) ;
List < WarehouseUpdownGoodsEntity > updownGoodsLogList = new ArrayList < > ( ) ;
for ( UpShelfStockDTO upShelfStockDTO : upShelfStockList ) {
Long marketId = upShelfStockDTO . getMarketId ( ) ;
Long allocationId = updownTypeEntity . getAllocationId ( ) ;
String materialCode = upShelfStockDTO . getMaterialCode ( ) ;
Integer enterNum = upShelfStockDTO . getEnterNum ( ) ;
String incomingBatch = upShelfStockDTO . getIncomingBatch ( ) ;
DistributionStockListEntity stockListEntity = distributionStockListClient . getEntityByMarketIdAndMaterialCodeAndIncomingBatch ( marketId , materialCode , incomingBatch ) ;
WarehouseUpdownGoodsEntity updownGoodsEntity = new WarehouseUpdownGoodsEntity ( ) ;
updownGoodsEntity . setUpdownTypeId ( updownTypeEntity . getId ( ) ) ;
updownGoodsEntity . setAreaId ( updownTypeEntity . getAreaId ( ) ) ;
updownGoodsEntity . setAreaTitle ( updownTypeEntity . getAreaTitle ( ) ) ;
updownGoodsEntity . setShelfId ( updownTypeEntity . getShelfId ( ) ) ;
updownGoodsEntity . setShelfTitle ( updownTypeEntity . getShelfTitle ( ) ) ;
updownGoodsEntity . setAllocationId ( updownTypeEntity . getAllocationId ( ) ) ;
updownGoodsEntity . setAllocationTitle ( updownTypeEntity . getAllocationTitle ( ) ) ;
updownGoodsEntity . setPositionCode ( updownTypeEntity . getPositionCode ( ) ) ;
updownGoodsEntity . setAssociationId ( stockListEntity . getMaterialId ( ) ) ;
updownGoodsEntity . setAssociationValue ( stockListEntity . getCargoNumber ( ) ) ;
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 ) ;
QueryWrapper < WarehouseUpdownGoodsEntity > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "allocation_id" , allocationId )
. eq ( "market_id" , marketId )
. eq ( "association_value" , materialCode )
. eq ( "incoming_batch" , incomingBatch ) ;
WarehouseUpdownGoodsEntity updownGoodsEntity = warehouseUpdownGoodsService . getOne ( queryWrapper ) ;
if ( ! Objects . isNull ( updownGoodsEntity ) ) {
Integer num = updownGoodsEntity . getNum ( ) ;
updownGoodsEntity . setNum ( num + enterNum ) ;
updownGoodsList . add ( updownGoodsEntity ) ;
//存入日志对象
WarehouseUpdownGoodsEntity oldUpdownGoodsEntity = new WarehouseUpdownGoodsEntity ( ) ;
BeanUtil . copy ( updownGoodsEntity , oldUpdownGoodsEntity ) ;
oldUpdownGoodsEntity . setNum ( enterNum ) ;
oldUpdownGoodsEntity . setId ( null ) ;
updownGoodsLogList . add ( oldUpdownGoodsEntity ) ;
} else {
DistributionStockListEntity stockListEntity = distributionStockListClient . getEntityByMarketIdAndMaterialCodeAndIncomingBatch ( marketId , materialCode , incomingBatch ) ;
updownGoodsEntity = new WarehouseUpdownGoodsEntity ( ) ;
updownGoodsEntity . setUpdownTypeId ( updownTypeEntity . getId ( ) ) ;
updownGoodsEntity . setAreaId ( updownTypeEntity . getAreaId ( ) ) ;
updownGoodsEntity . setAreaTitle ( updownTypeEntity . getAreaTitle ( ) ) ;
updownGoodsEntity . setShelfId ( updownTypeEntity . getShelfId ( ) ) ;
updownGoodsEntity . setShelfTitle ( updownTypeEntity . getShelfTitle ( ) ) ;
updownGoodsEntity . setAllocationId ( updownTypeEntity . getAllocationId ( ) ) ;
updownGoodsEntity . setAllocationTitle ( updownTypeEntity . getAllocationTitle ( ) ) ;
updownGoodsEntity . setPositionCode ( updownTypeEntity . getPositionCode ( ) ) ;
updownGoodsEntity . setAssociationId ( stockListEntity . getMaterialId ( ) ) ;
updownGoodsEntity . setAssociationValue ( stockListEntity . getCargoNumber ( ) ) ;
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 ) ;
updownGoodsLogList . add ( updownGoodsEntity ) ;
}
}
warehouseUpdownGoodsService . saveBatch ( updownGoodsList ) ;
saveUpdownGoodsLog ( updownGoodsList , "1" , 0 , "扫描上架:库存品上架" ) ;
saveUpdownGoodsLog ( updownGoodsLogL ist , "1" , 0 , "扫描上架:库存品上架" ) ;
}
private UpdownStockVO stockToUpdownStockVO ( DistributionStockListEntity stockListEntity ) {
@ -1324,30 +1359,47 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
private void bindingAllocationAndZeroOrderAndLog ( List < UpShelfZeroOrderDTO > upShelfZeroOrderList , WarehouseUpdownTypeEntity updownTypeEntity ) {
List < WarehouseUpdownGoodsEntity > updownGoodsList = new ArrayList < > ( ) ;
List < WarehouseUpdownGoodsEntity > updownGoodsLogList = new ArrayList < > ( ) ;
for ( UpShelfZeroOrderDTO upShelfZeroOrderDTO : upShelfZeroOrderList ) {
String orderCode = upShelfZeroOrderDTO . getOrderCode ( ) ;
Integer enterNum = upShelfZeroOrderDTO . getEnterNum ( ) ;
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient . findStockArticleByOrderCode ( orderCode ) ;
WarehouseUpdownGoodsEntity updownGoodsEntity = new WarehouseUpdownGoodsEntity ( ) ;
updownGoodsEntity . setUpdownTypeId ( updownTypeEntity . getId ( ) ) ;
updownGoodsEntity . setAreaId ( updownTypeEntity . getAreaId ( ) ) ;
updownGoodsEntity . setAreaTitle ( updownTypeEntity . getAreaTitle ( ) ) ;
updownGoodsEntity . setShelfId ( updownTypeEntity . getShelfId ( ) ) ;
updownGoodsEntity . setShelfTitle ( updownTypeEntity . getShelfTitle ( ) ) ;
updownGoodsEntity . setAllocationId ( updownTypeEntity . getAllocationId ( ) ) ;
updownGoodsEntity . setAllocationTitle ( updownTypeEntity . getAllocationTitle ( ) ) ;
updownGoodsEntity . setPositionCode ( updownTypeEntity . getPositionCode ( ) ) ;
updownGoodsEntity . setAssociationId ( stockArticleEntity . getId ( ) ) ;
updownGoodsEntity . setAssociationValue ( stockArticleEntity . getOrderCode ( ) ) ;
updownGoodsEntity . setAssociationType ( "1" ) ;
updownGoodsEntity . setGoodsName ( stockArticleEntity . getDescriptionGoods ( ) ) ;
updownGoodsEntity . setNum ( enterNum ) ;
updownGoodsList . add ( updownGoodsEntity ) ;
Long allocationId = updownTypeEntity . getAllocationId ( ) ;
//判断是否有这个订单在库位上
QueryWrapper < WarehouseUpdownGoodsEntity > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "association_value" , orderCode )
. eq ( "allocation_id" , allocationId ) ;
WarehouseUpdownGoodsEntity updownGoodsEntity = warehouseUpdownGoodsService . getOne ( queryWrapper ) ;
if ( ! Objects . isNull ( updownGoodsEntity ) ) {
Integer num = updownGoodsEntity . getNum ( ) ;
updownGoodsEntity . setNum ( num + enterNum ) ;
updownGoodsList . add ( updownGoodsEntity ) ; //存入绑定更新
WarehouseUpdownGoodsEntity oldUpdownGoodsEntity = new WarehouseUpdownGoodsEntity ( ) ;
BeanUtil . copy ( updownGoodsEntity , oldUpdownGoodsEntity ) ;
oldUpdownGoodsEntity . setNum ( enterNum ) ;
oldUpdownGoodsEntity . setId ( null ) ;
updownGoodsLogList . add ( oldUpdownGoodsEntity ) ;
} else {
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient . findStockArticleByOrderCode ( orderCode ) ;
updownGoodsEntity = new WarehouseUpdownGoodsEntity ( ) ;
updownGoodsEntity . setUpdownTypeId ( updownTypeEntity . getId ( ) ) ;
updownGoodsEntity . setAreaId ( updownTypeEntity . getAreaId ( ) ) ;
updownGoodsEntity . setAreaTitle ( updownTypeEntity . getAreaTitle ( ) ) ;
updownGoodsEntity . setShelfId ( updownTypeEntity . getShelfId ( ) ) ;
updownGoodsEntity . setShelfTitle ( updownTypeEntity . getShelfTitle ( ) ) ;
updownGoodsEntity . setAllocationId ( allocationId ) ;
updownGoodsEntity . setAllocationTitle ( updownTypeEntity . getAllocationTitle ( ) ) ;
updownGoodsEntity . setPositionCode ( updownTypeEntity . getPositionCode ( ) ) ;
updownGoodsEntity . setAssociationId ( stockArticleEntity . getId ( ) ) ;
updownGoodsEntity . setAssociationValue ( stockArticleEntity . getOrderCode ( ) ) ;
updownGoodsEntity . setAssociationType ( "1" ) ;
updownGoodsEntity . setGoodsName ( stockArticleEntity . getDescriptionGoods ( ) ) ;
updownGoodsEntity . setNum ( enterNum ) ;
updownGoodsList . add ( updownGoodsEntity ) ;
updownGoodsLogList . add ( updownGoodsEntity ) ;
}
}
warehouseUpdownGoodsService . saveBatch ( updownGoodsList ) ;
saveUpdownGoodsLog ( updownGoodsList , "1" , 0 , "扫描上架:零担上架" ) ;
warehouseUpdownGoodsService . saveOrUpdateBatch ( updownGoodsList ) ;
saveUpdownGoodsLog ( updownGoodsLogList , "1" , 0 , "扫描上架:零担上架" ) ;
}
private R saveTrayGoodsToAllocation ( WarehouseTrayTypeEntity trayTypeEntity , BasicdataGoodsAllocationEntity goodsAllocationEntity , BasicdataGoodsShelfEntity goodsShelfEntity , BasicdataGoodsAreaEntity goodsAreaEntity ) {
@ -1417,6 +1469,7 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
for ( WarehouseUpdownGoodsEntity updownGoodsEntity : updownGoodsList ) {
WarehouseUpdownGoodsLogEntity updownGoodsLogEntity = new WarehouseUpdownGoodsLogEntity ( ) ;
BeanUtil . copy ( updownGoodsEntity , updownGoodsLogEntity ) ;
updownGoodsLogEntity . setId ( null ) ;
updownGoodsLogEntity . setBindingType ( bindingType ) ;
updownGoodsLogEntity . setIsAlltrays ( isAlltrays ) ;
updownGoodsLogEntity . setRemark ( remark ) ;
@ -1485,7 +1538,7 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
String orderCode = parcelListEntity . getOrderCode ( ) ;
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient . findStockArticleByOrderCode ( orderCode ) ;
Integer totalNumber = stockArticleEntity . getTotalNumber ( ) ;
if ( ! set . contains ( associationValu e) ) {
if ( ! set . contains ( orderCod e) ) {
set . add ( orderCode ) ;
orderTotalNum = orderTotalNum + totalNumber ;
}