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
e2aa0390
authored
May 05, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
导出供应商
parent
47a5b647
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
3 deletions
app/Http/Services/DataService.php
app/Http/routes.php
vendor/_laravel_idea/_ide_helper_facades.php
app/Http/Services/DataService.php
View file @
e2aa0390
...
...
@@ -979,4 +979,70 @@ class DataService
});
})
->
store
(
'csv'
);
}
public
function
exportNotUploadSkuSupplier
()
{
ini_set
(
'memory_limit'
,
-
1
);
// $time = strtotime('2021-1-1');
// $suppliers = SupplierChannelModel::where('is_type', 0)->where('uploaded_sku', 1)
$time
=
strtotime
(
'2021-1-1'
);
$suppliers
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'uploaded_sku'
,
'!='
,
1
)
->
whereRaw
(
'supplier_name NOT LIKE "%-1"'
)
->
where
(
'create_time'
,
'>'
,
$time
)
->
get
();
$excelData
=
[];
$header
=
[
'供应商编码'
,
'供应商名称'
,
'采购员'
,
'部门'
,
];
$intraCodeModel
=
new
IntracodeModel
();
$users
=
$intraCodeModel
->
getSampleName
(
true
);
foreach
(
$suppliers
as
$supplier
)
{
//去采购系统找采购单金额最多的用户
$purchaseAmountMap
=
[];
$channelUids
=
PurchaseOrderModel
::
where
(
'supplier_id'
,
$supplier
[
'supplier_id'
])
->
pluck
(
'purchase_uid'
)
->
unique
()
->
toArray
();
if
(
empty
(
$channelUids
))
{
continue
;
}
//去获取对应的uid的采购金额
foreach
(
$channelUids
as
$channelUid
)
{
//去采购系统取采购单金额
$purchaseOrders
=
PurchaseOrderModel
::
where
(
'purchase_uid'
,
$channelUid
)
->
select
([
'purchase_amount'
,
'exchange_rate'
,
'currency'
])
->
get
()
->
toArray
();
//计算出采购金额
$totalAmount
=
0
;
foreach
(
$purchaseOrders
as
$purchaseOrder
)
{
if
(
$purchaseOrder
[
'currency'
]
==
1
)
{
$totalAmount
+=
$purchaseOrder
[
'purchase_amount'
]
*
$purchaseOrder
[
'exchange_rate'
]
*
1.13
;
}
else
{
$totalAmount
+=
$purchaseOrder
[
'purchase_amount'
]
*
$purchaseOrder
[
'exchange_rate'
];
}
}
$purchaseAmountMap
[
$channelUid
]
=
$totalAmount
;
}
asort
(
$purchaseAmountMap
);
dump
(
$purchaseAmountMap
);
$maxAmountPurchaseAdminId
=
array_keys
(
$purchaseAmountMap
)[
0
];
dump
(
$maxAmountPurchaseAdminId
);
$skuUserNameRaw
=
UserInfoModel
::
where
(
'userId'
,
$maxAmountPurchaseAdminId
)
->
value
(
'name'
);
$skuUserDepartment
=
(
new
DepartmentService
())
->
getDepartmentNameByUserName
(
$skuUserNameRaw
);
$itemData
=
[
$supplier
[
'supplier_code'
],
$supplier
[
'supplier_name'
],
$skuUserNameRaw
,
$skuUserDepartment
];
$excelData
[]
=
$itemData
;
}
array_unshift
(
$excelData
,
$header
);
Excel
::
create
(
'供应商无sku做单导出'
,
function
(
$excel
)
use
(
$excelData
)
{
$excel
->
sheet
(
'sheet1'
,
function
(
$sheet
)
use
(
$excelData
)
{
$sheet
->
fromArray
(
$excelData
);
});
})
->
store
(
'csv'
);
}
}
\ No newline at end of file
app/Http/routes.php
View file @
e2aa0390
...
...
@@ -67,7 +67,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
$data
[
'data'
][
'title'
]
=
"【猎芯网】 先生/女生您好,您的“云芯入驻申请”已收到,审核结果为:不通过,原因为:,如对审核结果有疑问,可联系您在猎芯的专属渠道经理(周强),联系电话:13512343214,联系邮箱:qiang@ichunt.com"
;
//// (new \App\Http\Services\MessageService())->sendMessage('supplier_apply_audit_mobile', $data, 18825159814, true);
// (new \App\Http\Services\MessageService())->sendMessage('supplier_apply_audit_email', $data, '648132694@qq.com', true);
(
new
\App\Http\Services\DataService
())
->
exportNotUploadSkuSupplier
();
});
vendor/_laravel_idea/_ide_helper_facades.php
View file @
e2aa0390
This diff is collapsed.
Click to expand it.
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