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
cd132135
authored
Aug 28, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add new script
parent
156a8346
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
6 deletions
handle.py
handle.py
View file @
cd132135
...
@@ -23,10 +23,10 @@ title_arr = [
...
@@ -23,10 +23,10 @@ title_arr = [
"封装"
"封装"
]
]
logging
.
basicConfig
(
level
=
logging
.
INFO
,
#
logging.basicConfig(level=logging.INFO,
filename
=
log_path
,
#
filename=log_path,
format
=
'
%(asctime)
s -
%(filename)
s[line:
%(lineno)
d] -
%(levelname)
s:
%(message)
s'
#
format='%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s'
)
#
)
class
Producer
:
class
Producer
:
def
__init__
(
self
):
def
__init__
(
self
):
...
@@ -55,6 +55,8 @@ class Producer:
...
@@ -55,6 +55,8 @@ class Producer:
"""判断传入的字符串是不是数字"""
"""判断传入的字符串是不是数字"""
def
is_number
(
s
:
str
):
def
is_number
(
s
:
str
):
if
s
.
lower
()
==
"nan"
:
return
False
try
:
try
:
float
(
s
)
float
(
s
)
return
True
return
True
...
@@ -82,20 +84,32 @@ def resolve(file_name: str, supplier_id: int):
...
@@ -82,20 +84,32 @@ def resolve(file_name: str, supplier_id: int):
continue
continue
if
goods_name
.
strip
()
==
""
or
brand_name
.
strip
()
==
""
or
goods_name
.
strip
()
==
"nan"
or
brand_name
.
strip
()
==
"nan"
:
if
goods_name
.
strip
()
==
""
or
brand_name
.
strip
()
==
""
or
goods_name
.
strip
()
==
"nan"
or
brand_name
.
strip
()
==
"nan"
:
continue
continue
if
not
is_number
(
str
(
df
.
loc
[
i
,
"库存"
])):
stock
=
"0"
else
:
stock
=
str
(
int
(
df
.
loc
[
i
,
"库存"
]))
stock
=
str
(
int
(
df
.
loc
[
i
,
"库存"
]))
if
not
is_number
(
str
(
df
.
loc
[
i
,
"起订量"
])):
moq
=
"1"
else
:
moq
=
str
(
int
(
df
.
loc
[
i
,
"起订量"
]))
moq
=
str
(
int
(
df
.
loc
[
i
,
"起订量"
]))
if
not
is_number
(
str
(
df
.
loc
[
i
,
"MPQ(最小包装数量)"
])):
mpq
=
"0"
else
:
mpq
=
str
(
int
(
df
.
loc
[
i
,
"MPQ(最小包装数量)"
]))
mpq
=
str
(
int
(
df
.
loc
[
i
,
"MPQ(最小包装数量)"
]))
if
not
is_number
(
str
(
df
.
loc
[
i
,
"增量"
])):
multiple
=
"1"
else
:
multiple
=
str
(
int
(
df
.
loc
[
i
,
"增量"
]))
price_is_us
=
False
price_is_us
=
False
if
currency
==
"USD"
:
if
currency
==
"USD"
:
price_is_us
=
True
price_is_us
=
True
supp_id
=
int
(
supplier_id
)
supp_id
=
int
(
supplier_id
)
supplier_name
=
""
supplier_name
=
""
multiple
=
str
(
int
(
df
.
loc
[
i
,
"增量"
]))
batch_sn
=
{
batch_sn
=
{
str
(
df
.
loc
[
i
,
"批次"
]):
int
(
df
.
loc
[
i
,
"库存"
]),
str
(
df
.
loc
[
i
,
"批次"
]):
int
(
df
.
loc
[
i
,
"库存"
]),
}
}
eccn
=
""
eccn
=
""
if
str
(
df
.
loc
[
i
,
"批次"
])
.
strip
()
==
""
:
if
str
(
df
.
loc
[
i
,
"批次"
])
.
strip
()
==
""
or
str
(
df
.
loc
[
i
,
"批次"
])
.
strip
()
==
"nan"
:
batch_sn
=
{}
batch_sn
=
{}
table
=
{
table
=
{
"goods_name"
:
goods_name
,
"goods_name"
:
goods_name
,
...
...
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