getIntersectPermitting(); $inventoryCompares=app('InventoryCompareService')->getInventoryCompare($request->all()); $param = $request->input(); return view('inventory.statement.inventoryCompare',compact('owners','inventoryCompares','param')); } function importExcel(Request $request){ if (!Gate::allows('库存管理-库存-库存对比')){return redirect(url('/')); } // $owner_id=$request->owner_id; // if(!$owner_id) return '
您还未选择相应货主!
'; $fileSuffix = $request->file()['file']->getClientOriginalExtension(); if (in_array($fileSuffix, ['xlsx', 'xlsm', 'xltx', 'xltm', 'xls', 'xlt', 'ods', 'ots', 'slk', 'xml', 'gnumeric', 'htm', 'html', 'csv', 'tsv'])) { ini_set('max_execution_time', 2100); ini_set('memory_limit', '512M'); $extension = $request->file()['file']->getClientOriginalExtension(); $extension[0] = strtoupper($extension[0]); Excel::import(new InventoryCompareImport(), $request->file('file')->path(), null, $extension); if (Cache::has('error')) { return '' . Cache::pull('error') . '
'; } else { $exception = Cache::get('exception'); // if ($exception){ $a = ''; for ($i = 0; $i < count($exception); $i++) { $a .= implode(',', $exception[$i]) . ' '; }; app('LogService')->log(__METHOD__, __FUNCTION__, json_encode($request->toArray()), Auth::user()['id']); return '不支持该文件类型
'; } } public function exportInventoryCompare(Request $request){ if (!Gate::allows('库存管理-库存-库存对比')){return redirect(url('/')); } if ($request->checkAllSign){ $params = $request->input(); unset($params['checkAllSign']); $sql=app('InventoryCompareService')->getSql($params); }else{ $sql=app('InventoryCompareService')->getSql(['id'=>$request->data]); } $post = Http::post(config('go.export.url'),['type'=>'inventoryCompare','sql'=>$sql]); if ($post->status() == 500){ throw new Exception($post->header("Msg")); } return response($post,200, [ "Content-type"=>"application/octet-stream", "Content-Disposition"=>"attachment; filename=库存对比记录-".date('ymdHis').'.xlsx', ]); } }