Browse Source

Merge remote-tracking branch 'origin/dev' into dev

pre-production
zhaoqiaobo 3 days ago
parent
commit
e239b8565d
  1. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java
  2. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java
  3. 53
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java

10
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java

@ -117,6 +117,11 @@ public class DistributionSplitOrderTaskController {
return distributionSplitOrderTaskService.checkOrderCode(orderCode);
}
@GetMapping("/check-order-code-by-stock-article-id")
public R<String> checkOrderCode(Long stockArticleId) {
return distributionSplitOrderTaskService.checkOrderCode(stockArticleId);
}
@GetMapping("/get-package-code-by-order-code")
public R<IPage<SplitPackageOrderVO>> getPackageCodeByOrderCode(Query query, String orderCode) {
return distributionSplitOrderTaskService.getPackageCodeByOrderCode(query, orderCode);
@ -126,4 +131,9 @@ public class DistributionSplitOrderTaskController {
public R<List<SplitPackageOrderVO>> getPackageCodeByTaskId(Long taskId) {
return distributionSplitOrderTaskService.getPackageCodeByTaskId( taskId);
}
@GetMapping("/get-allow-split-order-number")
public R<Long> getAllowSplitOrderNumber(Long stockArticleId){
return R.data(distributionSplitOrderTaskService.getSplitOrderAllowCount(stockArticleId));
}
}

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java

@ -117,6 +117,10 @@ public interface IDistributionSplitOrderTaskService extends BaseService<Distribu
R<String> checkOrderCode(String orderCode);
R<String> checkOrderCode(Long stockArticleId);
long getSplitOrderAllowCount(Long stockArticleId);
R<List<SplitPackageOrderVO>> getPackageCodeByTaskId(Long taskId);
R<IPage<SplitPackageOrderVO>> getPackageCodeByOrderCode(Query query, String orderCode);

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

@ -34,7 +34,6 @@ import org.springblade.common.constant.order.OrderSplitStateConstant;
import org.springblade.common.constant.order.OrderStatusConstant;
import org.springblade.common.constant.orderpackage.*;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
@ -42,9 +41,7 @@ import org.springblade.core.redis.lock.LockType;
import org.springblade.core.redis.lock.RedisLockClient;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.system.cache.UserCache;
import org.springblade.system.entity.User;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.feign.IUserClient;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -136,7 +133,8 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
if (distributionStockArticle == null) {
return R.fail("原订单信息错误");
}
if (!Objects.equals(distributionStockArticle.getOrderStatus(), OrderStatusConstant.ruku.getValue())
if (distributionStockArticle.getOrderStatus().equals(OrderStatusConstant.chuku.getValue())
|| distributionStockArticle.getOrderStatus().equals(OrderStatusConstant.qianshou.getValue())
|| Objects.equals(distributionStockArticle.getReservationStatus(), OrderReservationStatusConstant.yiyueyue.getValue())) {
return R.fail("订单"+ distributionStockArticle.getOrderCode() +"不允许拆单");
}
@ -163,7 +161,10 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
.mapToInt(Integer::intValue)
.sum();
if (packageAllowCount < taskNumber) {
return R.fail("拆单数大于订单包件数量,请重新填写,目前可拆单数量:" + packageAllowCount);
return R.fail("拆单包件数量不足,请重新填写,目前可拆单数量:" + (packageAllowCount - 1));
}
if (packageAllCount >= taskNumber) {
return R.fail("拆单数需要小于订单总数量,请重新填写,目前可拆单数量:" + (packageAllowCount - 1));
}
taskLock(stockArticleId, () -> {
@ -933,7 +934,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
List<Map<String, Object>> maps = baseMapper.selectMaps(
Wrappers.<DistributionSplitOrderTaskEntity>query()
.select("split_order_all_task_id", "SUM(number) as number")
.eq("split_order_all_task_id", taskIds)
.in("split_order_all_task_id", taskIds)
.in("state", OrderSplitStateConstant.InProgress.getValue(), OrderSplitStateConstant.finish.getValue())
.groupBy("split_order_all_task_id")
);
@ -993,6 +994,46 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
return R.success("");
}
@Override
public R<String> checkOrderCode(Long stockArticleId){
DistributionStockArticleEntity distributionStockArticle = distributionStockArticleService.getById(stockArticleId);
if (distributionStockArticle == null) {
return R.fail("原订单信息错误");
}
if (distributionStockArticle.getOrderStatus().equals(OrderStatusConstant.chuku.getValue())
|| distributionStockArticle.getOrderStatus().equals(OrderStatusConstant.qianshou.getValue())
|| Objects.equals(distributionStockArticle.getReservationStatus(), OrderReservationStatusConstant.yiyueyue.getValue())) {
return R.fail("订单"+ distributionStockArticle.getOrderCode() +"不允许拆单");
}
long packageAllowCount = getSplitOrderAllowCount(stockArticleId);
long packageAllCount = getSplitOrderAllCount(stockArticleId);
if (packageAllowCount == 0 || packageAllCount == 1) {
return R.fail("订单"+ distributionStockArticle.getOrderCode() +"包件数量不足,不允许拆单");
}
boolean exists = exists(
Wrappers.<DistributionSplitOrderTaskEntity>lambdaQuery()
.eq(DistributionSplitOrderTaskEntity::getStockArticleId, stockArticleId)
.eq(DistributionSplitOrderTaskEntity::getState, OrderSplitStateConstant.InProgress.getValue())
);
if (exists) {
return R.fail("订单"+ distributionStockArticle.getOrderCode() +"正在拆单中,不允许重复拆单");
}
boolean hasSplit = exists(
Wrappers.<DistributionSplitOrderTaskEntity>lambdaQuery()
.eq(DistributionSplitOrderTaskEntity::getNewStockArticleId, stockArticleId)
);
if (hasSplit){
return R.fail("订单"+ distributionStockArticle.getOrderCode() +"已是拆单订单,不允许再次拆单");
}
return R.success("");
}
@Override
public R<IPage<SplitPackageOrderVO>> getPackageCodeByOrderCode(Query query, String orderCode) {
IPage<DistributionParcelListEntity> page = Condition.getPage(query);

Loading…
Cancel
Save