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
f91ddabc
authored
May 10, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
异常供应商标签
parent
142832ba
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
27 deletions
app/Console/Commands/SetSupplierFollowUp.php
app/Http/Services/DataService.php
public/data/~$abnormal_supplier.xlsx
app/Console/Commands/SetSupplierFollowUp.php
View file @
f91ddabc
...
...
@@ -35,6 +35,7 @@ class SetSupplierFollowUp extends Command
// $service->importSupplierLevel();
// $service->changeSupplierTypeByIsType();
// $service->transferPayType();
$service
->
makeTempTagForSupplier
();
// $service->makeTempTagForSupplier();
$service
->
makeSupplierSystemTagAbnormal
();
}
}
app/Http/Services/DataService.php
View file @
f91ddabc
...
...
@@ -243,15 +243,15 @@ class DataService
}
//打上历史检测异常标签
public
function
makeSupplierSystemTagAbnormal
()
public
function
makeSupplierSystemTagAbnormal
(
$change
=
false
)
{
ini_set
(
'memory_limit'
,
'-1'
);
$channelModel
=
new
SupplierChannelModel
();
//读取excel
$filePath
=
public_path
(
'data'
)
.
DIRECTORY_SEPARATOR
.
'abnormal_supplier.xlsx'
;
try
{
Excel
::
selectSheetsByIndex
(
0
)
->
load
(
$filePath
,
function
(
$reader
)
{
$reader
->
sheet
(
'QC不良记录'
,
function
()
use
(
$reader
)
{
Excel
::
selectSheetsByIndex
(
0
)
->
load
(
$filePath
,
function
(
$reader
)
use
(
$change
)
{
$reader
->
sheet
(
'QC不良记录'
,
function
()
use
(
$reader
,
$change
)
{
$supplierModel
=
new
SupplierChannelModel
();
$suppliers
=
[];
foreach
(
$reader
->
all
()
->
toArray
()
as
$key
=>
$item
)
{
...
...
@@ -265,6 +265,8 @@ class DataService
$supplier
=
$supplierModel
->
where
(
'supplier_name'
,
$supplierName
)
->
first
();
if
(
!
empty
(
$supplier
))
{
$suppliers
[]
=
$supplier
->
toArray
();
}
else
{
echo
"供应商 : "
.
$supplierName
.
"不存在,跳过"
.
PHP_EOL
;
}
}
$tagService
=
new
SupplierTagService
();
...
...
@@ -272,15 +274,18 @@ class DataService
foreach
(
$suppliers
as
$supplier
)
{
$supplierId
=
$supplier
[
'supplier_id'
];
$oldTags
=
$supplier
[
'system_tags'
];
echo
"供应商 : "
.
$supplier
[
'supplier_name'
]
.
"检测异常,需要打上标签"
.
PHP_EOL
;
if
(
strpos
(
$supplier
[
'system_tags'
],
'历史检测异常'
)
!==
false
)
{
continue
;
}
$newTags
=
$supplier
[
'system_tags'
]
?
rtrim
(
$supplier
[
'system_tags'
],
','
)
.
',历史检测异常'
:
'历史检测异常'
;
if
(
$tagService
->
saveTags
(
$supplierId
,
14
,
$newTags
,
$oldTags
))
{
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'system_tags'
=>
$newTags
]);
if
(
$change
)
{
if
(
$tagService
->
saveTags
(
$supplierId
,
14
,
$newTags
,
$oldTags
))
{
$supplierModel
->
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'system_tags'
=>
$newTags
]);
}
}
}
});
...
...
@@ -451,13 +456,6 @@ class DataService
$supplierId
)
->
value
(
'quality_assurance_agreement'
);
//供应商性质为现货商,且没有上传品质协议,系统标签需要贴【临时供应商标签】,等级标记为E
if
(
!
$hasQualityAssuranceAgreement
&&
$supplier
[
'supplier_group'
]
==
2
)
{
$tagService
=
new
SupplierTagService
();
$oldTags
=
$supplier
[
'system_tags'
];
// if (strpos($supplier['system_tags'], '临时供应商') !== false) {
// continue;
// }
$newTags
=
$supplier
[
'system_tags'
]
?
rtrim
(
$supplier
[
'system_tags'
],
','
)
.
',临时供应商'
:
'临时供应商'
;
if
(
$supplier
[
'level'
]
!=
''
&&
$supplier
[
'level'
]
!=
'E'
)
{
echo
"供应商编码 ${supplier['supplier_code']} 已经有等级${supplier['level']},但是不为等级E,跳过"
.
PHP_EOL
;
continue
;
...
...
@@ -468,19 +466,7 @@ class DataService
'supplier_type'
=>
2
]);
}
// echo "供应商编码 ${supplier['supplier_code']} 打上临时供应商标签,等级标记为E" . PHP_EOL;
// if ($change) {
// if ($tagService->saveTags($supplierId, 14, $newTags, $oldTags)) {
// SupplierChannelModel::where('supplier_id', $supplierId)->update([
// 'system_tags' => $newTags,
// 'level' => 'E'
// ]);
// }
// }
}
}
}
...
...
public/data/~$abnormal_supplier.xlsx
0 → 100644
View file @
f91ddabc
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