Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
岳巧源
/
my-awesome-project
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5ec59bcc
authored
Jul 01, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add field
parent
7a3affaf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
migrate.py
migrate.py
View file @
5ec59bcc
...
@@ -5,7 +5,7 @@ item = ["source_type", "source_id", "kingdee_sales_order_no", "purchase_sn",
...
@@ -5,7 +5,7 @@ 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"
"create_time"
,
"update_time"
,
"purchase_uid"
,
"purchase_name"
,
"seller_uid"
,
"seller_name"
]
]
item_str
=
""
item_str
=
""
separator
=
", "
separator
=
", "
...
@@ -27,7 +27,7 @@ def migrate_from_lie_scm_order():
...
@@ -27,7 +27,7 @@ def migrate_from_lie_scm_order():
#先获取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 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 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 = "
db
=
pymysql
.
connect
(
**
conf
)
db
=
pymysql
.
connect
(
**
conf
)
cursor
=
db
.
cursor
()
cursor
=
db
.
cursor
()
...
@@ -50,6 +50,8 @@ def migrate_from_lie_scm_order():
...
@@ -50,6 +50,8 @@ def migrate_from_lie_scm_order():
if
len
(
result3
)
==
0
:
if
len
(
result3
)
==
0
:
continue
continue
erp_sn
=
result3
[
0
][
0
]
erp_sn
=
result3
[
0
][
0
]
seller_uid
=
result3
[
0
][
1
]
seller_name
=
result3
[
0
][
2
]
kingdee_sales_order_no
=
str
(
erp_sn
)
#------------------------
kingdee_sales_order_no
=
str
(
erp_sn
)
#------------------------
tmp_sql4
=
sql4
+
str
(
purchase_id
)
tmp_sql4
=
sql4
+
str
(
purchase_id
)
cursor
.
execute
(
tmp_sql4
)
cursor
.
execute
(
tmp_sql4
)
...
@@ -87,7 +89,7 @@ def migrate_from_lie_scm_order():
...
@@ -87,7 +89,7 @@ def migrate_from_lie_scm_order():
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
shipping_name
,
create_time
,
update_time
,
purchase_uid
,
purchase_name
,
seller_uid
,
seller_name
]
]
value_str
=
""
value_str
=
""
for
i
in
range
(
len
(
value_arr
)):
for
i
in
range
(
len
(
value_arr
)):
...
@@ -133,7 +135,7 @@ def migrate_from_stock_in_item():
...
@@ -133,7 +135,7 @@ def migrate_from_stock_in_item():
}
}
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 from lie_stock_in_items where stock_in_id = "
sql3
=
"select erp_sn 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
)
cursor
=
db
.
cursor
()
cursor
=
db
.
cursor
()
...
@@ -154,6 +156,8 @@ def migrate_from_stock_in_item():
...
@@ -154,6 +156,8 @@ def migrate_from_stock_in_item():
if
len
(
result3
)
==
0
:
if
len
(
result3
)
==
0
:
continue
continue
erp_sn
=
result3
[
0
][
0
]
erp_sn
=
result3
[
0
][
0
]
seller_uid
=
result3
[
0
][
1
]
seller_name
=
result3
[
0
][
2
]
kingdee_sales_order_no
=
erp_sn
kingdee_sales_order_no
=
erp_sn
source_type
=
1
source_type
=
1
tmp_sql4
=
sql4
+
str
(
purchase_id
)
tmp_sql4
=
sql4
+
str
(
purchase_id
)
...
@@ -195,7 +199,7 @@ def migrate_from_stock_in_item():
...
@@ -195,7 +199,7 @@ 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
shipping_name
,
create_time
,
update_time
,
purchase_uid
,
purchase_name
,
seller_uid
,
seller_name
]
]
value_str
=
""
value_str
=
""
for
i
in
range
(
len
(
value_arr
)):
for
i
in
range
(
len
(
value_arr
)):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment