|
|
|
@ -28,10 +28,7 @@ import com.logpm.distribution.vo.DistributionSplitOrderTaskVO;
|
|
|
|
|
import com.logpm.distribution.vo.SplitPackageOrderVO; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.common.constant.order.OrderReservationStatusConstant; |
|
|
|
|
import org.springblade.common.constant.order.OrderSplitAllTaskStateConstant; |
|
|
|
|
import org.springblade.common.constant.order.OrderSplitStateConstant; |
|
|
|
|
import org.springblade.common.constant.order.OrderStatusConstant; |
|
|
|
|
import org.springblade.common.constant.order.*; |
|
|
|
|
import org.springblade.common.constant.orderpackage.*; |
|
|
|
|
import org.springblade.common.exception.CustomerException; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
@ -160,11 +157,12 @@ 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("拆单包件数量不足,请重新填写,目前可拆单数量:" + (packageAllowCount - 1)); |
|
|
|
|
return R.fail("拆单包件数量不足,请重新填写,目前可拆单数量:" + tipNumber); |
|
|
|
|
} |
|
|
|
|
if (packageAllCount >= taskNumber) { |
|
|
|
|
return R.fail("拆单数需要小于订单总数量,请重新填写,目前可拆单数量:" + (packageAllowCount - 1)); |
|
|
|
|
if (packageAllCount <= taskNumber) { |
|
|
|
|
return R.fail("拆单数需要小于订单总数量,请重新填写,目前可拆单数量:" + tipNumber); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
taskLock(stockArticleId, () -> { |
|
|
|
@ -191,6 +189,9 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
|
|
|
|
|
save(distributionSplitOrderTaskEntity); |
|
|
|
|
distributionSplitOrderLogService.record(distributionSplitOrderTaskEntity, "创建拆单任务", AuthUtil.getUser().getUserName()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
distributionStockArticle.setSplitStatus(OrderSplitStatusConstant.InProgress.getValue()); |
|
|
|
|
distributionStockArticleService.save(distributionStockArticle); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
@ -793,6 +794,12 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
|
|
|
|
|
distributionSplitOrderAllTaskService.updateById(allTask); |
|
|
|
|
list.forEach(this::cancelTask); |
|
|
|
|
|
|
|
|
|
distributionStockArticleService.update( |
|
|
|
|
Wrappers.<DistributionStockArticleEntity>lambdaUpdate() |
|
|
|
|
.eq(DistributionStockArticleEntity::getId, allTask.getStockArticleId()) |
|
|
|
|
.set(DistributionStockArticleEntity::getSplitStatus, OrderSplitStatusConstant.No.getValue()) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return R.success("success"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -823,6 +830,12 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
|
|
|
|
|
.eq(DistributionSplitOrderTaskEntity::getState, OrderSplitStateConstant.finish.getValue()) |
|
|
|
|
).forEach(this::packageTransfer); |
|
|
|
|
|
|
|
|
|
distributionStockArticleService.update( |
|
|
|
|
Wrappers.<DistributionStockArticleEntity>lambdaUpdate() |
|
|
|
|
.eq(DistributionStockArticleEntity::getId, allTask.getStockArticleId()) |
|
|
|
|
.set(DistributionStockArticleEntity::getSplitStatus, OrderSplitStatusConstant.No.getValue()) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return R.success("success"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|