Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
3ebfecc1
Commit
3ebfecc1
authored
Feb 05, 2015
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MergeSteps plugin updated and corrected
parent
43cd2083
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
54 deletions
+64
-54
dream/plugins/MergeSteps.py
dream/plugins/MergeSteps.py
+64
-54
No files found.
dream/plugins/MergeSteps.py
View file @
3ebfecc1
...
...
@@ -17,60 +17,70 @@ class MergeSteps(plugin.InputPreparationPlugin):
""" merge the steps that constitute one single technology step
"""
orders
=
data
[
"input"
][
"BOM"
][
'orders'
]
for
order
in
orders
:
orderComponents
=
order
.
get
(
"componentsList"
,
[])
for
component
in
orderComponents
:
route
=
component
.
get
(
"route"
,
[])
updatedRoute
=
[]
technologySequence
=
[]
idxToMerge
=
None
for
index
,
step
in
enumerate
(
route
):
technology
=
step
[
"technology"
]
technology
=
technology
.
split
(
"-"
)[
0
]
# loadType is always manual for this pilot
step
[
"operationType"
]
=
{
"load"
:
"Manual"
}
step
[
"operator"
]
=
{}
# processingType + operator for processing
if
step
[
"operator"
]
==
"Automatic"
step
[
"operationType"
][
"processing"
]
=
"Automatic"
else
:
step
[
"operationType"
][
"processing"
]
=
"Manual"
tempOperator
=
copy
.
deepcopy
(
step
[
"operator"
])
step
[
"operator"
][
"processing"
]
=
[
tempOperator
],
step
[
"operator"
][
"load"
]
=
[
tempOperator
]}
# find out if there is there is any previous step to merge with
if
technology
==
technologySequence
[
-
1
]:
if
len
(
route
[
index
-
1
][
"technology"
].
split
(
"-"
)):
if
route
[
index
-
1
][
"technology"
].
split
(
"-"
)[
-
1
]
==
"SET"
:
idxToMerge
=
index
-
1
else
:
idxToMerge
=
None
# if we must merge two steps
if
idxToMerge
!=
None
:
# remove the previous step from the updatedRoute and technologySequence
updatedRoute
.
pop
(
-
1
)
technologySequence
.
pop
(
-
1
)
stepToMerge
=
route
[
idxToMerge
]
# parts needed
step
[
"parts_needed"
]
=
route
[
idxToMerge
][
"parts_needed"
]
# technology
step
[
"technology"
]
=
technology
# setupTime
if
route
[
idxToMerge
][
"processingTime"
]:
step
[
"setupTime"
]
=
route
[
idxToMerge
][
"processingTime"
]
# setupType + operator for setup
if
route
[
idxToMerge
][
"operator"
]
==
"Automatic"
step
[
"operationType"
][
"setup"
]
=
"Automatic"
else
:
step
[
"operationType"
][
"setup"
]
=
"Manual"
step
[
"operator"
][
"setup"
]
=
route
[
idxToMerge
][
"operator"
]
step
[
"operator"
][
"load"
]
=
route
[
idxToMerge
][
"operator"
]
technologySequence
.
append
(
techonology
)
# append the (updated) step to the temporary route
updatedRoute
.
append
(
step
)
# update the route of the step
component
[
"route"
]
=
updatedRoute
# for all the orders
for
order
in
orders
:
orderComponents
=
order
.
get
(
"componentsList"
,
[])
# for each component of the order
for
component
in
orderComponents
:
route
=
component
.
get
(
"route"
,
[])
updatedRoute
=
[]
technologySequence
=
[]
idxToMerge
=
None
for
index
,
step
in
enumerate
(
route
):
technology
=
step
[
"technology"
]
technology
=
technology
.
split
(
"-"
)[
0
]
# XXX loadType is always manual for this pilot
step
[
"operationType"
]
=
{
"load"
:
"Manual"
}
# processingType + operator for processing
if
step
[
"operator"
]
==
"Automatic"
:
step
[
"operationType"
][
"processing"
]
=
"Automatic"
step
.
pop
(
"operator"
)
else
:
step
[
"operationType"
][
"processing"
]
=
"Manual"
tempOperator
=
copy
.
deepcopy
(
step
[
"operator"
])
step
[
"operator"
]
=
{}
step
[
"operator"
][
"processing"
]
=
[
tempOperator
]
step
[
"operator"
][
"load"
]
=
[
tempOperator
]
# find out if there is there is any previous step to merge with
if
technologySequence
:
if
technology
==
technologySequence
[
-
1
]:
if
len
(
route
[
index
-
1
][
"technology"
].
split
(
"-"
)):
if
route
[
index
-
1
][
"technology"
].
split
(
"-"
)[
-
1
]
==
"SET"
:
idxToMerge
=
index
-
1
else
:
idxToMerge
=
None
# if we must merge two steps
if
idxToMerge
!=
None
:
# remove the previous step from the updatedRoute and technologySequence
updatedRoute
.
pop
(
-
1
)
technologySequence
.
pop
(
-
1
)
stepToMerge
=
route
[
idxToMerge
]
# parts needed
step
[
"parts_needed"
]
=
stepToMerge
[
"parts_needed"
]
# technology
step
[
"technology"
]
=
technology
# setupTime
if
stepToMerge
[
"processingTime"
]:
step
[
"setupTime"
]
=
stepToMerge
[
"processingTime"
]
# setupType + operator for setup
if
stepToMerge
[
"operator"
]
==
"Automatic"
step
[
"operationType"
][
"setup"
]
=
"Automatic"
else
:
step
[
"operationType"
][
"setup"
]
=
"Manual"
try
:
tempOperator
=
copy
.
deepcopy
(
step
[
"operator"
])
except
:
tempOperator
=
None
step
[
"operator"
]
=
{}
step
[
"operator"
][
"setup"
]
=
route
[
idxToMerge
][
"operator"
][
"processing"
]
step
[
"operator"
][
"load"
]
=
route
[
idxToMerge
][
"operator"
][
"load"
]
if
tempOperator
:
step
[
"operator"
][
"processing"
]
=
tempOperator
[
"processing"
]
technologySequence
.
append
(
technology
)
# append the (updated) step to the temporary route
updatedRoute
.
append
(
step
)
# update the route of the step
component
[
"route"
]
=
updatedRoute
return
data
if
__name__
==
'__main__'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment