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
b384ad5f
authored
Jul 21, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
导出采购员脚本
parent
8f4aaeda
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
2 deletions
app/Http/Services/AdminUserService.php
app/Http/Services/DataService.php
app/Http/routes.php
app/Http/Services/AdminUserService.php
View file @
b384ad5f
...
...
@@ -35,6 +35,11 @@ class AdminUserService
return
$codeId
;
}
public
function
getAdminIdByUserName
(
$userName
)
{
return
UserInfoModel
::
where
(
'name'
,
$userName
)
->
value
(
'userId'
);
}
public
function
getCodeIdsByUserIds
(
$userIds
)
{
$intraCodeModel
=
new
IntracodeModel
();
...
...
app/Http/Services/DataService.php
View file @
b384ad5f
...
...
@@ -764,7 +764,7 @@ class DataService
'supplier_type'
=>
SupplierChannelModel
::
SUPPLIER_TYPE_TEMPORARY
]);
}
}
else
{
}
else
{
if
(
$isUpdate
)
{
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplier
[
'supplier_id'
])
->
update
([
'level'
=>
''
,
...
...
@@ -773,5 +773,38 @@ class DataService
}
}
}
//导出某个人创建的供应商在采购系统里面是哪个采购做了单
public
function
exportSupplierChannelUser
(
$createName
)
{
$adminId
=
(
new
AdminUserService
())
->
getAdminIdByUserName
(
$createName
);
$contacts
=
SupplierContactModel
::
where
(
'admin_id'
,
$adminId
)
->
get
()
->
toArray
();
$csvData
=
[];
foreach
(
$contacts
as
$contact
)
{
$supplier
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$contact
[
'supplier_id'
])
->
first
();
if
(
empty
(
$supplier
))
{
continue
;
}
$supplier
=
$supplier
->
toArray
();
$canCheckChannelUser
=
(
new
AdminUserService
())
->
getAdminUserInfoByCodeId
(
$contact
[
'can_check_uids'
]);
$csvData
[]
=
[
$supplier
[
'supplier_code'
],
$supplier
[
'supplier_name'
],
$canCheckChannelUser
[
'name'
],
];
}
$header
=
[
'供应商编码'
,
'供应商名称'
,
'采购员名字'
,
];
array_unshift
(
$csvData
,
$header
);
Excel
::
create
(
'供应商采购员导出'
,
function
(
$excel
)
use
(
$csvData
)
{
$excel
->
sheet
(
'sheet1'
,
function
(
$sheet
)
use
(
$csvData
)
{
$sheet
->
fromArray
(
$csvData
);
});
})
->
export
(
'csv'
);
}
}
app/Http/routes.php
View file @
b384ad5f
...
...
@@ -62,5 +62,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
(
new
\App\Http\Services\DataService
())
->
repairLevelESupplierData
(
false
);
(
new
\App\Http\Services\DataService
())
->
exportSupplierChannelUser
(
'admin'
);
});
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