编辑数量时记录
This commit is contained in:
@@ -141,6 +141,26 @@ class InvItemService
|
||||
], $res['stock_qty']);
|
||||
}
|
||||
|
||||
public function beforeServiceUpdate($data, Request $request)
|
||||
{
|
||||
$uid = $request->user->uid;
|
||||
$name = $uid ? User::where('id', $uid)->value('name') : '';
|
||||
$item = InvItem::where('id', $data['id'])->first();
|
||||
$change_qty = $data['change_qty'] - $item['stock_qty'];
|
||||
// 记录库存变化日志
|
||||
$this->recordStockLog([
|
||||
'item_id' => $data['id'],
|
||||
'item_name_snap' => $data['item_name'],
|
||||
'change_qty' => $change_qty,
|
||||
'before_qty' => $item['stock_qty'],
|
||||
'after_qty' => $data['stock_qty'],
|
||||
'biz_type' => 1,
|
||||
'biz_no' => '',
|
||||
'operator_id' => $uid,
|
||||
'operator_name' => $name,
|
||||
'remark' => '管理员修改数量',
|
||||
], $change_qty);
|
||||
}
|
||||
|
||||
/**
|
||||
* 变动物品库存数量
|
||||
|
||||
Reference in New Issue
Block a user