@ -62,11 +62,9 @@ import org.springblade.common.constant.loading.LoadScanSigningStatusConstant;
import org.springblade.common.constant.loading.LoadingAbnormalAuditingStatusConstant ;
import org.springblade.common.constant.loading.LoadingAbnormalAuditingStatusConstant ;
import org.springblade.common.constant.loading.LoadingIsInsertConstant ;
import org.springblade.common.constant.loading.LoadingIsInsertConstant ;
import org.springblade.common.constant.loading.LoadingStatusConstant ;
import org.springblade.common.constant.loading.LoadingStatusConstant ;
import org.springblade.common.constant.order.OrderReservationStatusConstant ;
import org.springblade.common.constant.order.OrderStatusConstant ;
import org.springblade.common.constant.order.OrderStatusConstant ;
import org.springblade.common.constant.orderpackage.OrderPackageLoadingStatusConstant ;
import org.springblade.common.constant.orderpackage.* ;
import org.springblade.common.constant.orderpackage.OrderPackageReservationStatusConstant ;
import org.springblade.common.constant.orderpackage.OrderPackageStatusConstant ;
import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant ;
import org.springblade.common.constant.printTemplate.PrintTemplateStatusConstant ;
import org.springblade.common.constant.printTemplate.PrintTemplateStatusConstant ;
import org.springblade.common.constant.reservation.* ;
import org.springblade.common.constant.reservation.* ;
import org.springblade.common.constant.stockup.StockAssignStatusConstant ;
import org.springblade.common.constant.stockup.StockAssignStatusConstant ;
@ -147,6 +145,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
private final IWarehouseTrayTypeClient warehouseTrayTypeClient ;
private final IWarehouseTrayTypeClient warehouseTrayTypeClient ;
private final IDistributionLoadscanAbnormalService distributionLoadscanAbnormalService ;
private final IDistributionLoadscanAbnormalService distributionLoadscanAbnormalService ;
private final IDistributionReservationZeroPackageService distributionReservationZeroPackageService ;
private final IDistributionReservationZeroPackageService distributionReservationZeroPackageService ;
private final IDistributionParcelNumberService distributionParcelNumberService ;
// private final BladeRedis redis;
// private final BladeRedis redis;
@ -423,6 +422,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//异步确认包条扫描信息
//异步确认包条扫描信息
// distributionAsyncService.changeOrderSignforStatus(distrilbutionloadingscanDTO.getBarcode());
// distributionAsyncService.changeOrderSignforStatus(distrilbutionloadingscanDTO.getBarcode());
AtomicInteger loadingNum = new AtomicInteger ( ) ;
StringBuilder str = new StringBuilder ( ) ;
DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfEntity ( ) ;
DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfEntity ( ) ;
if ( distributionDeliveryListEntity . getKind ( ) . equals ( "1" ) ) {
if ( distributionDeliveryListEntity . getKind ( ) . equals ( "1" ) ) {
distributionDeliverySelfEntity = distributionDeliverySelfMapper . selectById ( distrilbutionloadingscanDTO . getLoadingId ( ) ) ;
distributionDeliverySelfEntity = distributionDeliverySelfMapper . selectById ( distrilbutionloadingscanDTO . getLoadingId ( ) ) ;
@ -430,7 +431,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
DistributionDeliveryTripartiteEntity distributionDeliveryTripartiteEntity = distributionDeliveryTripartiteMapper . selectById ( distrilbutionloadingscanDTO . getLoadingId ( ) ) ;
DistributionDeliveryTripartiteEntity distributionDeliveryTripartiteEntity = distributionDeliveryTripartiteMapper . selectById ( distrilbutionloadingscanDTO . getLoadingId ( ) ) ;
BeanUtils . copyProperties ( distributionDeliveryTripartiteEntity , distributionDeliverySelfEntity ) ;
BeanUtils . copyProperties ( distributionDeliveryTripartiteEntity , distributionDeliverySelfEntity ) ;
}
}
if ( distrilbutionloadingscanDTO . getType ( ) = = 1 ) {
if ( distrilbutionloadingscanDTO . getType ( ) = = 1 ) {
List < DistributionParcelListEntity > distributionParcelListEntities = distributionDeliveryListMapper . selectPackageListByDeliveryListId ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
List < DistributionParcelListEntity > distributionParcelListEntities = distributionDeliveryListMapper . selectPackageListByDeliveryListId ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
List < DistributionParcelListEntity > parcelListEntityList = distributionParcelListEntities . stream ( ) . filter ( p - > Func . equals ( p . getOrderPackageCode ( ) , distrilbutionloadingscanDTO . getBarcode ( ) ) ) . collect ( Collectors . toList ( ) ) ;
List < DistributionParcelListEntity > parcelListEntityList = distributionParcelListEntities . stream ( ) . filter ( p - > Func . equals ( p . getOrderPackageCode ( ) , distrilbutionloadingscanDTO . getBarcode ( ) ) ) . collect ( Collectors . toList ( ) ) ;
@ -485,13 +485,15 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService . getById ( parcelListEntity . getStockArticleId ( ) ) ;
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService . getById ( parcelListEntity . getStockArticleId ( ) ) ;
stockArticleEntity . setHandQuantity ( stockArticleEntity . getHandQuantity ( ) - parcelListEntity . getQuantity ( ) ) ;
stockArticleEntity . setHandQuantity ( stockArticleEntity . getHandQuantity ( ) - parcelListEntity . getQuantity ( ) ) ;
distributionStockArticleService . updateById ( stockArticleEntity ) ;
distributionStockArticleService . updateById ( stockArticleEntity ) ;
distributionLoadscanService . save ( loadscanEntity ) ;
//查询本车次是否第一次扫码,没有则更新上车时间
//查询本车次是否第一次扫码,没有则更新上车时间
Integer i = distributionDeliveryListMapper . updateloadingTimeById ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
Integer i = distributionDeliveryListMapper . updateloadingTimeById ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
//更新签收表的装车数量
//更新签收表的装车数量
Integer j = distributionSignforMapper . updateloadByReservationId ( loadscanEntity . getDeliveryId ( ) , loadscanEntity . getReservationId ( ) , loadscanEntity . getPackageNub ( ) ) ;
Integer j = distributionSignforMapper . updateloadByReservationId ( loadscanEntity . getDeliveryId ( ) , loadscanEntity . getReservationId ( ) , loadscanEntity . getPackageNub ( ) ) ;
distributionLoadscanService . save ( loadscanEntity ) ;
//这里还需要一个维护状态的方法
//这里还需要一个维护状态的方法
//异步维护状态
//异步维护状态
str . append ( "包件装车" ) ;
loadingNum . getAndAdd ( loadscanEntity . getPackageNub ( ) ) ;
distributionAsyncService . checkLoadingByPackage ( parcelListEntity , distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
distributionAsyncService . checkLoadingByPackage ( parcelListEntity , distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
} else if ( parcelListEntityList . size ( ) = = 0 ) {
} else if ( parcelListEntityList . size ( ) = = 0 ) {
//查找出该包件信息
//查找出该包件信息
@ -511,8 +513,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
& & r . getMallName ( ) . equals ( stockArticleEntity . getMallName ( ) ) ) . collect ( Collectors . toList ( ) ) ;
& & r . getMallName ( ) . equals ( stockArticleEntity . getMallName ( ) ) ) . collect ( Collectors . toList ( ) ) ;
//查看是否存在满足条件的预约单
//查看是否存在满足条件的预约单
if ( reservationEntities . size ( ) = = 1 ) {
if ( reservationEntities . size ( ) = = 1 ) {
return R . fail ( 5000 , "abnormal " ) ;
return R . fail ( 5000 , "异常装车 " ) ;
// return Resp.scanFail("装车失败","程序出错,请联系张思雨 ");
// return Resp.scanFail("装车失败","程序出错,请联系彪桑 ");
} else {
} else {
return Resp . scanFail ( "装车失败" , "窜货" ) ;
return Resp . scanFail ( "装车失败" , "窜货" ) ;
}
}
@ -602,8 +604,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
Integer i = distributionDeliveryListMapper . updateloadingTimeById ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
Integer i = distributionDeliveryListMapper . updateloadingTimeById ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
//更新签收表的装车数量
//更新签收表的装车数量
Integer j = distributionSignforMapper . updateloadByReservationId ( loadscanEntity . getDeliveryId ( ) , loadscanEntity . getReservationId ( ) , loadscanEntity . getPackageNub ( ) ) ;
Integer j = distributionSignforMapper . updateloadByReservationId ( loadscanEntity . getDeliveryId ( ) , loadscanEntity . getReservationId ( ) , loadscanEntity . getPackageNub ( ) ) ;
loadingNum . getAndAdd ( loadscanEntity . getPackageNub ( ) ) ;
}
}
}
}
str . append ( "预约客户整托装车" ) ;
distributionLoadscanService . saveBatch ( reservationLoadscanEntities ) ;
distributionLoadscanService . saveBatch ( reservationLoadscanEntities ) ;
//这里则进行整托装车的数据构建
//这里则进行整托装车的数据构建
} else {
} else {
@ -664,8 +668,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
Integer i = distributionDeliveryListMapper . updateloadingTimeById ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
Integer i = distributionDeliveryListMapper . updateloadingTimeById ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
//更新签收表的装车数量
//更新签收表的装车数量
Integer j = distributionSignforMapper . updateloadByReservationId ( loadscanEntity . getDeliveryId ( ) , loadscanEntity . getReservationId ( ) , loadscanEntity . getPackageNub ( ) ) ;
Integer j = distributionSignforMapper . updateloadByReservationId ( loadscanEntity . getDeliveryId ( ) , loadscanEntity . getReservationId ( ) , loadscanEntity . getPackageNub ( ) ) ;
loadingNum . getAndAdd ( loadscanEntity . getPackageNub ( ) ) ;
}
}
}
}
str . append ( "配送计划整托装车" ) ;
distributionLoadscanService . saveBatch ( deliveryLoadscanEntities ) ;
distributionLoadscanService . saveBatch ( deliveryLoadscanEntities ) ;
//这里则进行整托装车的数据构建
//这里则进行整托装车的数据构建
} else {
} else {
@ -680,7 +686,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
}
}
}
}
}
return Resp . scanSuccess ( "装车成功" , "装车成功 ") ;
return Resp . scanSuccess ( "装车成功" , str . toString ( ) + loadingNum . get ( ) + "件 ") ;
}
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -2340,10 +2346,47 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
waybillNo . add ( s . getWaybillNumber ( ) ) ;
waybillNo . add ( s . getWaybillNumber ( ) ) ;
}
}
DistributionReservationStockarticleEntity reservationStockarticleEntity = new DistributionReservationStockarticleEntity ( ) ;
DistributionReservationStockarticleEntity reservationStockarticleEntity = new DistributionReservationStockarticleEntity ( ) ;
AtomicInteger orderPackageNum = new AtomicInteger ( ) ;
if ( s . getIsZero ( ) . equals ( IsOrNoConstant . no . getValue ( ) ) ) {
//现在前端进行订单提交必然会携带包件信息
//现在前端进行订单提交必然会携带包件信息
List < DistributionParcelListDTO > packageListInfo = s . getPackageListInfo ( ) ;
List < DistributionParcelListDTO > packageListInfo = s . getPackageListInfo ( ) ;
AtomicInteger orderPackageNum = new AtomicInteger ( ) ;
reservationStockarticleEntity . setIsZero ( s . getIsZero ( ) ) ;
if ( ! packageListInfo . isEmpty ( ) ) {
if ( Func . isEmpty ( packageListInfo ) ) {
//添加该订单下可操作包件至计划中
//没有进行包件选择 默认添加可配送的所有包件
//添加订单下的所有在库订单的包件
List < DistributionParcelListEntity > distributionParcelListEntities = distributionParcelListService . list ( Wrappers . < DistributionParcelListEntity > query ( ) . lambda ( ) . eq ( DistributionParcelListEntity : : getStockArticleId , s . getId ( ) )
. ne ( DistributionParcelListEntity : : getOrderPackageLoadingStatus , OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) )
. ne ( DistributionParcelListEntity : : getOrderPackageReservationStatus , OrderPackageReservationStatusConstant . yiyueyue . getValue ( ) )
. notIn ( DistributionParcelListEntity : : getOrderPackageStatus , new String [ ] { OrderPackageStatusConstant . yichuku . getValue ( ) , OrderPackageStatusConstant . yiqianshou . getValue ( ) } ) ) ;
distributionParcelListEntities . forEach ( dp - > {
if ( ! dp . getOrderPackageStatus ( ) . equals ( OrderPackageStatusConstant . yiqianshou . getValue ( ) ) ) {
if ( ! Func . equals ( dp . getOrderPackageFreezeStatus ( ) , OrderPackageFreezeStatusConstant . yidongjie . getValue ( ) ) & & ! Func . equals ( dp . getOrderPackageReservationStatus ( ) , OrderPackageReservationStatusConstant . yiyueyue . getValue ( ) ) ) {
DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity ( ) ;
distributionReservationPackageEntity . setReservationId ( reservationEntity . getId ( ) ) ;
distributionReservationPackageEntity . setParceListId ( dp . getId ( ) ) ;
distributionReservationPackageEntity . setStockArticleId ( s . getId ( ) ) ;
distributionReservationPackageEntity . setPacketBarCode ( dp . getOrderPackageCode ( ) ) ;
//维护订单下包件信息
distributionReservationPackageService . save ( distributionReservationPackageEntity ) ;
//此时订单下的所有包件都处于预约状态,可用数为0
orderPackageNum . getAndAdd ( dp . getQuantity ( ) ) ;
//修改订单下的包件状态
// p.setOrderPackageReservationStatus();
dp . setOrderPackageReservationStatus ( OrderPackageReservationStatusConstant . yiyueyue . getValue ( ) ) ;
distributionParcelListService . updateById ( dp ) ;
distributionAsyncService . checkStockArticleReservationStatus ( dp ) ;
}
}
// stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
} ) ;
s . setReservationStatus ( OrderReservationStatusConstant . yiyueyue . getValue ( ) ) ;
s . setAvailableQuantity ( 0 ) ;
distributionStockArticleService . updateById ( s ) ;
} else {
packageListInfo . forEach ( p - > {
packageListInfo . forEach ( p - > {
orderPackageNum . getAndAdd ( p . getQuantity ( ) ) ;
orderPackageNum . getAndAdd ( p . getQuantity ( ) ) ;
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity ( ) ;
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity ( ) ;
@ -2358,9 +2401,53 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//这里根据包件进行订单状态的改变
//这里根据包件进行订单状态的改变
distributionAsyncService . checkStockArticleReservationStatus ( p ) ;
distributionAsyncService . checkStockArticleReservationStatus ( p ) ;
} ) ;
} ) ;
}
} else if ( s . getIsZero ( ) . equals ( IsOrNoConstant . yes . getValue ( ) ) ) {
List < DistributionParcelNumberVO > parcelNumberVOS = s . getParcelNumberVOS ( ) ;
reservationStockarticleEntity . setIsZero ( s . getIsZero ( ) ) ;
if ( Func . isNotEmpty ( parcelNumberVOS ) ) {
//这里需要先进行是否满足
parcelNumberVOS . forEach ( p - > {
if ( p . getReservationNum ( ) > 0 ) {
DistributionReservationZeroPackageEntity distributionReservationZeroPackageEntity = new DistributionReservationZeroPackageEntity ( ) ;
distributionReservationZeroPackageEntity . setZeroPackageStatus ( ReservationOrderStatusConstant . zhengchang . getValue ( ) ) ;
distributionReservationZeroPackageEntity . setQuantity ( p . getReservationNum ( ) ) ;
distributionReservationZeroPackageEntity . setStockArticleId ( s . getId ( ) ) ;
distributionReservationZeroPackageEntity . setReservationId ( reservationEntity . getId ( ) ) ;
distributionReservationZeroPackageEntity . setType ( DistributionTypeConstant . shangpei . getValue ( ) ) ;
distributionReservationZeroPackageEntity . setParcelListId ( p . getParcelListId ( ) ) ;
distributionReservationZeroPackageEntity . setCategoryName ( p . getFirsts ( ) ) ;
distributionReservationZeroPackageEntity . setRealityQuantity ( 0 ) ;
distributionReservationZeroPackageService . save ( distributionReservationZeroPackageEntity ) ;
p . setDeliveryQuantity ( p . getDeliveryQuantity ( ) + p . getReservationNum ( ) ) ;
distributionParcelNumberService . updateById ( p ) ;
orderPackageNum . getAndAdd ( distributionReservationZeroPackageEntity . getQuantity ( ) ) ;
}
} ) ;
} else {
} else {
log . error ( "订单包件参数有误+{" + packageListInfo + "}" ) ;
List < DistributionParcelNumberVO > list = distributionStockArticleService . getZeroOrderDetail ( s . getId ( ) ) ;
return ;
if ( Func . isNotEmpty ( list ) ) {
list . forEach ( l - > {
DistributionReservationZeroPackageEntity distributionReservationZeroPackageEntity = new DistributionReservationZeroPackageEntity ( ) ;
distributionReservationZeroPackageEntity . setZeroPackageStatus ( ReservationOrderStatusConstant . zhengchang . getValue ( ) ) ;
distributionReservationZeroPackageEntity . setQuantity ( l . getHandQuantity ( ) - l . getDeliveryQuantity ( ) - l . getOutboundQuantity ( ) ) ;
distributionReservationZeroPackageEntity . setStockArticleId ( s . getId ( ) ) ;
distributionReservationZeroPackageEntity . setReservationId ( reservationEntity . getId ( ) ) ;
distributionReservationZeroPackageEntity . setType ( DistributionTypeConstant . shangpei . getValue ( ) ) ;
distributionReservationZeroPackageEntity . setParcelListId ( l . getParcelListId ( ) ) ;
distributionReservationZeroPackageEntity . setCategoryName ( l . getFirsts ( ) ) ;
distributionReservationZeroPackageEntity . setRealityQuantity ( 0 ) ;
distributionReservationZeroPackageService . save ( distributionReservationZeroPackageEntity ) ;
l . setDeliveryQuantity ( l . getDeliveryQuantity ( ) + l . getReservationNum ( ) ) ;
distributionParcelNumberService . updateById ( l ) ;
orderPackageNum . getAndAdd ( distributionReservationZeroPackageEntity . getQuantity ( ) ) ;
} ) ;
} else {
log . error ( "###########################零担订单查询品类错误,订单ID:{}" , s . getId ( ) ) ;
}
}
} else {
log . error ( "########################订单isZero字段错误,订单ID:{}" , s . getId ( ) ) ;
}
}
reservationStockarticleEntity . setReservationId ( reservationEntity . getId ( ) ) ;
reservationStockarticleEntity . setReservationId ( reservationEntity . getId ( ) ) ;
reservationStockarticleEntity . setReservationNum ( orderPackageNum . get ( ) ) ;
reservationStockarticleEntity . setReservationNum ( orderPackageNum . get ( ) ) ;
@ -2394,7 +2481,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
deliveryWarehouseName . add ( reservationEntity . getWarehouseName ( ) ) ;
deliveryWarehouseName . add ( reservationEntity . getWarehouseName ( ) ) ;
deliveryPackageTotal . getAndAdd ( reservationEntity . getReservationNum ( ) ) ;
deliveryPackageTotal . getAndAdd ( reservationEntity . getReservationNum ( ) ) ;
//TODO 这里新增的客户还需要进行和配送任务、备货任务之间的绑定关系
//TODO 这里新增的客户还需要进行和配送任务、备货任务之间的绑定关系
//建立这个预约和配送任务之间的关系
//建立这个预约和配送任务之间的关系
DistributionSignforEntity distributionSignforEntity = new DistributionSignforEntity ( ) ;
DistributionSignforEntity distributionSignforEntity = new DistributionSignforEntity ( ) ;
distributionSignforEntity . setDeliveryId ( deliveryListEntityId ) ;
distributionSignforEntity . setDeliveryId ( deliveryListEntityId ) ;
@ -2406,7 +2492,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
stockupInfoEntity . setReservationId ( reservationEntity . getId ( ) ) ;
stockupInfoEntity . setReservationId ( reservationEntity . getId ( ) ) ;
stockupInfoEntity . setStockupId ( deliveryStockupInfo . getId ( ) ) ;
stockupInfoEntity . setStockupId ( deliveryStockupInfo . getId ( ) ) ;
distributionStockupInfoService . save ( stockupInfoEntity ) ;
distributionStockupInfoService . save ( stockupInfoEntity ) ;
} else {
} else {
//根据配送计划和运单号查询出该预约
//根据配送计划和运单号查询出该预约
// DistributionReservationEntity reservationEntity = baseMapper.selectReservationByDeliveryListIdAndCustomer(deliveryListEntityId, k);
// DistributionReservationEntity reservationEntity = baseMapper.selectReservationByDeliveryListIdAndCustomer(deliveryListEntityId, k);
@ -2457,12 +2542,13 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
}
//此订单包件数量统计
//此订单包件数量统计
AtomicInteger orderPackageNum = new AtomicInteger ( ) ;
AtomicInteger orderPackageNum = new AtomicInteger ( ) ;
if ( Func . isEmpty ( oldOrder . get ( s . getId ( ) ) ) ) {
if ( Func . isEmpty ( oldOrder . get ( s . getId ( ) ) ) ) {
//新增订单
DistributionReservationStockarticleEntity reservationStockarticleEntity = new DistributionReservationStockarticleEntity ( ) ;
DistributionReservationStockarticleEntity reservationStockarticleEntity = new DistributionReservationStockarticleEntity ( ) ;
if ( s . getIsZero ( ) . equals ( IsOrNoConstant . no . getValue ( ) ) ) {
//新增订单
List < DistributionParcelListDTO > packageListInfo = s . getPackageListInfo ( ) ;
List < DistributionParcelListDTO > packageListInfo = s . getPackageListInfo ( ) ;
if ( Func . isNotEmpty ( packageListInfo ) ) {
if ( packageListInfo . size ( ) > 0 ) {
packageListInfo . forEach ( p - > {
packageListInfo . forEach ( p - > {
orderPackageNum . getAndAdd ( p . getQuantity ( ) ) ;
orderPackageNum . getAndAdd ( p . getQuantity ( ) ) ;
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity ( ) ;
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity ( ) ;
@ -2478,8 +2564,84 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionAsyncService . checkStockArticleReservationStatus ( p ) ;
distributionAsyncService . checkStockArticleReservationStatus ( p ) ;
} ) ;
} ) ;
} else {
} else {
log . error ( "订单包件参数有误+{" + packageListInfo + "}" ) ;
//查询该订单下的所有包件信息并插入该计划中
return ;
//添加该订单下可操作包件至计划中
//没有进行包件选择 默认添加可配送的所有包件
//添加订单下的所有在库订单的包件
List < DistributionParcelListEntity > distributionParcelListEntities = distributionParcelListService . list ( Wrappers . < DistributionParcelListEntity > query ( ) . lambda ( ) . eq ( DistributionParcelListEntity : : getStockArticleId , s . getId ( ) )
. ne ( DistributionParcelListEntity : : getOrderPackageLoadingStatus , OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) )
. ne ( DistributionParcelListEntity : : getOrderPackageReservationStatus , OrderPackageReservationStatusConstant . yiyueyue . getValue ( ) )
. notIn ( DistributionParcelListEntity : : getOrderPackageStatus , new String [ ] { OrderPackageStatusConstant . yichuku . getValue ( ) , OrderPackageStatusConstant . yiqianshou . getValue ( ) } ) ) ;
distributionParcelListEntities . forEach ( dp - > {
if ( ! dp . getOrderPackageStatus ( ) . equals ( OrderPackageStatusConstant . yiqianshou . getValue ( ) ) ) {
if ( ! Func . equals ( dp . getOrderPackageFreezeStatus ( ) , OrderPackageFreezeStatusConstant . yidongjie . getValue ( ) ) & & ! Func . equals ( dp . getOrderPackageReservationStatus ( ) , OrderPackageReservationStatusConstant . yiyueyue . getValue ( ) ) ) {
DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity ( ) ;
distributionReservationPackageEntity . setReservationId ( reservationEntity . getId ( ) ) ;
distributionReservationPackageEntity . setParceListId ( dp . getId ( ) ) ;
distributionReservationPackageEntity . setStockArticleId ( s . getId ( ) ) ;
distributionReservationPackageEntity . setPacketBarCode ( dp . getOrderPackageCode ( ) ) ;
//维护订单下包件信息
distributionReservationPackageService . save ( distributionReservationPackageEntity ) ;
//此时订单下的所有包件都处于预约状态,可用数为0
orderPackageNum . getAndAdd ( dp . getQuantity ( ) ) ;
//修改订单下的包件状态
// p.setOrderPackageReservationStatus();
dp . setOrderPackageReservationStatus ( OrderPackageReservationStatusConstant . yiyueyue . getValue ( ) ) ;
distributionParcelListService . updateById ( dp ) ;
distributionAsyncService . checkStockArticleReservationStatus ( dp ) ;
}
}
// stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
} ) ;
s . setReservationStatus ( OrderReservationStatusConstant . yiyueyue . getValue ( ) ) ;
s . setAvailableQuantity ( 0 ) ;
distributionStockArticleService . updateById ( s ) ;
}
} else {
//该客户下增加零担订单
List < DistributionParcelNumberVO > parcelNumberVOS = s . getParcelNumberVOS ( ) ;
reservationStockarticleEntity . setIsZero ( s . getIsZero ( ) ) ;
if ( Func . isNotEmpty ( parcelNumberVOS ) ) {
//这里需要先进行是否满足
parcelNumberVOS . forEach ( p - > {
if ( p . getReservationNum ( ) > 0 ) {
DistributionReservationZeroPackageEntity distributionReservationZeroPackageEntity = new DistributionReservationZeroPackageEntity ( ) ;
distributionReservationZeroPackageEntity . setZeroPackageStatus ( ReservationOrderStatusConstant . zhengchang . getValue ( ) ) ;
distributionReservationZeroPackageEntity . setQuantity ( p . getReservationNum ( ) ) ;
distributionReservationZeroPackageEntity . setStockArticleId ( s . getId ( ) ) ;
distributionReservationZeroPackageEntity . setReservationId ( reservationEntity . getId ( ) ) ;
distributionReservationZeroPackageEntity . setType ( DistributionTypeConstant . shangpei . getValue ( ) ) ;
distributionReservationZeroPackageEntity . setParcelListId ( p . getParcelListId ( ) ) ;
distributionReservationZeroPackageEntity . setCategoryName ( p . getFirsts ( ) ) ;
distributionReservationZeroPackageEntity . setRealityQuantity ( 0 ) ;
distributionReservationZeroPackageService . save ( distributionReservationZeroPackageEntity ) ;
p . setDeliveryQuantity ( p . getDeliveryQuantity ( ) + p . getReservationNum ( ) ) ;
distributionParcelNumberService . updateById ( p ) ;
orderPackageNum . getAndAdd ( distributionReservationZeroPackageEntity . getQuantity ( ) ) ;
}
} ) ;
} else {
List < DistributionParcelNumberVO > list = distributionStockArticleService . getZeroOrderDetail ( s . getId ( ) ) ;
if ( Func . isNotEmpty ( list ) ) {
list . forEach ( l - > {
DistributionReservationZeroPackageEntity distributionReservationZeroPackageEntity = new DistributionReservationZeroPackageEntity ( ) ;
distributionReservationZeroPackageEntity . setZeroPackageStatus ( ReservationOrderStatusConstant . zhengchang . getValue ( ) ) ;
distributionReservationZeroPackageEntity . setQuantity ( l . getHandQuantity ( ) - l . getDeliveryQuantity ( ) - l . getOutboundQuantity ( ) ) ;
distributionReservationZeroPackageEntity . setStockArticleId ( s . getId ( ) ) ;
distributionReservationZeroPackageEntity . setReservationId ( reservationEntity . getId ( ) ) ;
distributionReservationZeroPackageEntity . setType ( DistributionTypeConstant . shangpei . getValue ( ) ) ;
distributionReservationZeroPackageEntity . setParcelListId ( l . getParcelListId ( ) ) ;
distributionReservationZeroPackageEntity . setCategoryName ( l . getFirsts ( ) ) ;
distributionReservationZeroPackageEntity . setRealityQuantity ( 0 ) ;
distributionReservationZeroPackageService . save ( distributionReservationZeroPackageEntity ) ;
l . setDeliveryQuantity ( l . getDeliveryQuantity ( ) + l . getReservationNum ( ) ) ;
distributionParcelNumberService . updateById ( l ) ;
orderPackageNum . getAndAdd ( distributionReservationZeroPackageEntity . getQuantity ( ) ) ;
} ) ;
} else {
log . error ( "###########################零担订单查询品类错误,订单ID:{}" , s . getId ( ) ) ;
}
}
}
}
reservationStockarticleEntity . setReservationId ( reservationEntity . getId ( ) ) ;
reservationStockarticleEntity . setReservationId ( reservationEntity . getId ( ) ) ;
reservationStockarticleEntity . setStockArticleStatus ( ReservationOrderStatusConstant . zengjia . getValue ( ) ) ;
reservationStockarticleEntity . setStockArticleStatus ( ReservationOrderStatusConstant . zengjia . getValue ( ) ) ;
@ -2530,6 +2692,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionReservationPackageService . updateById ( reservationPackageEntity ) ;
distributionReservationPackageService . updateById ( reservationPackageEntity ) ;
//取消包件的预约状态,并且进行整个订单的状态修改
//取消包件的预约状态,并且进行整个订单的状态修改
DistributionParcelListEntity parcelListEntity = distributionParcelListService . getById ( reservationPackageEntity . getParceListId ( ) ) ;
DistributionParcelListEntity parcelListEntity = distributionParcelListService . getById ( reservationPackageEntity . getParceListId ( ) ) ;
parcelListEntity . setOrderPackageReservationStatus ( OrderPackageReservationStatusConstant . daiyuyue . getValue ( ) ) ;
distributionAsyncService . checkStockArticleReservationStatus ( parcelListEntity ) ;
distributionAsyncService . checkStockArticleReservationStatus ( parcelListEntity ) ;
} ) ;
} ) ;
} else {
} else {
@ -3965,6 +4128,50 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
return Resp . scanSuccess ( "操作成功" , "操作成功" ) ;
return Resp . scanSuccess ( "操作成功" , "操作成功" ) ;
}
}
@Override
public R getPackageListByDeliveryIdAndOrderId ( IPage < Object > page , Long deliveryId , Long orderId ) {
List < DistributionParcelListVO > allPackageList = new ArrayList < > ( ) ;
List < DistributionParcelListEntity > reservationPackageList = baseMapper . getPackageListByDeliveryId ( deliveryId , orderId ) ;
DistributionReservationOrderPackageVO reservationOrderPackageVO = new DistributionReservationOrderPackageVO ( ) ;
List < DistributionParcelListEntity > parcelListEntities = distributionParcelListService . list ( Wrappers . < DistributionParcelListEntity > query ( ) . lambda ( )
. eq ( DistributionParcelListEntity : : getStockArticleId , orderId )
. eq ( DistributionParcelListEntity : : getOrderPackageReservationStatus , OrderPackageReservationStatusConstant . daiyuyue . getValue ( ) )
. notIn ( DistributionParcelListEntity : : getOrderPackageStatus , OrderPackageStatusConstant . yiqianshou . getValue ( ) , OrderPackageStatusConstant . yichuku . getValue ( ) ) ) ;
if ( Func . isNotEmpty ( reservationPackageList ) ) {
List < DistributionParcelListVO > parcelListVOS = DistributionParcelListWrapper . build ( ) . listVO ( reservationPackageList ) ;
allPackageList . addAll ( DistributionParcelListWrapper . build ( ) . listVO ( reservationPackageList ) ) ;
String packageListIds = reservationPackageList . stream ( ) . map ( DistributionParcelListEntity : : getId ) . map ( String : : valueOf ) . collect ( Collectors . joining ( "," ) ) ;
reservationOrderPackageVO . setPackageListIds ( packageListIds ) ;
reservationOrderPackageVO . setReservationPackageList ( parcelListVOS ) ;
}
if ( Func . isNotEmpty ( parcelListEntities ) ) {
allPackageList . addAll ( DistributionParcelListWrapper . build ( ) . listVO ( parcelListEntities ) ) ;
}
if ( Func . isEmpty ( allPackageList ) ) {
log . error ( "###########################包件查询结果异常:{}" , allPackageList ) ;
return null ;
}
reservationOrderPackageVO . setPackageList ( allPackageList ) ;
return R . data ( reservationOrderPackageVO ) ;
}
@Override
public List < DistributionParcelNumberVO > getDeliveryZeroOrderDetail ( Long deliveryId , Long orderId ) {
List < DistributionParcelNumberVO > zeroOrderDetail = distributionStockArticleService . getZeroOrderDetail ( orderId ) ;
List < DistributionParcelNumberVO > parcelNumberVOS = baseMapper . selectDeliveryZeroOrderDetail ( orderId , deliveryId ) ;
Map < Long , DistributionParcelNumberVO > reservationNum = parcelNumberVOS . stream ( ) . collect ( Collectors . toMap ( DistributionParcelNumberVO : : getParcelListId , Function . identity ( ) , ( k1 , k2 ) - > k2 ) ) ;
zeroOrderDetail . forEach ( z - > {
if ( Func . isNotEmpty ( reservationNum . get ( z . getParcelListId ( ) ) ) ) {
z . setReservationNum ( reservationNum . get ( z . getParcelListId ( ) ) . getReservationNum ( ) ) ;
}
} ) ;
return zeroOrderDetail ;
}
public Map < String , String > getDriverCar ( String kind , Long deliveryListEntityId ) {
public Map < String , String > getDriverCar ( String kind , Long deliveryListEntityId ) {
Map < String , String > map = new HashMap < > ( ) ;
Map < String , String > map = new HashMap < > ( ) ;
String dirverName = null ;
String dirverName = null ;