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