Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
amazon_reports
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
common
amazon_reports
Commits
d14da127
Commit
d14da127
authored
Oct 22, 2024
by
邱阿朋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
4bfa7ee9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
20 deletions
+25
-20
coop.py
coop.py
+8
-8
invoices.py
invoices.py
+6
-5
returns.py
returns.py
+11
-7
No files found.
coop.py
View file @
d14da127
...
...
@@ -38,14 +38,14 @@ def sku_relations():
def
export_list_read_data
():
file_name
=
"ContraCogsInvoices.xls"
if
not
os
.
path
.
isfile
(
file_name
):
raise
FileNotFoundError
(
f
"{file_name},文件不存在"
)
#
page.get("https://vendorcentral.amazon.com/hz/vendor/members/coop?ref_=vc_xx_subNav")
#
#
全选
#
page.ele("#select-all").click()
#
#
点击选项卡
#
page.ele("#cc-invoice-actions-dropdown").click()
#
#
点击下载报表
#
page.ele("#cc-invoice-actions-dropdown_2").click.to_download().wait()
#
raise FileNotFoundError(f"{file_name},文件不存在")
page
.
get
(
"https://vendorcentral.amazon.com/hz/vendor/members/coop?ref_=vc_xx_subNav"
)
# 全选
page
.
ele
(
"#select-all"
)
.
click
()
# 点击选项卡
page
.
ele
(
"#cc-invoice-actions-dropdown"
)
.
click
()
# 点击下载报表
page
.
ele
(
"#cc-invoice-actions-dropdown_2"
)
.
click
.
to_download
()
.
wait
()
return
pd
.
read_excel
(
file_name
,
engine
=
'xlrd'
)
...
...
invoices.py
View file @
d14da127
...
...
@@ -35,12 +35,13 @@ def export_list_read_data():
file_name
=
'Payments.xlsx'
if
not
os
.
path
.
isfile
(
file_name
):
raise
FileNotFoundError
(
f
"{file_name},文件不存在"
)
# raise FileNotFoundError(f"{file_name},文件不存在")
pass
#
page.get(f"https://vendorcentral.amazon.com/hz/vendor/members/remittance/home", timeout=3)
#
page.ele("#remittance-home-select-all", timeout=2).click()
#
page.ele("#remittance-home-export-link", timeout=2).click.to_download()
#
file.wait_for_downloads(file_name)
page
.
get
(
f
"https://vendorcentral.amazon.com/hz/vendor/members/remittance/home"
,
timeout
=
3
)
page
.
ele
(
"#remittance-home-select-all"
,
timeout
=
2
)
.
click
()
page
.
ele
(
"#remittance-home-export-link"
,
timeout
=
2
)
.
click
.
to_download
()
file
.
wait_for_downloads
(
file_name
)
all_df
=
pd
.
read_excel
(
file_name
,
header
=
None
)
...
...
returns.py
View file @
d14da127
...
...
@@ -27,7 +27,7 @@ page.set.download_path(download_path)
def
open_url
(
url
):
# 访问网页
page
.
get
(
url
,
timeout
=
5
)
time
.
sleep
(
2
)
time
.
sleep
(
1
)
element
=
page
.
ele
(
'#ap_email'
,
timeout
=
1
)
if
element
:
...
...
@@ -65,12 +65,12 @@ def sku_relations():
def
export_list_read_data
():
file_name
=
"Return_Summary.xls"
if
not
os
.
path
.
isfile
(
file_name
):
raise
FileNotFoundError
(
f
"{file_name},文件不存在"
)
#
#
访问网页
#
open_url("https://vendorcentral.amazon.com/hz/vendor/members/returns?ref_=vc_xx_subNav")
#
#
导出退货单
#
page.ele("#file-download-button").click.to_download()
#
file.wait_for_downloads(file_name)
#
raise FileNotFoundError(f"{file_name},文件不存在")
# 访问网页
open_url
(
"https://vendorcentral.amazon.com/hz/vendor/members/returns?ref_=vc_xx_subNav"
)
# 导出退货单
page
.
ele
(
"#file-download-button"
)
.
click
.
to_download
()
file
.
wait_for_downloads
(
file_name
)
return
pd
.
read_excel
(
file_name
,
engine
=
'xlrd'
)
...
...
@@ -101,8 +101,12 @@ def main():
list_data
=
export_list_read_data
()
new_list_data
=
[]
i
=
0
for
_
,
data
in
list_data
.
iterrows
():
i
+=
1
return_id
=
data
.
get
(
'Return ID'
)
print
({
"index"
:
i
,
"return_id"
:
return_id
})
# 下载退货详情表格读取数据
item_data
=
export_item_read_data
(
return_id
)
# 按 'Purchase order' 和 'ASIN' 分组,并对 'Quantity' 和 Total amount 进行求和
...
...
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