|
@@ -2662,8 +2662,9 @@ class ApplyOrderService extends Service
|
|
$result = [];
|
|
$result = [];
|
|
$type = $data['type'];
|
|
$type = $data['type'];
|
|
$for_type = $data['for_type'];
|
|
$for_type = $data['for_type'];
|
|
|
|
+ $process_id = $data['process_id'] ?? 0;
|
|
if ($data['type'] == 1) {
|
|
if ($data['type'] == 1) {
|
|
- $result = $this->typeOne($for_type, $id);
|
|
|
|
|
|
+ $result = $this->typeOne($for_type, $id, $process_id);
|
|
} elseif ($type == 2) {
|
|
} elseif ($type == 2) {
|
|
$result = $this->typeTwo($for_type, $id);
|
|
$result = $this->typeTwo($for_type, $id);
|
|
} elseif ($type == 3) {
|
|
} elseif ($type == 3) {
|
|
@@ -2695,7 +2696,7 @@ class ApplyOrderService extends Service
|
|
return $result;
|
|
return $result;
|
|
}
|
|
}
|
|
|
|
|
|
- private function typeOne($for_type, $id){
|
|
|
|
|
|
+ private function typeOne($for_type, $id, $process_id){
|
|
$result = [];
|
|
$result = [];
|
|
if($for_type == 2){
|
|
if($for_type == 2){
|
|
$result = OrdersProduct::where('del_time',0)
|
|
$result = OrdersProduct::where('del_time',0)
|
|
@@ -2705,11 +2706,17 @@ class ApplyOrderService extends Service
|
|
}elseif ($for_type == 3){
|
|
}elseif ($for_type == 3){
|
|
$result = DispatchSub::where('del_time',0)
|
|
$result = DispatchSub::where('del_time',0)
|
|
->where('sale_orders_product_id', $id)
|
|
->where('sale_orders_product_id', $id)
|
|
|
|
+ ->when(! empty($process_id), function ($query) use ($process_id){
|
|
|
|
+ return $query->where('process_id', $process_id);
|
|
|
|
+ })
|
|
->select('id', 'dispatch_no as order_no')
|
|
->select('id', 'dispatch_no as order_no')
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
}elseif ($for_type == 4){
|
|
}elseif ($for_type == 4){
|
|
$dispatch = DispatchSub::where('del_time',0)
|
|
$dispatch = DispatchSub::where('del_time',0)
|
|
->where('sale_orders_product_id', $id)
|
|
->where('sale_orders_product_id', $id)
|
|
|
|
+ ->when(! empty($process_id), function ($query) use ($process_id){
|
|
|
|
+ return $query->where('process_id', $process_id);
|
|
|
|
+ })
|
|
->select('id')
|
|
->select('id')
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
$detail = ReportWorkingDetail::whereIn('data_id', array_column($dispatch,'id'))
|
|
$detail = ReportWorkingDetail::whereIn('data_id', array_column($dispatch,'id'))
|
|
@@ -2722,6 +2729,9 @@ class ApplyOrderService extends Service
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
}elseif ($for_type == 5){
|
|
}elseif ($for_type == 5){
|
|
$result = DispatchSub::where('del_time',0)
|
|
$result = DispatchSub::where('del_time',0)
|
|
|
|
+ ->when(! empty($process_id), function ($query) use ($process_id){
|
|
|
|
+ return $query->where('process_id', $process_id);
|
|
|
|
+ })
|
|
->where('sale_orders_product_id', $id)
|
|
->where('sale_orders_product_id', $id)
|
|
->where('finished_num','>',0)
|
|
->where('finished_num','>',0)
|
|
->select('id', 'dispatch_no as order_no')
|
|
->select('id', 'dispatch_no as order_no')
|
|
@@ -2744,12 +2754,18 @@ class ApplyOrderService extends Service
|
|
->pluck('id')
|
|
->pluck('id')
|
|
->toArray();
|
|
->toArray();
|
|
$result = ScrappCount::where('del_time',0)
|
|
$result = ScrappCount::where('del_time',0)
|
|
|
|
+ ->when(! empty($process_id), function ($query) use ($process_id){
|
|
|
|
+ return $query->where('process_id', $process_id);
|
|
|
|
+ })
|
|
->where('sale_orders_product_id', $id)
|
|
->where('sale_orders_product_id', $id)
|
|
->whereIn('process_id', $process)
|
|
->whereIn('process_id', $process)
|
|
->select('id', 'order_number as order_no')
|
|
->select('id', 'order_number as order_no')
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
}elseif ($for_type == 8){
|
|
}elseif ($for_type == 8){
|
|
$result = ScrappCount::where('del_time',0)
|
|
$result = ScrappCount::where('del_time',0)
|
|
|
|
+ ->when(! empty($process_id), function ($query) use ($process_id){
|
|
|
|
+ return $query->where('process_id', $process_id);
|
|
|
|
+ })
|
|
->where('sale_orders_product_id', $id)
|
|
->where('sale_orders_product_id', $id)
|
|
->where('scrapp_num','>', 0)
|
|
->where('scrapp_num','>', 0)
|
|
->select('id', 'order_number as order_no')
|
|
->select('id', 'order_number as order_no')
|