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
3d0f35b4
authored
Jul 30, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add new script
parent
7e34e35b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
waldom_data_process_USD.py
waldom_data_process_USD.py
View file @
3d0f35b4
...
...
@@ -10,12 +10,13 @@ logger = logging.getLogger('waldom_data_process_USD.py')
# Manufacturer ----------------> brand_name
# 库存相加 HIJK 列
# 加一个 multiple 列
#
#
TODO 缺少goods_sn
title_map
=
{
'Part Number'
,
'Manufacturer'
,
'Stock EMEA'
,
'Stock USA'
,
'Stock APAC'
,
'Stock CN'
,
'MOQ'
,
'Multiplier'
,
'Price Break Qty 1'
,
'Price Break Qty 2'
,
'Price Break Qty 3'
,
'Price Break Qty 4'
,
'Price Break Qty 5'
,
'Price Break Qty 6'
,
'Price Break Qty 7'
,
'Price Break Qty 8'
,
'Price Break Qty 9'
,
'Date Code'
}
ladder_map
=
{
'Price Break Qty 1'
,
'Price Break Qty 2'
,
'Price Break Qty 3'
,
...
...
@@ -29,6 +30,8 @@ class HandleCSV:
first_line
=
[]
reader
=
csv
.
reader
(
f
)
for
index
,
row
in
enumerate
(
reader
):
if
index
>
100
:
break
if
index
==
0
:
first_line
=
row
flag
=
self
.
validate
(
first_line
)
...
...
@@ -38,7 +41,6 @@ class HandleCSV:
else
:
json_str
=
self
.
generate_json
(
row
,
first_line
)
result
.
append
(
json_str
)
print
(
json_str
)
logger
.
info
(
"文件
%
s 已解析"
%
path
)
return
result
...
...
@@ -56,6 +58,7 @@ class HandleCSV:
table
[
'price_is_us'
]
=
True
table
[
'ladder_price'
]
=
[]
table
[
'supplier_name'
]
=
'Waldom美金'
table
[
'goods_sn'
]
=
''
for
i
in
range
(
len
(
title
)):
ladder_item_map
=
dict
()
if
title
[
i
]
in
title_map
:
...
...
@@ -82,6 +85,9 @@ class HandleCSV:
ladder_item_map
[
'price_us'
]
=
float
(
arr
[
i
+
1
])
ladder_item_map
[
'price_cn'
]
=
float
(
0
)
table
[
'ladder_price'
]
.
append
(
ladder_item_map
)
elif
title
[
i
]
==
'Date Code'
:
items
=
str
(
arr
[
i
])
.
split
(
sep
=
";"
)
print
(
items
)
return
json
.
dumps
(
table
,
ensure_ascii
=
False
)
if
__name__
==
'__main__'
:
...
...
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