@ -35,6 +35,8 @@ import com.logpm.distribution.wrapper.DistributionParcelListWrapper;
import com.logpm.distribution.wrapper.DistributionReservationWrapper ;
import com.logpm.distribution.wrapper.DistributionStockArticleWrapper ;
import com.logpm.distribution.wrapper.DistributionStockListWrapper ;
import com.logpm.oldproject.entity.WayBillEntity ;
import com.logpm.oldproject.feign.IWayBillClient ;
import com.logpm.warehouse.entity.WarehouseWaybillEntity ;
import com.logpm.warehouse.feign.IWarehouseWaybillClient ;
import lombok.extern.slf4j.Slf4j ;
@ -175,6 +177,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
@Autowired
private DistributionStockupInfoMapper distributionStockupInfoMapper ;
@Autowired
private IWayBillClient wayBillClient ;
@ -281,6 +286,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
HashSet < String > storeName = new HashSet < > ( ) ;
HashSet < String > mallName = new HashSet < > ( ) ;
HashSet < String > receivingUnit = new HashSet < > ( ) ;
HashSet < String > waybillNo = new HashSet < > ( ) ;
HashSet < String > waybillId = new HashSet < > ( ) ;
HashSet < String > marketPhone = new HashSet < > ( ) ;
AtomicReference < BigDecimal > initTotal = new AtomicReference < > ( BigDecimal . ZERO ) ;
//存在订单构建预约订单关联信息
if ( ! Func . isEmpty ( stockArticleList ) ) {
@ -293,6 +301,17 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
//存在订单的情况下才会对预约和包件的关系进行维护
//选择了订单但是未进行包件的选择,默认选择了订单下的所有在库包件
stockArticleList . forEach ( s - > {
// WarehouseWaybillEntity byWaybillNo = warehouseWaybillClient.findByWaybillNo(s.getWaybillNumber());
WayBillEntity wayBillEntity = wayBillClient . getByWaybillNo ( s . getWaybillNumber ( ) ) ;
if ( Func . isNotEmpty ( wayBillEntity ) ) {
waybillId . add ( wayBillEntity . getId ( ) . toString ( ) ) ;
}
if ( Func . isNotEmpty ( wayBillEntity . getTakePhone ( ) ) ) {
marketPhone . add ( wayBillEntity . getTakePhone ( ) ) ;
}
if ( Func . isNotEmpty ( s . getWaybillNumber ( ) ) ) {
waybillNo . add ( s . getWaybillNumber ( ) ) ;
}
if ( Func . isNotBlank ( s . getServiceNumber ( ) ) ) {
serviceNumber . add ( s . getServiceNumber ( ) ) ;
}
@ -458,6 +477,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
reservationEntity . setWarehouseName ( myCurrentWarehouse . getName ( ) ) ;
reservationEntity . setMallName ( String . join ( "," , mallName ) ) ;
reservationEntity . setStoreName ( String . join ( "," , storeName ) ) ;
reservationEntity . setWaybillNo ( String . join ( "," , waybillNo ) ) ;
reservationEntity . setWaybillId ( String . join ( "," , waybillId ) ) ;
reservationEntity . setMailPhone ( String . join ( "," , marketPhone ) ) ;
reservationEntity . setReceivingUnit ( String . join ( "," , receivingUnit ) ) ;
//统计数量
BigDecimal fee = initTotal . get ( ) . add ( reservationEntity . getOtherFee ( ) ) ;
@ -1426,7 +1448,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
clientTotal . getAndIncrement ( ) ;
// AtomicInteger receivingUnit = new AtomicInteger();
//这里查询有问题
WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillClient . findByWaybillNo ( k ) ;
DistributionReservationDTO reservation = allocationDTO . getReservation ( ) ;
DistributionReservationEntity reservationEntity = Func . copy ( reservation , DistributionReservationEntity . class ) ;
reservationEntity . setWaybillNo ( k ) ;
@ -1441,6 +1463,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
// HashSet<String> waybillNo = new HashSet<>();
//运单ID -------这里运单Id后续可能变更为运单号
HashSet < String > waybillId = new HashSet < > ( ) ;
HashSet < String > waybillNo = new HashSet < > ( ) ;
//订单服务号
HashSet < String > serviceNumber = new HashSet < > ( ) ;
//仓库名称
@ -1449,6 +1473,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
HashSet < String > mallName = new HashSet < > ( ) ;
//门店名称
HashSet < String > storeName = new HashSet < > ( ) ;
//门店名称
HashSet < String > marketPhone = new HashSet < > ( ) ;
//包件总数量
AtomicInteger packageTotal = new AtomicInteger ( ) ;
// ------------------收货信息构建-------------------
@ -1461,6 +1488,25 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
//运单客户收货单位
HashSet < String > consignee = new HashSet < > ( ) ;
v . forEach ( s - > {
// WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillClient.findByWaybillNo(s.getWaybillNumber());
// if (Func.isNotEmpty(warehouseWaybillEntity.getConsigneeMobile())){
// marketPhone.add(warehouseWaybillEntity.getConsigneeMobile());
// }
// if (Func.isNotEmpty(warehouseWaybillEntity.getConsigneeAddress())){
// consigneeAddress.add(warehouseWaybillEntity.getConsigneeMobile());
// }
WayBillEntity wayBillEntity = wayBillClient . getByWaybillNo ( s . getWaybillNumber ( ) ) ;
if ( Func . isNotEmpty ( wayBillEntity ) ) {
waybillId . add ( wayBillEntity . getId ( ) . toString ( ) ) ;
if ( Func . isNotEmpty ( wayBillEntity . getTakePhone ( ) ) ) {
marketPhone . add ( wayBillEntity . getTakePhone ( ) ) ;
}
if ( Func . isNotEmpty ( wayBillEntity . getTakeAddress ( ) ) ) {
consigneeAddress . add ( wayBillEntity . getTakeAddress ( ) ) ;
}
}
//预约单数据填充
if ( Func . isNotEmpty ( s . getMallName ( ) ) ) {
mallName . add ( s . getMallName ( ) ) ;
@ -1477,8 +1523,11 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
if ( Func . isNotEmpty ( s . getWarehouse ( ) ) ) {
warehouseName . add ( s . getWarehouse ( ) ) ;
}
if ( Func . isNotEmpty ( s . getWaybillId ( ) ) ) {
waybillId . add ( s . getWaybillId ( ) . toString ( ) ) ;
// if (Func.isNotEmpty(s.getWaybillId())){
// waybillId.add(s.getWaybillId().toString());
// }
if ( Func . isNotEmpty ( s . getWaybillNumber ( ) ) ) {
waybillNo . add ( s . getWaybillNumber ( ) ) ;
}
if ( Func . isNotEmpty ( s . getConsigneeUnit ( ) ) ) {
consignee . add ( s . getConsigneeUnit ( ) ) ;
@ -1489,9 +1538,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
if ( Func . isNotEmpty ( s . getConsigneeMobile ( ) ) ) {
consigneeMobile . add ( s . getConsigneeMobile ( ) ) ;
}
if ( Func . isNotEmpty ( s . getConsigneeAddress ( ) ) ) {
consigneeAddress . add ( s . getConsigneeAddress ( ) ) ;
}
// if (Func.isNotEmpty(s.getConsigneeAddress())){
// consigneeAddress.add(s.getConsigneeAddress());
// }
if ( Func . isNotEmpty ( s . getServiceNumber ( ) ) ) {
serviceNumber . add ( s . getServiceNumber ( ) ) ;
}
@ -1540,11 +1589,16 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
reservationEntity . setConsignee ( String . join ( "," , consigneeName ) ) ;
reservationEntity . setDeliveryPhone ( String . join ( "," , consigneeMobile ) ) ;
reservationEntity . setDeliveryAddress ( String . join ( "," , consigneeAddress ) ) ;
reservationEntity . setReceivingUnit ( String . join ( "," , consignee ) ) ;
reservationEntity . setReceivingUnit ( k ) ;
// reservationEntity.setWaybillId(String.join(",", waybillId));
reservationEntity . setReservationDate ( date ) ;
// -----------------------预约信息完善----------------------------
reservationEntity . setReservationCode ( reservationMa ( ) ) ;
reservationEntity . setReplaceFee ( BigDecimal . ZERO ) ;
reservationEntity . setFee ( BigDecimal . ZERO ) ;
reservationEntity . setCollectFee ( BigDecimal . ZERO ) ;
reservationEntity . setOrderSource ( ReservationOrderSourceConstant . zijian . getValue ( ) ) ;
// reservationEntity.setDeliveryWay();
reservationEntity . setDeliveryType ( DistributionTypeConstant . shangpei . getValue ( ) ) ;
reservationEntity . setStockupStatus ( ReservationStockupStatusConstant . daibeihuo . getValue ( ) ) ;
@ -1552,6 +1606,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
reservationEntity . setStockArticleId ( String . join ( "," , orderNumber ) ) ;
reservationEntity . setServiceNumber ( String . join ( "," , serviceNumber ) ) ;
reservationEntity . setWarehouseName ( String . join ( "," , warehouseName ) ) ;
reservationEntity . setWaybillNo ( String . join ( "," , waybillNo ) ) ;
reservationEntity . setWaybillId ( String . join ( "," , waybillId ) ) ;
reservationEntity . setMailPhone ( String . join ( "," , marketPhone ) ) ;
reservationEntity . setMallName ( String . join ( "," , mallName ) ) ;
reservationEntity . setStoreName ( String . join ( "," , storeName ) ) ;
reservationEntity . setLoadingStatus ( ReservationLoadingStatusConstant . daizhuangche . getValue ( ) ) ;
@ -2098,6 +2155,12 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
HashSet < String > receivingUnit = new HashSet < > ( ) ;
HashSet < String > waybillNo = new HashSet < > ( ) ;
HashSet < String > waybillId = new HashSet < > ( ) ;
HashSet < String > marketPhone = new HashSet < > ( ) ;
AtomicReference < BigDecimal > initTotal = new AtomicReference < > ( BigDecimal . ZERO ) ;
//存在订单构建预约订单关联信息
@ -2111,6 +2174,17 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
return R . fail ( "订单已预约!!!" ) ;
}
stockArticleList . forEach ( s - > {
// WarehouseWaybillEntity byWaybillNo = warehouseWaybillClient.findByWaybillNo();
// String consigneeMobile = byWaybillNo.getConsigneeMobile();
WayBillEntity wayBillEntity = wayBillClient . getByWaybillNo ( s . getWaybillNumber ( ) ) ;
if ( Func . isNotEmpty ( wayBillEntity ) ) {
waybillId . add ( wayBillEntity . getId ( ) . toString ( ) ) ;
}
if ( Func . isNotEmpty ( wayBillEntity . getTakePhone ( ) ) ) {
marketPhone . add ( wayBillEntity . getTakePhone ( ) ) ;
}
// storeName.add(s.getStoreName());
// mallName.add(s.getMallName());
// warehouseNames.add(s.getWarehouse());
@ -2133,6 +2207,10 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
if ( Func . isNotBlank ( s . getConsigneeUnit ( ) ) ) {
receivingUnit . add ( s . getConsigneeUnit ( ) ) ;
}
if ( Func . isNotBlank ( s . getWaybillNumber ( ) ) ) {
waybillNo . add ( s . getWaybillNumber ( ) ) ;
}
// DistributionStockArticleEntity stockArticleEntity = Func.copy(s, DistributionStockArticleEntity.class);
DistributionReservationStockarticleEntity distributionReservationStockarticleEntity = new DistributionReservationStockarticleEntity ( ) ;
//预约订单数量
@ -2276,6 +2354,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
reservationEntity . setWarehouseName ( String . join ( "," , warehouseNames ) ) ;
reservationEntity . setMallName ( String . join ( "," , mallName ) ) ;
reservationEntity . setStoreName ( String . join ( "," , storeName ) ) ;
reservationEntity . setWaybillNo ( String . join ( "," , waybillNo ) ) ;
reservationEntity . setWaybillId ( String . join ( "," , waybillId ) ) ;
reservationEntity . setMailPhone ( String . join ( "," , marketPhone ) ) ;
reservationEntity . setReceivingUnit ( String . join ( "," , receivingUnit ) ) ;
//统计数量
BigDecimal fee = initTotal . get ( ) . add ( reservationEntity . getOtherFee ( ) ) ;