Commit 5a04ffca by 杨树贤

本地限制查看供应商

parent 052742fd
......@@ -104,6 +104,9 @@ class SupplierFilter
}
//默认过滤带有-1字符串的供应商名称的数据
$query->whereRaw('supplier_name NOT LIKE "%-1"');
if (config('website.domain') == 'liexin.net') {
$query->where('supplier_id', '>', 12211);
}
return $query;
}
......
......@@ -245,19 +245,23 @@ class DataService
{
ini_set('memory_limit', '-1');
$channelModel = new SupplierChannelModel();
//读取excel
//读取excel
$filePath = public_path('data') . DIRECTORY_SEPARATOR . 'abnormal_supplier.xlsx';
$suppliers = [];
try {
Excel::selectSheetsByIndex(0)->load($filePath, function ($reader) {
$reader->sheet('Sheet1', function () use ($reader) {
$reader->sheet('QC不良记录', function () use ($reader) {
$supplierModel = new SupplierChannelModel();
dd($reader->all()->toArray());
foreach ($reader->all()->toArray() as $key => $item) {
$supplierName = trim($item[0]);
if ($key == 0 || $key == 1) {
continue;
}
$supplierName = trim($item[2]);
if (empty($supplierName)) {
continue;
}
$supplier = $supplierModel->where('supplier_name',$supplierName)->first();
$supplier = $supplierModel->where('supplier_name', $supplierName)->first();
if (!empty($supplier)) {
$suppliers[] = $supplier->toArray();
}
......@@ -267,7 +271,8 @@ class DataService
foreach ($suppliers as $supplier) {
$supplierId = $supplier['supplier_id'];
$oldTags = $supplier['system_tags'];
$newTags = $supplier['system_tags'] ? rtrim($supplier['system_tags'], ',') . ',历史检测异常' : '历史检测异常';
$newTags = $supplier['system_tags'] ? rtrim($supplier['system_tags'],
',') . ',历史检测异常' : '历史检测异常';
if ($tagService->saveTags($supplierId, 14, $newTags, $oldTags)) {
$supplierModel->where('supplier_id', $supplierId)->update([
'system_tags' => $newTags
......@@ -462,7 +467,7 @@ class DataService
//转移付款方式到新添加的付款方式
public function TransferPayTypeDataToNewTable()
{
ini_set('memory_limit','-1');
ini_set('memory_limit', '-1');
$suppliers = SupplierChannelModel::where('pay_type', '!=', '0')->get()->toArray();
$payTypeData = [];
foreach ($suppliers as $supplier) {
......
This diff could not be displayed because it is too large.
No preview for this file type
[ZoneTransfer]
[ZoneTransfer]
ZoneId=3
ReferrerUrl=https://www.tapd.cn/
HostUrl=https://file.tapd.cn/56056445/attachments/download/1156056445001001663/story
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