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
0e4f556d
authored
Sep 21, 2024
by
larosa
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add exception handle
parent
b4df46bb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
rs_data.py
rs_data.py
View file @
0e4f556d
...
...
@@ -216,19 +216,20 @@ if __name__ == '__main__':
os
.
makedirs
(
extract_dir
)
"""unzip the zip file"""
file_handle
.
unzip
(
conf_environment
[
"tmp_file_path"
]
+
local_file_name_1
,
extract_dir
)
file_handle
.
unzip
(
conf_environment
[
"tmp_file_path"
]
+
local_file_name_3
,
extract_dir
)
"""handle the file and then post to rabbitmq"""
rs_hk_supplier_id
=
get_supplier_id
(
supplier_name
=
'Rs'
,
conf
=
conf_environment
)
rs_cn_supplier_id
=
get_supplier_id
(
supplier_name
=
'RS-CN'
,
conf
=
conf_environment
)
if
rs_cn_supplier_id
==
-
1
or
rs_hk_supplier_id
==
-
1
:
sys
.
exit
(
"can't query the correct supplier id."
)
handle_hk_csv
(
extract_dir
+
handle_file_name_1
,
conf_environment
,
rs_hk_supplier_id
)
handle_cn_csv
(
extract_dir
+
handle_file_name_3
,
conf_environment
,
rs_cn_supplier_id
)
try
:
file_handle
.
unzip
(
conf_environment
[
"tmp_file_path"
]
+
local_file_name_1
,
extract_dir
)
file_handle
.
unzip
(
conf_environment
[
"tmp_file_path"
]
+
local_file_name_3
,
extract_dir
)
"""handle the file and then post to rabbitmq"""
rs_hk_supplier_id
=
get_supplier_id
(
supplier_name
=
'Rs'
,
conf
=
conf_environment
)
rs_cn_supplier_id
=
get_supplier_id
(
supplier_name
=
'RS-CN'
,
conf
=
conf_environment
)
if
rs_cn_supplier_id
==
-
1
or
rs_hk_supplier_id
==
-
1
:
sys
.
exit
(
"can't query the correct supplier id."
)
handle_hk_csv
(
extract_dir
+
handle_file_name_1
,
conf_environment
,
rs_hk_supplier_id
)
handle_cn_csv
(
extract_dir
+
handle_file_name_3
,
conf_environment
,
rs_cn_supplier_id
)
except
Exception
as
e
:
print
(
e
)
"""remove the temp file, close the connection"""
remove
(
extract_dir
+
handle_file_name_1
)
remove
(
extract_dir
+
handle_file_name_3
)
...
...
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