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