Commit cd132135 by 岳巧源

add new script

parent 156a8346
Showing with 23 additions and 9 deletions
...@@ -23,10 +23,10 @@ title_arr = [ ...@@ -23,10 +23,10 @@ title_arr = [
"封装" "封装"
] ]
logging.basicConfig(level=logging.INFO, # logging.basicConfig(level=logging.INFO,
filename=log_path, # filename=log_path,
format='%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s' # format='%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s'
) # )
class Producer: class Producer:
def __init__(self): def __init__(self):
...@@ -55,6 +55,8 @@ class Producer: ...@@ -55,6 +55,8 @@ class Producer:
"""判断传入的字符串是不是数字""" """判断传入的字符串是不是数字"""
def is_number(s: str): def is_number(s: str):
if s.lower() == "nan":
return False
try: try:
float(s) float(s)
return True return True
...@@ -82,20 +84,32 @@ def resolve(file_name: str, supplier_id: int): ...@@ -82,20 +84,32 @@ def resolve(file_name: str, supplier_id: int):
continue continue
if goods_name.strip() == "" or brand_name.strip() == "" or goods_name.strip() == "nan" or brand_name.strip() == "nan": if goods_name.strip() == "" or brand_name.strip() == "" or goods_name.strip() == "nan" or brand_name.strip() == "nan":
continue continue
stock = str(int(df.loc[i, "库存"])) if not is_number(str(df.loc[i, "库存"])):
moq = str(int(df.loc[i, "起订量"])) stock = "0"
mpq = str(int(df.loc[i, "MPQ(最小包装数量)"])) else:
stock = str(int(df.loc[i, "库存"]))
if not is_number(str(df.loc[i, "起订量"])):
moq = "1"
else:
moq = str(int(df.loc[i, "起订量"]))
if not is_number(str(df.loc[i, "MPQ(最小包装数量)"])):
mpq = "0"
else:
mpq = str(int(df.loc[i, "MPQ(最小包装数量)"]))
if not is_number(str(df.loc[i, "增量"])):
multiple = "1"
else:
multiple = str(int(df.loc[i, "增量"]))
price_is_us = False price_is_us = False
if currency == "USD": if currency == "USD":
price_is_us = True price_is_us = True
supp_id = int(supplier_id) supp_id = int(supplier_id)
supplier_name = "" supplier_name = ""
multiple = str(int(df.loc[i, "增量"]))
batch_sn = { batch_sn = {
str(df.loc[i, "批次"]): int(df.loc[i, "库存"]), str(df.loc[i, "批次"]): int(df.loc[i, "库存"]),
} }
eccn = "" eccn = ""
if str(df.loc[i, "批次"]).strip() == "": if str(df.loc[i, "批次"]).strip() == "" or str(df.loc[i, "批次"]).strip() == "nan":
batch_sn = {} batch_sn = {}
table = { table = {
"goods_name": goods_name, "goods_name": goods_name,
......
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