Commit d14da127 authored by 邱阿朋's avatar 邱阿朋

优化

parent 4bfa7ee9
......@@ -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')
......
......@@ -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)
......
......@@ -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 进行求和
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment