createExceptionPaginate($request->paginate ?? 50); return view('weight.weightExcepted.index',['weightExcepteds'=>$weightExcepteds,'view'=>'indexCreate']); } public function indexIssued(Request $request) { if(!Gate::allows('称重管理-查看异常')){ return redirect(url('/')); } $weightExcepteds=app('OrderPackageService')->issueExceptionPaginate($request->paginate ?? 50); return view('weight.weightExcepted.index',['weightExcepteds'=>$weightExcepteds,'view'=>'indexIssued']); } public function export($type ,Request $request){ if(!Gate::allows('称重管理-查看异常')){ return redirect(url('/')); } $e = new Export(); $e->setMysqlConnection(config('database.connections.mysql.host'), config('database.connections.mysql.port'),config('database.connections.mysql.database') ,config('database.connections.mysql.username'),config('database.connections.mysql.password')); if ($type == 'indexIssued'){ $e->setFileName("称重异常记录单"); if ($request->checkAllSign){ $params = $request->input(); unset($params['checkAllSign']); $sql = app('WeighExceptedService')->getIssuedExceptionSql($params); }else $sql=app('WeighExceptedService')->getIssuedExceptionSql(['id'=>$request->data]); $mapping = [ "logistic_number"=>"快递单号","logistic_name"=>"承运商", "measuring_machine_name"=>"设备","weigh_time"=>"称重时间", "weight"=>"重(KG)","length"=>"长(CM)", "width"=>"宽(CM)","height"=>"高(CM)","bulk"=>"体积(CM³)", "paper_box_name"=>"纸箱","status"=>"异常类型" ]; }else{ $e->setFileName("下发异常记录单"); if ($request->checkAllSign){ $params = $request->input(); unset($params['checkAllSign']); $sql = app('WeighExceptedService')->getCreateExceptionSql($params); }else $sql=app('WeighExceptedService')->getCreateExceptionSql(['id'=>$request->data]); $mapping = [ "logistic_number"=>"快递单号","created_at"=>"下发时间", "delivery_number"=>"发货单号","batch_number"=>"波次号", "batch_rule"=>"波次规则","recipient"=>"收件人", "recipient_mobile"=>"收件人电话","logistic_name"=>"承运商","status"=>"异常类型" ]; } return $e->sql($sql,$mapping)->direct(); } }