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'
txt_title = ["Manufacturer", "mpn", "sku",
"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-4", "price-jpy-4", "price-break-5", "price-jpy-5", "price-break-6", "price-jpy-6",
"Rohs", "PB", "Packaging", "Category", "MOQ", "SPQ", "C1S PN", "Lead-Time"
"price-break-1", "price-usd-1", "price-break-2", "price-usd-2", "price-break-3", "price-usd-3",
"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", "DC"
]
"""判断传入的字符串是不是数字"""
......@@ -179,7 +179,6 @@ class DataUtil:
return
with open(file_path, errors='ignore') as f:
content_list = f.readlines()
print(content_list[0].split("\t"))
for index in range(len(content_list)):
if index > 100:
break
......@@ -225,29 +224,29 @@ class DataUtil:
if txt_title[i] == "price-break-6" and element != "":
ladder_purchases["price-break-6"] = element
if txt_title[i] == "price-jpy-1" and element != "":
ladder_prices["price-jpy-1"] = element
if txt_title[i] == "price-jpy-2" and element != "":
ladder_prices["price-jpy-2"] = element
if txt_title[i] == "price-jpy-3" and element != "":
ladder_prices["price-jpy-3"] = element
if txt_title[i] == "price-jpy-4" and element != "":
ladder_prices["price-jpy-4"] = element
if txt_title[i] == "price-jpy-5" and element != "":
ladder_prices["price-jpy-5"] = element
if txt_title[i] == "price-jpy-6" and element != "":
ladder_prices["price-jpy-6"] = element
if txt_title[i] == "price-usd-1" and element != "":
ladder_prices["price-usd-1"] = element
if txt_title[i] == "price-usd-2" and element != "":
ladder_prices["price-usd-2"] = element
if txt_title[i] == "price-usd-3" and element != "":
ladder_prices["price-usd-3"] = element
if txt_title[i] == "price-usd-4" and element != "":
ladder_prices["price-usd-4"] = element
if txt_title[i] == "price-usd-5" and element != "":
ladder_prices["price-usd-5"] = element
if txt_title[i] == "price-usd-6" and element != "":
ladder_prices["price-usd-6"] = element
if table["goods_name"] == "" or table["brand_name"] == "":
continue
for k in range(1, 7):
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_prices["price-jpy-" + str(k)]):
and is_number(ladder_prices["price-usd-" + str(k)]):
item = dict()
item["purchases"] = int(ladder_purchases["price-break-" + str(k)])
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)
ans = json.dumps(table)
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