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
8d69a62d
authored
2020-11-05 21:16:23 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix vat
1 parent
82e0a207
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
22 deletions
src/apps/doc/consts.py
src/apps/doc/management/commands/ocr_process.py
src/apps/doc/ocr/wb.py
src/apps/doc/consts.py
View file @
8d69a62
...
...
@@ -720,30 +720,30 @@ MVI_FIELD_ORDER = (('发票代码', '发票代码'),
(
'发票类型'
,
'发票联'
),
(
'购方名称'
,
'购买方名称'
),
(
'购买方身份证号或组织机构代码'
,
'购买方证件号码'
),
(
'
纳税人识别号'
,
'纳税人识别号'
),
# nodo
(
'
购方纳税人识别号'
,
'纳税人识别号'
),
(
'车辆识别代码'
,
'车架号'
),
(
'价税合计小写'
,
'价税合计小写'
),
(
'销方名称'
,
'销货单位名称'
),
(
'增值税税额'
,
'增值税税额'
),
(
'增值税税率'
,
'增值税税率'
),
# nodo
(
'
发票章有无'
,
'发票章有无'
),
# nodo 全国统一发票监制章 销售单位章
(
'价税合计大写'
,
'价税合计大写'
),
# nodo
(
'增值税税率'
,
'增值税税率'
),
(
'
销售单位章'
,
'发票章有无'
),
(
'价税合计大写'
,
'价税合计大写'
),
(
''
,
None
),
(
'发动机号码'
,
'发动机号'
),
(
'车辆类型'
,
'车辆类型'
),
# nodo
(
'厂牌型号'
,
'厂牌型号'
),
# nodo
(
'产地'
,
'产地'
),
# nodo
(
'合格证号'
,
'合格证号'
),
# nodo
(
'进口证明书号'
,
'进口证明书号'
),
# nodo
(
'商检单号'
,
'商检单号'
),
# nodo
(
'电话'
,
'电话'
),
# nodo
(
'车辆类型'
,
'车辆类型'
),
(
'厂牌型号'
,
'厂牌型号'
),
(
'产地'
,
'产地'
),
(
'合格证号'
,
'合格证号'
),
(
'进口证明书号'
,
'进口证明书号'
),
(
'商检单号'
,
'商检单号'
),
(
'电话'
,
'电话'
),
(
'销方纳税人识别号'
,
'销货方纳税人识别号'
),
(
'账号'
,
'账号'
),
# nodo
(
'地址'
,
'地址'
),
# nodo
(
'开户银行'
,
'开户银行'
),
# nodo
(
'主管税务机关及代码'
,
'主管税务机关及代码'
),
# nodo
(
'吨位'
,
'吨位'
),
# nodo
(
'限乘人数'
,
'限乘人数'
),)
# nodo
(
'账号'
,
'账号'
),
(
'地址'
,
'地址'
),
(
'开户银行'
,
'开户银行'
),
(
'主管税务机关及代码'
,
'主管税务机关及代码'
),
(
'吨位'
,
'吨位'
),
(
'限乘人数'
,
'限乘人数'
),)
IC_PID
=
VAT_PID
=
MVC_PID
=
MVI_PID
=
None
# 营业执照
...
...
src/apps/doc/management/commands/ocr_process.py
View file @
8d69a62
...
...
@@ -397,7 +397,7 @@ class Command(BaseCommand, LoggerMixin):
try
:
img_path
=
img_queue
.
get
(
block
=
False
)
except
Exception
as
e
:
self
.
cronjob_log
.
info
(
'{0} [img_2_ocr_1] [queue empty]'
.
format
(
self
.
log_base
))
#
self.cronjob_log.info('{0} [img_2_ocr_1] [queue empty]'.format(self.log_base))
time
.
sleep
(
0.5
)
continue
else
:
...
...
@@ -453,8 +453,8 @@ class Command(BaseCommand, LoggerMixin):
try
:
task_str
=
finish_queue
.
get
(
block
=
False
)
except
Exception
as
e
:
self
.
cronjob_log
.
info
(
'{0} [res_2_wb] [queue empty]'
.
format
(
self
.
log_base
))
time
.
sleep
(
0.5
)
#
self.cronjob_log.info('{0} [res_2_wb] [queue empty]'.format(self.log_base))
time
.
sleep
(
1
)
continue
else
:
self
.
cronjob_log
.
info
(
'{0} [res_2_wb] [get task] [task={1}]'
.
format
(
self
.
log_base
,
task_str
))
...
...
@@ -612,7 +612,6 @@ class Command(BaseCommand, LoggerMixin):
# 识别失败:普通异常,如PDF异常、构建过程异常
# EDMS异常:下载异常-->回队列-->邮件;上传异常-->重新上传队列-->邮件
# 算法异常:第一道异常-->识别失败-->邮件;第二道异常-->识别失败-->邮件
# TODO OCR接口调用重试
def
handle
(
self
,
*
args
,
**
kwargs
):
lock
=
Lock
()
with
Manager
()
as
manager
:
...
...
src/apps/doc/ocr/wb.py
View file @
8d69a62
...
...
@@ -499,7 +499,11 @@ class BSWorkbook(Workbook):
key
,
field_order_yes
,
field_order_no
=
consts
.
FIELD_ORDER_MAP
.
get
(
classify
)
field_order
=
field_order_yes
if
key
in
license_dict
else
field_order_no
for
search_field
,
write_field
in
field_order
:
ws
.
append
((
write_field
,
license_dict
.
get
(
search_field
,
''
)))
field_value
=
license_dict
.
get
(
search_field
,
''
)
if
isinstance
(
field_value
,
list
):
ws
.
append
((
write_field
,
*
field_value
))
else
:
ws
.
append
((
write_field
,
field_value
))
ws
.
append
((
None
,
))
def
res_sheet
(
self
,
res_list
):
...
...
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