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
1f40559c
authored
Jul 01, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
处理禁用供应商
parent
d4763767
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
1 deletions
app/Console/Commands/SetSupplierFollowUp.php
app/Http/Services/DataService.php
public/data/supplier_disable.xlsx
app/Console/Commands/SetSupplierFollowUp.php
View file @
1f40559c
...
@@ -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();
}
}
}
}
app/Http/Services/DataService.php
View file @
1f40559c
...
@@ -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
);
}
}
}
}
public/data/supplier_disable.xlsx
0 → 100644
View file @
1f40559c
No preview for this file type
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