Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
96178db6
authored
2021-06-22 17:46:32 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add max img count
1 parent
23c4a341
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
src/apps/doc/management/commands/ocr_process.py
src/apps/doc/named_enum.py
src/apps/doc/management/commands/ocr_process.py
View file @
96178db
...
...
@@ -613,6 +613,26 @@ class Command(BaseCommand, LoggerMixin):
self
.
online_log
.
warn
(
'{0} [pdf to img failed (pdf img empty)] [task={1}]'
.
format
(
self
.
log_base
,
task_str
))
raise
Exception
(
'pdf img empty'
)
elif
img_count
>=
max_img_count
:
self
.
online_log
.
info
(
'{0} [too many pdf image] [task={1}] [img_count={2}]'
.
format
(
self
.
log_base
,
task_str
,
img_count
))
try
:
report_table
=
HILOCRReport
if
business_type
==
consts
.
HIL_PREFIX
else
AFCOCRReport
report_table
.
objects
.
create
(
case_number
=
doc
.
application_id
,
request_team
=
RequestTeam
.
get_value
(
doc
.
document_scheme
,
0
),
request_trigger
=
RequestTrigger
.
get_value
(
doc
.
data_source
,
0
),
input_file
=
doc
.
document_name
,
transaction_start
=
doc
.
start_time
,
transaction_end
=
time
.
time
(),
successful_at_this_level
=
False
,
failure_reason
=
FailureReason
.
IMG_LIMIT
.
value
,
process_name
=
ProcessName
.
ALL
.
value
,
)
except
Exception
as
e
:
self
.
online_log
.
error
(
'{0} [process error (report db save)] [error={1}]'
.
format
(
self
.
log_base
,
traceback
.
format_exc
()))
else
:
with
lock
:
todo_count_dict
[
task_str
]
=
img_count
...
...
src/apps/doc/named_enum.py
View file @
96178db
...
...
@@ -41,6 +41,7 @@ class FailureReason(NamedEnum):
PDF
=
(
0
,
'PDF处理失败'
)
EXCEL
=
(
1
,
'构建excel失败'
)
EDMS
=
(
2
,
'EDMS上传失败'
)
IMG_LIMIT
=
(
3
,
'PDF图片过多'
)
class
ProcessName
(
NamedEnum
):
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment