Commit cbed968a by larosa

add new line

parent 1227384f
Showing with 14 additions and 9 deletions
...@@ -5,7 +5,8 @@ item = ["source_type", "source_id", "kingdee_sales_order_no", "purchase_sn", ...@@ -5,7 +5,8 @@ item = ["source_type", "source_id", "kingdee_sales_order_no", "purchase_sn",
"brand_id", "brand_name", "company_id", "company_name", "supplier_id", "brand_id", "brand_name", "company_id", "company_name", "supplier_id",
"supplier_name", "warehouse_receipt_sn", "in_qty", "out_qty", "stock_in_status", "supplier_name", "warehouse_receipt_sn", "in_qty", "out_qty", "stock_in_status",
"create_name", "shipping_id", "create_uid", "shipment_number", "shipping_name", "create_name", "shipping_id", "create_uid", "shipment_number", "shipping_name",
"create_time", "update_time", "purchase_uid", "purchase_name", "seller_uid", "seller_name" "create_time", "update_time", "purchase_uid", "purchase_name", "seller_uid", "seller_name",
"purchase_item_id"
] ]
item_str = "" item_str = ""
separator = ", " separator = ", "
...@@ -25,7 +26,7 @@ def migrate_from_lie_scm_order(): ...@@ -25,7 +26,7 @@ def migrate_from_lie_scm_order():
'charset': 'utf8' 'charset': 'utf8'
} }
#先获取scm的主键还有 purchase_item_id #先获取scm的主键还有 purchase_item_id
sql1 = "select scm_order_item_id, purchase_item_id, purchase_id, goods_id, goods_sn, goods_name, brand_id, brand_name, supplier_id, supplier_name, warehouse_receipt_sn, in_qty, goods_number, stock_in_status, create_name, shipping_id, create_uid, shipment_number, shipping_name, create_time, update_time, purchase_uid, purchase_name from lie_scm_order" sql1 = "select scm_order_item_id, purchase_item_id, purchase_id, goods_id, goods_sn, goods_name, brand_id, brand_name, supplier_id, supplier_name, warehouse_receipt_sn, in_qty, goods_number, stock_in_status, create_name, shipping_id, create_uid, shipment_number, shipping_name, create_time, update_time, purchase_uid, purchase_name, purchase_item_id from lie_scm_order"
sql2 = "select frq_id from lie_purchase_items where purchase_item_id = " sql2 = "select frq_id from lie_purchase_items where purchase_item_id = "
sql3 = "select erp_sn, seller_uid, seller_name from lie_frq where frq_id = " #获取到的erp_sn作为 kingdee_sales_order_no sql3 = "select erp_sn, seller_uid, seller_name from lie_frq where frq_id = " #获取到的erp_sn作为 kingdee_sales_order_no
sql4 = "select purchase_sn, erp_purchase_sn, company_id, company_name from lie_purchase_order where purchase_id = " sql4 = "select purchase_sn, erp_purchase_sn, company_id, company_name from lie_purchase_order where purchase_id = "
...@@ -83,13 +84,15 @@ def migrate_from_lie_scm_order(): ...@@ -83,13 +84,15 @@ def migrate_from_lie_scm_order():
update_time = row[20] update_time = row[20]
purchase_uid = row[21] purchase_uid = row[21]
purchase_name = row[22] purchase_name = row[22]
purchase_item_id = row[23]
value_arr = [ value_arr = [
source_type, source_id, kingdee_sales_order_no, purchase_sn, source_type, source_id, kingdee_sales_order_no, purchase_sn,
kingdee_purchase_order_no, goods_id, goods_sn, goods_name, kingdee_purchase_order_no, goods_id, goods_sn, goods_name,
brand_id, brand_name, company_id, company_name, supplier_id, brand_id, brand_name, company_id, company_name, supplier_id,
supplier_name, warehouse_receipt_sn, in_qty, out_qty, supplier_name, warehouse_receipt_sn, in_qty, out_qty,
stock_in_status, create_name, shipping_id, create_uid, shipment_number, stock_in_status, create_name, shipping_id, create_uid, shipment_number,
shipping_name, create_time, update_time, purchase_uid, purchase_name, seller_uid, seller_name shipping_name, create_time, update_time, purchase_uid, purchase_name, seller_uid, seller_name,
purchase_item_id
] ]
value_str = "" value_str = ""
for i in range(len(value_arr)): for i in range(len(value_arr)):
...@@ -105,8 +108,8 @@ def migrate_from_lie_scm_order(): ...@@ -105,8 +108,8 @@ def migrate_from_lie_scm_order():
value_str = value_str + "'" + str(value_arr[i]) + "'" value_str = value_str + "'" + str(value_arr[i]) + "'"
insert_sql = "insert into lie_shipping_intermediate_data (" + item_str + ") " + "values (" + value_str + ")" insert_sql = "insert into lie_shipping_intermediate_data (" + item_str + ") " + "values (" + value_str + ")"
#判断 goods_name + warehouse_receipt_sn 还有shipment_number的组合是否出现过 #判断 goods_name + warehouse_receipt_sn 还有shipment_number的组合是否出现过
if len(str(goods_name)) != 0 and len(str(warehouse_receipt_sn)) != 0 and len(str(shipment_number)) != 0: #这两个字段不为空值 if len(str(purchase_item_id)) != 0 and len(str(warehouse_receipt_sn)) != 0: #这两个字段不为空值
sql5 = "select id from lie_shipping_intermediate_data where goods_name = " + "'" +str(goods_name) + "'" + " and " + "warehouse_receipt_sn = " + "'" + str(warehouse_receipt_sn) + "'" + " and " + "shipment_number = " + "'" + str(shipment_number) + "'" sql5 = "select id from lie_shipping_intermediate_data where purchase_item_id = " + "'" +str(purchase_item_id) + "'" + " and " + "warehouse_receipt_sn = " + "'" + str(warehouse_receipt_sn) + "'"
cursor.execute(sql5) cursor.execute(sql5)
result5 = cursor.fetchall() result5 = cursor.fetchall()
if len(result5) != 0: if len(result5) != 0:
...@@ -133,7 +136,7 @@ def migrate_from_stock_in_item(): ...@@ -133,7 +136,7 @@ def migrate_from_stock_in_item():
'charset': 'utf8' 'charset': 'utf8'
} }
sql1 = "select stock_in_id, supplier_id, supplier_name, status, create_name, shipping_id, create_uid, shipment_number, shipping_name, purchase_uid, purchase_name from lie_stock_in where stock_in_type in (1, 2)" sql1 = "select stock_in_id, supplier_id, supplier_name, status, create_name, shipping_id, create_uid, shipment_number, shipping_name, purchase_uid, purchase_name from lie_stock_in where stock_in_type in (1, 2)"
sql2 = "select frq_id, purchase_id, stock_in_item_id, goods_id, goods_sn, goods_name, brand_id, brand_name, warehouse_receipt_sn, in_qty, out_qty, create_time, update_time from lie_stock_in_items where stock_in_id = " sql2 = "select frq_id, purchase_id, stock_in_item_id, goods_id, goods_sn, goods_name, brand_id, brand_name, warehouse_receipt_sn, in_qty, out_qty, create_time, update_time, purchase_item_id from lie_stock_in_items where stock_in_id = "
sql3 = "select erp_sn, seller_uid, seller_name from lie_frq where frq_id = " sql3 = "select erp_sn, seller_uid, seller_name from lie_frq where frq_id = "
sql4 = "select purchase_sn, erp_purchase_sn, company_id, company_name from lie_purchase_order where purchase_id = " sql4 = "select purchase_sn, erp_purchase_sn, company_id, company_name from lie_purchase_order where purchase_id = "
db = pymysql.connect(**conf) db = pymysql.connect(**conf)
...@@ -190,6 +193,7 @@ def migrate_from_stock_in_item(): ...@@ -190,6 +193,7 @@ def migrate_from_stock_in_item():
shipping_name = row[8] shipping_name = row[8]
create_time = result2[0][11] create_time = result2[0][11]
update_time = result2[0][12] update_time = result2[0][12]
purchase_item_id = result2[0][13]
purchase_uid = row[9] purchase_uid = row[9]
purchase_name = row[10] purchase_name = row[10]
value_arr = [ value_arr = [
...@@ -198,7 +202,8 @@ def migrate_from_stock_in_item(): ...@@ -198,7 +202,8 @@ def migrate_from_stock_in_item():
brand_id, brand_name, company_id, company_name, supplier_id, brand_id, brand_name, company_id, company_name, supplier_id,
supplier_name, warehouse_receipt_sn, in_qty, out_qty, supplier_name, warehouse_receipt_sn, in_qty, out_qty,
stock_in_status, create_name, shipping_id, create_uid, shipment_number, stock_in_status, create_name, shipping_id, create_uid, shipment_number,
shipping_name, create_time, update_time, purchase_uid, purchase_name, seller_uid, seller_name shipping_name, create_time, update_time, purchase_uid, purchase_name, seller_uid, seller_name,
purchase_item_id
] ]
value_str = "" value_str = ""
for i in range(len(value_arr)): for i in range(len(value_arr)):
...@@ -215,8 +220,8 @@ def migrate_from_stock_in_item(): ...@@ -215,8 +220,8 @@ def migrate_from_stock_in_item():
insert_sql = "insert into lie_shipping_intermediate_data (" + item_str + ") " + "values (" + value_str + ")" insert_sql = "insert into lie_shipping_intermediate_data (" + item_str + ") " + "values (" + value_str + ")"
#判断 goods_name + warehouse_receipt_sn 还有shipment_number的组合是否出现过 #判断 goods_name + warehouse_receipt_sn 还有shipment_number的组合是否出现过
if len(str(goods_name)) != 0 and len(str(warehouse_receipt_sn)) != 0 and len(str(shipment_number)) != 0: #这两个字段不为空值 if len(str(purchase_item_id)) != 0 and len(str(warehouse_receipt_sn)) != 0: #这两个字段不为空值
sql5 = "select id from lie_shipping_intermediate_data where goods_name = " + "'" +str(goods_name) + "'" + " and " + "warehouse_receipt_sn = " + "'" + str(warehouse_receipt_sn) + "'" + " and " + "shipment_number = " + "'" + str(shipment_number) + "'" sql5 = "select id from lie_shipping_intermediate_data where purchase_item_id = " + "'" +str(purchase_item_id) + "'" + " and " + "warehouse_receipt_sn = " + "'" + str(warehouse_receipt_sn) + "'"
cursor.execute(sql5) cursor.execute(sql5)
result5 = cursor.fetchall() result5 = cursor.fetchall()
if len(result5) != 0: if len(result5) != 0:
......
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