mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
feat: #20220819 代码优化
This commit is contained in:
parent
622467c64c
commit
5a2ef8745f
@ -34,12 +34,16 @@ class BusinessOrdersUpdate
|
||||
|
||||
private function updateStock()
|
||||
{
|
||||
[$goodsCode, $skuCode] = explode('_', $this->businessOrderItem['external_sku_id']);
|
||||
$this->goodsSku = GoodsSku::query()->where('sku_code', $skuCode)
|
||||
->whereHas('goods', function ($query) use ($goodsCode) {
|
||||
$query->where('goods_code', $goodsCode);
|
||||
})
|
||||
->first();
|
||||
try {
|
||||
[$goodsCode, $skuCode] = explode('_', $this->businessOrderItem['external_sku_id']);
|
||||
$this->goodsSku = GoodsSku::query()->where('sku_code', $skuCode)
|
||||
->whereHas('goods', function ($query) use ($goodsCode) {
|
||||
$query->where('goods_code', $goodsCode);
|
||||
})
|
||||
->first();
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
if ($this->goodsSku) {
|
||||
$this->goodsSku->stock += $this->num;
|
||||
$this->goodsSku->save();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user