cqp hai 3 meses
pai
achega
932ec36611
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      app/Service/PurchaseOrderService.php

+ 4 - 1
app/Service/PurchaseOrderService.php

@@ -851,7 +851,8 @@ class PurchaseOrderService extends Service
             ->whereIn('purchase_order_id',$purchase_id)
             ->whereIn('product_id',$product)
 //            ->whereColumn('number','>','outbound_number')
-            ->select('id','number','price','purchase_order_id','order_number','product_id')
+            ->select('id',DB::raw('sum(number) as number'),'price','purchase_order_id','order_number','product_id')
+            ->groupby('product_id','purchase_order_id')
             ->orderBy('id','asc')
             ->get()->toArray();
 //        $map = (new ProductService())->getProductDetail(array_column($purchase_product,'product_id'));
@@ -861,6 +862,7 @@ class PurchaseOrderService extends Service
             ->whereIn('purchase_order_id',array_unique(array_column($purchase_product,'purchase_order_id')))
             ->where('type',PurchaseOrderInfoForOutBound::type_one)
             ->where('from_order_type',PurchaseOrderInfoForOutBound::from_type_zero)
+            ->whereIn('product_id',$product)
             ->select('purchase_order_id','product_id','number','return_number')
             ->get()->toArray();
         $purchase_product_outbound_map = [];
@@ -892,6 +894,7 @@ class PurchaseOrderService extends Service
         $sub = ReturnExchangeOrderProductInfo::where('return_or_exchange',ReturnExchangeOrderProductInfo::type_one)
             ->where('del_time',0)
             ->whereIn('return_exchange_id',$return_id)
+            ->whereIn('product_id',$product)
             ->get()->toArray();
         foreach ($sub as $value){
             if(isset($return_map[$value['return_exchange_id']])){