Commit 5501c50f by 岳巧源

add md

parent a8a044f1
import pymysql
if __name__ == '__main__':
conf = {
'host': "192.168.1.238",
'port': 3306,
'user': "europa_erp",
'password': "europa_erp#zsyM",
'db': "europa_erp",
'charset': 'utf8'
}
# sql = "select * from erp_goods where brand_id != 0"
db = pymysql.connect(**conf)
cursor = db.cursor()
goods_id = 0
while True:
pass
...@@ -48,7 +48,7 @@ CREATE TABLE `lie_shipping_intermediate_data` ( ...@@ -48,7 +48,7 @@ CREATE TABLE `lie_shipping_intermediate_data` (
- shipping_name - shipping_name
- shipment_number - shipment_number
- shipping_id - shipping_id
- lie_stock_in_items - lie_stock_in_items update + insert
- out_qty - out_qty
- in_qty - in_qty
......
...@@ -99,7 +99,7 @@ def pur(): ...@@ -99,7 +99,7 @@ def pur():
"create_uid": create_uid, # ok "create_uid": create_uid, # ok
"create_name": create_name, # ok "create_name": create_name, # ok
"address_data": [{ "address_data": [{
"source_id": "end_cust_id_" + str(end_cust_id), #也是主键id "source_id": "end_cust_id_en_" + str(end_cust_id), #也是主键id
"source_code": "", "source_code": "",
"address_type": "终端地址", "address_type": "终端地址",
"address": com_addr "address": com_addr
......
import json
import pymysql
if __name__ == '__main__':
conf = {
'host': "192.168.1.238",
'port': 3306,
'user': "europa_erp",
'password': "europa_erp#zsyM",
'db': "europa_erp",
'charset': 'utf8'
}
# 117183438154202117
sku_id = 0
# sql = "select * from erp_goods_sku where sku_id > %s order by sku_id limit 1000"
db = pymysql.connect(**conf)
cursor = db.cursor()
while True:
sql = "select * from erp_goods_sku where sku_id > %s order by sku_id limit 1000"
cursor.execute(sql, [str(sku_id)])
result = cursor.fetchall()
if len(result) > 0:
sku_id = result[-1][0]
for row in result:
flag = False
json_str = row[19]
skuId = row[0]
print("old: ----->" + json_str)
ans = json.loads(json_str)
for i in range(len(ans)):
if 'purchase' in ans[i]:
flag = True
break
if 'purchases' in ans[i]:
break
if flag:
new_str = str(json_str).replace("purchase", "purchases")
print("new str: ---->" + new_str)
update_sql = "update erp_goods_sku set ladder_price = %s where sku_id = %s limit 1"
try:
cursor.execute(update_sql, [str(new_str), str(skuId)])
db.commit()
except Exception as e:
db.rollback()
print(e)
else:
break
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 sign in to comment