Commit cd132135 by 岳巧源

add new script

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