Commit fba2bbd2 by 岳巧源

add chip1stop

parent 0bf688c3
Showing with 18 additions and 19 deletions
...@@ -55,9 +55,9 @@ csv_title = ['Mfr', 'C1S Part#', 'Mfr Part#', 'MOQ', 'Avail Qty', 'Days to Ship' ...@@ -55,9 +55,9 @@ csv_title = ['Mfr', 'C1S Part#', 'Mfr Part#', 'MOQ', 'Avail Qty', 'Days to Ship'
txt_title = ["Manufacturer", "mpn", "sku", txt_title = ["Manufacturer", "mpn", "sku",
"quantity", "Distributor-url", "Distributor-url2", "quantity", "Distributor-url", "Distributor-url2",
"price-break-1", "price-jpy-1", "price-break-2", "price-jpy-2", "price-break-3", "price-jpy-3", "price-break-1", "price-usd-1", "price-break-2", "price-usd-2", "price-break-3", "price-usd-3",
"price-break-4", "price-jpy-4", "price-break-5", "price-jpy-5", "price-break-6", "price-jpy-6", "price-break-4", "price-usd-4", "price-break-5", "price-usd-5", "price-break-6", "price-usd-6",
"Rohs", "PB", "Packaging", "Category", "MOQ", "SPQ", "C1S PN", "Lead-Time" "Rohs", "PB", "Packaging", "Category", "MOQ", "SPQ", "C1S PN", "Lead-Time", "DC"
] ]
"""判断传入的字符串是不是数字""" """判断传入的字符串是不是数字"""
...@@ -179,7 +179,6 @@ class DataUtil: ...@@ -179,7 +179,6 @@ class DataUtil:
return return
with open(file_path, errors='ignore') as f: with open(file_path, errors='ignore') as f:
content_list = f.readlines() content_list = f.readlines()
print(content_list[0].split("\t"))
for index in range(len(content_list)): for index in range(len(content_list)):
if index > 100: if index > 100:
break break
...@@ -225,29 +224,29 @@ class DataUtil: ...@@ -225,29 +224,29 @@ class DataUtil:
if txt_title[i] == "price-break-6" and element != "": if txt_title[i] == "price-break-6" and element != "":
ladder_purchases["price-break-6"] = element ladder_purchases["price-break-6"] = element
if txt_title[i] == "price-jpy-1" and element != "": if txt_title[i] == "price-usd-1" and element != "":
ladder_prices["price-jpy-1"] = element ladder_prices["price-usd-1"] = element
if txt_title[i] == "price-jpy-2" and element != "": if txt_title[i] == "price-usd-2" and element != "":
ladder_prices["price-jpy-2"] = element ladder_prices["price-usd-2"] = element
if txt_title[i] == "price-jpy-3" and element != "": if txt_title[i] == "price-usd-3" and element != "":
ladder_prices["price-jpy-3"] = element ladder_prices["price-usd-3"] = element
if txt_title[i] == "price-jpy-4" and element != "": if txt_title[i] == "price-usd-4" and element != "":
ladder_prices["price-jpy-4"] = element ladder_prices["price-usd-4"] = element
if txt_title[i] == "price-jpy-5" and element != "": if txt_title[i] == "price-usd-5" and element != "":
ladder_prices["price-jpy-5"] = element ladder_prices["price-usd-5"] = element
if txt_title[i] == "price-jpy-6" and element != "": if txt_title[i] == "price-usd-6" and element != "":
ladder_prices["price-jpy-6"] = element ladder_prices["price-usd-6"] = element
if table["goods_name"] == "" or table["brand_name"] == "": if table["goods_name"] == "" or table["brand_name"] == "":
continue continue
for k in range(1, 7): for k in range(1, 7):
if ("price-break-" + str(k)) in ladder_purchases \ if ("price-break-" + str(k)) in ladder_purchases \
and ("price-jpy-" + str(k)) in ladder_prices \ and ("price-usd-" + str(k)) in ladder_prices \
and is_number(ladder_purchases["price-break-" + str(k)]) \ and is_number(ladder_purchases["price-break-" + str(k)]) \
and is_number(ladder_prices["price-jpy-" + str(k)]): and is_number(ladder_prices["price-usd-" + str(k)]):
item = dict() item = dict()
item["purchases"] = int(ladder_purchases["price-break-" + str(k)]) item["purchases"] = int(ladder_purchases["price-break-" + str(k)])
item["price_us"] = float(0) item["price_us"] = float(0)
item["price_cn"] = float(ladder_prices["price-jpy-" + str(k)]) item["price_cn"] = float(ladder_prices["price-usd-" + str(k)])
table["ladder_price"].append(item) table["ladder_price"].append(item)
ans = json.dumps(table) ans = json.dumps(table)
print(ans) print(ans)
......
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 sign in to comment