@ -8,10 +8,9 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity ;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient ;
import com.logpm.business.dto.BusinessPreListDTO ;
import com.logpm.business.dto.BusinessSanDTO ;
import com.logpm.business.entity.DistributionBusinessPreOrderEntity ;
import com.logpm.business.vo.DistributionBusinessPreCarNumberVO ;
import com.logpm.business.vo.DistributionBusinessPreOrderListVO ;
import com.logpm.business.vo.DistributionBusinessPreOrderVO ;
import com.logpm.business.vo.* ;
import com.logpm.distribution.bean.Resp ;
import com.logpm.distribution.dto.DistributionBusinessPreOrderDTO ;
import com.logpm.distribution.entity.DistributionParcelListEntity ;
@ -21,20 +20,25 @@ import com.logpm.distribution.service.IDistributionBusinessPreOrderService;
import com.logpm.distribution.service.IDistributionParcelListService ;
import com.logpm.distribution.service.IDistributionStockArticleService ;
import com.logpm.trunkline.dto.InComingDTO ;
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity ;
import com.logpm.trunkline.feign.IInComingClient ;
import com.logpm.trunkline.feign.ITrunklineAdvanceDetailClient ;
import lombok.AllArgsConstructor ;
import org.jetbrains.annotations.Nullable ;
import org.springblade.common.annotations.ChangeAsync ;
import org.springblade.common.constant.IncomingTypeEnum ;
import org.springblade.common.constant.RedisKeyConstant ;
import org.springblade.common.exception.CustomerException ;
import org.springblade.core.cache.utils.CacheUtil ;
import org.springblade.core.log.exception.ServiceException ;
import org.springblade.core.mp.base.BaseServiceImpl ;
import org.springblade.core.redis.cache.BladeRedis ;
import org.springblade.core.tool.api.R ;
import org.springblade.core.tool.utils.BeanUtil ;
import org.springblade.core.tool.utils.Func ;
import org.springframework.stereotype.Service ;
import java.util.ArrayList ;
import java.util.Arrays ;
import java.util.List ;
import java.util.Map ;
import java.util.* ;
import java.util.stream.Collectors ;
@Service
@ -49,6 +53,9 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl<Di
private final IInComingClient inComingClient ;
private final ITrunklineAdvanceDetailClient trunklineAdvanceDetailClient ;
private final BladeRedis bladeRedis ;
@Override
public Boolean inOrder ( String ids ) throws ServiceException {
@ -57,7 +64,6 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl<Di
QueryWrapper wrapper = new QueryWrapper ( ) ;
wrapper . in ( "id" , idArray ) ;
InComingDTO inComingDTO = new InComingDTO ( ) ;
StringBuffer sb = new StringBuffer ( ) ;
List < DistributionBusinessPreOrderEntity > list = baseMapper . selectList ( wrapper ) ;
@ -74,30 +80,25 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl<Di
data . add ( distributionBusinessPreOrderEntity ) ;
}
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient . getMyCurrentWarehouse ( ) ;
inComingDTO . setOrderPackageCode ( sb . toString ( ) ) ;
inComingDTO . setIncomingType ( IncomingTypeEnum . LINE_INCOMING . getCode ( ) ) ;
inComingDTO . setWarehouseId ( myCurrentWarehouse . getId ( ) ) ;
inComingDTO . setWarehouseName ( myCurrentWarehouse . getName ( ) ) ;
R r = inComingClient . incomingPackage ( inComingDTO ) ;
R r = inOrderWarehourse ( sb . toString ( ) ) ;
if ( r . isSuccess ( ) ) {
// 更新成功
// 更新入库状态
for ( DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : data ) {
distributionBusinessPreOrderEntity . setInWarehouse ( 1 ) ;
baseMapper . updateById ( distributionBusinessPreOrderEntity ) ;
Object o = bladeRedis . get ( RedisKeyConstant . BUSINESS_IN_CARNUMBER + distributionBusinessPreOrderEntity . getDistrCarNumber ( ) ) ;
if ( ! Objects . isNull ( o ) ) {
bladeRedis . set ( RedisKeyConstant . BUSINESS_IN_CARNUMBER + distributionBusinessPreOrderEntity . getDistrCarNumber ( ) , null ) ;
}
}
}
return true ;
}
@Override
public Integer inOrderByOrderPackageCode ( String orderPackageCode , String carNum ) {
@ -172,80 +173,257 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl<Di
}
private R inOrderWarehourse ( String orderPackageCode ) {
InComingDTO inComingDTO = new InComingDTO ( ) ;
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient . getMyCurrentWarehouse ( ) ;
inComingDTO . setOrderPackageCode ( orderPackageCode ) ;
inComingDTO . setIncomingType ( IncomingTypeEnum . LINE_INCOMING . getCode ( ) ) ;
inComingDTO . setWarehouseId ( myCurrentWarehouse . getId ( ) ) ;
inComingDTO . setWarehouseName ( myCurrentWarehouse . getName ( ) ) ;
R r = inComingClient . incomingPackage ( inComingDTO ) ;
return r ;
}
@Override
public Resp inOrderWarehourse ( String orderPackageCode , String reservationCode ) {
public Resp inOrderWarehourse ( BusinessSanDTO businessSanDTO ) {
// // 查询当前预约单所有的包件
//
// LambdaQueryWrapper<DistributionBusinessPreOrderEntity> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(DistributionBusinessPreOrderEntity::getReservationCode, reservationCode);
// List<DistributionBusinessPreOrderEntity> list = baseMapper.selectList(queryWrapper);
//
// // 寻找 当前匹配的包条
// DistributionBusinessPreOrderEntity t = null;
// DistributionBusinessPreOrderEntity t1 = null;
// for (DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : list) {
// if (distributionBusinessPreOrderEntity.getOrderPackageCode().equals(orderPackageCode)) {
// // 找到匹配的包条码
// if (distributionBusinessPreOrderEntity.getInWarehouse() == 1) {
// return Resp.scanSuccess("扫描成功", "包件已入库");
// } else {
// t = distributionBusinessPreOrderEntity;
// }
// }
// if (t1 == null) {
// t1 = distributionBusinessPreOrderEntity;
// }
// }
// if (t == null) {
// try {
// DistributionBusinessPreOrderEntity finalT = t1;
// CompletableFuture<DistributionParcelListEntity> distributionParcelListEntityCompletableFuture = CompletableFuture.supplyAsync(() -> this.selectByOrderPackageCode(orderPackageCode, finalT.getAcceptWarehouseId()));
//
// DistributionParcelListEntity distributionParcelListEntity = distributionParcelListEntityCompletableFuture.get();
//
// // 如找到了 保存在当前的这个配送计划任务中
// if (distributionParcelListEntity != null) {
// // 保存包件
// t = BeanUtil.copy(distributionParcelListEntity, DistributionBusinessPreOrderEntity.class);
// t.setDriverName(finalT.getDriverName());
// t.setVehicleName(finalT.getVehicleName());
// t.setDistrCarNumber(finalT.getTrainNumber());
// t.setOperationStatus(1);
// t.setInWarehouse(0);
// this.save(t);
// list.add(t);
//
// }
// } catch (InterruptedException | ExecutionException e) {
// log.error("inOrderWarehourse:", e);
// throw new ServiceException("包件信息不存在!");
// }
//
//
// }
//
// // 保存订单
// DistributionStockArticleEntity stockArticleEntity = buildDistributionStockArticleEntity(t);
// if (stockArticleEntity == null) {
// return Resp.scanFail("操作失败", "包件数据不存在");
// }
// // 保存包件
// t.setWarehouseId(stockArticleEntity.getWarehouseId());
// t.setWarehouse(stockArticleEntity.getWarehouse());
// t.setStockArticleId(stockArticleEntity.getId());
// buildDistributionParcelListEntity(t);
//
// // 调用入库方法
// t.setInWarehouse(1);
// baseMapper.updateById(t);
//
// queryWrapper.eq(DistributionBusinessPreOrderEntity::getInWarehouse, 1);
// Long l = baseMapper.selectCount(queryWrapper);
try {
String orderPackageCode = businessSanDTO . getOrderPackageCode ( ) ;
String distrCarNumber = businessSanDTO . getDistrCarNumber ( ) ;
if ( Func . isAllEmpty ( orderPackageCode , distrCarNumber , businessSanDTO . getInWarehouseException ( ) ) ) {
return Resp . scanFail ( "扫描失败" , "没有包件或者车次" ) ;
}
// 查询配送车次下面所有的包件
LambdaQueryWrapper < DistributionBusinessPreOrderEntity > queryWrapper = new LambdaQueryWrapper < > ( ) ;
queryWrapper . eq ( DistributionBusinessPreOrderEntity : : getDistrCarNumber , distrCarNumber ) ;
queryWrapper . eq ( DistributionBusinessPreOrderEntity : : getIsDeleted , 0 ) ;
List < DistributionBusinessPreOrderEntity > list = baseMapper . selectList ( queryWrapper ) ;
if ( list . isEmpty ( ) ) {
return Resp . scanFail ( "扫描失败" , "车次信息不存在" ) ;
}
// 异常入库
if ( 1 = = businessSanDTO . getInWarehouseException ( ) ) {
Resp a = handleExceptionalWarehourse ( businessSanDTO , list , orderPackageCode , distrCarNumber ) ;
if ( a ! = null ) return a ;
} else {
Resp scanFail = handleNormalWarehourse ( businessSanDTO , orderPackageCode , list , distrCarNumber ) ;
if ( scanFail ! = null ) return scanFail ;
}
} catch ( Exception e ) {
log . error ( "系统异常" , e ) ;
throw new CustomerException ( e . getMessage ( ) ) ;
}
return Resp . scanFail ( "扫描失败" , "系统错误" ) ;
}
return Resp . scanSuccess ( "扫描成功" , "请前往码板打托进行入库!" ) ;
@Nullable
private Resp handleNormalWarehourse ( BusinessSanDTO businessSanDTO , String orderPackageCode , List < DistributionBusinessPreOrderEntity > list , String distrCarNumber ) {
LambdaQueryWrapper < DistributionBusinessPreOrderEntity > queryWrapper1 = new LambdaQueryWrapper < > ( ) ;
queryWrapper1 . eq ( DistributionBusinessPreOrderEntity : : getOrderPackageCode , orderPackageCode ) ;
queryWrapper1 . eq ( DistributionBusinessPreOrderEntity : : getInWarehouse , 1 ) ;
queryWrapper1 . eq ( DistributionBusinessPreOrderEntity : : getIsDeleted , 0 ) ;
List < DistributionBusinessPreOrderEntity > list1 = baseMapper . selectList ( queryWrapper1 ) ;
if ( ! list1 . isEmpty ( ) ) {
return Resp . scanFail ( "扫描失败" , "包件已入库" ) ;
}
DistributionBusinessPreOrderEntity selectD = null ;
// 检查包件是否入库
for ( DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : list ) {
if ( distributionBusinessPreOrderEntity . getOrderPackageCode ( ) . equals ( orderPackageCode ) ) {
//找到这个包件
selectD = distributionBusinessPreOrderEntity ;
break ;
}
}
// 全仓查询
if ( selectD = = null ) {
LambdaQueryWrapper < DistributionBusinessPreOrderEntity > queryWrapper2 = new LambdaQueryWrapper < > ( ) ;
queryWrapper2 . eq ( DistributionBusinessPreOrderEntity : : getOrderPackageCode , orderPackageCode ) ;
queryWrapper2 . eq ( DistributionBusinessPreOrderEntity : : getIsDeleted , 0 ) ;
List < DistributionBusinessPreOrderEntity > list2 = baseMapper . selectList ( queryWrapper2 ) ;
// 全仓查询
if ( ! list2 . isEmpty ( ) ) {
for ( DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : list2 ) {
if ( distributionBusinessPreOrderEntity . getOrderPackageCode ( ) . equals ( orderPackageCode ) ) {
return Resp . scanSuccessWithData ( "是否切换车次" , "当前包件不在当前车次,是否切换车次?" , distributionBusinessPreOrderEntity . getDistrCarNumber ( ) ) ;
}
selectD = distributionBusinessPreOrderEntity ;
break ;
}
}
}
if ( selectD = = null ) {
// 暂存单查询
TrunklineAdvanceDetailEntity entityByOrderPackageCode = trunklineAdvanceDetailClient . findEntityByOrderPackageCode ( orderPackageCode ) ;
if ( Objects . isNull ( entityByOrderPackageCode ) ) {
return Resp . scanFail ( "扫描失败" , "包件信息不存在" ) ;
}
return Resp . scanSuccessWithData ( "是否异常入库" , "当前包件不在配送计划内,是否异常入库" , entityByOrderPackageCode ) ;
}
R r = inOrderWarehourse ( selectD . getOrderPackageCode ( ) ) ;
if ( r . isSuccess ( ) ) {
selectD . setInWarehouse ( 1 ) ;
this . updateById ( selectD ) ;
int a = 0 ;
//记录当前车次的异常件数
Object o = bladeRedis . get ( RedisKeyConstant . BUSINESS_IN_CARNUMBER + businessSanDTO . getDistrCarNumber ( ) ) ;
if ( Objects . isNull ( o ) ) {
// 查询当前车次的异常入库数量
LambdaQueryWrapper < DistributionBusinessPreOrderEntity > queryWrapper3 = new LambdaQueryWrapper < > ( ) ;
queryWrapper3 . eq ( DistributionBusinessPreOrderEntity : : getDistrCarNumber , distrCarNumber ) ;
queryWrapper3 . eq ( DistributionBusinessPreOrderEntity : : getInWarehouse , 1 ) ;
queryWrapper3 . eq ( DistributionBusinessPreOrderEntity : : getIsDeleted , 0 ) ;
List < DistributionBusinessPreOrderEntity > list3 = baseMapper . selectList ( queryWrapper3 ) ;
o = 1 ;
if ( ! list3 . isEmpty ( ) ) {
o = list3 . size ( ) ;
a = ( int ) o ;
}
bladeRedis . setEx ( RedisKeyConstant . BUSINESS_IN_CARNUMBER + businessSanDTO . getDistrCarNumber ( ) , o , 60 * 60 * 24L ) ;
} else {
a = ( int ) o ;
a = a + 1 ;
bladeRedis . setEx ( RedisKeyConstant . BUSINESS_IN_CARNUMBER + businessSanDTO . getDistrCarNumber ( ) , a , 60 * 60 * 24L ) ;
}
return Resp . scanSuccess ( "扫描成功" , a + "件" ) ;
}
return null ;
}
@Nullable
private Resp handleExceptionalWarehourse ( BusinessSanDTO businessSanDTO , List < DistributionBusinessPreOrderEntity > list , String orderPackageCode , String distrCarNumber ) {
DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity = list . get ( 0 ) ;
TrunklineAdvanceDetailEntity entityByOrderPackageCode = trunklineAdvanceDetailClient . findEntityByOrderPackageCode ( orderPackageCode ) ;
// 增加异常预入库信息
// 如找到了 保存在当前的这个配送计划任务中
DistributionBusinessPreOrderEntity t = null ;
if ( entityByOrderPackageCode ! = null ) {
// 保存包件
t = BeanUtil . copy ( entityByOrderPackageCode , DistributionBusinessPreOrderEntity . class ) ;
assert t ! = null ;
t . setWaybillNumber ( entityByOrderPackageCode . getWaybillNo ( ) ) ;
t . setFirsts ( entityByOrderPackageCode . getFirstPackName ( ) ) ;
t . setSecond ( entityByOrderPackageCode . getSecondPackName ( ) ) ;
t . setThirdProduct ( entityByOrderPackageCode . getThirdPackName ( ) ) ;
t . setBrandName ( entityByOrderPackageCode . getBrand ( ) ) ;
t . setConditions ( 1 ) ;
t . setDriverName ( distributionBusinessPreOrderEntity . getDriverName ( ) ) ;
t . setVehicleName ( distributionBusinessPreOrderEntity . getVehicleName ( ) ) ;
t . setDistrCarNumber ( distributionBusinessPreOrderEntity . getDistrCarNumber ( ) ) ;
t . setFromTenantId ( distributionBusinessPreOrderEntity . getFromTenantId ( ) ) ;
t . setOperationStatus ( 1 ) ;
t . setInWarehouse ( 0 ) ;
this . save ( t ) ;
}
R r = inOrderWarehourse ( entityByOrderPackageCode . getOrderPackageCode ( ) ) ;
if ( r . isSuccess ( ) ) {
t . setInWarehouse ( 1 ) ;
this . updateById ( t ) ;
int a = 0 ;
//记录当前车次的异常件数
Object o = bladeRedis . get ( RedisKeyConstant . BUSINESS_INEXCE_CARNUMBER + businessSanDTO . getDistrCarNumber ( ) ) ;
if ( Objects . isNull ( o ) ) {
// 查询当前车次的异常入库数量
LambdaQueryWrapper < DistributionBusinessPreOrderEntity > queryWrapper3 = new LambdaQueryWrapper < > ( ) ;
queryWrapper3 . eq ( DistributionBusinessPreOrderEntity : : getDistrCarNumber , distrCarNumber ) ;
queryWrapper3 . eq ( DistributionBusinessPreOrderEntity : : getOperationStatus , 1 ) ;
queryWrapper3 . eq ( DistributionBusinessPreOrderEntity : : getInWarehouse , 1 ) ;
queryWrapper3 . eq ( DistributionBusinessPreOrderEntity : : getIsDeleted , 0 ) ;
List < DistributionBusinessPreOrderEntity > list3 = baseMapper . selectList ( queryWrapper3 ) ;
a = 1 ;
if ( ! list3 . isEmpty ( ) ) {
a = list3 . size ( ) ;
}
bladeRedis . setEx ( RedisKeyConstant . BUSINESS_INEXCE_CARNUMBER + businessSanDTO . getDistrCarNumber ( ) , a , 60 * 60 * 24L ) ;
} else {
a = ( int ) o ;
a = a + 1 ;
bladeRedis . setEx ( RedisKeyConstant . BUSINESS_INEXCE_CARNUMBER + businessSanDTO . getDistrCarNumber ( ) , a , 60 * 60 * 24L ) ;
}
return Resp . scanSuccess ( "扫描成功" , "异常" + a + "件" ) ;
}
return null ;
}
@Override
public IPage < DistributionBusinessPreCarNumerPageVO > listCarNum ( IPage < Object > page , DistributionBusinessPreCarNumerPageQueryVO distributionBusinessPreCarNumerPageQueryVO ) {
IPage < DistributionBusinessPreCarNumerPageVO > listCarNum = baseMapper . listCarNum ( page , distributionBusinessPreCarNumerPageQueryVO ) ;
return listCarNum ;
}
@Override
public DistributionBusinessPreCarDetalVO preCarInfoDetailByCarNumber ( DistributionBusinessPreCarNumerPageQueryVO queryVO ) {
if ( queryVO = = null | | queryVO . getDistrCarNumber ( ) = = null ) {
throw new IllegalArgumentException ( "查询参数不能为空" ) ;
}
List < DistributionBusinessPreCarOrderDetalVO > data = new ArrayList < > ( ) ;
LambdaQueryWrapper < DistributionBusinessPreOrderEntity > queryWrapper = new LambdaQueryWrapper < > ( ) ;
queryWrapper . eq ( DistributionBusinessPreOrderEntity : : getDistrCarNumber , queryVO . getDistrCarNumber ( ) ) ;
queryWrapper . eq ( DistributionBusinessPreOrderEntity : : getIsDeleted , 0 ) ;
List < DistributionBusinessPreOrderEntity > list = this . list ( queryWrapper ) ;
if ( list ! = null ) {
Map < String , List < DistributionBusinessPreOrderEntity > > groupedData = list . stream ( )
. collect ( Collectors . groupingBy ( DistributionBusinessPreOrderEntity : : getOrderCode ) ) ;
groupedData . forEach ( ( k , v ) - > processGroupedData ( k , v , data ) ) ;
}
DistributionBusinessPreCarNumerPageVO distributionBusinessPreCarNumerPageVO = baseMapper . listCarInforByCarNum ( queryVO ) ;
DistributionBusinessPreCarDetalVO distributionBusinessPreCarDetalVO = BeanUtil . copy ( distributionBusinessPreCarNumerPageVO , DistributionBusinessPreCarDetalVO . class ) ;
if ( distributionBusinessPreCarDetalVO ! = null ) {
distributionBusinessPreCarDetalVO . setDistributionBusinessPreCarOrderDetalVOList ( data ) ;
} else {
throw new ServiceException ( "系统异常" ) ;
}
return distributionBusinessPreCarDetalVO ;
}
private void processGroupedData ( String orderCode , List < DistributionBusinessPreOrderEntity > entities , List < DistributionBusinessPreCarOrderDetalVO > data ) {
DistributionBusinessPreCarOrderDetalVO t = new DistributionBusinessPreCarOrderDetalVO ( ) ;
t . setOrderCode ( orderCode ) ;
int planNum = entities . size ( ) ;
int loadNum = ( int ) entities . stream ( ) . filter ( e - > "20" . equals ( e . getOrderPackageLoadingStatus ( ) ) ) . count ( ) ;
int inNum = ( int ) entities . stream ( ) . filter ( e - > e . getInWarehouse ( ) = = 1 ) . count ( ) ;
int inExceNum = ( int ) entities . stream ( ) . filter ( e - > e . getOperationStatus ( ) = = 1 ) . count ( ) ;
String wallbillNum = entities . stream ( ) . map ( DistributionBusinessPreOrderEntity : : getWaybillNumber ) . distinct ( ) . collect ( Collectors . joining ( "," ) ) ;
t . setWaybillNumber ( wallbillNum ) ;
t . setLoadCarCount ( loadNum ) ;
t . setInWarehouseCount ( inNum ) ;
t . setOrderPackageCodeCount ( planNum ) ;
t . setInWarehouseExceCount ( inExceNum ) ;
List < DistributionBusinessPreCarDetalPackageVO > packageVOS = entities . stream ( ) . map ( entity - > BeanUtil . copy ( entity , DistributionBusinessPreCarDetalPackageVO . class ) ) . collect ( Collectors . toList ( ) ) ;
t . setDistributionBusinessPreCarDetalPackageList ( packageVOS ) ;
data . add ( t ) ;
}
@ -258,58 +436,8 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl<Di
}
private void buildDistributionParcelListEntity ( DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity ) {
DistributionParcelListEntity distributionParcelListEntity = BeanUtil . copy ( distributionBusinessPreOrderEntity , DistributionParcelListEntity . class ) ;
distributionParcelListEntity . setId ( null ) ;
distributionParcelListEntity . setOrderPackageFreezeStatus ( "10" ) ;
distributionParcelListEntity . setOrderPackageStatus ( "20" ) ;
distributionParcelListEntity . setOrderPackageLoadingStatus ( "10" ) ;
distributionParcelListEntity . setOrderPackageReservationStatus ( "10" ) ;
distributionParcelListEntity . setOrderPackageGroundingStatus ( "10" ) ;
distributionParcelListEntity . setOrderPackageStockupStatus ( "10" ) ;
distributionParcelListService . save ( distributionParcelListEntity ) ;
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService . getById ( distributionParcelListEntity . getStockArticleId ( ) ) ;
//增加
// 统计订单下的包间总数
LambdaQueryWrapper < DistributionParcelListEntity > lambdaQueryWrapper = new LambdaQueryWrapper < > ( ) ;
lambdaQueryWrapper . eq ( DistributionParcelListEntity : : getStockArticleId , distributionParcelListEntity . getStockArticleId ( ) ) ;
long count = distributionParcelListService . count ( lambdaQueryWrapper ) ;
stockArticleEntity . setHandQuantity ( ( int ) count ) ;
distributionStockArticleService . updateById ( stockArticleEntity ) ;
}
// private DistributionStockArticleEntity buildDistributionStockArticleEntity(DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity) {
// DistributionStockArticleEntity stockArticleEntity = null;
// try {
// BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
// stockArticleEntity = distributionStockArticleService.findStockArticleByOrderCodeAndWarehouseId(distributionBusinessPreOrderEntity.getOrderCode(),
// myCurrentWarehouse.getId());
// if (stockArticleEntity == null) {
// // 需要保存这个对象
// CompletableFuture<DistributionStockArticleEntity> distributionStockArticleEntityCompletableFuture = CompletableFuture.supplyAsync(() -> distributionAsyncService.findDistributionStockArticleEntityByIdForAsync(distributionBusinessPreOrderEntity.getFromTenantId(), distributionBusinessPreOrderEntity.getStockArticleId()));
// stockArticleEntity = distributionStockArticleEntityCompletableFuture.get();
// if (stockArticleEntity == null) {
// return null;
// }
// // 获取当前登录人的仓库信息
// stockArticleEntity.setId(null);
// stockArticleEntity.setTenantId(null);
// stockArticleEntity.setWarehouseId(myCurrentWarehouse.getId());
// stockArticleEntity.setWarehouse(myCurrentWarehouse.getName());
// stockArticleEntity.setHandQuantity(0);
// distributionStockArticleService.save(stockArticleEntity);
// }
// } catch (InterruptedException | ExecutionException e) {
// log.error("buildDistributionStockArticleEntity :", e);
// throw new CustomerException("系统异常,请联系管理员");
// }
// return stockArticleEntity;
// }
@ChangeAsync ( )
public DistributionParcelListEntity selectByOrderPackageCode ( String orderPackageCode , Long warehouseId ) {