mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
feat: #10000 修改
This commit is contained in:
parent
6ad2379046
commit
cf3f7fad4d
@ -28,11 +28,7 @@ class BusinessOrdersUpdate
|
||||
*/
|
||||
public function __construct($item, $num)
|
||||
{
|
||||
if (is_array($item)) {
|
||||
$this->businessGoods = $item;
|
||||
} else {
|
||||
$this->businessGoods = $item->toArray();
|
||||
}
|
||||
$this->num = $num;
|
||||
$this->updateStock();
|
||||
}
|
||||
@ -41,10 +37,6 @@ class BusinessOrdersUpdate
|
||||
{
|
||||
try {
|
||||
$this->goodsSku = GoodsSku::query()
|
||||
->with([
|
||||
'combinationGoods',
|
||||
'combinationGoods.goodsSkuItem:id,external_sku_id',
|
||||
])
|
||||
->where('external_sku_id', $this->businessGoods['external_sku_id'])
|
||||
->first();
|
||||
} catch (\Exception $e) {
|
||||
@ -54,10 +46,6 @@ class BusinessOrdersUpdate
|
||||
if ($this->goodsSku) {
|
||||
$this->goodsSku->stock += $this->num;
|
||||
$this->goodsSku->save();
|
||||
foreach ($this->goodsSku->combinationGoods as $item) {
|
||||
$this->businessGoods['external_sku_id'] = $item['goodsSkuItem']['external_sku_id'];
|
||||
event(new BusinessOrdersUpdate($this->businessGoods, 0 - $item['item_num']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ class GoodsSkusController extends Controller
|
||||
}])
|
||||
->where('is_combination', 0)
|
||||
->orderByDesc('stock')
|
||||
->paginate(10);
|
||||
->paginate($request->get('per_page'));
|
||||
$fields = implode(',', [
|
||||
'shop_id',
|
||||
'external_sku_id',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user