Commit cac7d04a authored by Jialin's avatar Jialin

Merge remote-tracking branch 'origin/master' into master

parents c040d93d 7f773523
...@@ -82,6 +82,9 @@ def upload_params_data(category,path): ...@@ -82,6 +82,9 @@ def upload_params_data(category,path):
#创建新产品库链接 #创建新产品库链接
conn_zi_new = pymssql.connect(host='123.56.115.207', user='zgcprice3311',password='zgcprice20200628',database= 'ZI_NEW',autocommit=True) conn_zi_new = pymssql.connect(host='123.56.115.207', user='zgcprice3311',password='zgcprice20200628',database= 'ZI_NEW',autocommit=True)
cursor_zi_new = conn_zi_new.cursor() cursor_zi_new = conn_zi_new.cursor()
conn_zdindex = pymssql.connect(host='123.56.115.207', user='zgcprice3311',password='zgcprice20200628',database= 'zdindex',autocommit=True)
cursor_zdindex = conn_zdindex.cursor()
##加载库中参数项数据(参数id,参数从属) ##加载库中参数项数据(参数id,参数从属)
cursor_zi_new.execute(f"select * from vw_property where name = '{category}' and identy != '0000'") cursor_zi_new.execute(f"select * from vw_property where name = '{category}' and identy != '0000'")
...@@ -295,8 +298,19 @@ def upload_params_data(category,path): ...@@ -295,8 +298,19 @@ def upload_params_data(category,path):
try: try:
cursor_zi_new.execute(f"update p_sku set skuname = '{skuname}' where sku = '{sku}'") cursor_zi_new.execute(f"update p_sku set skuname = '{skuname}' where sku = '{sku}'")
except: except:
skuname_double = skuname + '(重复)' cursor_zi_new.execute(f"select sku from p_sku where skuname = '{skuname}'")
correct_sku = cursor_zi_new.fetchone()[0]
skuname_double = skuname + f"(sku:'{sku}';重复sku:'{correct_sku}')"
cursor_zi_new.execute(f"update p_sku set skuname = '{skuname_double}',state = '6' where sku = '{sku}'") cursor_zi_new.execute(f"update p_sku set skuname = '{skuname_double}',state = '6' where sku = '{sku}'")
#更新价格库数据
cursor_zdindex.execute(f"select top 1 max(periods) from zd_entry_goods_price")
periods = cursor_zdindex.fetchone()[0]
cursor_zdindex.execute(f"update zd_entry_goods_price set goods_id = '{correct_sku}' where periods = '{periods}' and goods_id = '{sku}'")
cursor_zdindex.execute(f"update zd_electricity_price set goods_id = '{correct_sku}' where periods = '{periods}' and goods_id = '{sku}'")
cursor_zdindex.execute(f"update zd_purchase_price set goods_id = '{correct_sku}' where periods = '{periods}' and goods_id = '{sku}'")
#print(skuname) #print(skuname)
...@@ -393,6 +407,7 @@ def upload_params_data(category,path): ...@@ -393,6 +407,7 @@ def upload_params_data(category,path):
cursor_zi_new.execute(f"insert into p_valuemap (spuid,valueid) values ({spuid}, {valueid})") cursor_zi_new.execute(f"insert into p_valuemap (spuid,valueid) values ({spuid}, {valueid})")
conn_zi_new.close() conn_zi_new.close()
conn_zdindex.close()
print(f"{category_name}参数数据更新完成,命名完成") print(f"{category_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 to comment