Commit c039fd85 authored by sanlu's avatar sanlu

fix some problems

parent 8482d93c
......@@ -57,21 +57,24 @@ def param_upload(filename):
'subcategorycode':[]
}
for productid in param_data_dict.keys():
sql_ZIdatabase.cursor.execute(f"select productName,paramAttributeImportant,paramAttributeMatch,paramAttributeStandard from Product_Parameter_Process where batch='{batch}' and source='{source}' and productId='{productid}'")
product_name_data = sql_ZIdatabase.cursor.fetchone()
for productparam in param_data_dict[productid].keys():
update_table['batch'].append(batch)
update_table['source'].append(source)
update_table['productId'].append(productid)
update_table['productName'].append(product_name_data[0])
update_table['param'].append(productparam)
update_table['paramAttributeImportant'].append(product_name_data[1])
update_table['paramAttributeMatch'].append(product_name_data[2])
update_table['paramAttributeStandard'].append(product_name_data[3])
update_table['value'].append(param_data_dict[productid][productparam])
update_table['paramSource'].append('名称提取参数项')
update_table['state'].append('1')
update_table['subcategorycode'].append(subcategorycode)
try:
sql_ZIdatabase.cursor.execute(f"select productName,paramAttributeImportant,paramAttributeMatch,paramAttributeStandard from Product_Parameter_Process where batch='{batch}' and source='{source}' and productId='{productid}'")
product_name_data = sql_ZIdatabase.cursor.fetchone()
if product_name_data == None:
continue
for productparam in param_data_dict[productid].keys():
update_table['batch'].append(batch)
update_table['source'].append(source)
update_table['productId'].append(productid)
update_table['productName'].append(product_name_data[0])
update_table['param'].append(productparam)
update_table['paramAttributeImportant'].append(product_name_data[1])
update_table['paramAttributeMatch'].append(product_name_data[2])
update_table['paramAttributeStandard'].append(product_name_data[3])
update_table['value'].append(param_data_dict[productid][productparam])
update_table['paramSource'].append('名称提取参数项')
update_table['state'].append('1')
update_table['subcategorycode'].append(subcategorycode)
update_table_df = pd.DataFrame.from_dict(update_table)
#update_table_df.to_excel(f'update_data_{now_time}.xlsx')
update_table_df.to_sql('Product_Parameter_Process', sql_ZIdatabase.engine, if_exists='append', index=False)
\ No newline at end of file
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