Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2aa2c508
authored
Aug 16, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改导入以及导入等级脚本
parent
3bb1b79e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
5 deletions
app/Console/Commands/SetSupplierFollowUp.php
app/Http/Services/DataService.php
app/Http/routes.php
public/data/supplier_level_20220816.csv
app/Console/Commands/SetSupplierFollowUp.php
View file @
2aa2c508
...
...
@@ -38,7 +38,7 @@ class SetSupplierFollowUp extends Command
// $service->importSupplierGroup(true);
// $service->changeSupplierType();
// $service->generateYunxinAccount(true);
$service
->
reSyncSupplierToErp
();
$service
->
importSupplierLevel
();
// $service->makeSupplierSystemTagAbnormal();
}
}
app/Http/Services/DataService.php
View file @
2aa2c508
...
...
@@ -802,4 +802,31 @@ class DataService
}
}
}
//导入公司性质
public
function
importSupplierLevel
(
$isUpdate
=
false
)
{
ini_set
(
'memory_limit'
,
-
1
);
$filePath
=
public_path
(
'data'
)
.
DIRECTORY_SEPARATOR
.
'supplier_level_20220816.csv'
;
try
{
Excel
::
selectSheetsByIndex
(
0
)
->
load
(
$filePath
,
function
(
$reader
)
use
(
$isUpdate
)
{
$reader
->
sheet
(
'supplier_level_20220816'
,
function
()
use
(
$reader
,
$isUpdate
)
{
$suppliers
=
$reader
->
all
()
->
toArray
();
foreach
(
$suppliers
as
$supplier
)
{
$supplierCode
=
trim
(
$supplier
[
1
]);
$level
=
trim
(
$supplier
[
16
]);
echo
"修改供应商
$supplierCode
等级为
$level
"
.
PHP_EOL
;
if
(
$isUpdate
)
{
SupplierChannelModel
::
where
(
'supplier_code'
,
$supplierCode
)
->
update
([
'level'
=>
$level
,
]);
}
}
});
});
}
catch
(
\Exception
$exception
)
{
dd
(
$exception
);
}
}
}
\ No newline at end of file
app/Http/routes.php
View file @
2aa2c508
...
...
@@ -62,8 +62,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
// (new \App\Http\Services\DataService())->initSystemTag();
\App\Model\SupplierChannelModel
::
where
(
'supplier_id'
,
6148
)
->
update
([
'status'
=>
2
]);
(
new
\App\Http\Services\DataService
())
->
importSupplierLevel
();
});
public/data/supplier_level_20220816.csv
0 → 100644
View file @
2aa2c508
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment