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
9be82ba6
authored
2023-01-15 14:24:45 +0800
by
冯轩
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
MOD:比对前fsm判断
1 parent
4d22f813
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
src/apps/doc/management/commands/ocr_process.py
src/apps/doc/views.py
src/apps/doc/management/commands/ocr_process.py
View file @
9be82ba
...
...
@@ -42,6 +42,8 @@ from apps.doc.models import (
DDARecords
,
IDBCRecords
,
Configs
,
AFCCmsStatusInfo
,
HILCmsStatusInfo
,
)
from
celery_compare.tasks
import
compare
,
fsm_compare
...
...
@@ -2056,8 +2058,13 @@ class Command(BaseCommand, LoggerMixin):
self
.
log_base
,
task_str
,
res_obj
.
id
))
# 触发比对
try
:
fsm_activited
=
getattr
(
res_obj
,
'fsm_activited'
)
if
fsm_activited
:
# 是否fsm
cms_status_class
=
HILCmsStatusInfo
if
business_type
in
consts
.
HIL_SET
else
AFCCmsStatusInfo
cms_status_info
=
cms_status_class
.
objects
.
filter
(
application_id
=
doc
.
application_id
)
.
first
()
is_fsm
=
cms_status_info
and
cms_status_info
.
is_fsm
==
1
self
.
online_log
.
info
(
'{0} [isfsm] [task={1}] [true or false={2}]'
.
format
(
self
.
log_base
,
task_str
,
is_fsm
))
if
is_fsm
:
fsm_compare
.
apply_async
((
doc
.
application_id
,
business_type
,
None
,
res_obj
.
id
,
is_ca
,
True
),
queue
=
'queue_compare'
)
else
:
...
...
src/apps/doc/views.py
View file @
9be82ba
...
...
@@ -580,9 +580,12 @@ class UploadDocView(GenericView, DocHandler):
document_scheme
=
self
.
fix_scheme
(
document_scheme
)
# fsm激活状态, 更新ocr_result 表fsm状态
is_fsm
=
consts
.
FSM_ACTIVITED_STATUS
.
get
(
application_status
)
or
consts
.
FSM_BEFORE_ACTIVITED_STATUS
.
get
(
application_status
)
self
.
running_log
.
info
(
'[doc upload applicationId-{0}] [applicationStatus-{1}, activated-{2}]'
.
format
(
application_id
,
application_status
,
True
if
consts
.
FSM_ACTIVITED_STATUS
.
get
(
application_status
)
else
False
))
if
consts
.
FSM_ACTIVITED_STATUS
.
get
(
application_status
):
.
format
(
application_id
,
application_status
,
is_fsm
))
if
is_fsm
:
# fsm激活状态 0(默认):非sfm;1:激活前;2:激活后
fsm_activited
=
2
if
consts
.
FSM_ACTIVITED_STATUS
.
get
(
application_status
)
else
1
result_class
=
None
if
business_type
==
consts
.
HIL_PREFIX
:
if
document_scheme
==
RequestTeam
.
ACCEPTANCE
.
name
:
...
...
@@ -597,12 +600,12 @@ class UploadDocView(GenericView, DocHandler):
ocr_result_obj
=
result_class
.
objects
.
filter
(
application_id
=
application_id
)
.
first
()
if
ocr_result_obj
:
ocr_result_obj
.
fsm_activited
=
1
ocr_result_obj
.
fsm_activited
=
fsm_activited
ocr_result_obj
.
save
()
else
:
ocr_result_obj
=
result_class
()
ocr_result_obj
.
application_id
=
application_id
ocr_result_obj
.
fsm_activited
=
1
ocr_result_obj
.
fsm_activited
=
fsm_activited
ocr_result_obj
.
save
()
if
data_source
==
consts
.
DATA_SOURCE_LIST
[
1
]:
...
...
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