diff --git a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php index 842136a64..c75f82e9f 100644 --- a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php +++ b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php @@ -399,7 +399,7 @@ class BeforehandOrderLogic extends BaseLogic } $finds = WarehouseProduct::where('oid', $res['id'])->field('sum(nums) as nums,sum(total_price) as total_price')->find(); WarehouseOrder::where('id', $res['id'])->update(['total_price' => $finds['total_price'], 'nums' => $finds['nums']]); - $order->save(['outbound_id' => $res['id'], 'is_outbound' => 1]); + $order->save(['outbound_id' => $res['id'], 'is_outbound' => 1,'pay_price'=>$finds['total_price']]); Db::commit(); return true; } catch (\Throwable $e) { diff --git a/app/admin/logic/warehouse_product_return/WarehouseProductReturnLogic.php b/app/admin/logic/warehouse_product_return/WarehouseProductReturnLogic.php index 686f18066..dbea9f7c3 100644 --- a/app/admin/logic/warehouse_product_return/WarehouseProductReturnLogic.php +++ b/app/admin/logic/warehouse_product_return/WarehouseProductReturnLogic.php @@ -6,6 +6,7 @@ namespace app\admin\logic\warehouse_product_return; use app\common\model\warehouse_product_return\WarehouseProductReturn; use app\common\logic\BaseLogic; use app\common\model\beforehand_order\BeforehandOrder; +use app\common\model\beforehand_order_cart_info\BeforehandOrderCartInfo; use app\common\model\warehouse_order\WarehouseOrder; use app\common\model\warehouse_product\WarehouseProduct; use app\common\model\warehouse_product_storege\WarehouseProductStorege; @@ -62,12 +63,15 @@ class WarehouseProductReturnLogic extends BaseLogic $total_price=0; if($nums>0){ $total_price=bcmul($nums,$find['price'],2); - } $find->save(['nums'=>$nums,'total_price'=>$total_price]); + $total_price=WarehouseProduct::where('oid',$find['oid'])->sum('total_price'); if($nums>0){ - $total_price=WarehouseProduct::where('oid',$find['oid'])->sum('total_price'); WarehouseOrder::where(['id'=>$find['oid']])->update(['total_price'=>$total_price]); + BeforehandOrder::update(['pay_price'=>$total_price],['id'=>$params['bhoid']]); + }elseif($nums==0){ + WarehouseOrder::where(['id'=>$find['oid']])->update(['total_price'=>$total_price]); + BeforehandOrder::update(['pay_price'=>$total_price],['id'=>$params['bhoid']]); } WarehouseProductStorege::where(['product_id'=>$find['product_id'],'warehouse_id'=>$find['warehouse_id']])->inc('nums',$params['nums'])->update(); }elseif($params['financial_pm']==0 &&$params['return_type']==2){ @@ -80,7 +84,6 @@ class WarehouseProductReturnLogic extends BaseLogic return true; } catch (\Throwable $e) { Db::rollback(); - d($e); throw new BusinessException($e->getMessage()); } }