commit
2f4b148d4c
@ -34,12 +34,16 @@ class BusinessOrdersUpdate
|
|||||||
|
|
||||||
private function updateStock()
|
private function updateStock()
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
[$goodsCode, $skuCode] = explode('_', $this->businessOrderItem['external_sku_id']);
|
[$goodsCode, $skuCode] = explode('_', $this->businessOrderItem['external_sku_id']);
|
||||||
$this->goodsSku = GoodsSku::query()->where('sku_code', $skuCode)
|
$this->goodsSku = GoodsSku::query()->where('sku_code', $skuCode)
|
||||||
->whereHas('goods', function ($query) use ($goodsCode) {
|
->whereHas('goods', function ($query) use ($goodsCode) {
|
||||||
$query->where('goods_code', $goodsCode);
|
$query->where('goods_code', $goodsCode);
|
||||||
})
|
})
|
||||||
->first();
|
->first();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if ($this->goodsSku) {
|
if ($this->goodsSku) {
|
||||||
$this->goodsSku->stock += $this->num;
|
$this->goodsSku->stock += $this->num;
|
||||||
$this->goodsSku->save();
|
$this->goodsSku->save();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user