Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tool-code
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
tool-code
Commits
5adb0e1f
Commit
5adb0e1f
authored
Dec 08, 2021
by
rico.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add while
parent
102318a3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
3 deletions
+21
-3
更新库内产品数据.py
更新库内参数并重新命名/更新库内产品数据.py
+21
-3
No files found.
更新库内参数并重新命名/更新库内产品数据.py
View file @
5adb0e1f
...
@@ -75,7 +75,7 @@ def dael_name_content(skuname,brand):
...
@@ -75,7 +75,7 @@ def dael_name_content(skuname,brand):
return
res
.
strip
()
return
res
.
strip
()
def
upload_params_data
(
category
,
path
):
def
upload_params_data
(
category
,
path
,
record_code_list
):
df
=
pd
.
read_excel
(
path
,
converters
=
{
'产品编码'
:
str
})
df
=
pd
.
read_excel
(
path
,
converters
=
{
'产品编码'
:
str
})
...
@@ -133,6 +133,8 @@ def upload_params_data(category,path):
...
@@ -133,6 +133,8 @@ def upload_params_data(category,path):
process_index
=
0
process_index
=
0
index_
=
Index
()
index_
=
Index
()
#SPU、SKU命名
#SPU、SKU命名
for
index
,
row
in
df
.
iterrows
():
for
index
,
row
in
df
.
iterrows
():
try
:
try
:
...
@@ -141,6 +143,9 @@ def upload_params_data(category,path):
...
@@ -141,6 +143,9 @@ def upload_params_data(category,path):
print
(
index_
(
process_index
,
1
),
end
=
'
%
'
)
print
(
index_
(
process_index
,
1
),
end
=
'
%
'
)
process_index
+=
1
process_index
+=
1
try
:
sku
=
row
[
'产品编码'
]
sku
=
row
[
'产品编码'
]
brandname
=
row
[
'产品品牌'
]
brandname
=
row
[
'产品品牌'
]
try
:
try
:
...
@@ -150,6 +155,8 @@ def upload_params_data(category,path):
...
@@ -150,6 +155,8 @@ def upload_params_data(category,path):
print
(
f
"异常品牌: {brandname},请检查产品品牌表"
)
print
(
f
"异常品牌: {brandname},请检查产品品牌表"
)
break
break
if
sku
in
record_code_list
:
continue
cursor_zi_new
.
execute
(
f
"select pid from p_brand where id = {brand_code}"
)
cursor_zi_new
.
execute
(
f
"select pid from p_brand where id = {brand_code}"
)
father_brand_code
=
cursor_zi_new
.
fetchone
()[
0
]
father_brand_code
=
cursor_zi_new
.
fetchone
()[
0
]
...
@@ -477,9 +484,14 @@ def upload_params_data(category,path):
...
@@ -477,9 +484,14 @@ def upload_params_data(category,path):
check_df
=
pd
.
DataFrame
(
data
,
columns
=
[
tuple
[
0
]
for
tuple
in
cursor_zi_new
.
description
])
check_df
=
pd
.
DataFrame
(
data
,
columns
=
[
tuple
[
0
]
for
tuple
in
cursor_zi_new
.
description
])
if
check_df
.
empty
:
if
check_df
.
empty
:
cursor_zi_new
.
execute
(
f
"insert into p_valuemap (spuid,valueid) values ({spuid}, {valueid})"
)
cursor_zi_new
.
execute
(
f
"insert into p_valuemap (spuid,valueid) values ({spuid}, {valueid})"
)
record_code_list
.
append
(
sku
)
except
:
print
(
"处理异常请重跑"
)
return
False
,
record_code_list
conn_zi_new
.
close
()
conn_zi_new
.
close
()
print
(
f
"{category}参数数据更新完成,命名完成"
)
print
(
f
"{category}参数数据更新完成,命名完成"
)
return
True
,
record_code_list
def
get_configure_price
():
def
get_configure_price
():
#获取配件价格
#获取配件价格
...
@@ -566,8 +578,15 @@ def check_configure_price(category,path,params_list):
...
@@ -566,8 +578,15 @@ def check_configure_price(category,path,params_list):
category
=
'复印纸'
category
=
'复印纸'
path
=
'/Users/rico/WorkSpace/1_Project/Company/中电中采/4_中电商品库功能类/更新库内参数并重新命名/复印纸参数确认(校验通过).xlsx'
path
=
'/Users/rico/WorkSpace/1_Project/Company/中电中采/4_中电商品库功能类/更新库内参数并重新命名/复印纸参数确认(校验通过).xlsx'
record_code_list
=
[]
flag
,
return_record_code_list
=
upload_params_data
(
category
,
path
,
record_code_list
)
while
not
flag
:
flag
,
return_record_code_list
=
upload_params_data
(
category
,
path
,
return_record_code_list
)
upload_params_data
(
category
,
path
)
#params_list = ['CPU型号', '产品子系列', '产品系列', '内存容量', '固态硬盘容量', '屏幕尺寸', '操作系统', '显存容量', '机械硬盘容量', '质保时间']
#params_list = ['CPU型号', '产品子系列', '产品系列', '内存容量', '固态硬盘容量', '屏幕尺寸', '操作系统', '显存容量', '机械硬盘容量', '质保时间']
#check_configure_price(category,path,params_list)
#check_configure_price(category,path,params_list)
\ 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