|
@@ -612,10 +612,14 @@ class ReorderChild extends Base
|
|
|
->findOrEmpty();
|
|
|
if (empty($has_good)) throw new Exception('未找到商品上线记录');
|
|
|
else {
|
|
|
+ //要增加的实际库存要减去所有丢失数量
|
|
|
+ $all_loss_num = Db::name('sale_return_child')
|
|
|
+ ->where(['is_del' => 0, 'returnCode' => $info['returnCode']])
|
|
|
+ ->sum('loss_num');
|
|
|
Db::name('good')
|
|
|
->data(['updatetime' => $date])
|
|
|
->where('id', $has_good['id'])
|
|
|
- ->inc('usable_stock', $thnum)
|
|
|
+ ->inc('usable_stock', $thnum - $all_loss_num)
|
|
|
->update();
|
|
|
}
|
|
|
|