Commit 05c9571f authored by rico.liu's avatar rico.liu

add op

parent 04f40546
......@@ -14,7 +14,7 @@ DL/DW/DZ/GM/JD/LXWL/OFS/SN/YHD/ZCSM
def matchSKU(sku_list,frm):
conn = pymssql.connect(host='123.56.115.207', user='zgcprice3311',password='admin@2018@)!*',database='ZI_DataBase')
cursor = conn.cursor()
print('正在删除库中产品状态为6的sku,稍等。。。')#首先将库中错误状态产品的JD/SN/GM的SKU删除
......@@ -49,16 +49,27 @@ def matchSKU(sku_list,frm):
conn.commit()
print('正在获取当前库中所有sku,请稍等.....')#获取库中所有的SKU,以供检查
try:
get_all_sku = f"select * from productcode_sku where frm in {frm} and productcode not like '78%' "
get_all_sku = f"select productcode,sku from productcode_sku where frm in {frm} and productcode not like '78%' "
cursor.execute(get_all_sku)
data_sku = (cursor.fetchall())
data_sku_file = pd.DataFrame(data_sku,columns=['id','productcode','sku','skuname','createddate','frm'])
data_sku_file = pd.DataFrame(data_sku,columns=['productcode','sku'])
except:
get_all_sku = f"select * from productcode_sku where frm='{frm}' and productcode not like '78%' "
get_all_sku = f"select productcode,sku from productcode_sku where frm='{frm}' and productcode not like '78%' "
cursor.execute(get_all_sku)
data_sku = (cursor.fetchall())
data_sku_file = pd.DataFrame(data_sku,columns=['id','productcode','sku','skuname','createddate','frm'])
data_sku_file = pd.DataFrame(data_sku,columns=['productcode','sku'])
#获取op_productcode_sku
if frm == 'SN':
frm = 'SN-NEW'
get_all_sku = f"select productcode,sku from op_product_sku where frm='{frm}' and productcode not like '78%' "
cursor.execute(get_all_sku)
data_sku = (cursor.fetchall())
data_sku_file_op = pd.DataFrame(data_sku,columns=['productcode','sku'])
data_sku_file = pd.concat([data_sku_file,data_sku_file_op]).drop_duplicates()
print('sku获取完毕')
conn.close()
cursor.close()
......@@ -74,7 +85,7 @@ def matchSKU(sku_list,frm):
sku_check[f'{sku}'] = '2' #匹配上多个SKU,属于问题数据
else:
if frm == 'SN':
if frm == 'SN' or frm == 'SN-NEW':
sku_add = '0000000000/'+ str(sku)
if str(sku_add) in list(data_sku_file['sku']):
try:
......
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