Commit 0c3c6e1e by 杨树贤

导出供应商

parent a25e54ac
......@@ -38,7 +38,7 @@ class SetSupplierFollowUp extends Command
// $service->importSupplierGroup(true);
// $service->changeSupplierType();
// $service->generateYunxinAccount(true);
$service->exportSupplierForUnionData();
$service->exportSupplier();
// $service->makeSupplierSystemTagAbnormal();
}
}
......@@ -917,4 +917,51 @@ class DataService
})->store('xlsx');
}
//导出供应商
public function exportSupplier()
{
ini_set('memory_limit', -1);
$excelData = [];
$header = [
'供应商编码',
'供应商名称',
'供应商性质',
'采购员',
'sku采购员',
'最新修改人',
'创建人',
'创建时间',
'首次上传sku时间',
];
$map = [
'source_type' => 'all',
'uploaded_sku' => -1,
'is_export' => 1,
'is_type' => 0,
];
$suppliers = (new SupplierService())->getSupplierList($map);
$transformer = new SupplierTransformer();
$suppliers = $transformer->transformList($suppliers);
foreach ($suppliers as $supplier) {
$itemData = [
$supplier['supplier_code'],
$supplier['supplier_name'],
$supplier['supplier_group'],
$supplier['channel_username'],
$supplier['yunxin_channel_username'],
$supplier['last_update_name'],
$supplier['create_name'],
$supplier['create_time'],
$supplier['first_upload_sku_time'],
];
$excelData[] = $itemData;
}
array_unshift($excelData, $header);
Excel::create('供应商导出_2023423', function ($excel) use ($excelData) {
$excel->sheet('sheet1', function ($sheet) use ($excelData) {
$sheet->fromArray($excelData);
});
})->store('csv');
}
}
\ No newline at end of file
......@@ -63,5 +63,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route::match(['get', 'post'], '/test', function () {
(new \App\Http\Services\DataService())->exportSupplierForUnionData();
(new \App\Http\Services\DataService())->exportSupplier();
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment