Commit 1f40559c by 杨树贤

处理禁用供应商

parent d4763767
...@@ -38,7 +38,7 @@ class SetSupplierFollowUp extends Command ...@@ -38,7 +38,7 @@ class SetSupplierFollowUp extends Command
// $service->importSupplierGroup(true); // $service->importSupplierGroup(true);
// $service->changeSupplierType(); // $service->changeSupplierType();
// $service->generateYunxinAccount(true); // $service->generateYunxinAccount(true);
$service->checkCompanyName(); $service->disableSupplier();
// $service->makeSupplierSystemTagAbnormal(); // $service->makeSupplierSystemTagAbnormal();
} }
} }
...@@ -568,5 +568,49 @@ class DataService ...@@ -568,5 +568,49 @@ class DataService
} }
} }
} }
//导入公司性质
public function disableSupplier($isUpdate = false)
{
ini_set('memory_limit', -1);
$filePath = public_path('data') . DIRECTORY_SEPARATOR . 'supplier_disable.xlsx';
try {
Excel::selectSheetsByIndex(1)->load($filePath, function ($reader) use ($isUpdate) {
$reader->sheet('禁用', function () use ($reader, $isUpdate) {
$num = 0;
foreach ($reader->all()->toArray() as $key => $item) {
$supplierId = trim($item[0]);
$supplierName = trim($item[1]);
$supplier = SupplierChannelModel::where('supplier_id', $supplierId)->first();
if (empty($supplier)) {
echo '供应商不存在 : ' . $supplierId . '__' . $supplierName . PHP_EOL;
continue;
}
$supplier = $supplier->toArray();
if ($supplier['group_code']) {
echo '已经有集团编码,跳过 : ' . $supplier['supplier_name'] . PHP_EOL;
continue;
}
if ($supplierName != $supplier['supplier_name']) {
echo '供应商名称遭到更改 : ' . $supplierName . '___' . $supplier['supplier_name'] . PHP_EOL;
continue;
}
$num++;
if ($isUpdate) {
SupplierChannelModel::where('supplier_id', $supplierId)->update([
'is_type' => 3
]);
}
}
echo "一共处理 $num 家供应商" . PHP_EOL;
});
});
} catch (\Exception $exception) {
dd($exception);
}
}
} }
No preview for this file type
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