|
@@ -2728,13 +2728,20 @@ class ApplyOrderService extends Service
|
|
|
->select('id', 'order_number as order_no')
|
|
|
->get()->toArray();
|
|
|
}elseif ($for_type == 5){
|
|
|
- $result = DispatchSub::where('del_time',0)
|
|
|
+ $dispatch = DispatchSub::where('del_time',0)
|
|
|
+ ->where('sale_orders_product_id', $id)
|
|
|
->when(! empty($process_id), function ($query) use ($process_id){
|
|
|
return $query->where('process_id', $process_id);
|
|
|
})
|
|
|
- ->where('sale_orders_product_id', $id)
|
|
|
- ->where('finished_num','>',0)
|
|
|
- ->select('id', 'dispatch_no as order_no')
|
|
|
+ ->select('id')
|
|
|
+ ->get()->toArray();
|
|
|
+ $detail = ReportWorkingDetail::whereIn('data_id', array_column($dispatch,'id'))
|
|
|
+ ->where('del_time',0)
|
|
|
+ ->select('report_working_id')
|
|
|
+ ->get()->toArray();
|
|
|
+ $result = ReportWorking::where('del_time',0)
|
|
|
+ ->whereIn('id', array_unique(array_column($detail,'report_working_id')))
|
|
|
+ ->select('id', 'order_number as order_no')
|
|
|
->get()->toArray();
|
|
|
}elseif ($for_type == 6){
|
|
|
$sale = SaleOrdersProduct::where('id', $id)->select('order_no')->get()->toArray();
|
|
@@ -2912,10 +2919,17 @@ class ApplyOrderService extends Service
|
|
|
->select('id', 'order_number as order_no')
|
|
|
->get()->toArray();
|
|
|
}elseif ($for_type == 5){
|
|
|
- $result = DispatchSub::where('del_time',0)
|
|
|
+ $dispatch = DispatchSub::where('del_time',0)
|
|
|
->where('order_product_id', $id)
|
|
|
- ->where('finished_num','>',0)
|
|
|
- ->select('id', 'dispatch_no as order_no')
|
|
|
+ ->select('id')
|
|
|
+ ->get()->toArray();
|
|
|
+ $detail = ReportWorkingDetail::whereIn('data_id', array_column($dispatch,'id'))
|
|
|
+ ->where('del_time',0)
|
|
|
+ ->select('report_working_id')
|
|
|
+ ->get()->toArray();
|
|
|
+ $result = ReportWorking::where('del_time',0)
|
|
|
+ ->whereIn('id', array_unique(array_column($detail,'report_working_id')))
|
|
|
+ ->select('id', 'order_number as order_no')
|
|
|
->get()->toArray();
|
|
|
}elseif ($for_type == 6){
|
|
|
$sale_orders_product_id = OrdersProduct::where('del_time',0)
|
|
@@ -3095,10 +3109,17 @@ class ApplyOrderService extends Service
|
|
|
->select('id', 'order_number as order_no')
|
|
|
->get()->toArray();
|
|
|
}elseif ($for_type == 5){
|
|
|
- $result = DispatchSub::where('del_time',0)
|
|
|
+ $dispatch = DispatchSub::where('del_time',0)
|
|
|
->where('id', $id)
|
|
|
- ->where('finished_num','>',0)
|
|
|
- ->select('id', 'dispatch_no as order_no')
|
|
|
+ ->select('id')
|
|
|
+ ->get()->toArray();
|
|
|
+ $detail = ReportWorkingDetail::whereIn('data_id', array_column($dispatch,'id'))
|
|
|
+ ->where('del_time',0)
|
|
|
+ ->select('report_working_id')
|
|
|
+ ->get()->toArray();
|
|
|
+ $result = ReportWorking::where('del_time',0)
|
|
|
+ ->whereIn('id', array_unique(array_column($detail,'report_working_id')))
|
|
|
+ ->select('id', 'order_number as order_no')
|
|
|
->get()->toArray();
|
|
|
}elseif ($for_type == 6){
|
|
|
$sale_orders_product_id = DispatchSub::where('del_time',0)
|
|
@@ -3311,10 +3332,9 @@ class ApplyOrderService extends Service
|
|
|
->where('del_time',0)
|
|
|
->pluck('data_id')
|
|
|
->toArray();
|
|
|
- $result = DispatchSub::where('del_time',0)
|
|
|
+ $result = ReportWorking::where('del_time',0)
|
|
|
->whereIn('id', $dispatch_id)
|
|
|
- ->where('finished_num','>',0)
|
|
|
- ->select('id', 'dispatch_no as order_no')
|
|
|
+ ->select('id', 'order_number as order_no')
|
|
|
->get()->toArray();
|
|
|
}elseif ($for_type == 6){
|
|
|
$dispatch_id = ReportWorkingDetail::where('report_working_id', $id)
|
|
@@ -3774,10 +3794,16 @@ class ApplyOrderService extends Service
|
|
|
->where('box_id', $id)
|
|
|
->pluck('dispatch_id')
|
|
|
->toArray();
|
|
|
- $result = DispatchSub::where('del_time',0)
|
|
|
- ->whereIn('id', $dispatch_id)
|
|
|
- ->select('id', 'dispatch_no as order_no')
|
|
|
+ $detail = ReportWorkingDetail::whereIn('data_id', $dispatch_id)
|
|
|
+ ->where('del_time',0)
|
|
|
+ ->select('report_working_id')
|
|
|
+ ->get()->toArray();
|
|
|
+ $return = ReportWorking::where('del_time',0)
|
|
|
+ ->whereIn('id', array_unique(array_column($detail,'report_working_id')))
|
|
|
+ ->select('id', 'order_number as order_no')
|
|
|
->get()->toArray();
|
|
|
+ $t = $return[0] ?? [];
|
|
|
+ if(! empty($t)) $result[] = $t;
|
|
|
}elseif ($for_type == 7){
|
|
|
$process = Process::where('del_time',0)
|
|
|
->where('is_need_remain',1)
|
|
@@ -4034,14 +4060,13 @@ class ApplyOrderService extends Service
|
|
|
->select('id', 'order_number as order_no')
|
|
|
->get()->toArray();
|
|
|
}elseif ($for_type == 5){
|
|
|
- $dispatch_id = ScrappCount::where('del_time',0)
|
|
|
+ $report_id = ScrappCount::where('del_time',0)
|
|
|
->where('id', $id)
|
|
|
- ->pluck('dispatch_sub_id')
|
|
|
+ ->pluck('report_id')
|
|
|
->toArray();
|
|
|
- $result = DispatchSub::where('del_time',0)
|
|
|
- ->where('id', $dispatch_id)
|
|
|
- ->where('finished_num','>',0)
|
|
|
- ->select('id', 'dispatch_no as order_no')
|
|
|
+ $result = ReportWorking::where('del_time',0)
|
|
|
+ ->whereIn('id', $report_id)
|
|
|
+ ->select('id', 'order_number as order_no')
|
|
|
->get()->toArray();
|
|
|
}elseif ($for_type == 6){
|
|
|
$sale_orders_product_id = ScrappCount::where('del_time',0)
|
|
@@ -4264,14 +4289,13 @@ class ApplyOrderService extends Service
|
|
|
->select('id', 'order_number as order_no')
|
|
|
->get()->toArray();
|
|
|
}elseif ($for_type == 5){
|
|
|
- $dispatch_id = ScrappCount::where('del_time',0)
|
|
|
+ $report_id = ScrappCount::where('del_time',0)
|
|
|
->where('id', $id)
|
|
|
- ->pluck('dispatch_sub_id')
|
|
|
+ ->pluck('report_id')
|
|
|
->toArray();
|
|
|
- $result = DispatchSub::where('del_time',0)
|
|
|
- ->where('id', $dispatch_id)
|
|
|
- ->where('finished_num','>',0)
|
|
|
- ->select('id', 'dispatch_no as order_no')
|
|
|
+ $result = ReportWorking::where('del_time',0)
|
|
|
+ ->whereIn('id', $report_id)
|
|
|
+ ->select('id', 'order_number as order_no')
|
|
|
->get()->toArray();
|
|
|
}elseif ($for_type == 6){
|
|
|
$sale_orders_product_id = ScrappCount::where('del_time',0)
|