@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper ;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper ;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper ;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper ;
import com.baomidou.mybatisplus.core.metadata.IPage ;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils ;
import com.baomidou.mybatisplus.core.toolkit.StringUtils ;
@ -101,6 +102,8 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
private final IDistributionBillLadingScanService distributionBillLadingScanService ;
private final IDistrilbutionBillStockService distrilbutionBillStockService ;
private final IDistributionStockupScanService distributionStockupScanService ;
@ -197,6 +200,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}
}
//判断有没有库存品数据
private void updateStockBill ( DistrilbutionBillLadingDTO distrilbutionBillLading ) {
List < DistributionDeliveryDetailsEntity > list = distributionDeliveryDetailsService . list ( Wrappers . < DistributionDeliveryDetailsEntity > query ( ) . lambda ( )
@ -246,9 +250,9 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}
/ * *
* 提货单 新增或修改
*
* @param distrilbutionBillLading
* @return
* /
@ -622,8 +626,6 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
@Override
public boolean signImages ( DistrilbutionBillLadingDTO distrilbutionBillLading ) {
//修改图片
List < DistributionPrintEntity > printEntityList = distributionPrintService . list ( Wrappers . < DistributionPrintEntity > query ( ) . lambda ( ) . eq ( DistributionPrintEntity : : getBillLadingId , distrilbutionBillLading . getId ( ) ) ) ;
if ( ! printEntityList . isEmpty ( ) ) {
@ -645,8 +647,114 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
return false ;
}
@Override
public R cancelBillLoding ( String billLodingIds ) {
String method = "##########类DistrilbutionBillLadingServiceImpl执行方法cancelBillLoding," ;
List < Long > ids = Func . toLongList ( "," , billLodingIds ) ;
List < DistrilbutionBillLadingEntity > distrilbutionBillLadingEntities = this . listByIds ( ids ) ;
if ( Func . isEmpty ( distrilbutionBillLadingEntities ) ) {
log . error ( method + "查询自提单信息失败:{}" , billLodingIds ) ;
return R . fail ( "服务器正忙,请联系管理员!!!" ) ;
}
String errorBillLading = distrilbutionBillLadingEntities . stream ( ) . filter ( f - > ! f . getConditions ( ) . equals ( BillLadingStatusConstant . daitihuo . getValue ( ) ) ) . map ( DistrilbutionBillLadingEntity : : getPickupBatch ) . collect ( Collectors . joining ( "," ) ) ;
if ( Func . isNotEmpty ( errorBillLading ) ) {
log . error ( method + "存在已提货或签收自提单:{}" , errorBillLading ) ;
return R . fail ( errorBillLading + "已提货或已签收!!!" ) ;
}
//查询是否存在自提扫描的有效包件
List < DistributionBillLadingScanEntity > ladingScanEntities = distributionBillLadingScanService . list ( Wrappers . < DistributionBillLadingScanEntity > query ( ) . lambda ( )
. in ( DistributionBillLadingScanEntity : : getBillLadingId , ids )
) ;
if ( Func . isNotEmpty ( ladingScanEntities ) ) {
log . error ( method + "取消自提单存在自提扫描数据:{}" , errorBillLading ) ;
return R . fail ( errorBillLading + "已提货或已签收!!!" ) ;
}
//满足进行取消自提,进行自提单的资源释放
//直接对配送的包件和库存品进行取消
Integer a = this . cancelBillLodingPackage ( ids ) ;
switch ( a ) {
case 0 :
//进行自提单的取消
this . removeBatchByIds ( ids ) ;
return R . status ( true ) ;
case 1 :
return R . fail ( "未授权!!!" ) ;
case 2 :
return R . fail ( "存在签收包件" ) ;
}
return R . status ( false ) ;
}
@Transactional
private Integer cancelBillLodingPackage ( List < Long > ids ) {
String method = "##########类DistrilbutionBillLadingServiceImpl执行方法cancelBillLoding," ;
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient . getMyCurrentWarehouse ( ) ;
if ( Func . isEmpty ( myCurrentWarehouse ) ) {
//未授权
return 1 ;
}
//查询关联包件进行状态恢复
List < DistributionParcelListEntity > distributionParcelListEntities = baseMapper . selectBillLadingPackage ( ids ) ;
if ( Func . isNotEmpty ( distributionParcelListEntities ) ) {
List < DistributionParcelListEntity > signingPakcage = distributionParcelListEntities . stream ( ) . filter ( f - > f . getOrderPackageStatus ( ) . equals ( OrderPackageStatusConstant . yiqianshou . getValue ( ) ) ) . collect ( Collectors . toList ( ) ) ;
if ( Func . isNotEmpty ( signingPakcage ) ) {
//存在签收包件
return 2 ;
}
//取消包件
UpdateWrapper < DistrilbutionBillPackageEntity > updateWrapper = new UpdateWrapper < > ( ) ;
updateWrapper . lambda ( )
. in ( DistrilbutionBillPackageEntity : : getBillLadingId , ids )
. set ( DistrilbutionBillPackageEntity : : getPacketBarStatus , "3" )
;
distrilbutionBillPackageService . update ( updateWrapper ) ;
//取消订单
UpdateWrapper < DistrilbutionBillStockEntity > orderUpdateWrapper = new UpdateWrapper < > ( ) ;
orderUpdateWrapper . lambda ( )
. in ( DistrilbutionBillStockEntity : : getBillLadingId , ids )
. set ( DistrilbutionBillStockEntity : : getOrderStatus , "3" )
;
distrilbutionBillStockService . update ( orderUpdateWrapper ) ;
List < Long > packageIds = distributionParcelListEntities . stream ( ) . map ( DistributionParcelListEntity : : getId ) . collect ( Collectors . toList ( ) ) ;
//将这些包件还原成可操作状态
Integer num = distributionParcelListService . restorePakcageByIds ( packageIds ) ;
//维护订单状态
String orderCodes = distributionParcelListEntities . stream ( ) . map ( DistributionParcelListEntity : : getOrderCode ) . distinct ( ) . collect ( Collectors . joining ( "," ) ) ;
distributionStockArticleService . maintenanceOrderInfo ( orderCodes , myCurrentWarehouse . getId ( ) ) ;
}
//取消库存品
//查询自提库存品信息
List < DistributionDeliveryDetailsEntity > distributionStockListEntities = baseMapper . selectBillLadingInventory ( ids ) ;
if ( Func . isNotEmpty ( distributionStockListEntities ) ) {
//已经备货的库存品 存在库存品包件
distributionStockListEntities . forEach ( ddd - > {
//恢复库存品数量
distributionStockListService . updateInventoryQuantityOccupied ( ddd . getStockListId ( ) , ddd . getQuantity ( ) ) ;
//进行库存品包件取消
if ( ddd . getStockStatus ( ) . equals ( "3" ) ) {
disStockListDetailService . cancelInventoryPackageByReservationIdAnStockListId ( ddd . getStockListId ( ) , ddd . getBillLadingId ( ) ) ;
}
}
) ;
//对所有的库存品相关进行取消标识
UpdateWrapper < DistributionDeliveryDetailsEntity > updateWrapper = new UpdateWrapper < > ( ) ;
updateWrapper . lambda ( )
. set ( DistributionDeliveryDetailsEntity : : getInventoryStatus , 3 )
. set ( DistributionDeliveryDetailsEntity : : getQuantity , 0 )
. in ( DistributionDeliveryDetailsEntity : : getBillLadingId , ids ) ;
distributionDeliveryDetailsService . update ( updateWrapper ) ;
}
return 0 ;
}
/ * *
* 自提没有包件信息添加包件
*
* @param stockArticleId
* @param billId
* @param parcelLisList
@ -696,9 +804,9 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}
/ * *
* 添加提货包件数据
*
* @return
* /
public Boolean updateBillPackeg ( DistrilbutionBillLadingDTO distrilbutionBillLading ) {
@ -767,9 +875,9 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}
/ * *
* 修改零担
*
* @param distrilbutionBillLadingDTO
* @return
* /
@ -837,7 +945,9 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
zeroPackageEntity . setRealityQuantity ( 0 ) ;
packageEntityList . add ( zeroPackageEntity ) ;
} ) ;
if ( ! packageEntityList . isEmpty ( ) ) { distributionZeroPackageService . saveBatch ( packageEntityList ) ; }
if ( ! packageEntityList . isEmpty ( ) ) {
distributionZeroPackageService . saveBatch ( packageEntityList ) ;
}
} else {
log . warn ( "没有品类数据" ) ;
@ -848,8 +958,6 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}
/ * *
* 修改操作订单数据
*
@ -1868,6 +1976,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}
return true ;
}
/ * *
* 处理提货库存品签收
* /
@ -1893,15 +2002,12 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}
}
}
/ * *
* 修改包件签收状态
* /
@ -1955,7 +2061,6 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
} ) ;
// if(!scanEntityList.isEmpty()){
// distributionBillLadingScanService.saveBatch(scanEntityList);
// }
@ -1964,8 +2069,6 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}
@Override
public DistrilbutionBillLadingVO listNum ( Map < String , Object > distrilbutionBillLading ) {
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient . getMyCurrentWarehouse ( ) ;
@ -2133,6 +2236,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
/ * *
* 零担的包件物料数据查询
*
* @param billLadingAppDTO
* @return
* /
@ -2170,6 +2274,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
/ * *
* 零担批量签收
*
* @param billLadingAppDTO
* @return
* /
@ -2256,6 +2361,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
/ * *
* 查询订单信息
*
* @param billLadingAppDTO
* @return
* /
@ -2297,6 +2403,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
/ * *
* 零担单个签收
*
* @param billLadingAppDTO
* @return
* /
@ -2385,6 +2492,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
/ * *
* 添加自提图片
*
* @param billLadingAppDTO
* @return
* /
@ -2438,6 +2546,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
/ * *
* 查询自提签收图片
*
* @param billLadingAppDTO
* @return
* /
@ -2472,6 +2581,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
/ * *
* 修改订单状态
*
* @return
* /
public Boolean updateStockArticle ( Integer sum , Long stockArticleId ) {