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
0f667074
authored
Jun 26, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
导出脚本
parent
f8bca94c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
app/Http/Services/DataService.php
app/Http/Services/DataService.php
View file @
0f667074
...
...
@@ -1426,7 +1426,9 @@ class DataService
'supplier_code'
,
'supplier_id'
,
'channel_uid'
,
'yunxin_channel_uid'
'yunxin_channel_uid'
,
'create_uid'
,
'create_name'
,
])
->
where
(
'is_type'
,
0
)
->
whereIn
(
'supplier_code'
,
$supplierCodeList
)
->
whereRaw
(
'supplier_name NOT LIKE "%-1"'
)
->
get
()
->
toArray
();
$excelData
=
[];
...
...
@@ -1434,17 +1436,28 @@ class DataService
'供应商名称'
,
'最大金额采购员'
,
'sku采购员'
,
'采购员'
,
'创建人'
,
];
$intraCodeModel
=
new
IntracodeModel
();
$users
=
$intraCodeModel
->
getSampleName
(
true
);
foreach
(
$suppliers
as
$supplier
)
{
$skuUserName
=
$skuUserNameRaw
=
$purchasePurchaseName
=
''
;
$
purchaseNames
=
$
skuUserName
=
$skuUserNameRaw
=
$purchasePurchaseName
=
''
;
if
(
$supplier
[
'yunxin_channel_uid'
])
{
$skuUserNameRaw
=
array_get
(
$users
,
$supplier
[
'yunxin_channel_uid'
]);
$skuUserName
=
$skuUserNameRaw
;
}
if
(
$supplier
[
'create_name'
])
{
$createName
=
$supplier
[
'create_name'
];
}
else
if
(
$supplier
[
'create_uid'
])
{
$createUser
=
(
new
AdminUserService
())
->
getAdminUserInfo
(
$supplier
[
'create_uid'
]);
$createName
=
array_get
(
$createUser
,
'name'
,
''
);
}
if
(
$supplier
[
'channel_uid'
])
{
$purchaseCodeIdList
=
explode
(
','
,
$supplier
[
'channel_uid'
]);
$users
=
(
new
AdminUserService
())
->
getAdminUserListByCodeIds
(
$purchaseCodeIdList
);
$purchaseNames
=
array_column
(
$users
,
'name'
);
$purchaseNames
=
implode
(
','
,
$purchaseNames
);
$channelUids
=
IntracodeModel
::
whereIn
(
'code_id'
,
$purchaseCodeIdList
)
->
pluck
(
'admin_id'
)
->
toArray
();
//去采购系统找最多金额的用户id
$purchaseAmountMap
=
[];
...
...
@@ -1471,7 +1484,7 @@ class DataService
arsort
(
$purchaseAmountMap
);
if
(
array_values
(
$purchaseAmountMap
)[
0
]
==
0
)
{
$purchasePurchaseName
=
''
;
}
else
{
}
else
{
$maxAmountPurchaseAdminId
=
array_keys
(
$purchaseAmountMap
)[
0
];
$codeId
=
IntracodeModel
::
where
(
'admin_id'
,
$maxAmountPurchaseAdminId
)
->
value
(
'code_id'
);
if
(
$codeId
)
{
...
...
@@ -1491,11 +1504,12 @@ class DataService
$supplier
[
'supplier_name'
],
$purchasePurchaseName
,
$skuUserName
,
$purchaseNames
,
$createName
,
];
$excelData
[]
=
$itemData
;
}
array_unshift
(
$excelData
,
$header
);
dd
(
$excelData
);
Excel
::
create
(
'供应商导出'
,
function
(
$excel
)
use
(
$excelData
)
{
$excel
->
sheet
(
'sheet1'
,
function
(
$sheet
)
use
(
$excelData
)
{
$sheet
->
fromArray
(
$excelData
);
...
...
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