Commit cc09ad5c by 岳巧源

add currency

parent 7da52229
Showing with 12 additions and 2 deletions
......@@ -60,12 +60,18 @@ def resolve(file_name: str, supplier_id: int):
for i in range(len(df.index.values)):
goods_name = str(df.loc[i, "原厂型号"])
brand_name = str(df.loc[i, "品牌"])
currency = str(df.loc[i, "币种"])
if currency.strip() == "" or currency.strip() == "nan":
continue
currency = currency.upper().strip()
if goods_name.strip() == "" or brand_name.strip() == "" or goods_name.strip() == "nan" or brand_name.strip() == "nan":
continue
stock = str(int(df.loc[i, "库存"]))
moq = str(int(df.loc[i, "起订量"]))
mpq = str(int(df.loc[i, "MPQ(最小包装数量)"]))
price_is_us = False
if currency == "USD":
price_is_us = True
supp_id = int(supplier_id)
supplier_name = ""
multiple = str(int(df.loc[i, "增量"]))
......@@ -101,8 +107,12 @@ def resolve(file_name: str, supplier_id: int):
str(price_data).strip() != "" and str(price_data).strip() != "nan" and str(price_data).strip() != "NaN":
item_map = dict()
item_map["purchases"] = int(ladder_data)
item_map["price_us"] = float(0)
item_map["price_cn"] = float(price_data)
if price_is_us:
item_map["price_us"] = float(price_data)
item_map["price_cn"] = float(0)
else:
item_map["price_us"] = float(0)
item_map["price_cn"] = float(price_data)
table["ladder_price"].append(item_map)
ans = json.dumps(table, ensure_ascii=False)
logging.info(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