|
@@ -161,6 +161,7 @@ class ApplyOrderService extends Service
|
|
if(! empty($data['storehouse_title'])) $model->where('storehouse_title', 'LIKE', '%'.$data['storehouse_title'].'%');
|
|
if(! empty($data['storehouse_title'])) $model->where('storehouse_title', 'LIKE', '%'.$data['storehouse_title'].'%');
|
|
if(! empty($data['order_number'])) $model->where('order_number', 'LIKE', '%'.$data['order_number'].'%');
|
|
if(! empty($data['order_number'])) $model->where('order_number', 'LIKE', '%'.$data['order_number'].'%');
|
|
if(! empty($data['apply_id'])) $model->where('apply_id', $data['apply_id']);
|
|
if(! empty($data['apply_id'])) $model->where('apply_id', $data['apply_id']);
|
|
|
|
+ if(! empty($data['id'])) $model->where('id', $data['id']);
|
|
if(! empty($data['crt_id'])) $model->where('crt_id', $data['crt_id']);
|
|
if(! empty($data['crt_id'])) $model->where('crt_id', $data['crt_id']);
|
|
if(! empty($data['apply_time'][0]) && ! empty($data['apply_time'][1])) $model->whereBetween('apply_time',[$data['apply_time'][0],$data['apply_time'][1]]);
|
|
if(! empty($data['apply_time'][0]) && ! empty($data['apply_time'][1])) $model->whereBetween('apply_time',[$data['apply_time'][0],$data['apply_time'][1]]);
|
|
if(! empty($data['crt_time'][0]) && ! empty($data['crt_time'][1])) $model->whereBetween('crt_time',[$data['crt_time'][0],$data['crt_time'][1]]);
|
|
if(! empty($data['crt_time'][0]) && ! empty($data['crt_time'][1])) $model->whereBetween('crt_time',[$data['crt_time'][0],$data['crt_time'][1]]);
|
|
@@ -1159,6 +1160,7 @@ class ApplyOrderService extends Service
|
|
->select('id','order_number','apply_time','mark','status','storehouse_title')
|
|
->select('id','order_number','apply_time','mark','status','storehouse_title')
|
|
->orderBy('id','desc');
|
|
->orderBy('id','desc');
|
|
if(isset($data['status'])) $model->where('status', $data['status']);
|
|
if(isset($data['status'])) $model->where('status', $data['status']);
|
|
|
|
+ if(!empty($data['id'])) $model->where('id', $data['id']);
|
|
if(! empty($data['crt_time'][0]) && ! empty($data['crt_time'][1])){
|
|
if(! empty($data['crt_time'][0]) && ! empty($data['crt_time'][1])){
|
|
$model->where('crt_time',">=",$data['crt_time'][0]);
|
|
$model->where('crt_time',">=",$data['crt_time'][0]);
|
|
$model->where('crt_time',"<=",$data['crt_time'][1]);
|
|
$model->where('crt_time',"<=",$data['crt_time'][1]);
|
|
@@ -2453,15 +2455,15 @@ class ApplyOrderService extends Service
|
|
} elseif ($type == 8) {
|
|
} elseif ($type == 8) {
|
|
$result = $this->typeEight($for_type, $id);
|
|
$result = $this->typeEight($for_type, $id);
|
|
} elseif ($type == 9) {
|
|
} elseif ($type == 9) {
|
|
-
|
|
|
|
|
|
+ $result = $this->typeNine($for_type, $id);
|
|
} elseif ($type == 10) {
|
|
} elseif ($type == 10) {
|
|
-
|
|
|
|
|
|
+ $result = $this->typeTen($for_type, $id);
|
|
} elseif ($type == 11) {
|
|
} elseif ($type == 11) {
|
|
-
|
|
|
|
|
|
+ $result = $this->typeEve($for_type, $id);
|
|
} elseif ($type == 12) {
|
|
} elseif ($type == 12) {
|
|
-
|
|
|
|
|
|
+ $result = $this->typeTwl($for_type, $id);
|
|
} elseif ($type == 13) {
|
|
} elseif ($type == 13) {
|
|
-
|
|
|
|
|
|
+ $result = $this->typeThi($for_type, $id);
|
|
}
|
|
}
|
|
|
|
|
|
return $result;
|
|
return $result;
|
|
@@ -2620,7 +2622,7 @@ class ApplyOrderService extends Service
|
|
->toArray();
|
|
->toArray();
|
|
$result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
|
|
$result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
|
|
->where('del_time',0)
|
|
->where('del_time',0)
|
|
- ->select('id','out_order_no as order')
|
|
|
|
|
|
+ ->select('id','out_order_no as order_no')
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
}elseif ($for_type == 3){
|
|
}elseif ($for_type == 3){
|
|
$result = DispatchSub::where('del_time',0)
|
|
$result = DispatchSub::where('del_time',0)
|
|
@@ -2772,7 +2774,7 @@ class ApplyOrderService extends Service
|
|
->toArray();
|
|
->toArray();
|
|
$result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
|
|
$result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
|
|
->where('del_time',0)
|
|
->where('del_time',0)
|
|
- ->select('id','out_order_no as order')
|
|
|
|
|
|
+ ->select('id','out_order_no as order_no')
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
}elseif ($for_type == 2){
|
|
}elseif ($for_type == 2){
|
|
$order_product_id = DispatchSub::where('del_time',0)
|
|
$order_product_id = DispatchSub::where('del_time',0)
|
|
@@ -2924,7 +2926,7 @@ class ApplyOrderService extends Service
|
|
->toArray();
|
|
->toArray();
|
|
$result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
|
|
$result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
|
|
->where('del_time',0)
|
|
->where('del_time',0)
|
|
- ->select('id','out_order_no as order')
|
|
|
|
|
|
+ ->select('id','out_order_no as order_no')
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
}elseif ($for_type == 2){
|
|
}elseif ($for_type == 2){
|
|
$dispatch_id = ReportWorkingDetail::where('report_working_id', $id)
|
|
$dispatch_id = ReportWorkingDetail::where('report_working_id', $id)
|
|
@@ -3106,7 +3108,7 @@ class ApplyOrderService extends Service
|
|
->toArray();
|
|
->toArray();
|
|
$result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
|
|
$result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
|
|
->where('del_time',0)
|
|
->where('del_time',0)
|
|
- ->select('id','out_order_no as order')
|
|
|
|
|
|
+ ->select('id','out_order_no as order_no')
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
}elseif ($for_type == 2){
|
|
}elseif ($for_type == 2){
|
|
$order_product_id = DispatchSub::where('del_time',0)
|
|
$order_product_id = DispatchSub::where('del_time',0)
|
|
@@ -3246,7 +3248,7 @@ class ApplyOrderService extends Service
|
|
|
|
|
|
private function typeSix($for_type, $id){
|
|
private function typeSix($for_type, $id){
|
|
$result = [];
|
|
$result = [];
|
|
- $box = Box::where('id', $id)->select('top_order_no')->first();
|
|
|
|
|
|
+ $box = Box::where('id', $id)->first();
|
|
if(empty($box)) return $result;
|
|
if(empty($box)) return $result;
|
|
$top_order_no = $box->top_order_no;
|
|
$top_order_no = $box->top_order_no;
|
|
$order_no = $box->order_no;
|
|
$order_no = $box->order_no;
|
|
@@ -3259,7 +3261,7 @@ class ApplyOrderService extends Service
|
|
->toArray();
|
|
->toArray();
|
|
$result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
|
|
$result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
|
|
->where('del_time',0)
|
|
->where('del_time',0)
|
|
- ->select('id','out_order_no as order')
|
|
|
|
|
|
+ ->select('id','out_order_no as order_no')
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
}elseif ($for_type == 2){
|
|
}elseif ($for_type == 2){
|
|
$box_detail = new BoxDetail(['channel'=> $top_order_no]);
|
|
$box_detail = new BoxDetail(['channel'=> $top_order_no]);
|
|
@@ -3440,7 +3442,7 @@ class ApplyOrderService extends Service
|
|
->toArray();
|
|
->toArray();
|
|
$result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
|
|
$result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
|
|
->where('del_time',0)
|
|
->where('del_time',0)
|
|
- ->select('id','out_order_no as order')
|
|
|
|
|
|
+ ->select('id','out_order_no as order_no')
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
}elseif ($for_type == 2){
|
|
}elseif ($for_type == 2){
|
|
$order_product_id = ScrappCount::where('del_time',0)
|
|
$order_product_id = ScrappCount::where('del_time',0)
|
|
@@ -3461,16 +3463,12 @@ class ApplyOrderService extends Service
|
|
->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_id = ScrappCount::where('del_time',0)
|
|
|
|
|
|
+ $report_id = ScrappCount::where('del_time',0)
|
|
->where('id', $id)
|
|
->where('id', $id)
|
|
- ->pluck('dispatch_sub_id')
|
|
|
|
|
|
+ ->pluck('report_id')
|
|
->toArray();
|
|
->toArray();
|
|
- $detail = ReportWorkingDetail::whereIn('data_id', $dispatch_id)
|
|
|
|
- ->where('del_time',0)
|
|
|
|
- ->select('report_working_id')
|
|
|
|
- ->get()->toArray();
|
|
|
|
$result = ReportWorking::where('del_time',0)
|
|
$result = ReportWorking::where('del_time',0)
|
|
- ->whereIn('id', array_unique(array_column($detail,'report_working_id')))
|
|
|
|
|
|
+ ->whereIn('id', $report_id)
|
|
->select('id', 'order_number as order_no')
|
|
->select('id', 'order_number as order_no')
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
}elseif ($for_type == 5){
|
|
}elseif ($for_type == 5){
|
|
@@ -3608,7 +3606,7 @@ class ApplyOrderService extends Service
|
|
->toArray();
|
|
->toArray();
|
|
$result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
|
|
$result = SaleOrdersProduct::whereIn('id', $sale_orders_product_id)
|
|
->where('del_time',0)
|
|
->where('del_time',0)
|
|
- ->select('id','out_order_no as order')
|
|
|
|
|
|
+ ->select('id','out_order_no as order_no')
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
}elseif ($for_type == 2){
|
|
}elseif ($for_type == 2){
|
|
$order_product_id = ScrappCount::where('del_time',0)
|
|
$order_product_id = ScrappCount::where('del_time',0)
|
|
@@ -3629,16 +3627,12 @@ class ApplyOrderService extends Service
|
|
->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_id = ScrappCount::where('del_time',0)
|
|
|
|
|
|
+ $report_id = ScrappCount::where('del_time',0)
|
|
->where('id', $id)
|
|
->where('id', $id)
|
|
- ->pluck('dispatch_sub_id')
|
|
|
|
|
|
+ ->pluck('report_id')
|
|
->toArray();
|
|
->toArray();
|
|
- $detail = ReportWorkingDetail::whereIn('data_id', $dispatch_id)
|
|
|
|
- ->where('del_time',0)
|
|
|
|
- ->select('report_working_id')
|
|
|
|
- ->get()->toArray();
|
|
|
|
$result = ReportWorking::where('del_time',0)
|
|
$result = ReportWorking::where('del_time',0)
|
|
- ->whereIn('id', array_unique(array_column($detail,'report_working_id')))
|
|
|
|
|
|
+ ->whereIn('id', $report_id)
|
|
->select('id', 'order_number as order_no')
|
|
->select('id', 'order_number as order_no')
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
}elseif ($for_type == 5){
|
|
}elseif ($for_type == 5){
|
|
@@ -3766,6 +3760,81 @@ class ApplyOrderService extends Service
|
|
return $result;
|
|
return $result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private function typeNine($for_type, $id){
|
|
|
|
+ $data_id = ApplyOrderDetail::where('del_time', 0)
|
|
|
|
+ ->where('apply_order_id', $id)
|
|
|
|
+ ->where('type', ApplyOrder::type_one)
|
|
|
|
+ ->pluck('data_id')
|
|
|
|
+ ->toArray();
|
|
|
|
+ $result = DispatchSub::where('del_time',0)
|
|
|
|
+ ->whereIn('id', $data_id)
|
|
|
|
+ ->select('id', 'dispatch_no as order_no')
|
|
|
|
+ ->get()->toArray();
|
|
|
|
+
|
|
|
|
+ return $result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private function typeTen($for_type, $id){
|
|
|
|
+ $data_id = ApplyOrderDetail::where('del_time', 0)
|
|
|
|
+ ->where('apply_order_id', $id)
|
|
|
|
+ ->where('type', ApplyOrder::type_two)
|
|
|
|
+ ->pluck('data_id')
|
|
|
|
+ ->toArray();
|
|
|
|
+ $detail = ReportWorkingDetail::whereIn('data_id', $data_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();
|
|
|
|
+
|
|
|
|
+ $result[] = $return[0];
|
|
|
|
+ return $result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private function typeEve($for_type, $id){
|
|
|
|
+ $detail = ApplyOrderDetail::where('del_time', 0)
|
|
|
|
+ ->where('apply_order_id', $id)
|
|
|
|
+ ->where('type', ApplyOrder::type_four)
|
|
|
|
+ ->select('data_id as box_id')
|
|
|
|
+ ->get()->toArray();
|
|
|
|
+ $result = Box::where('del_time', 0)
|
|
|
|
+ ->whereIn('id', array_unique(array_column($detail, 'box_id')))
|
|
|
|
+ ->select("id", 'order_no')
|
|
|
|
+ ->get()->toArray();
|
|
|
|
+
|
|
|
|
+ return $result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private function typeTwl($for_type, $id){
|
|
|
|
+ $detail = ApplyOrderDetail::where('del_time', 0)
|
|
|
|
+ ->where('apply_order_id', $id)
|
|
|
|
+ ->where('type', ApplyOrder::type_three)
|
|
|
|
+ ->select('data_id as box_id')
|
|
|
|
+ ->get()->toArray();
|
|
|
|
+ $result = Box::where('del_time', 0)
|
|
|
|
+ ->whereIn('id', array_unique(array_column($detail, 'box_id')))
|
|
|
|
+ ->select("id", 'order_no')
|
|
|
|
+ ->get()->toArray();
|
|
|
|
+
|
|
|
|
+ return $result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private function typeThi($for_type, $id){
|
|
|
|
+ $detail = ApplyOrderDetail::where('del_time', 0)
|
|
|
|
+ ->where('apply_order_id', $id)
|
|
|
|
+ ->where('type', ApplyOrder::type_five)
|
|
|
|
+ ->select('data_id as zj_id')
|
|
|
|
+ ->get()->toArray();
|
|
|
|
+ $result = ScrappCount::where('del_time', 0)
|
|
|
|
+ ->whereIn('id', array_unique(array_column($detail, 'zj_id')))
|
|
|
|
+ ->select('id','order_number as order_no')
|
|
|
|
+ ->get()->toArray();
|
|
|
|
+
|
|
|
|
+ return $result;
|
|
|
|
+ }
|
|
|
|
+
|
|
public function reportList($data){
|
|
public function reportList($data){
|
|
$model = ReportMessage::where('del_time',0)
|
|
$model = ReportMessage::where('del_time',0)
|
|
->select('id','order_id','opt_case','quantity','crt_time','user_id','is_use')
|
|
->select('id','order_id','opt_case','quantity','crt_time','user_id','is_use')
|