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
421da294
authored
2022-11-07 18:00:26 +0800
by
王聪
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
pos 3045 update
1 parent
feecd311
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
13 deletions
src/pos/views.py
src/pos/views.py
View file @
421da29
...
...
@@ -4,7 +4,7 @@ from webargs import fields, validate
from
apps.doc.views
import
CustomDecimal
,
CustomDate
from
common
import
response
from
apps.doc.models
import
HILSEOCRResult
,
HILOCRResult
,
AFCSEOCRResult
,
AFCOCRResult
from
apps.doc
import
consts
from
prese
import
consts
params
=
{
'invoiceCode'
:
fields
.
Str
(
required
=
True
,
validate
=
validate
.
Length
(
max
=
128
)),
...
...
@@ -14,11 +14,11 @@ params = {
"buyerId"
:
fields
.
Int
(
required
=
True
),
'vin'
:
fields
.
Str
(
required
=
True
,
validate
=
validate
.
Length
(
max
=
128
)),
'dealer'
:
fields
.
Str
(
required
=
False
,
validate
=
validate
.
Length
(
max
=
64
)),
'priceWithVat'
:
CustomDecimal
(
required
=
Fals
e
),
'priceWithVat'
:
CustomDecimal
(
required
=
Tru
e
),
'priceNoVat'
:
CustomDecimal
(
required
=
True
),
'priceInCapitals'
:
fields
.
Str
(
required
=
False
),
'vat'
:
CustomDecimal
(
required
=
True
),
'vatRate'
:
CustomDecimal
(
required
=
Tru
e
),
'vatRate'
:
CustomDecimal
(
required
=
Fals
e
),
}
input_args
=
{
...
...
@@ -75,19 +75,31 @@ class DeMortgageView(GenericView):
*
consts
.
CA_ADD_COMPARE_FIELDS_PRE
)
.
first
()
ocr_res_dict
=
result_class
.
objects
.
filter
(
application_id
=
application_id
)
.
values
(
*
consts
.
PRE_COMPARE_FIELDS
)
.
first
()
if
ocr_res_dict
is
None
:
return
get_empty_result
()
#
if ocr_res_dict is None:
#
return get_empty_result()
id_res_list
=
[]
for
field_name
in
consts
.
CA_ADD_COMPARE_FIELDS_PRE
:
if
field_name
==
consts
.
IC_OCR_FIELD
:
id_res_list
.
append
(
ca_ocr_res_dict
.
get
(
field_name
)
if
isinstance
(
ca_ocr_res_dict
,
dict
)
else
None
)
id_res_list
.
append
(
ocr_res_dict
.
get
(
field_name
))
ic_res_list
=
[]
ic_res_list
.
append
(
ca_ocr_res_dict
.
get
(
consts
.
IC_OCR_FIELD
)
if
isinstance
(
ca_ocr_res_dict
,
dict
)
else
None
)
ic_res_list
.
append
(
ocr_res_dict
.
get
(
consts
.
IC_OCR_FIELD
)
if
isinstance
(
ca_ocr_res_dict
,
dict
)
else
None
)
field_name
,
compare_logic
,
args
,
comment
=
consts
.
ID_COMPARE_LOGIC
.
get
(
consts
.
ID_FIELDS
[
0
])
for
ic_res
in
ic_res_list
:
if
ic_res
:
value
=
ic_res
.
get
(
field_name
,
''
)
compare_logic
result
=
{
"is_pass"
:
True
,
"customer_name"
:
True
,
"application_entity"
:
True
,
"de_mortgage_date"
:
True
"fields"
:
[{
"name"
:
""
,
"input"
:
"张三"
,
"ocr"
:
"张三"
,
"field_is_pass"
:
True
,
"comments"
:
"身份证姓名与系统不一致"
}]
# "customer_name": True,
# "application_entity": True,
# "de_mortgage_date": True
}
return
response
.
ok
(
data
=
result
)
...
...
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