@ -42,14 +42,19 @@ import com.logpm.distribution.vo.*;
import com.logpm.distribution.vo.app.* ;
import com.logpm.distribution.vo.print.PrintPreviewVO ;
import com.logpm.distribution.wrapper.* ;
import com.logpm.warehouse.entity.WarehouseRetentionScanEntity ;
import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity ;
import com.logpm.warehouse.feign.IWarehouseRetentionScanClient ;
import com.logpm.warehouse.feign.IWarehouseTrayGoodsClient ;
import com.logpm.warehouse.feign.IWarehouseTrayTypeClient ;
import com.logpm.warehouse.feign.IWarehouseUpdownTypeClient ;
import com.logpm.warehouse.vo.TrayTypeDataVO ;
import lombok.AllArgsConstructor ;
import lombok.extern.log4j.Log4j2 ;
import org.apache.commons.lang.StringUtils ;
import org.apache.ibatis.scripting.xmltags.ForEachSqlNode ;
import org.jetbrains.annotations.NotNull ;
import org.springblade.common.constant.DictBizConstant ;
import org.springblade.common.constant.DistributionTypeConstant ;
import org.springblade.common.constant.Inventory.InventoryLoadingStatusConstant ;
import org.springblade.common.constant.common.IsOrNoConstant ;
@ -77,6 +82,7 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser ;
import org.springblade.core.secure.utils.AuthUtil ;
import org.springblade.core.tool.api.R ;
import org.springblade.core.tool.constant.BladeConstant ;
import org.springblade.core.tool.utils.Func ;
import org.springblade.core.tool.utils.ObjectUtil ;
import org.springblade.system.cache.DictBizCache ;
@ -146,6 +152,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
private final IDistributionLoadscanAbnormalService distributionLoadscanAbnormalService ;
private final IDistributionReservationZeroPackageService distributionReservationZeroPackageService ;
private final IDistributionParcelNumberService distributionParcelNumberService ;
private final IWarehouseTrayGoodsClient warehouseTrayGoodsClient ;
private final IWarehouseRetentionScanClient warehouseRetentionScanClient ;
// private final DistributionStockMapper distributionStockMapper;
// private final BladeRedis redis;
@ -170,12 +179,55 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
@Override
public List < DistributionDeliveryListExcel > exportDistributionDeliveryList ( Wrapper < DistributionDeliveryListEntity > queryWrapper ) {
List < DistributionDeliveryListExcel > distributionDeliveryListList = baseMapper . exportDistributionDeliveryList ( queryWrapper ) ;
//distributionDeliveryListList.forEach(distributionDeliveryList -> {
// distributionDeliveryList.setTypeName(DictCache.getValue(DictEnum.YES_NO, DistributionDeliveryList.getType()));
//});
return distributionDeliveryListList ;
public List < DistributionDeliveryListExcel > exportDistributionDeliveryList ( Map < String , Object > distributionDeliveryList ) {
Object o = distributionDeliveryList . get ( "ids" ) ;
if ( ObjectUtils . isNotNull ( o ) ) {
distributionDeliveryList . remove ( "ids" ) ;
}
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient . getMyCurrentWarehouse ( ) ;
if ( ObjectUtils . isNull ( myCurrentWarehouse ) ) {
throw new ServiceException ( "没有仓库信息!" ) ;
}
QueryWrapper < DistributionDeliveryListEntity > queryWrapper = Condition . getQueryWrapper ( distributionDeliveryList , DistributionDeliveryListEntity . class ) ;
queryWrapper . eq ( "warehouse_id" , myCurrentWarehouse . getId ( ) ) ;
if ( ObjectUtils . isNotNull ( o ) ) {
queryWrapper . in ( "id" , String . valueOf ( o ) . split ( "," ) ) ;
}
queryWrapper . lambda ( ) . eq ( DistributionDeliveryListEntity : : getIsDeleted , BladeConstant . DB_NOT_DELETED ) ;
List < DistributionDeliveryListExcel > list = new ArrayList < > ( ) ;
List < DistributionDeliveryListVO > distributionDeliveryListVOS = baseMapper . exportDistributionDeliveryList ( queryWrapper ) ;
distributionDeliveryListVOS . forEach ( dis - > {
// distributionDeliveryList.setTypeName(DictCache.getValue(DictEnum.YES_NO, DistributionDeliveryList.getType()));
DistributionDeliveryListExcel deliveryListExcel = new DistributionDeliveryListExcel ( ) ;
BeanUtils . copyProperties ( dis , deliveryListExcel ) ;
String value = DictBizCache . getValue ( DictBizConstant . DISTRIBUTION_TYPE , dis . getType ( ) ) ;
deliveryListExcel . setType ( value ) ;
String valuek = DictBizCache . getValue ( DictBizConstant . DISTRIBUTION_DELIVERY_KiIND , dis . getKind ( ) ) ;
deliveryListExcel . setKind ( valuek ) ;
String valueks = DictBizCache . getValue ( DictBizConstant . DISTRIBUTION_DELIVERY_STATUS , dis . getDeliveryStatus ( ) ) ;
deliveryListExcel . setState ( valueks ) ;
deliveryListExcel . setInventoryNub ( ObjectUtils . isNotNull ( dis . getInventoryNub ( ) ) ? dis . getInventoryNub ( ) : 0 ) ;
//查询配送数据
if ( dis . getKind ( ) . equals ( "1" ) ) {
//z自
List < DistributionDeliverySelfEntity > list1 = distributionDeliverySelfService . list ( Wrappers . < DistributionDeliverySelfEntity > query ( ) . lambda ( ) . eq ( DistributionDeliverySelfEntity : : getDeliveryId , dis . getId ( ) ) ) ;
String collect = list1 . stream ( ) . map ( DistributionDeliverySelfEntity : : getDriverName ) . collect ( Collectors . joining ( ) ) ;
String colle = list1 . stream ( ) . map ( DistributionDeliverySelfEntity : : getVehicleNub ) . collect ( Collectors . joining ( ) ) ;
deliveryListExcel . setDriver ( collect ) ;
deliveryListExcel . setVehicle ( colle ) ;
} else {
//三
List < DistributionDeliveryTripartiteEntity > list1 = distributionDeliveryTripartiteService . list ( Wrappers . < DistributionDeliveryTripartiteEntity > query ( ) . lambda ( ) . eq ( DistributionDeliveryTripartiteEntity : : getDeliveryId , dis . getId ( ) ) ) ;
String collect = list1 . stream ( ) . map ( DistributionDeliveryTripartiteEntity : : getDriverName ) . collect ( Collectors . joining ( ) ) ;
String colle = list1 . stream ( ) . map ( DistributionDeliveryTripartiteEntity : : getVehicleNum ) . collect ( Collectors . joining ( ) ) ;
deliveryListExcel . setDriver ( collect ) ;
deliveryListExcel . setVehicle ( colle ) ;
}
deliveryListExcel . setLoadingTeam ( "装:" + dis . getLoadingTeamName ( ) + ",卸:" + dis . getUnloadingTeamName ( ) ) ;
list . add ( deliveryListExcel ) ;
} ) ;
return list ;
}
@Override
@ -1241,7 +1293,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
BeanUtils . copyProperties ( distributionDeliveryTripartiteEntity , distributionDeliverySelfEntity ) ;
}
}
DistributionReservationEntity reservationEntity = distributionReservationMapper . selectById ( distrilbutionloadingscanDTO . getReservationId ( ) ) ;
reservationEntity . setLoadingStatus ( ReservationLoadingStatusConstant . yizhuangche . getValue ( ) ) ;
distributionReservationMapper . updateById ( reservationEntity ) ;
//查询预约下所有的订单信息
List < DistributionReservationStockarticleEntity > reservationStockarticleEntityList = distributionReservationStockarticleService . list ( Wrappers . < DistributionReservationStockarticleEntity > query ( ) . lambda ( )
. eq ( DistributionReservationStockarticleEntity : : getReservationId , distrilbutionloadingscanDTO . getReservationId ( ) ) ) ;
@ -1310,15 +1364,15 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
if ( Func . isNotEmpty ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ) {
loadscanEntity . setDeliveryId ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
}
parcelListEntity . setOrderPackageLoadingStatus ( OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) ) ;
distributionParcelListService . updateById ( parcelListEntity ) ;
// parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue());
// distributionParcelListService.updateById(parcelListEntity);
distributionLoadscanService . save ( loadscanEntity ) ;
Integer i = distributionDeliveryListMapper . updateloadingTimeById ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
Integer j = distributionSignforMapper . updateloadByReservationId ( loadscanEntity . getDeliveryId ( ) , loadscanEntity . getReservationId ( ) , loadscanEntity . getPackageNub ( ) ) ;
warehouseUpdownTypeClient . downPackage ( parcelListEntity . getOrderPackageCode ( ) , myCurrentWarehouse . getId ( ) ) ;
//异步修改包件状态
distributionAsyncService . changeMarketDeliveryListStatus ( loadscanEntity . getOrderPackageCode ( ) , loadscanEntity . getDeliveryId ( ) ) ;
// distributionAsyncService.changeMarketDeliveryListStatus(loadscanEntity.getOrderPackageCode(), loadscanEntity.getDeliveryId());
}
} ) ;
break ;
@ -1439,7 +1493,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
signforEntity . setLoadedNumber ( loadedNumber . subtract ( packageLoadingNub ) . add ( reservationNum ) . intValue ( ) ) ;
distributionSignforService . updateById ( signforEntity ) ;
//异步修改包件状态
distributionAsyncService . checkZeroStockArticleLoadingStatus ( parcelNumberEntity ) ;
// distributionAsyncService.checkZeroStockArticleLoadingStatus(parcelNumberEntity);
}
}
}
@ -1508,7 +1562,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
Integer j = distributionSignforMapper . updateloadByinvn ( loadscaninvnEntity . getDeliveryId ( ) , loadscaninvnEntity . getReservationId ( ) , loadscaninvnEntity . getPackageNub ( ) ) ;
// warehouseUpdownTypeClient.downStock()
//异步修改包件状态 //对于存在库存品的这里还需要将库存品从对应的信息中进行扣除
distributionAsyncService . changeMarketDeliveryListStatus ( loadscaninvnEntity . getOrderPackageCode ( ) , loadscaninvnEntity . getDeliveryId ( ) ) ;
// distributionAsyncService.changeMarketDeliveryListStatus(loadscaninvnEntity.getOrderPackageCode(), loadscaninvnEntity.getDeliveryId());
DistributionStockListEntity stockListEntity = distributionStockListMapper . selectOne ( Wrappers . < DistributionStockListEntity > query ( ) . lambda ( ) . eq ( DistributionStockListEntity : : getId , loadscaninvnEntity . getInventoryId ( ) ) ) ;
stockListEntity . setQuantityStock ( stockListEntity . getQuantityStock ( ) - loadscaninvnEntity . getPackageNub ( ) ) ;
stockListEntity . setQuantityOccupied ( stockListEntity . getQuantityOccupied ( ) - loadscaninvnEntity . getPackageNub ( ) ) ;
@ -1517,7 +1571,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
}
}
return R . success ( "成功" ) ;
return Resp . scanS uccess ( "操作成功" , "装车 成功" ) ;
}
@ -2437,24 +2491,104 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//查询客户
List < DistributionAppReservationVO > customList = distributionDeliveryInfoMapper . selectAppcustomListPage ( page , distributionDeliveryList . getId ( ) ) ;
for ( DistributionAppReservationVO distributionAppReservationVO : customList ) {
List < DistributionParcelListEntity > parcelListEntities = distributionReservationMapper . selectPackageListByReservationId ( distributionAppReservationVO . getId ( ) ) ;
List < DistributionReservationStockarticleEntity > reservationStockarticleEntityList = distributionReservationMapper . selectStockArticleByReservationId ( distributionAppReservationVO . getId ( ) ) ;
List < DistributionStockEntity > distributionStockEntities = new ArrayList < > ( ) ;
List < DistributionLoadscanEntity > loadscanEntityList = new ArrayList < > ( ) ;
List < WarehouseTrayGoodsEntity > trayList = new ArrayList < > ( ) ;
for ( DistributionReservationStockarticleEntity reservationStockarticleEntity : reservationStockarticleEntityList ) {
if ( reservationStockarticleEntity . getIsZero ( ) . equals ( IsOrNoConstant . no . getValue ( ) ) ) {
//查询订制品备货数量
List < DistributionStockEntity > packageListStockUpScan = distributionStockMapper . selectList ( Wrappers . < DistributionStockEntity > query ( ) . lambda ( )
. eq ( DistributionStockEntity : : getType , 1 )
. eq ( DistributionStockEntity : : getParcelListId , reservationStockarticleEntity . getStockArticleId ( ) )
. eq ( DistributionStockEntity : : getReservationId , reservationStockarticleEntity . getReservationId ( ) ) ) ;
if ( Func . isNotEmpty ( packageListStockUpScan ) ) {
distributionStockEntities . addAll ( packageListStockUpScan ) ;
}
//统计托盘数
//查询所有包件
List < DistributionParcelListEntity > parcelListEntities = distributionReservationMapper . selectPackageByReservationAndStockArticle ( reservationStockarticleEntity . getReservationId ( ) , reservationStockarticleEntity . getStockArticleId ( ) ) ;
parcelListEntities . forEach ( p - > {
WarehouseTrayGoodsEntity warehouseTrayGoodsEntity = new WarehouseTrayGoodsEntity ( ) ;
warehouseTrayGoodsEntity . setAssociationId ( p . getId ( ) ) ;
warehouseTrayGoodsEntity . setAssociationType ( "1" ) ;
List < WarehouseTrayGoodsEntity > trayGoodsClientTrayList = warehouseTrayGoodsClient . getTrayList ( warehouseTrayGoodsEntity ) ;
if ( Func . isNotEmpty ( trayGoodsClientTrayList ) ) {
trayList . addAll ( trayGoodsClientTrayList ) ;
}
} ) ;
//查询订制品装车数量
List < DistributionLoadscanEntity > packageListLoadingScan = distributionLoadscanService . list ( Wrappers . < DistributionLoadscanEntity > query ( ) . lambda ( )
. eq ( DistributionLoadscanEntity : : getReservationId , reservationStockarticleEntity . getReservationId ( ) )
. eq ( DistributionLoadscanEntity : : getOrderId , reservationStockarticleEntity . getStockArticleId ( ) )
. ne ( DistributionLoadscanEntity : : getScanStatus , LoadingStatusConstant . quxiao . getValue ( ) ) ) ;
if ( Func . isNotEmpty ( packageListLoadingScan ) ) {
loadscanEntityList . addAll ( packageListLoadingScan ) ;
}
} else if ( reservationStockarticleEntity . getIsZero ( ) . equals ( IsOrNoConstant . yes . getValue ( ) ) ) {
//查询零担备货数量
List < DistributionStockEntity > zeroPackageListStockUpScan = distributionStockMapper . selectList ( Wrappers . < DistributionStockEntity > query ( ) . lambda ( )
. eq ( DistributionStockEntity : : getType , 2 )
. eq ( DistributionStockEntity : : getParcelListId , reservationStockarticleEntity . getStockArticleId ( ) )
. eq ( DistributionStockEntity : : getReservationId , reservationStockarticleEntity . getReservationId ( ) ) ) ;
if ( Func . isNotEmpty ( zeroPackageListStockUpScan ) ) {
distributionStockEntities . addAll ( zeroPackageListStockUpScan ) ;
}
//查询零担装车数量
List < DistributionLoadscanEntity > zeroPackageListLoadingScan = distributionLoadscanService . list ( Wrappers . < DistributionLoadscanEntity > query ( ) . lambda ( )
. eq ( DistributionLoadscanEntity : : getReservationId , reservationStockarticleEntity . getReservationId ( ) )
. eq ( DistributionLoadscanEntity : : getOrderId , reservationStockarticleEntity . getStockArticleId ( ) )
. ne ( DistributionLoadscanEntity : : getScanStatus , LoadingStatusConstant . quxiao . getValue ( ) ) ) ;
if ( Func . isNotEmpty ( zeroPackageListLoadingScan ) ) {
loadscanEntityList . addAll ( zeroPackageListLoadingScan ) ;
}
}
}
distributionAppReservationVO . setTrayNum ( 0 ) ;
if ( Func . isNotEmpty ( trayList ) ) {
Long count = trayList . stream ( ) . map ( WarehouseTrayGoodsEntity : : getTrayId ) . count ( ) ;
distributionAppReservationVO . setTrayNum ( count . intValue ( ) ) ;
}
List < DisStockListDetailEntity > stockListDetailEntityList = distributionReservationMapper . selectInventoryListByReservation ( distributionAppReservationVO . getId ( ) ) ;
boolean stockArticleStockupStatus = parcelListEntities . stream ( ) . allMatch ( s - > Func . isNotEmpty ( s . getOrderPackageStockupStatus ( ) ) & & s . getOrderPackageStockupStatus ( ) . equals ( OrderPackageStockupStatusConstant . yibeihu . getValue ( ) ) ) ;
boolean inventoryStockupStatus = stockListDetailEntityList . stream ( ) . allMatch ( i - > Func . isNotEmpty ( i . getStockPackageCode ( ) ) ) ;
if ( stockArticleStockupStatus & & inventoryStockupStatus ) {
// boolean inventoryStockupStatus = stockListDetailEntityList.stream().allMatch(i -> Func.isNotEmpty(i.getStockPackageCode()));
//备货数和计划数一致时完成备货
if ( distributionStockEntities . size ( ) + stockListDetailEntityList . stream ( ) . filter ( s - > Func . isNotEmpty ( s . getStockPackageCode ( ) ) ) . count ( ) = = distributionAppReservationVO . getReservationNum ( ) ) {
distributionAppReservationVO . setIsstock ( "是" ) ;
} else {
} else {
distributionAppReservationVO . setIsstock ( "否" ) ;
}
boolean stockArticleLoadingStatus = parcelListEntities . stream ( ) . allMatch ( s - > Func . isNotEmpty ( s . getOrderPackageLoadingStatus ( ) ) & & s . getOrderPackageLoadingStatus ( ) . equals ( OrderPackageLoadingStatusConstant . yizhuangche . getValue ( ) ) ) ;
boolean inventoryLoadingStatus = stockListDetailEntityList . stream ( ) . allMatch ( i - > Func . isNotEmpty ( i . getStockPackageCode ( ) ) & & i . getStockLockingStatus ( ) . equals ( InventoryLoadingStatusConstant . yizhuangche . getValue ( ) ) ) ;
if ( stockArticleLoadingStatus & & inventoryLoadingStatus ) {
Integer packageListScanNum = loadscanEntityList . stream ( ) . mapToInt ( DistributionLoadscanEntity : : getLoadedNub ) . sum ( ) ;
Long inventoryListScanNum = stockListDetailEntityList . stream ( ) . filter ( i - > Func . isNotEmpty ( i . getStockPackageCode ( ) ) & & i . getStockLockingStatus ( ) . equals ( InventoryLoadingStatusConstant . yizhuangche . getValue ( ) ) ) . count ( ) ;
distributionAppReservationVO . setLoadingNub ( packageListScanNum + inventoryListScanNum . intValue ( ) ) ;
if ( packageListScanNum + inventoryListScanNum = = distributionAppReservationVO . getReservationNum ( ) ) {
distributionAppReservationVO . setIsload ( "是" ) ;
} else {
distributionAppReservationVO . setIsload ( "否" ) ;
}
// List<DistributionParcelListEntity> parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distributionAppReservationVO.getId());
//
// boolean stockArticleStockupStatus = parcelListEntities.stream().allMatch(s -> Func.isNotEmpty(s.getOrderPackageStockupStatus()) && s.getOrderPackageStockupStatus().equals(OrderPackageStockupStatusConstant.yibeihu.getValue()));
// if (stockArticleStockupStatus && inventoryStockupStatus) {
// distributionAppReservationVO.setIsstock("是");
// } else {
// distributionAppReservationVO.setIsstock("否");
// }
// boolean stockArticleLoadingStatus = parcelListEntities.stream().allMatch(s -> Func.isNotEmpty(s.getOrderPackageLoadingStatus()) && s.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue()));
// boolean inventoryLoadingStatus = stockListDetailEntityList.stream().allMatch(i -> Func.isNotEmpty(i.getStockPackageCode()) && i.getStockLockingStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue()));
// if (stockArticleLoadingStatus && inventoryLoadingStatus) {
// distributionAppReservationVO.setIsload("是");
// } else {
// distributionAppReservationVO.setIsload("否");
// }
// //查询备货是否完成
// int aLong = distributionStockMapper.selectCount(new QueryWrapper<DistributionStockEntity>().lambda()
// .eq(DistributionStockEntity::getReservationId, distributionAppReservationVO.getId())
@ -5023,6 +5157,142 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
return Resp . scanSuccess ( "装车成功" , str . toString ( ) ) ;
}
@Override
public R retentionScan ( DistrilbutionloadingscanDTO distrilbutionloadingscanDTO ) {
Integer retentionType = distrilbutionloadingscanDTO . getRetentionType ( ) ;
List < DistributionRetentionScanVo > retentionScanVos = new ArrayList < > ( ) ;
switch ( retentionType ) {
case 1 :
//包件--库存品 和包件
List < DistributionParcelListEntity > parcelListEntities = baseMapper . selectPackageListByDeliveryListId ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
// List<DisStockListDetailEntity> detailEntities = baseMapper.selectInventoryListByDeliveryListId(distrilbutionloadingscanDTO.getDeliveryId());
if ( Func . isNotEmpty ( parcelListEntities ) ) {
List < DistributionParcelListEntity > packageInfo = parcelListEntities . stream ( ) . filter ( p - > Func . isNotEmpty ( p . getOrderPackageCode ( ) ) & & p . getOrderPackageCode ( ) . equals ( distrilbutionloadingscanDTO . getBarcode ( ) ) ) . collect ( Collectors . toList ( ) ) ;
if ( packageInfo . size ( ) > 1 ) {
log . error ( "################包条码重复:{}" , distrilbutionloadingscanDTO . getBarcode ( ) ) ;
return Resp . scanFail ( "操作失败" , "操作失败" ) ;
}
if ( packageInfo . size ( ) = = 1 ) {
// DistributionRetentionScanVo distributionRetentionScanVo = new DistributionRetentionScanVo();
//此时才是满足条件的包件,能够进行滞留
//通过配送任务和包件确定预约信息
DistributionParcelListEntity parcelListEntity = packageInfo . get ( 0 ) ;
DistributionRetentionScanVo retentionPackage = baseMapper . selectRetentionPackage ( parcelListEntity . getOrderPackageCode ( ) , distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
// distributionRetentionScanVo.setConditions(1);
// distributionRetentionScanVo.setOrderCode(parcelListEntity.getOrderPackageCode());
// distributionRetentionScanVo.setOrderId(parcelListEntity.getStockArticleId());
// distributionRetentionScanVo.setOrderPackageId(parcelListEntity.getId());
// distributionRetentionScanVo.setOrderPackageCode(parcelListEntity.getOrderPackageCode());
// distributionRetentionScanVo.setReservationCode(reservationEntity.getReservationCode());
// distributionRetentionScanVo.setReservationId(reservationEntity.getId());
// distributionRetentionScanVo.setRetentionQuantity(parcelListEntity.getQuantity());
// retentionScanVos.add(distributionRetentionScanVo);
}
//
} else {
List < DisStockListDetailEntity > detailEntities = baseMapper . selectInventoryListByDeliveryListId ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
if ( Func . isNotEmpty ( detailEntities ) ) {
List < DisStockListDetailEntity > stockListDetailEntities = detailEntities . stream ( ) . filter ( i - > Func . isNotEmpty ( i . getStockPackageCode ( ) ) & & Func . equals ( i . getStockPackageCode ( ) , distrilbutionloadingscanDTO . getDeliveryId ( ) ) ) . collect ( Collectors . toList ( ) ) ;
if ( stockListDetailEntities . size ( ) > 1 ) {
log . error ( "################库存品条码重复:{}" , distrilbutionloadingscanDTO . getBarcode ( ) ) ;
return Resp . scanFail ( "操作失败" , "操作失败" ) ;
}
if ( stockListDetailEntities . size ( ) = = 1 ) {
// DistributionRetentionScanVo distributionRetentionScanVo = new DistributionRetentionScanVo();
//此时才是满足条件的包件,能够进行滞留
//通过配送任务和包件确定预约信息
DisStockListDetailEntity disStockListDetailEntity = stockListDetailEntities . get ( 0 ) ;
DistributionRetentionScanVo inventoryPackage = baseMapper . selectRetentionInventoryPackage ( disStockListDetailEntity . getStockPackageCode ( ) , distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
retentionScanVos . add ( inventoryPackage ) ;
}
} else {
log . error ( "################查询包件和库存品为空:{}" , distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
return Resp . scanFail ( "操作失败" , "不属于该配送任务!!!" ) ;
}
}
List < DistributionRetentionScanVo > distributionRetentionScanVos = baseMapper . selectRetentionZeroPackage ( distrilbutionloadingscanDTO . getDeliveryId ( ) , distrilbutionloadingscanDTO . getBarcode ( ) ) ;
if ( Func . isNotEmpty ( distributionRetentionScanVos ) ) {
retentionScanVos . addAll ( distributionRetentionScanVos ) ;
}
break ;
case 2 :
//托盘
break ;
default :
log . info ( "################无满足滞留扫描类型" ) ;
break ;
}
// warehouseRetentionScanClient.saveRetentionScan();
if ( Func . isEmpty ( retentionScanVos ) ) {
return Resp . scanFail ( "操作失败" , "无该信息!!!" ) ;
}
return R . data ( retentionScanVos ) ;
}
@Override
public R getZeroPackageInfo ( DistrilbutionloadingscanDTO distrilbutionloadingscanDTO ) {
List < DistributionReservationStockarticleEntity > reservationStockarticleEntityList = baseMapper . selectReservationStockByDeliveryId ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
if ( Func . isEmpty ( reservationStockarticleEntityList ) ) {
log . error ( "#############配送任务查询订单错误,deliveryId:{}" , distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
return null ;
}
List < Long > orderIds = reservationStockarticleEntityList . stream ( ) . filter ( rs - > Func . isNotEmpty ( rs . getIsZero ( ) ) & & rs . getIsZero ( ) . equals ( IsOrNoConstant . yes . getValue ( ) ) ) . map ( DistributionReservationStockarticleEntity : : getStockArticleId ) . collect ( Collectors . toList ( ) ) ;
if ( Func . isEmpty ( orderIds ) ) {
log . error ( "####################配送任务下无零担信息:{}" ) ;
return Resp . scanFail ( "查询错误" , "该任务无零担订单" ) ;
}
List < DistributionParcelNumberVO > parcelNumberVOS = new ArrayList < > ( ) ;
orderIds . forEach ( o - > {
List < DistributionParcelNumberVO > parcelNumberVOList = baseMapper . selectDeliveryZeroOrderDetail ( o , distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
if ( Func . isNotEmpty ( parcelNumberVOList ) ) {
parcelNumberVOS . addAll ( parcelNumberVOList ) ;
}
} ) ;
if ( Func . isEmpty ( parcelNumberVOS ) ) {
return Resp . scanFail ( "查询失败" , "该配送任务无该零担订单" ) ;
}
return R . data ( parcelNumberVOS ) ;
}
@Override
public R getInventoryInfo ( DistrilbutionloadingscanDTO distrilbutionloadingscanDTO ) {
List < DisStockListDetailEntity > detailEntities = baseMapper . selectInventoryListByDeliveryListId ( distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
if ( Func . isEmpty ( detailEntities ) ) {
log . error ( "######################查询配送任务零担信息错误,deliveryId:{}," , distrilbutionloadingscanDTO . getDeliveryId ( ) ) ;
return null ;
}
List < DisStockListDetailEntity > stockListDetailEntities = detailEntities . stream ( ) . filter ( d - > Func . isNotEmpty ( d . getStockPackageCode ( ) ) ) . filter ( d - > d . getStockPackageCode ( ) . equals ( distrilbutionloadingscanDTO . getBarcode ( ) ) ) . collect ( Collectors . toList ( ) ) ;
List < DisStockListDetailVO > disStockListDetailVOS = DistributionDisStockListWrapper . build ( ) . listVO ( stockListDetailEntities ) ;
List < Long > inventoryIds = disStockListDetailVOS . stream ( ) . map ( DisStockListDetailVO : : getStockListId ) . distinct ( ) . collect ( Collectors . toList ( ) ) ;
DistributionStockListEntity distributionStockListEntity = distributionStockListService . listByIds ( inventoryIds ) . get ( 0 ) ;
disStockListDetailVOS . stream ( ) . forEach ( d - > { d . setMarketName ( distributionStockListEntity . getMarketName ( ) ) ; d . setCargoNumber ( distributionStockListEntity . getCargoNumber ( ) ) ; } ) ;
if ( Func . isEmpty ( stockListDetailEntities ) ) {
return Resp . scanFail ( "查询失败" , "不属于该配送任务" ) ;
}
return R . data ( stockListDetailEntities ) ;
}
@Override
public List < DistributionDeliverySelfVO > getDriverInfo ( Long deliveryId ) {
DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper . selectById ( deliveryId ) ;
if ( Func . isEmpty ( distributionDeliveryListEntity ) ) {
log . error ( "############################# 配送任务查询为空,deliveryId为:{}" , distributionDeliveryListEntity ) ;
}
//零担订单进行装车
//这里需要进行判定是进行编辑还是进行的装车
DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfEntity ( ) ;
if ( distributionDeliveryListEntity . getKind ( ) . equals ( "1" ) ) {
distributionDeliverySelfEntity = distributionDeliverySelfMapper . selectById ( deliveryId ) ;
} else {
DistributionDeliveryTripartiteEntity distributionDeliveryTripartiteEntity = distributionDeliveryTripartiteMapper . selectTripartiteInfo ( deliveryId ) ;
BeanUtils . copyProperties ( distributionDeliveryTripartiteEntity , distributionDeliverySelfEntity ) ;
}
return null ;
}
public Map < String , String > getDriverCar ( String kind , Long deliveryListEntityId ) {
Map < String , String > map = new HashMap < > ( ) ;