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

update sku rel load

parent c1cf3d04
...@@ -60,7 +60,8 @@ def InitializeData(path): ...@@ -60,7 +60,8 @@ def InitializeData(path):
counter += 1 counter += 1
id_ = row['序号'] id_ = row['序号']
sku = "无" sku = row['供应商SKU']
channel_alias = row['供应商简称']
category = row['指数类别'] category = row['指数类别']
brand = row['指数品牌'] brand = row['指数品牌']
name = row['指数名称'] name = row['指数名称']
...@@ -82,7 +83,7 @@ def InitializeData(path): ...@@ -82,7 +83,7 @@ def InitializeData(path):
url_source = str(url_source) url_source = str(url_source)
url_price = str(df_price[df_price['序号'] == id_]['电子商城价'].tolist()) url_price = str(df_price[df_price['序号'] == id_]['电子商城价'].tolist())
insert_data.append((sku,name,brand,category,model,url_price,url,url_source,url_price,channel,channel,channel,batch)) insert_data.append((sku,name,brand,category,model,url_price,url,url_source,url_price,channel,channel_alias,channel_alias,batch))
cursor_zi_service.executemany(f"insert into product_all (sku,name,brand,category,model,price,url,url_source,url_price,channel,channel_id,channel_alias,batch) \ cursor_zi_service.executemany(f"insert into product_all (sku,name,brand,category,model,price,url,url_source,url_price,channel,channel_id,channel_alias,batch) \
values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",insert_data) values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",insert_data)
...@@ -112,7 +113,7 @@ def LoadData(batch,channel_alias,mode): ...@@ -112,7 +113,7 @@ def LoadData(batch,channel_alias,mode):
cursor_zi_service.execute(f"select id,sku,name,brand,category,params,price,channel_alias,batch from product_all where batch = '{batch}' and channel_alias = '{channel_alias}' and state is Null") cursor_zi_service.execute(f"select id,sku,name,brand,category,params,price,channel_alias,batch from product_all where batch = '{batch}' and channel_alias = '{channel_alias}' and state is Null")
df = pd.DataFrame(cursor_zi_service.fetchall(), columns=[tuple[0] for tuple in cursor_zi_service.description]) df = pd.DataFrame(cursor_zi_service.fetchall(), columns=[tuple[0] for tuple in cursor_zi_service.description])
elif mode == 'collectDataConfirm': elif mode == 'collectDataConfirm':
cursor_zi_service.execute(f"select id,category,brand,sku,name,params,url,url_source,url_price,new_name,params_standard,zi_subcategoryname,zi_subcategorycode,zi_brandname,zi_brandcode,channel_alias,state from product_all where batch = '{batch}' and channel_alias = '{channel_alias}'") cursor_zi_service.execute(f"select id,category,brand,sku,channel_alias,name,params,url,url_source,url_price,new_name,params_standard,zi_subcategoryname,zi_subcategorycode,zi_brandname,zi_brandcode,channel_alias,state from product_all where batch = '{batch}' and channel_alias = '{channel_alias}'")
df = pd.DataFrame(cursor_zi_service.fetchall(), columns=[tuple[0] for tuple in cursor_zi_service.description]) df = pd.DataFrame(cursor_zi_service.fetchall(), columns=[tuple[0] for tuple in cursor_zi_service.description])
elif mode == 'dealPicInfo': elif mode == 'dealPicInfo':
cursor_zi_service.execute(f"select id,sku,productcode,name,batch,url,url_pic from product_all where batch = '{batch}' and channel_alias = '{channel_alias}'") cursor_zi_service.execute(f"select id,sku,productcode,name,batch,url,url_pic from product_all where batch = '{batch}' and channel_alias = '{channel_alias}'")
...@@ -1929,8 +1930,31 @@ def collect_df_to_db(path): ...@@ -1929,8 +1930,31 @@ def collect_df_to_db(path):
} }
} }
res = zgc_api("Stock-InPriceInfo",data) res = zgc_api("Stock-InPriceInfo",data)
print(res)
print("产品价格录入完成") print("产品价格录入完成")
#组织SKU对应关系数据
sku_df = df[df['sku'] != '无']
if sku_df.empty:
print(f"无SKU对应关系录入")
else:
cust_sku_list = sku_df['sku'].tolist()
sku_list = sku_df['productcode'].tolist()
channel_alias_list = sku_df['channel_alias'].tolist()
data = {
"params_info": {
"cust_sku_list": cust_sku_list,
"sku_list": sku_list,
"channelAlias_list": channel_alias_list
}
}
res = zgc_api("Stock-InSkuRelationshipInfo",data)
print(res)
print("SKU对应关系录入完成")
#导出待建库的产品图片 #导出待建库的产品图片
def confirm_product_picture(batch,channel_alias): def confirm_product_picture(batch,channel_alias):
......
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