|
@@ -91,7 +91,8 @@ public class VoyageApiImpl implements VoyageApi {
|
|
|
if (Objects.equals(type, DistributorOrStoreEnum.DISTRIBUTOR.getValue())) {
|
|
if (Objects.equals(type, DistributorOrStoreEnum.DISTRIBUTOR.getValue())) {
|
|
|
//分销商下单只扣分销商库存,默认是OTA,默认OTC只能门店下单
|
|
//分销商下单只扣分销商库存,默认是OTA,默认OTC只能门店下单
|
|
|
//初定扣分销商库存
|
|
//初定扣分销商库存
|
|
|
- //先返还初定扣的库存
|
|
|
|
|
|
|
+ //先返还初定扣的库存,使用修改前一步订单的 ID
|
|
|
|
|
+ preCancelReduceStockDistributor(reqDTO.getOldOrderId(), reqDTO.getType());
|
|
|
preCancelReduceStockDistributor(reqDTO.getOrderId(), reqDTO.getType());
|
|
preCancelReduceStockDistributor(reqDTO.getOrderId(), reqDTO.getType());
|
|
|
//再去扣初定的库存
|
|
//再去扣初定的库存
|
|
|
preReduceStockDistributor(reqDTO);
|
|
preReduceStockDistributor(reqDTO);
|
|
@@ -124,6 +125,7 @@ public class VoyageApiImpl implements VoyageApi {
|
|
|
//分销商下单只扣分销商库存,默认是OTA,默认OTC只能门店下单
|
|
//分销商下单只扣分销商库存,默认是OTA,默认OTC只能门店下单
|
|
|
//初定扣分销商库存
|
|
//初定扣分销商库存
|
|
|
preCancelReduceStockDistributor(reqDTO.getOrderId(), reqDTO.getType());
|
|
preCancelReduceStockDistributor(reqDTO.getOrderId(), reqDTO.getType());
|
|
|
|
|
+ preCancelReduceStockDistributor(reqDTO.getOldOrderId(), reqDTO.getType());
|
|
|
}
|
|
}
|
|
|
} finally {
|
|
} finally {
|
|
|
if (lock.isHeldByCurrentThread() && lock.isLocked()) {
|
|
if (lock.isHeldByCurrentThread() && lock.isLocked()) {
|
|
@@ -147,6 +149,7 @@ public class VoyageApiImpl implements VoyageApi {
|
|
|
//分销商下单只扣分销商库存,默认是OTA,默认OTC只能门店下单
|
|
//分销商下单只扣分销商库存,默认是OTA,默认OTC只能门店下单
|
|
|
//初定扣分销商库存
|
|
//初定扣分销商库存
|
|
|
//先返还初定扣的库存
|
|
//先返还初定扣的库存
|
|
|
|
|
+ preCancelReduceStockDistributor(reqDTO.getOldOrderId(), reqDTO.getType());
|
|
|
preCancelReduceStockDistributor(reqDTO.getOrderId(), reqDTO.getType());
|
|
preCancelReduceStockDistributor(reqDTO.getOrderId(), reqDTO.getType());
|
|
|
//再去扣确定的库存
|
|
//再去扣确定的库存
|
|
|
reduceStockDistributor(reqDTO);
|
|
reduceStockDistributor(reqDTO);
|
|
@@ -173,6 +176,7 @@ public class VoyageApiImpl implements VoyageApi {
|
|
|
//分销商下单只扣分销商库存,默认是OTA,默认OTC只能门店下单
|
|
//分销商下单只扣分销商库存,默认是OTA,默认OTC只能门店下单
|
|
|
//初定扣分销商库存
|
|
//初定扣分销商库存
|
|
|
cancelReduceStockDistributor(reqDTO.getOrderId(), reqDTO.getType());
|
|
cancelReduceStockDistributor(reqDTO.getOrderId(), reqDTO.getType());
|
|
|
|
|
+ cancelReduceStockDistributor(reqDTO.getOldOrderId(), reqDTO.getType());
|
|
|
}
|
|
}
|
|
|
} finally {
|
|
} finally {
|
|
|
if (lock.isHeldByCurrentThread() && lock.isLocked()) {
|
|
if (lock.isHeldByCurrentThread() && lock.isLocked()) {
|
|
@@ -185,6 +189,9 @@ public class VoyageApiImpl implements VoyageApi {
|
|
|
* 确定状态时取消订单还库存
|
|
* 确定状态时取消订单还库存
|
|
|
*/
|
|
*/
|
|
|
private void cancelReduceStockDistributor(Long orderId, Integer type) {
|
|
private void cancelReduceStockDistributor(Long orderId, Integer type) {
|
|
|
|
|
+ if(orderId == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
//退还航次总库存
|
|
//退还航次总库存
|
|
|
//找到确定时扣库存的记录
|
|
//找到确定时扣库存的记录
|
|
|
VoyageStockLogDO voyageStockLogDO = voyageStockLogMapper.selectByOrder(orderId, TradeOrderStatusEnum.UNUSED.getStatus());
|
|
VoyageStockLogDO voyageStockLogDO = voyageStockLogMapper.selectByOrder(orderId, TradeOrderStatusEnum.UNUSED.getStatus());
|
|
@@ -536,6 +543,9 @@ public class VoyageApiImpl implements VoyageApi {
|
|
|
* 初定取消还分销商库存
|
|
* 初定取消还分销商库存
|
|
|
*/
|
|
*/
|
|
|
private void preCancelReduceStockDistributor(Long orderId, Integer type) {
|
|
private void preCancelReduceStockDistributor(Long orderId, Integer type) {
|
|
|
|
|
+ if(orderId == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
//退还航次总库存
|
|
//退还航次总库存
|
|
|
//找到初定时扣库存的记录
|
|
//找到初定时扣库存的记录
|
|
|
VoyageStockLogDO voyageStockLogDO = voyageStockLogMapper.selectByOrder(orderId, TradeOrderStatusEnum.YD.getStatus());
|
|
VoyageStockLogDO voyageStockLogDO = voyageStockLogMapper.selectByOrder(orderId, TradeOrderStatusEnum.YD.getStatus());
|