Browse Source

修改拆单问题

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

Loading…
Cancel
Save