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
325a8d95
authored
Aug 29, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add sku_file_id
parent
c301d52c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
handle.py
server.py
handle.py
View file @
325a8d95
...
...
@@ -70,7 +70,7 @@ def is_number(s: str):
pass
return
False
def
resolve
(
file_name
:
str
,
supplier_id
:
int
):
def
resolve
(
file_name
:
str
,
supplier_id
:
int
,
sku_file_id
:
int
):
producer
=
Producer
()
df
=
pd
.
read_excel
(
file_name
,
sheet_name
=
0
)
for
i
in
range
(
len
(
df
.
index
.
values
)):
...
...
@@ -124,7 +124,8 @@ def resolve(file_name: str, supplier_id: int):
"batch_sn"
:
batch_sn
,
"ladder_price"
:
[],
"goods_sn"
:
""
,
"mpq"
:
mpq
"mpq"
:
mpq
,
"sku_file_id"
:
int
(
sku_file_id
),
}
normal_text
=
(
goods_name
+
brand_name
+
str
(
supplier_id
)
+
str
(
df
.
loc
[
i
,
"封装"
])
+
str
(
df
.
loc
[
i
,
"批次"
]))
.
lower
()
md
=
hashlib
.
md5
(
normal_text
.
encode
())
...
...
@@ -152,7 +153,7 @@ def resolve(file_name: str, supplier_id: int):
producer
.
close
()
def
process
(
url
:
str
,
supplier_id
:
int
):
def
process
(
url
:
str
,
supplier_id
:
int
,
sku_file_id
:
int
):
# http://erp.liexindev.net/sku/20240823/p6jMKaPtjMpNnZMK5vEX3KEQf7Gdvgvw3TCA7d6b.xls
abs_path
=
""
try
:
...
...
@@ -163,7 +164,7 @@ def process(url: str, supplier_id: int):
abs_path
=
absolute_path
with
open
(
absolute_path
,
"wb"
)
as
f
:
f
.
write
(
response
.
content
)
resolve
(
absolute_path
,
supplier_id
)
resolve
(
absolute_path
,
supplier_id
,
sku_file_id
)
except
Exception
as
e
:
logging
.
error
(
e
)
finally
:
...
...
server.py
View file @
325a8d95
...
...
@@ -10,7 +10,8 @@ def callback(ch, method, properties, body):
url
=
str
(
data
[
"file_address"
])
url
=
url
.
replace
(
"
\\
"
,
""
)
supplier_id
=
data
[
"supplier_id"
]
handle
.
process
(
url
,
supplier_id
)
sku_file_id
=
data
[
"sku_file_id"
]
handle
.
process
(
url
,
supplier_id
,
sku_file_id
)
except
Exception
as
e
:
print
(
e
)
ch
.
basic_ack
(
delivery_tag
=
method
.
delivery_tag
)
...
...
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