Merge pull request 'feat: 修改仓库产品逻辑以优化代码结构' (#116) from dev into main
Reviewed-on: #116
This commit is contained in:
commit
c20dbe164a
@ -123,21 +123,13 @@ class WarehouseProductLogic extends BaseLogic
|
|||||||
$find->save();
|
$find->save();
|
||||||
|
|
||||||
$storege = WarehouseProductStorege::where('warehouse_id', $find['warehouse_id'])->where('product_id', $find['product_id'])->find();
|
$storege = WarehouseProductStorege::where('warehouse_id', $find['warehouse_id'])->where('product_id', $find['product_id'])->find();
|
||||||
// if ($financial_pm == 0) {
|
|
||||||
// StoreProduct::where('id', $find['product_id'])->dec('stock', $find['nums'])->update();
|
|
||||||
// } else {
|
|
||||||
// StoreProduct::where('id', $find['product_id'])->inc('stock', $find['nums'])->update(['purchase' => $find['purchase'], 'cost' => $find['cost'], 'price' => $find['price']]);
|
|
||||||
// StoreBranchProduct::where('product_id', $find['product_id'])->update(['purchase' => $find['purchase'], 'cost' => $find['cost'], 'price' => $find['price']]);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if ($storege) {
|
if ($storege) {
|
||||||
if ($financial_pm == 0) {
|
if ($financial_pm == 0) {
|
||||||
$storege->nums = bcsub($storege->nums, $find['nums']);
|
WarehouseProductStorege::where('id',$storege['id'])->dec('nums', $find['nums'])->update();
|
||||||
} else {
|
} else {
|
||||||
|
WarehouseProductStorege::where('id',$storege['id'])->inc('nums', $find['nums'])->update();
|
||||||
$storege->nums = bcadd($storege->nums, $find['nums']);
|
|
||||||
}
|
}
|
||||||
$storege->save();
|
|
||||||
} else {
|
} else {
|
||||||
WarehouseProductStorege::create([
|
WarehouseProductStorege::create([
|
||||||
'warehouse_id' => $find['warehouse_id'],
|
'warehouse_id' => $find['warehouse_id'],
|
||||||
@ -177,7 +169,6 @@ class WarehouseProductLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user