Commit f2887063 authored by rico.liu's avatar rico.liu

update

parent 61e2445b
...@@ -206,7 +206,19 @@ def SkuMatch(df,channel_alias,engine): ...@@ -206,7 +206,19 @@ def SkuMatch(df,channel_alias,engine):
zi_subcategoryname = df_his['zi_subcategoryname'].tolist()[0].replace("'","''") zi_subcategoryname = df_his['zi_subcategoryname'].tolist()[0].replace("'","''")
zi_subcategorycode = df_his['zi_subcategorycode'].tolist()[0].replace("'","''") zi_subcategorycode = df_his['zi_subcategorycode'].tolist()[0].replace("'","''")
model = df_his['model'].tolist()[0] model = df_his['model'].tolist()[0]
remark = df_his['remark'].tolist()[0] remark = str(df_his['remark'].tolist()[0])
if remark == 'None':
try:
params_standard = df_his['params_standard'].tolist()[0].replace("'","''")
print(f"update product_all set zi_brandname = '{zi_brandname}',zi_brandcode = '{zi_brandcode}',zi_subcategoryname = '{zi_subcategoryname}',zi_subcategorycode = '{zi_subcategorycode}',model = '{model}',params_standard = '{params_standard}',state = '8' where id = {id_}")
cursor_zi_service.execute(f"update product_all set zi_brandname = '{zi_brandname}',zi_brandcode = '{zi_brandcode}',zi_subcategoryname = '{zi_subcategoryname}',zi_subcategorycode = '{zi_subcategorycode}',model = '{model}',params_standard = '{params_standard}',remark=Null,state = '8' where id = {id_}")
except:
print(f"update product_all set zi_brandname = '{zi_brandname}',zi_brandcode = '{zi_brandcode}',zi_subcategoryname = '{zi_subcategoryname}',zi_subcategorycode = '{zi_subcategorycode}',model = '{model}',state = '8' where id = {id_}")
cursor_zi_service.execute(f"update product_all set zi_brandname = '{zi_brandname}',zi_brandcode = '{zi_brandcode}',zi_subcategoryname = '{zi_subcategoryname}',zi_subcategorycode = '{zi_subcategorycode}',model = '{model}',remark=Null,state = '8' where id = {id_}")
else:
try: try:
params_standard = df_his['params_standard'].tolist()[0].replace("'","''") params_standard = df_his['params_standard'].tolist()[0].replace("'","''")
print(f"update product_all set zi_brandname = '{zi_brandname}',zi_brandcode = '{zi_brandcode}',zi_subcategoryname = '{zi_subcategoryname}',zi_subcategorycode = '{zi_subcategorycode}',model = '{model}',params_standard = '{params_standard}',state = '8' where id = {id_}") print(f"update product_all set zi_brandname = '{zi_brandname}',zi_brandcode = '{zi_brandcode}',zi_subcategoryname = '{zi_subcategoryname}',zi_subcategorycode = '{zi_subcategorycode}',model = '{model}',params_standard = '{params_standard}',state = '8' where id = {id_}")
...@@ -1357,7 +1369,7 @@ def create_to_db(path,std_value_dict): ...@@ -1357,7 +1369,7 @@ def create_to_db(path,std_value_dict):
spuid_list = list() spuid_list = list()
for index,row in df.iterrows(): for index,row in df.iterrows():
if (row['remark'] != 'nan' and row['remark'] != 'None') or (row['productcode'] != 'nan' and row['productcode'] != 'None'): if (row['remark'] != 'nan' and row['remark'] != 'None' and row['remark'] != '未匹配上产品') or (row['productcode'] != 'nan' and row['productcode'] != 'None'):
new_name_list.append(" ") new_name_list.append(" ")
continue continue
...@@ -1512,7 +1524,7 @@ def create_to_db(path,std_value_dict): ...@@ -1512,7 +1524,7 @@ def create_to_db(path,std_value_dict):
df['new_name'] = new_name_list df['new_name'] = new_name_list
for index,row in df.iterrows(): for index,row in df.iterrows():
if row['remark'] != 'nan' and row['remark'] != 'None':#驳回数据 if row['remark'] != 'nan' and row['remark'] != 'None' and row['remark'] != '未匹配上产品':#驳回数据
new_product_flag_list.append('0') new_product_flag_list.append('0')
new_name_update = row['new_name'].replace("'","\'") new_name_update = row['new_name'].replace("'","\'")
#print(1,f"update product_all set state = '2',new_name = '{new_name_update}',remark = '{row['remark']}' where id = {row['id']}") #print(1,f"update product_all set state = '2',new_name = '{new_name_update}',remark = '{row['remark']}' where id = {row['id']}")
...@@ -2027,7 +2039,7 @@ def update_non_point_to_db(path,mode): ...@@ -2027,7 +2039,7 @@ def update_non_point_to_db(path,mode):
counter += 1 counter += 1
except: except:
print(index_(counter,1), end='%') print(index_(counter,1), end='%')
if remark == 'nan' or remark == 'null': if remark == 'nan' or remark == 'null' or remark == '未匹配上产品':
if matchcode == 'nan': if matchcode == 'nan':
newname = str(newname).replace("'","''") newname = str(newname).replace("'","''")
brand = str(brand).replace("'","''") brand = str(brand).replace("'","''")
...@@ -2065,7 +2077,7 @@ def update_non_point_to_db(path,mode): ...@@ -2065,7 +2077,7 @@ def update_non_point_to_db(path,mode):
counter += 1 counter += 1
except: except:
print(index_(counter,1), end='%') print(index_(counter,1), end='%')
if remark == 'nan' or remark == 'null': if remark == 'nan' or remark == 'null' or remark == '未匹配上产品':
if matchcode == 'nan': if matchcode == 'nan':
newname = str(newname).replace("'","''") newname = str(newname).replace("'","''")
brand = str(brand).replace("'","''") brand = str(brand).replace("'","''")
......
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 to comment