批量修改在售库存
This commit is contained in:
parent
67ed7dbe6b
commit
2e96bc6cdd
@ -54,7 +54,7 @@ class CombinationGoodsStockUpdateListener implements ShouldQueue
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//拉取三分订单时可能出现组合订单的情况 需要同步扣减库存
|
||||||
if ($combinationGoodsIds) {
|
if ($combinationGoodsIds) {
|
||||||
$combinationGoods = CombinationGood::query()
|
$combinationGoods = CombinationGood::query()
|
||||||
->with('goodsSku:id,stock')
|
->with('goodsSku:id,stock')
|
||||||
@ -64,7 +64,7 @@ class CombinationGoodsStockUpdateListener implements ShouldQueue
|
|||||||
$goodsSku = GoodsSku::query()->find($item['item_id']);
|
$goodsSku = GoodsSku::query()->find($item['item_id']);
|
||||||
$stock = $goodsSku->stock - $item['item_num'];
|
$stock = $goodsSku->stock - $item['item_num'];
|
||||||
//新增逻辑 在线库存同步扣减
|
//新增逻辑 在线库存同步扣减
|
||||||
$saleStock = $goodsSku->sale_stock - $item['item_num'];
|
$saleStock = max($goodsSku->sale_stock - $item['item_num'],0);
|
||||||
[$status, $stock] = $this->checkStatusAndStock($goodsSku, $stock, $saleStock);
|
[$status, $stock] = $this->checkStatusAndStock($goodsSku, $stock, $saleStock);
|
||||||
$goodsSku->status = $status;
|
$goodsSku->status = $status;
|
||||||
$goodsSku->stock = $stock;
|
$goodsSku->stock = $stock;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user