Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
岳巧源
/
data_server
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
cc09ad5c
authored
Aug 27, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add currency
parent
7da52229
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
handle.py
handle.py
View file @
cc09ad5c
...
...
@@ -60,12 +60,18 @@ def resolve(file_name: str, supplier_id: int):
for
i
in
range
(
len
(
df
.
index
.
values
)):
goods_name
=
str
(
df
.
loc
[
i
,
"原厂型号"
])
brand_name
=
str
(
df
.
loc
[
i
,
"品牌"
])
currency
=
str
(
df
.
loc
[
i
,
"币种"
])
if
currency
.
strip
()
==
""
or
currency
.
strip
()
==
"nan"
:
continue
currency
=
currency
.
upper
()
.
strip
()
if
goods_name
.
strip
()
==
""
or
brand_name
.
strip
()
==
""
or
goods_name
.
strip
()
==
"nan"
or
brand_name
.
strip
()
==
"nan"
:
continue
stock
=
str
(
int
(
df
.
loc
[
i
,
"库存"
]))
moq
=
str
(
int
(
df
.
loc
[
i
,
"起订量"
]))
mpq
=
str
(
int
(
df
.
loc
[
i
,
"MPQ(最小包装数量)"
]))
price_is_us
=
False
if
currency
==
"USD"
:
price_is_us
=
True
supp_id
=
int
(
supplier_id
)
supplier_name
=
""
multiple
=
str
(
int
(
df
.
loc
[
i
,
"增量"
]))
...
...
@@ -101,8 +107,12 @@ def resolve(file_name: str, supplier_id: int):
str
(
price_data
)
.
strip
()
!=
""
and
str
(
price_data
)
.
strip
()
!=
"nan"
and
str
(
price_data
)
.
strip
()
!=
"NaN"
:
item_map
=
dict
()
item_map
[
"purchases"
]
=
int
(
ladder_data
)
item_map
[
"price_us"
]
=
float
(
0
)
item_map
[
"price_cn"
]
=
float
(
price_data
)
if
price_is_us
:
item_map
[
"price_us"
]
=
float
(
price_data
)
item_map
[
"price_cn"
]
=
float
(
0
)
else
:
item_map
[
"price_us"
]
=
float
(
0
)
item_map
[
"price_cn"
]
=
float
(
price_data
)
table
[
"ladder_price"
]
.
append
(
item_map
)
ans
=
json
.
dumps
(
table
,
ensure_ascii
=
False
)
logging
.
info
(
ans
)
...
...
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