feat: 修改仓库逻辑以优化库存产品价格计算
This commit is contained in:
parent
e3b6bb9831
commit
d85c837a9b
@ -234,7 +234,6 @@ class WarehouseLogic extends BaseLogic
|
||||
}
|
||||
|
||||
public static function stockProductPrice($parmas){
|
||||
|
||||
$arr1=WarehouseProductStorege::where('nums','>',0)->select();
|
||||
foreach ($arr1 as $k=>$v){
|
||||
$find=StoreProduct::where('id',$v['product_id'])->find();
|
||||
@ -262,7 +261,7 @@ class WarehouseLogic extends BaseLogic
|
||||
foreach ($arr3 as $k=>$v){
|
||||
StoreProduct::where('id',$v['product_id'])->update(['stock'=>$v['nums']]);
|
||||
}
|
||||
$arr4=StoreBranchProduct::where('stock','>',0)->field('product_id,sum(stock) as stock')->select();
|
||||
$arr4=StoreBranchProduct::where('stock','>',0)->field('product_id,sum(stock) as stock')->group('product_id')->order('stock desc')->select();
|
||||
foreach ($arr4 as $k=>$v){
|
||||
$find=StoreProduct::where('id',$v['product_id'])->find();
|
||||
if($find){
|
||||
|
Loading…
x
Reference in New Issue
Block a user