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
430140c2
authored
2023-01-05 15:02:37 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'feature/enhancement-file-name-change' into feature/uat-tmp
2 parents
e0d31a26
903a34ba
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
5 deletions
src/apps/doc/management/commands/ocr_process.py
src/apps/doc/ocr/ecm.py
src/apps/doc/ocr/wb.py
src/apps/doc/management/commands/ocr_process.py
View file @
430140c
...
...
@@ -1908,7 +1908,8 @@ class Command(BaseCommand, LoggerMixin):
# 重构Excel文件
# src_excel_path = os.path.join(doc_data_path, 'src.xlsx')
# wb.save(src_excel_path)
count_list
=
wb
.
rebuild
(
merged_bs_summary
,
license_summary
,
res_list
,
doc
.
document_scheme
,
contract_result
,
doc
.
metadata
)
#need_follow表示在上传edms时文件名是否要添加"关注"两字
count_list
,
need_follow
=
wb
.
rebuild
(
merged_bs_summary
,
license_summary
,
res_list
,
doc
.
document_scheme
,
contract_result
,
doc
.
metadata
)
wb
.
save
(
excel_path
)
except
Exception
as
e
:
...
...
@@ -1929,7 +1930,7 @@ class Command(BaseCommand, LoggerMixin):
# 上传至EDMS
for
times
in
range
(
consts
.
RETRY_TIMES
):
try
:
self
.
edms
.
upload
(
excel_path
,
doc
,
business_type
)
self
.
edms
.
upload
(
excel_path
,
doc
,
business_type
,
need_follow
)
except
Exception
as
e
:
self
.
online_log
.
warn
(
'{0} [edms upload failed] [times={1}] [task={2}] [error={3}]'
.
format
(
...
...
src/apps/doc/ocr/ecm.py
View file @
430140c
...
...
@@ -110,15 +110,16 @@ class ECM:
return
'{0}{1}'
.
format
(
self
.
prefix
,
name
)
return
'{0}{1}'
.
format
(
self
.
prefix
,
doc_name
)
def
upload
(
self
,
file_path
,
doc
,
business_type
):
def
upload
(
self
,
file_path
,
doc
,
business_type
,
need_follow
):
doc_type
,
folder_afc
,
folder_hil
=
self
.
doc_type_map
.
get
(
doc
.
document_scheme
)
folder
=
folder_afc
if
business_type
==
'AFC'
else
folder_hil
object_name
=
'关注'
+
self
.
get_doc_file_name
(
doc
.
document_name
)
if
need_follow
else
self
.
get_doc_file_name
(
doc
.
document_name
)
args
=
{
"username"
:
self
.
username
,
"password"
:
self
.
pwd
,
"docbase"
:
self
.
doc_base_map
.
get
(
business_type
),
"documentType"
:
doc_type
,
"object_name"
:
self
.
get_doc_file_name
(
doc
.
document_name
)
,
"object_name"
:
object_name
,
"folder"
:
folder
,
"format"
:
"excel12book"
,
"r_content_type"
:
"excel12book"
,
...
...
src/apps/doc/ocr/wb.py
View file @
430140c
...
...
@@ -37,6 +37,7 @@ class BSWorkbook(Workbook):
# self.bd = Side(style='thin', color="000000")
# self.border = Border(left=self.bd, top=self.bd, right=self.bd, bottom=self.bd)
self
.
MAX_MEAN
=
31
self
.
need_follow
=
False
@staticmethod
def
replace_newline
(
queryset_value
):
...
...
@@ -364,6 +365,8 @@ class BSWorkbook(Workbook):
self
.
blank_row
,
self
.
interest_keyword_header
]
)
if
len
(
verify_highlight_row
)
>
0
or
len
(
metadata_highlight_row
)
>
0
:
self
.
need_follow
=
True
return
metadata_rows
,
verify_highlight_row
,
timedelta
,
metadata_highlight_row
def
build_meta_sheet
(
self
,
role_name
,
card
,
confidence
,
code
,
verify_list
,
print_time
,
start_date
,
end_date
,
...
...
@@ -911,4 +914,4 @@ class BSWorkbook(Workbook):
self
.
contract_rebuild
(
contract_result
,
True
)
self
.
move_res_sheet
()
self
.
remove_base_sheet
()
return
count_list
return
count_list
,
self
.
need_follow
...
...
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