Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
岳巧源
/
python_script
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
8da26578
authored
Jul 31, 2024
by
larosa
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add str
parent
b53035f6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
waldom_data_process_RMB.py
waldom_data_process_USD.py
waldom_data_process_RMB.py
View file @
8da26578
...
...
@@ -74,9 +74,9 @@ class HandleCSV:
ladder_item_map
=
dict
()
data
=
df
.
loc
[
i
,
title_arr
[
j
]]
if
title_arr
[
j
]
==
'Manufacturer Name'
:
table
[
'brand_name'
]
=
data
table
[
'brand_name'
]
=
str
(
data
)
elif
title_arr
[
j
]
==
'Part Number'
:
table
[
'goods_name'
]
=
data
table
[
'goods_name'
]
=
str
(
data
)
elif
title_arr
[
j
]
==
'Stock EMEA'
or
\
title_arr
[
j
]
==
'Stock USA'
or
\
title_arr
[
j
]
==
'Stock APAC'
or
\
...
...
@@ -110,6 +110,8 @@ class HandleCSV:
else
:
batch_sn_map
[
key
]
=
int
(
value
)
table
[
'batch_sn'
]
=
batch_sn_map
# 统一字符串处理
table
[
'stock'
]
=
str
(
table
[
'stock'
])
json_str
=
json
.
dumps
(
table
,
ensure_ascii
=
False
)
self
.
push_to_mq
(
json_str
)
print
(
json_str
)
...
...
waldom_data_process_USD.py
View file @
8da26578
...
...
@@ -78,9 +78,9 @@ class HandleCSV:
ladder_item_map
=
dict
()
if
title
[
i
]
in
title_map
:
if
title
[
i
]
==
'Part Number'
:
table
[
'goods_name'
]
=
arr
[
i
]
table
[
'goods_name'
]
=
str
(
arr
[
i
])
elif
title
[
i
]
==
'Manufacturer'
:
table
[
'brand_name'
]
=
arr
[
i
]
table
[
'brand_name'
]
=
str
(
arr
[
i
])
elif
title
[
i
]
==
'Stock EMEA'
or
\
title
[
i
]
==
'Stock USA'
or
\
title
[
i
]
==
'Stock APAC'
or
\
...
...
@@ -91,9 +91,9 @@ class HandleCSV:
else
:
table
[
'stock'
]
+=
int
(
arr
[
i
])
elif
title
[
i
]
==
'MOQ'
:
table
[
'moq'
]
=
arr
[
i
]
table
[
'moq'
]
=
str
(
arr
[
i
])
elif
title
[
i
]
==
'Multiplier'
:
table
[
'multiple'
]
=
arr
[
i
]
table
[
'multiple'
]
=
str
(
arr
[
i
])
elif
title
[
i
]
in
ladder_map
:
if
len
(
str
(
arr
[
i
])
.
strip
())
!=
0
:
ladder_item_map
[
'purchases'
]
=
int
(
arr
[
i
])
...
...
@@ -116,6 +116,8 @@ class HandleCSV:
else
:
batch_sn_map
[
key
]
=
int
(
value
)
table
[
'batch_sn'
]
=
batch_sn_map
# 统一字符串处理
table
[
'stock'
]
=
str
(
table
[
'stock'
])
return
json
.
dumps
(
table
,
ensure_ascii
=
False
)
def
push_to_mq
(
self
,
msg
:
str
):
...
...
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