Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
matchSKUWithDB
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ZGC_INDEX
matchSKUWithDB
Commits
05c9571f
Commit
05c9571f
authored
Feb 12, 2020
by
rico.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add op
parent
04f40546
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
matchSKU.py
matchSKU.py
+17
-6
No files found.
matchSKU.py
View file @
05c9571f
...
@@ -49,15 +49,26 @@ def matchSKU(sku_list,frm):
...
@@ -49,15 +49,26 @@ def matchSKU(sku_list,frm):
conn
.
commit
()
conn
.
commit
()
print
(
'正在获取当前库中所有sku,请稍等.....'
)
#获取库中所有的SKU,以供检查
print
(
'正在获取当前库中所有sku,请稍等.....'
)
#获取库中所有的SKU,以供检查
try
:
try
:
get_all_sku
=
f
"select
*
from productcode_sku where frm in {frm} and productcode not like '78
%
' "
get_all_sku
=
f
"select
productcode,sku
from productcode_sku where frm in {frm} and productcode not like '78
%
' "
cursor
.
execute
(
get_all_sku
)
cursor
.
execute
(
get_all_sku
)
data_sku
=
(
cursor
.
fetchall
())
data_sku
=
(
cursor
.
fetchall
())
data_sku_file
=
pd
.
DataFrame
(
data_sku
,
columns
=
[
'
id'
,
'productcode'
,
'sku'
,
'skuname'
,
'createddate'
,
'frm
'
])
data_sku_file
=
pd
.
DataFrame
(
data_sku
,
columns
=
[
'
productcode'
,
'sku
'
])
except
:
except
:
get_all_sku
=
f
"select
*
from productcode_sku where frm='{frm}' and productcode not like '78
%
' "
get_all_sku
=
f
"select
productcode,sku
from productcode_sku where frm='{frm}' and productcode not like '78
%
' "
cursor
.
execute
(
get_all_sku
)
cursor
.
execute
(
get_all_sku
)
data_sku
=
(
cursor
.
fetchall
())
data_sku
=
(
cursor
.
fetchall
())
data_sku_file
=
pd
.
DataFrame
(
data_sku
,
columns
=
[
'id'
,
'productcode'
,
'sku'
,
'skuname'
,
'createddate'
,
'frm'
])
data_sku_file
=
pd
.
DataFrame
(
data_sku
,
columns
=
[
'productcode'
,
'sku'
])
#获取op_productcode_sku
if
frm
==
'SN'
:
frm
=
'SN-NEW'
get_all_sku
=
f
"select productcode,sku from op_product_sku where frm='{frm}' and productcode not like '78
%
' "
cursor
.
execute
(
get_all_sku
)
data_sku
=
(
cursor
.
fetchall
())
data_sku_file_op
=
pd
.
DataFrame
(
data_sku
,
columns
=
[
'productcode'
,
'sku'
])
data_sku_file
=
pd
.
concat
([
data_sku_file
,
data_sku_file_op
])
.
drop_duplicates
()
print
(
'sku获取完毕'
)
print
(
'sku获取完毕'
)
conn
.
close
()
conn
.
close
()
...
@@ -74,7 +85,7 @@ def matchSKU(sku_list,frm):
...
@@ -74,7 +85,7 @@ def matchSKU(sku_list,frm):
sku_check
[
f
'{sku}'
]
=
'2'
#匹配上多个SKU,属于问题数据
sku_check
[
f
'{sku}'
]
=
'2'
#匹配上多个SKU,属于问题数据
else
:
else
:
if
frm
==
'SN'
:
if
frm
==
'SN'
or
frm
==
'SN-NEW'
:
sku_add
=
'0000000000/'
+
str
(
sku
)
sku_add
=
'0000000000/'
+
str
(
sku
)
if
str
(
sku_add
)
in
list
(
data_sku_file
[
'sku'
]):
if
str
(
sku_add
)
in
list
(
data_sku_file
[
'sku'
]):
try
:
try
:
...
...
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