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
d19ca8f1
authored
2021-05-14 10:34:03 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
purne back
1 parent
60c6551b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
src/apps/doc/management/commands/ocr_process.py
src/apps/doc/ocr/wb.py
src/apps/doc/management/commands/ocr_process.py
View file @
d19ca8f
...
...
@@ -871,7 +871,7 @@ class Command(BaseCommand, LoggerMixin):
# 重构Excel文件
# src_excel_path = os.path.join(doc_data_path, 'src.xlsx')
# wb.save(src_excel_path)
wb
.
rebuild
(
merged_bs_summary
,
license_summary
,
res_list
,
doc
.
document_scheme
)
count_list
=
wb
.
rebuild
(
merged_bs_summary
,
license_summary
,
res_list
,
doc
.
document_scheme
)
wb
.
save
(
excel_path
)
except
Exception
as
e
:
...
...
@@ -918,9 +918,9 @@ class Command(BaseCommand, LoggerMixin):
try
:
doc
.
end_time
=
timezone
.
now
()
doc
.
duration
=
min
((
doc
.
end_time
-
doc
.
start_time
)
.
seconds
,
32760
)
#
for field, count in count_list:
#
if hasattr(doc, field):
#
setattr(doc, field, count)
for
field
,
count
in
count_list
:
if
hasattr
(
doc
,
field
):
setattr
(
doc
,
field
,
count
)
doc
.
save
()
except
Exception
as
e
:
self
.
online_log
.
error
(
'{0} [process error (db save)] [task={1}] [error={2}]'
.
format
(
...
...
src/apps/doc/ocr/wb.py
View file @
d19ca8f
...
...
@@ -633,12 +633,12 @@ class BSWorkbook(Workbook):
for
sheet
in
sheets_list
:
self
.
remove
(
self
.
get_sheet_by_name
(
sheet
))
def
license_rebuild
(
self
,
license_summary
,
document_scheme
):
for
classify
,
(
_
,
name
,
field_order
,
side_diff
,
scheme_diff
,
_
)
in
consts
.
LICENSE_ORDER
:
def
license_rebuild
(
self
,
license_summary
,
document_scheme
,
count_list
):
for
classify
,
(
_
,
name
,
field_order
,
side_diff
,
scheme_diff
,
field_str
)
in
consts
.
LICENSE_ORDER
:
license_list
=
license_summary
.
get
(
classify
)
if
not
license_list
:
continue
#
count = 0
count
=
0
ws
=
self
.
create_sheet
(
name
)
if
scheme_diff
and
document_scheme
==
consts
.
DOC_SCHEME_LIST
[
1
]:
classify
=
consts
.
MVC_CLASSIFY_SE
...
...
@@ -653,8 +653,8 @@ class BSWorkbook(Workbook):
else
:
ws
.
append
((
write_field
,
field_value
))
ws
.
append
((
None
,
))
#
count += 1
#
count_list.append((field_str, count))
count
+=
1
count_list
.
append
((
field_str
,
count
))
def
simple_license_rebuild
(
self
,
license_summary
,
document_scheme
):
# for ic_license_dict in license_summary.get(consts.IC_CLASSIFY, []):
...
...
@@ -708,13 +708,13 @@ class BSWorkbook(Workbook):
self
.
remove
(
self
.
get_sheet_by_name
(
'Sheet'
))
def
rebuild
(
self
,
bs_summary
,
license_summary
,
res_list
,
document_scheme
):
#
count_list = [(consts.MODEL_FIELD_BS, len(self.sheetnames) - 1)]
count_list
=
[(
consts
.
MODEL_FIELD_BS
,
len
(
self
.
sheetnames
)
-
1
)]
if
document_scheme
==
consts
.
DOC_SCHEME_LIST
[
1
]:
self
.
license_rebuild
(
license_summary
,
document_scheme
)
self
.
license_rebuild
(
license_summary
,
document_scheme
,
count_list
)
self
.
bs_rebuild
(
bs_summary
)
else
:
self
.
bs_rebuild
(
bs_summary
)
self
.
license_rebuild
(
license_summary
,
document_scheme
)
self
.
license_rebuild
(
license_summary
,
document_scheme
,
count_list
)
self
.
res_sheet
(
res_list
)
self
.
remove_base_sheet
()
#
return count_list
return
count_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