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
8c04b90c
authored
Jun 28, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
sql
parent
a5fcf3de
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
migrate.py
migrate.py
View file @
8c04b90c
...
...
@@ -95,15 +95,27 @@ def migrate_from_lie_scm_order():
if
len
(
str
(
value_arr
[
i
]))
==
0
:
value_str
=
value_str
+
"''"
+
", "
continue
value_str
=
value_str
+
str
(
value_arr
[
i
])
+
", "
value_str
=
value_str
+
"'"
+
str
(
value_arr
[
i
])
+
"'"
+
", "
else
:
if
len
(
str
(
value_arr
[
i
]))
==
0
:
value_str
=
value_str
+
"''"
continue
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
+
")"
#判断 goods_name + warehouse_receipt_sn 的组合是否出现过 没出现就
if
len
(
str
(
goods_name
))
!=
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
)
+
"'"
cursor
.
execute
(
sql5
)
result5
=
cursor
.
fetchall
()
if
len
(
result5
)
!=
0
:
continue
#组合已存在 跳过插入
print
(
insert_sql
)
try
:
cursor
.
execute
(
insert_sql
)
db
.
commit
()
except
Exception
as
e
:
db
.
rollback
()
print
(
e
)
if
__name__
==
'__main__'
:
migrate_from_lie_scm_order
()
...
...
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