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
b0a600ce
There was an error fetching the commit references. Please try again later.
Commit
b0a600ce
authored
5 years ago
by
Recolic Keghart
Browse files
Options
Downloads
Patches
Plain Diff
revert a previous pack
parent
5090e388
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
+19
-18
19 additions, 18 deletions
summerize-part-list/main.py
with
19 additions
and
18 deletions
summerize-part-list/main.py
+
19
−
18
View file @
b0a600ce
...
...
@@ -132,24 +132,25 @@ def add_product(serial, _id, name, quantity, must_have_xlsx=False, allow_recursi
contMat
[:,
3
]
=
quantity
contMat
=
npmat_truncate_cols
(
contMat
,
13
)
# magic number: only keep the first 13 columns of material list.
############ dirty begin
# dirty part: append POSTFIX part_id to each part without PREFIX id. shitty, right?
_dirty_subpart_name_counter
=
{}
# 'name' -> 3
def
_get_subpart_name_count
(
name
):
if
name
in
_dirty_subpart_name_counter
:
_dirty_subpart_name_counter
[
name
]
=
1
+
_dirty_subpart_name_counter
[
name
]
else
:
_dirty_subpart_name_counter
[
name
]
=
1
return
str
(
_dirty_subpart_name_counter
[
name
])
_new_contMat
=
np
.
matrix
([[]],
dtype
=
str
)
for
line
in
contMat
:
line
=
line
.
tolist
()[
0
]
subpart_name
=
line
[
config
.
part_name_col_index
]
if
get_id_prefix_from_string
(
subpart_name
)
==
''
:
line
[
config
.
part_name_col_index
]
=
subpart_name
+
part_id
+
'
-
'
+
_get_subpart_name_count
(
subpart_name
)
_new_contMat
=
npmat_appendrow
(
_new_contMat
,
[
line
])
contMat
=
_new_contMat
############ dirty end
############## dirty begin
### dirty part: append POSTFIX part_id to each part without PREFIX id. shitty, right?
##_dirty_subpart_name_counter = {} # 'name' -> 3
##def _get_subpart_name_count(name):
## if name in _dirty_subpart_name_counter:
## _dirty_subpart_name_counter[name] = 1 + _dirty_subpart_name_counter[name]
## else:
## _dirty_subpart_name_counter[name] = 1
## return str(_dirty_subpart_name_counter[name])
##_new_contMat = np.matrix([[]], dtype=str)
##for line in contMat:
## line = line.tolist()[0]
## subpart_name = line[config.part_name_col_index]
## if get_id_prefix_from_string(subpart_name) == '':
## line[config.part_name_col_index] = subpart_name + part_id + '-' + _get_subpart_name_count(subpart_name)
## _new_contMat = npmat_appendrow(_new_contMat, [line])
##contMat = _new_contMat
############## dirty end
## dirty part removed at 2020.02.17, unknown reason. backup it up, and do not remove this!
# moved down # csv_preprocess.npmat2csv(contMat, csv_buf)
...
...
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