Browse Source

Merge branch 'dev' into pre-production

pre-production
pref_mail@163.com 3 days ago
parent
commit
5c1465d795
  1. 26
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java

26
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java

@ -137,10 +137,9 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
} }
long packageAllowCount = getSplitOrderAllowCount(stockArticleId); long packageAllowCount = getSplitOrderAllowCount(stockArticleId);
long packageAllCount = getSplitOrderAllCount(stockArticleId);
if (packageAllowCount == 0 || packageAllCount == 1) { if (packageAllowCount == 0) {
return R.fail("订单"+ distributionStockArticle.getOrderCode() +"包件数量不足,不允许拆单"); return R.fail("订单"+ distributionStockArticle.getOrderCode() +"可拆包件数量不足,不允许拆单");
} }
boolean exists = exists( boolean exists = exists(
@ -157,12 +156,8 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
.map(DistributionSplitOrderTaskEntity::getTaskNumber) .map(DistributionSplitOrderTaskEntity::getTaskNumber)
.mapToInt(Integer::intValue) .mapToInt(Integer::intValue)
.sum(); .sum();
long tipNumber = packageAllCount > packageAllowCount ? packageAllowCount : packageAllowCount - 1;
if (packageAllowCount < taskNumber) { if (packageAllowCount < taskNumber) {
return R.fail("拆单包件数量不足,请重新填写,目前可拆单数量:" + tipNumber); return R.fail("拆单包件数量不足,请重新填写,目前可拆单数量:" + packageAllowCount);
}
if (packageAllCount <= taskNumber) {
return R.fail("拆单数需要小于订单总数量,请重新填写,目前可拆单数量:" + tipNumber);
} }
taskLock(stockArticleId, () -> { taskLock(stockArticleId, () -> {
@ -272,7 +267,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
long count = distributionParcelListService.count( long count = distributionParcelListService.count(
Wrappers.<DistributionParcelListEntity>lambdaQuery() Wrappers.<DistributionParcelListEntity>lambdaQuery()
.in(DistributionParcelListEntity::getOrderPackageCode, packageCodes) .in(DistributionParcelListEntity::getOrderPackageCode, packageCodes)
.ne(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue()) .eq(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiruku.getValue())
.eq(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue()) .eq(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue())
.eq(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.weizhuancghe.getValue()) .eq(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.weizhuancghe.getValue())
.eq(DistributionParcelListEntity::getOrderPackageFreezeStatus, OrderPackageFreezeStatusConstant.weidongjie.getValue()) .eq(DistributionParcelListEntity::getOrderPackageFreezeStatus, OrderPackageFreezeStatusConstant.weidongjie.getValue())
@ -977,15 +972,19 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
} }
public long getSplitOrderAllowCount(Long stockArticleId) { public long getSplitOrderAllowCount(Long stockArticleId) {
return distributionParcelListService.count( long splitOrderAllCount = getSplitOrderAllCount(stockArticleId);
long allowCount = distributionParcelListService.count(
Wrappers.<DistributionParcelListEntity>lambdaQuery() Wrappers.<DistributionParcelListEntity>lambdaQuery()
.in(DistributionParcelListEntity::getStockArticleId, stockArticleId) .in(DistributionParcelListEntity::getStockArticleId, stockArticleId)
.ne(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue()) .eq(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiruku.getValue())
.eq(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue()) .eq(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue())
.eq(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.weizhuancghe.getValue()) .eq(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.weizhuancghe.getValue())
.eq(DistributionParcelListEntity::getOrderPackageFreezeStatus, OrderPackageFreezeStatusConstant.weidongjie.getValue()) .eq(DistributionParcelListEntity::getOrderPackageFreezeStatus, OrderPackageFreezeStatusConstant.weidongjie.getValue())
.eq(DistributionParcelListEntity::getIsTransfer, 0) .eq(DistributionParcelListEntity::getIsTransfer, 0)
); );
return allowCount >= splitOrderAllCount ? allowCount - 1 : allowCount;
} }
public long getSplitOrderAllCount(Long stockArticleId) { public long getSplitOrderAllCount(Long stockArticleId) {
@ -1020,10 +1019,9 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
} }
long packageAllowCount = getSplitOrderAllowCount(stockArticleId); long packageAllowCount = getSplitOrderAllowCount(stockArticleId);
long packageAllCount = getSplitOrderAllCount(stockArticleId);
if (packageAllowCount == 0 || packageAllCount == 1) { if (packageAllowCount == 0) {
return R.fail("订单"+ distributionStockArticle.getOrderCode() +"包件数量不足,不允许拆单"); return R.fail("订单"+ distributionStockArticle.getOrderCode() +"可拆包件数量不足,不允许拆单");
} }
boolean exists = exists( boolean exists = exists(

Loading…
Cancel
Save