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
83b6b826
authored
May 19, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
导出特定供应商
parent
431d41b4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletions
app/Http/Services/DataService.php
app/Http/routes.php
app/Http/Services/DataService.php
View file @
83b6b826
...
...
@@ -1157,4 +1157,37 @@ class DataService
echo
json_encode
(
$supplierList
);
}
//获取上传了平台合作协议的供应商
public
function
exportHasCooperationAgreementSupplierList
()
{
$header
=
[
'供应商编码'
,
'供应商名称'
,
'供应商性质'
,
'sku采购员'
,
'组别'
,
];
$intraCodeModel
=
new
IntracodeModel
();
$users
=
$intraCodeModel
->
getSampleName
(
true
);
$excelData
=
[];
$attachments
=
SupplierAttachmentsModel
::
where
(
'field_name'
,
'cooperation_agreement'
)
->
groupBy
(
'supplier_id'
)
->
get
()
->
toArray
();
foreach
(
$attachments
as
$attachment
)
{
$supplier
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$attachment
[
'supplier_id'
])
->
first
()
->
toArray
();
$skuUserNameRaw
=
array_get
(
$users
,
$supplier
[
'yunxin_channel_uid'
]);
$departmentName
=
(
new
DepartmentService
())
->
getDepartmentNameByUserName
(
$skuUserNameRaw
);
$excelData
[]
=
[
$supplier
[
'supplier_code'
],
$supplier
[
'supplier_name'
],
array_get
(
config
(
'fixed.SupplierGroup'
),
$supplier
[
'supplier_group'
],
'未设置'
),
$departmentName
];
}
array_unshift
(
$excelData
,
$header
);
Excel
::
create
(
'上传了“平台合作协议”的供应商'
,
function
(
$excel
)
use
(
$excelData
)
{
$excel
->
sheet
(
'sheet1'
,
function
(
$sheet
)
use
(
$excelData
)
{
$sheet
->
fromArray
(
$excelData
);
});
})
->
export
(
'csv'
);
}
}
\ No newline at end of file
app/Http/routes.php
View file @
83b6b826
...
...
@@ -67,7 +67,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
(
new
\App\Http\Services\DataService
())
->
getOffShelf
SupplierList
();
(
new
\App\Http\Services\DataService
())
->
exportHasCooperationAgreement
SupplierList
();
// \App\Model\SupplierChannelModel::where('supplier_name', '深圳市金开盛电子有限公司')->update([
// 'status' => 2,
// 'update_time' => time(),
...
...
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