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
a7b8b12c
Commit
a7b8b12c
authored
Oct 25, 2024
by
邱阿朋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
多国家
parent
554e5277
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
11 deletions
+21
-11
invoices.py
invoices.py
+21
-11
No files found.
invoices.py
View file @
a7b8b12c
...
...
@@ -184,16 +184,17 @@ def click_get_price_data():
'(//div[@class="a-column a-span4"])[2]//div[@class="a-row invoice-property-field-row"][3]//div[@class="a-column a-span6 a-span-last"]/span/text()'
)
# 检查内容是否有效
if
price_variance_amount
and
price_variance_amount
[
0
]
.
strip
()
!=
"-"
:
page
.
ele
(
"#pd"
,
timeout
=
5
)
.
click
()
while
True
:
print
(
"等待争议数据加载,5秒后获取表单数据"
)
page
.
wait
(
5
)
try
:
page
.
ele
(
"#pd"
,
timeout
=
5
)
.
click
()
print
(
"等待争议数据加载,5秒后获取表单数据"
)
page
.
wait
(
5
)
table_html
=
page
.
ele
(
"#priceDiscrepancyWithDMSGridForm"
,
timeout
=
5
)
.
html
price_data
=
price_extract_data
(
table_html
)
return
price_data
except
ElementNotFoundError
:
print
(
"未获取到表数据"
)
break
return
[]
except
ElementNotFoundError
:
...
...
@@ -246,6 +247,8 @@ def handle_data(detail_datum, vendor, deduction_points):
def
main
():
list_data
=
export_list_read_data
()
excel
.
save_xls
(
list_data
,
"回款数据.xlsx"
,
"Remittance payments"
)
print
(
f
"共计:{len(list_data)} 订单"
)
all_normal_pay_data
=
[]
...
...
@@ -254,16 +257,21 @@ def main():
for
_
,
data
in
list_data
.
iterrows
():
i
+=
1
invoice_number
=
data
.
get
(
"Invoice Number"
)
# 取订单前8位后面的没用
invoice_number
=
invoice_number
[:
8
]
# 获取当前订单的Payee和优惠比例
vendor_payment_terms
=
get_po_code
(
i
,
invoice_number
)
vendor_payment_terms
=
get_po_code
(
i
,
invoice_number
[:
8
]
)
print
(
vendor_payment_terms
)
vendor
=
vendor_payment_terms
[
'vendor'
]
deduction_points
=
int
(
vendor_payment_terms
[
'payment_terms'
])
last_two
=
invoice_number
[
-
2
:]
# 取后两位
last_three
=
invoice_number
[
-
3
:]
# 取后三位
# 检查后两位是否在测试列表中
if
last_two
in
[
"PC"
,
"MA"
,
"SC"
]:
invoice_number
=
invoice_number
[:
-
2
]
# 去掉后两位
if
last_three
==
"PCR"
:
invoice_number
=
invoice_number
[:
-
3
]
# 去掉最后三位
# 下载excel文件并读取数据
detail_data
=
export_details_read_data
(
invoice_number
)
...
...
@@ -294,12 +302,14 @@ def main():
if
len
(
price_pay_data
)
>
0
:
all_price_pay_data
.
append
(
pd
.
DataFrame
(
price_pay_data
))
# 将所有数据合并为一个 DataFrame
normal_pay_summary
=
pd
.
concat
(
all_normal_pay_data
,
ignore_index
=
True
)
price_pay_summary
=
pd
.
concat
(
all_price_pay_data
,
ignore_index
=
True
)
if
all_normal_pay_data
:
# 将所有数据合并为一个 DataFrame
normal_pay_summary
=
pd
.
concat
(
all_normal_pay_data
,
ignore_index
=
True
)
excel
.
save_xls
(
normal_pay_summary
,
"回款数据.xlsx"
,
"正常回款导出明细"
)
excel
.
save_xls
(
normal_pay_summary
,
"回款数据.xlsx"
,
"正常回款导出明细"
)
excel
.
save_xls
(
price_pay_summary
,
"回款数据.xlsx"
,
"Price导出明细"
)
if
all_price_pay_data
:
price_pay_summary
=
pd
.
concat
(
all_price_pay_data
,
ignore_index
=
True
)
excel
.
save_xls
(
price_pay_summary
,
"回款数据.xlsx"
,
"Price导出明细"
)
page
.
close
()
...
...
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