Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
岳巧源
/
europa-erp-python
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
40fb380a
authored
Sep 18, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
cn
parent
f248e7ab
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
rs_data.py
rs_data.py
View file @
40fb380a
...
...
@@ -51,10 +51,10 @@ def handle_hk_csv(file_name):
ladder_number
=
[]
ladder_price
=
[]
prices
=
[]
for
i
in
range
(
len
(
row
)):
message_map
[
'batch_sn'
]
=
{}
message_map
[
'eccn'
]
=
''
message_map
[
'goods_details'
]
=
''
for
i
in
range
(
len
(
row
)):
if
title
[
i
]
==
'DistributorPartNumber'
:
# TODO origin goods_sn + supplier_id
message_map
[
"goods_sn"
]
=
str
(
row
[
i
])
+
"_"
...
...
@@ -93,26 +93,29 @@ def handle_hk_csv(file_name):
def
handle_cn_csv
(
file_name
):
"""handle the RMB file"""
with
open
(
file_name
,
errors
=
'ignore'
)
as
f
:
reader
=
csv
.
reader
(
f
)
with
open
(
file_name
,
mode
=
'r'
,
errors
=
'ignore'
)
as
f
:
reader
=
f
.
readlines
(
)
title
=
[]
for
index
,
row
in
enumerate
(
reader
):
for
j
in
range
(
len
(
reader
)
):
# TODO remember to delete this code.
if
index
>
10
:
if
j
>
10
:
break
if
index
==
0
:
data
=
reader
[
j
]
data
=
data
.
replace
(
"
\n
"
,
''
)
row
=
data
.
split
(
sep
=
'
\t
'
)
if
j
==
0
:
title
=
row
continue
message_map
=
dict
()
ladder_number
=
[]
ladder_price
=
[]
prices
=
[]
for
i
in
range
(
len
(
row
)):
message_map
[
'batch_sn'
]
=
{}
message_map
[
'eccn'
]
=
''
message_map
[
'goods_details'
]
=
''
for
i
in
range
(
len
(
row
)):
if
title
[
i
]
==
'DistributorPartNumber'
:
# TODO origin goods_sn + supplier_id
message_map
[
"goods_sn"
]
=
str
(
row
[
i
])
+
"_"
if
title
[
i
]
==
'ManufacturerPartNumber'
:
message_map
[
'goods_name'
]
=
str
(
row
[
i
])
...
...
@@ -134,7 +137,7 @@ def handle_cn_csv(file_name):
if
row
[
i
]
==
''
or
len
(
row
[
i
])
==
0
:
continue
prices
.
append
(
row
[
i
])
for
i
in
range
(
min
(
len
(
ladder_number
),
len
(
prices
))):
for
k
in
range
(
min
(
len
(
ladder_number
),
len
(
prices
))):
item_map
=
dict
()
item_map
[
"purchases"
]
=
int
(
ladder_number
[
i
])
item_map
[
"price_us"
]
=
float
(
0
)
...
...
@@ -155,6 +158,10 @@ def handle_cn_csv(file_name):
if
__name__
==
'__main__'
:
environment
=
sys
.
argv
[
1
]
if
environment
not
in
{
"local"
,
"dev"
,
"prod"
}:
...
...
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