Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
product-uniqer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Recolic
product-uniqer
Commits
5478fa68
There was an error fetching the commit references. Please try again later.
Commit
5478fa68
authored
4 years ago
by
Recolic Keghart
Browse files
Options
Downloads
Patches
Plain Diff
FR 20200825: sort output pdf basing on input part list.
parent
1674051e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
summerize-part-list/main.py
+22
-0
22 additions, 0 deletions
summerize-part-list/main.py
with
22 additions
and
0 deletions
summerize-part-list/main.py
+
22
−
0
View file @
5478fa68
...
...
@@ -35,6 +35,26 @@ def log_error(msg):
def
log_warn
(
msg
):
print
(
'
Warning:
'
,
msg
)
def
pdf_sorter_init
(
targetPath
):
# FR 20200825: sort output pdf basing on input part list.
try
:
shutil
.
rmtree
(
targetPath
)
except
:
pass
os
.
mkdir
(
targetPath
)
_hook_storage
=
[]
def
pdf_sorter_reach_pdf
(
pdfPath
,
targetPath
):
# input pdfpath: readonly.
# FR 20200825: sort output pdf basing on input part list.
if
pdfPath
in
_hook_storage
:
return
# only deal the first occurence.
else
:
_hook_storage
.
append
(
pdfPath
)
myLoid
=
len
(
_hook_storage
)
-
1
# starts from 0
myPrefix
=
'
LoID{0:05d}-
'
.
format
(
myLoid
)
myTargetFilename
=
myPrefix
+
os
.
path
.
basename
(
pdfPath
)
try_copy
(
pdfPath
,
targetPath
,
myTargetFilename
)
missing_parts
=
[]
def
_main
():
if
len
(
sys
.
argv
)
<
2
:
...
...
@@ -56,6 +76,7 @@ def _main():
contMat
=
np
.
mat
(
contArr
)
os
.
mkdir
(
config
.
output_dirname
)
pdf_sorter_init
(
config
.
output_dirname
+
'
-sorted
'
)
for
line
in
contMat
:
line
=
line
.
tolist
()[
0
]
...
...
@@ -120,6 +141,7 @@ def add_product(serial, _id, name, quantity, load_xlsx=False, allow_recursive_pa
else
:
# Found the product pdf.
try_copy
(
found_pdf
,
config
.
output_dirname
)
pdf_sorter_reach_pdf
(
found_pdf
,
config
.
output_dirname
+
'
-sorted
'
)
if
load_xlsx
and
found_xlsx
is
None
:
name_and_id
=
'
{}({})
'
.
format
(
name
,
_id
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment