修改报损出库

This commit is contained in:
lewis 2025-03-26 14:00:16 +08:00
parent 9e51c0963b
commit 5d74bf2f41
2 changed files with 4 additions and 3 deletions

View File

@ -106,6 +106,7 @@ class WarehouseOrderController extends BaseAdminController
'admin_id' => $this->adminId, 'admin_id' => $this->adminId,
'type' => $type, 'type' => $type,
'order_type' => 0, 'order_type' => 0,
'code' => $code,
]; ];
$storeProduct = StoreProduct::where('id', $arr['id'])->find(); $storeProduct = StoreProduct::where('id', $arr['id'])->find();
$data['total_price'] = bcmul($arr['stock'], $storeProduct['purchase'], 2); $data['total_price'] = bcmul($arr['stock'], $storeProduct['purchase'], 2);

View File

@ -55,7 +55,7 @@ class WarehouseProductLogic extends BaseLogic
$total_price = bcmul($after_nums, $storeProduct['purchase'], 2); $total_price = bcmul($after_nums, $storeProduct['purchase'], 2);
} }
WarehouseProductStorege::update(['nums' => $after_nums, 'total_price' => $total_price], ['id' => $storege['id']]); WarehouseProductStorege::update(['nums' => $after_nums, 'total_price' => $total_price], ['id' => $storege['id']]);
SqlChannelLog('WarehouseProductStorege', $storege['id'], $after_nums, 1, Request()->url(),$admin_id); SqlChannelLog('WarehouseProductStorege', $storege['id'], $params['nums'], 1, Request()->url(),$admin_id);
} }
} else { } else {
@ -149,7 +149,7 @@ class WarehouseProductLogic extends BaseLogic
$after_nums = bcsub($storege['nums'], $params['nums']); $after_nums = bcsub($storege['nums'], $params['nums']);
$total_price = bcmul($after_nums, $params['purchase'], 2); $total_price = bcmul($after_nums, $params['purchase'], 2);
WarehouseProductStorege::update(['nums' => bcsub($storege['nums'], $params['nums']), 'total_price' => $total_price], ['id' => $storege['id']]); WarehouseProductStorege::update(['nums' => bcsub($storege['nums'], $params['nums']), 'total_price' => $total_price], ['id' => $storege['id']]);
SqlChannelLog('WarehouseProductStorege', $storege['id'], bcsub($storege['nums'], $params['nums']), -1, Request()->url(),$admin_id); SqlChannelLog('WarehouseProductStorege', $storege['id'], $params['nums'], -1, Request()->url(),$admin_id);
} else { } else {
$data = [ $data = [
'warehouse_id' => $params['warehouse_id'], 'warehouse_id' => $params['warehouse_id'],
@ -158,7 +158,7 @@ class WarehouseProductLogic extends BaseLogic
'total_price' => 0 'total_price' => 0
]; ];
$storege = WarehouseProductStorege::create($data); $storege = WarehouseProductStorege::create($data);
SqlChannelLog('WarehouseProductStorege', $storege->id, -$params['nums'], -1, Request()->url(),$admin_id); SqlChannelLog('WarehouseProductStorege', $storege->id, $params['nums'], -1, Request()->url(),$admin_id);
} }
} else { } else {
$storege['nums'] = 0; $storege['nums'] = 0;