input('paginate'); $weightExcepteds=Package::query()->select('id','status','logistic_number','logistic_id','measuring_machine_id','weighed_at','weight','length','width','height','bulk','paper_box_id')-> where('status','上传异常')->orWhere('status','测量异常')->orderBy('created_at','DESC'); if ($paginate){ $weightExcepteds=$weightExcepteds->paginate($paginate); }else{ $weightExcepteds=$weightExcepteds->paginate(50); }; return view('weight.weightExcepted.index',['weightExcepteds'=>$weightExcepteds,'view'=>'indexCreate']); } public function indexIssued(Request $request) { if(!Gate::allows('称重管理-查看异常')){ return redirect(url('/')); } $paginate=$request->input('paginate'); $weightExcepteds=Package::query()->select('id','owner_id','logistic_number','created_at','delivery_number','batch_number','batch_rule','recipient','recipient_mobile','logistic_id')-> where('status','下发异常')->orWhere('status','记录异常')->orWhere('status','已上传异常')->orderBy('created_at','DESC'); if ($paginate){ $weightExcepteds=$weightExcepteds->paginate($paginate); }else{ $weightExcepteds=$weightExcepteds->paginate(50); }; return view('weight.weightExcepted.index',['weightExcepteds'=>$weightExcepteds,'view'=>'indexIssued']); } public function export($type ,Request $request){ if(!Gate::allows('称重管理-查看异常')){ return redirect(url('/')); } if ($type == 'indexIssued'){ if ($request->checkAllSign){ $params = $request->input(); unset($params['checkAllSign']); $sql = app('weighExceptedService')->getIssuedExceptionSql($params); }else $sql=app('weighExceptedService')->getIssuedExceptionSql(['id'=>$request->data]); return response(Http::post(config('go.export.url'),['type'=>'packageIssuedException','sql'=>$sql]),200, [ "Content-type"=>"application/octet-stream", "Content-Disposition"=>"attachment; filename=下发异常记录-".date('ymdHis').'.xlsx', ]); }else{ if ($request->checkAllSign){ $params = $request->input(); unset($params['checkAllSign']); $sql = app('weighExceptedService')->getCreateExceptionSql($params); }else $sql=app('weighExceptedService')->getCreateExceptionSql(['id'=>$request->data]); return response(Http::post(config('go.export.url'),['type'=>'packageCreateException','sql'=>$sql]),200, [ "Content-type"=>"application/octet-stream", "Content-Disposition"=>"attachment; filename=录入异常记录-".date('ymdHis').'.xlsx', ]); } } }