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
0315fcf9
authored
Jun 28, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
migrate
parent
8f59f1ef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
4 deletions
migrate.py
migrate.py
View file @
0315fcf9
...
@@ -10,12 +10,46 @@ def migrate_from_lie_scm_order():
...
@@ -10,12 +10,46 @@ def migrate_from_lie_scm_order():
'db'
:
"liexin_purchase"
,
'db'
:
"liexin_purchase"
,
'charset'
:
'utf8'
'charset'
:
'utf8'
}
}
sql1
=
"select "
#先获取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 from lie_scm_order"
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
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
()
cursor
.
execute
(
sql1
)
cursor
.
execute
(
sql1
)
result1
=
cursor
.
fetchall
()
result1
=
cursor
.
fetchall
()
#sql的执行结果
for
row
in
result1
:
source_type
=
2
#---------------------------
source_id
=
row
[
0
]
#------------------------
purchase_id
=
row
[
2
]
purchase_item_id
=
str
(
row
[
1
])
tmp_sql2
=
sql2
+
purchase_item_id
cursor
.
execute
(
tmp_sql2
)
result2
=
cursor
.
fetchall
()
#第二条sql的执行结果
if
len
(
result2
)
==
0
:
continue
frq_id
=
result2
[
0
][
0
]
tmp_sql3
=
sql3
+
str
(
frq_id
)
cursor
.
execute
(
tmp_sql3
)
result3
=
cursor
.
fetchall
()
if
len
(
result3
)
==
0
:
continue
erp_sn
=
result3
[
0
][
0
]
kingdee_sales_order_no
=
str
(
erp_sn
)
#------------------------
tmp_sql4
=
sql4
+
str
(
purchase_id
)
cursor
.
execute
(
tmp_sql4
)
result4
=
cursor
.
fetchall
()
if
len
(
result4
)
==
0
:
continue
purchase_sn
=
result4
[
0
][
0
]
#-------------------------------
erp_purchase_sn
=
result4
[
0
][
1
]
kingdee_purchase_order_no
=
erp_purchase_sn
#--------------------------------
company_id
=
result4
[
0
][
2
]
#---------------------------
company_name
=
result4
[
0
][
3
]
#---------------------------
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
pass
migrate_from_lie_scm_order
()
\ No newline at end of file
\ No newline at end of file
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