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
fba048bf
authored
2020-10-22 13:26:12 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix bug
1 parent
ee9fa268
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
18 deletions
src/apps/doc/consts.py
src/apps/doc/ocr/wb.py
src/apps/doc/consts.py
View file @
fba048b
...
...
@@ -250,6 +250,7 @@ HEADERS_MAPPING.update(
HEADERS_MAPPING
.
update
(
{
'借贷发生额(借:-贷:+)'
:
AMOUNT_KEY
,
'借贷发生额(借:-贷:+)'
:
AMOUNT_KEY
,
}
)
...
...
src/apps/doc/ocr/wb.py
View file @
fba048b
...
...
@@ -96,8 +96,8 @@ class BSWorkbook(Workbook):
best_sheet_info
=
sheet_header_info
.
get
(
sheet_order_list
[
0
])
if
best_sheet_info
.
get
(
consts
.
FIND_COUNT_KEY
,
0
)
==
0
:
for
key
,
value
in
consts
.
CLASSIFY_MAP
.
items
():
col
=
consts
.
CLASSIFY_LIST
[
classify
][
1
][
value
]
-
1
statistics_header_info
[
key
]
=
col
col
=
consts
.
CLASSIFY_LIST
[
classify
][
1
][
value
]
statistics_header_info
[
key
]
=
col
-
1
if
isinstance
(
col
,
int
)
else
None
statistics_header_info
[
consts
.
HEADER_KEY
]
=
consts
.
CLASSIFY_HEADER_LIST
[
classify
]
else
:
find_col_set
=
best_sheet_info
.
get
(
consts
.
FIND_COL_KEY
,
set
())
...
...
@@ -113,9 +113,9 @@ class BSWorkbook(Workbook):
find_col_set
.
add
(
col
)
break
else
:
fixed_col
=
consts
.
CLASSIFY_LIST
[
classify
][
1
][
consts
.
CLASSIFY_MAP
[
key
]]
-
1
if
fixed_col
not
in
find_col_set
:
col
=
fixed_col
fixed_col
=
consts
.
CLASSIFY_LIST
[
classify
][
1
][
consts
.
CLASSIFY_MAP
[
key
]]
if
fixed_col
not
in
find_col_set
and
isinstance
(
fixed_col
,
int
)
:
col
=
fixed_col
-
1
find_col_set
.
add
(
col
)
statistics_header_info
[
key
]
=
col
statistics_header_info
[
consts
.
HEADER_KEY
]
=
best_sheet_info
.
get
(
consts
.
HEADER_KEY
)
...
...
@@ -134,7 +134,7 @@ class BSWorkbook(Workbook):
break
else
:
fixed_col
=
consts
.
CLASSIFY_LIST
[
classify
][
1
][
consts
.
CLASSIFY_MAP
[
consts
.
DATE_KEY
]]
if
fixed_col
not
in
find_col_set
:
if
fixed_col
not
in
find_col_set
and
isinstance
(
fixed_col
,
int
)
:
date_col
=
fixed_col
min_row
=
sheet_header_info
.
get
(
sheet
,
{})
.
get
(
consts
.
MIN_ROW_KEY
,
2
)
return
date_col
,
min_row
...
...
@@ -318,20 +318,20 @@ class BSWorkbook(Workbook):
for
rows
in
new_ws
.
iter_rows
(
min_row
=
2
):
# TODO 删除空行
summary_cell
=
None
if
summary_cell_idx
is
None
else
rows
[
summary_cell_idx
]
date_cell
=
None
if
summary
_cell_idx
is
None
else
rows
[
date_cell_idx
]
amount_cell
=
None
if
summary
_cell_idx
is
None
else
rows
[
amount_cell_idx
]
over_cell
=
None
if
summary
_cell_idx
is
None
else
rows
[
over_cell_idx
]
income_cell
=
None
if
summary
_cell_idx
is
None
else
rows
[
income_cell_idx
]
outlay_cell
=
None
if
summar
y_cell_idx
is
None
else
rows
[
outlay_cell_idx
]
borrow_cell
=
None
if
summary
_cell_idx
is
None
else
rows
[
borrow_cell_idx
]
date_cell
=
None
if
date
_cell_idx
is
None
else
rows
[
date_cell_idx
]
amount_cell
=
None
if
amount
_cell_idx
is
None
else
rows
[
amount_cell_idx
]
over_cell
=
None
if
over
_cell_idx
is
None
else
rows
[
over_cell_idx
]
income_cell
=
None
if
income
_cell_idx
is
None
else
rows
[
income_cell_idx
]
outlay_cell
=
None
if
outla
y_cell_idx
is
None
else
rows
[
outlay_cell_idx
]
borrow_cell
=
None
if
borrow
_cell_idx
is
None
else
rows
[
borrow_cell_idx
]
summary_cell_value
=
None
if
summary_cell
is
None
else
summary_cell
.
value
date_cell_value
=
None
if
summary
_cell
is
None
else
date_cell
.
value
amount_cell_value
=
None
if
summary
_cell
is
None
else
amount_cell
.
value
over_cell_value
=
None
if
summary
_cell
is
None
else
over_cell
.
value
income_cell_value
=
None
if
summary
_cell
is
None
else
income_cell
.
value
outlay_cell_value
=
None
if
summar
y_cell
is
None
else
outlay_cell
.
value
borrow_cell_value
=
None
if
summary
_cell
is
None
else
borrow_cell
.
value
date_cell_value
=
None
if
date
_cell
is
None
else
date_cell
.
value
amount_cell_value
=
None
if
amount
_cell
is
None
else
amount_cell
.
value
over_cell_value
=
None
if
over
_cell
is
None
else
over_cell
.
value
income_cell_value
=
None
if
income
_cell
is
None
else
income_cell
.
value
outlay_cell_value
=
None
if
outla
y_cell
is
None
else
outlay_cell
.
value
borrow_cell_value
=
None
if
borrow
_cell
is
None
else
borrow_cell
.
value
# row = summary_cell.row
if
summary_cell
is
not
None
:
...
...
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