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):
...
@@ -17,60 +17,70 @@ class MergeSteps(plugin.InputPreparationPlugin):
""" merge the steps that constitute one single technology step
""" merge the steps that constitute one single technology step
"""
"""
orders
=
data
[
"input"
][
"BOM"
][
'orders'
]
orders
=
data
[
"input"
][
"BOM"
][
'orders'
]
# for all the orders
for
order
in
orders
:
for
order
in
orders
:
orderComponents
=
order
.
get
(
"componentsList"
,
[])
orderComponents
=
order
.
get
(
"componentsList"
,
[])
for
component
in
orderComponents
:
# for each component of the order
route
=
component
.
get
(
"route"
,
[])
for
component
in
orderComponents
:
updatedRoute
=
[]
route
=
component
.
get
(
"route"
,
[])
technologySequence
=
[]
updatedRoute
=
[]
idxToMerge
=
None
technologySequence
=
[]
for
index
,
step
in
enumerate
(
route
):
idxToMerge
=
None
technology
=
step
[
"technology"
]
for
index
,
step
in
enumerate
(
route
):
technology
=
technology
.
split
(
"-"
)[
0
]
technology
=
step
[
"technology"
]
# loadType is always manual for this pilot
technology
=
technology
.
split
(
"-"
)[
0
]
step
[
"operationType"
]
=
{
"load"
:
"Manual"
}
# XXX loadType is always manual for this pilot
step
[
"operator"
]
=
{}
step
[
"operationType"
]
=
{
"load"
:
"Manual"
}
# processingType + operator for processing
# processingType + operator for processing
if
step
[
"operator"
]
==
"Automatic"
if
step
[
"operator"
]
==
"Automatic"
:
step
[
"operationType"
][
"processing"
]
=
"Automatic"
step
[
"operationType"
][
"processing"
]
=
"Automatic"
else
:
step
.
pop
(
"operator"
)
step
[
"operationType"
][
"processing"
]
=
"Manual"
else
:
tempOperator
=
copy
.
deepcopy
(
step
[
"operator"
])
step
[
"operationType"
][
"processing"
]
=
"Manual"
step
[
"operator"
][
"processing"
]
=
[
tempOperator
],
tempOperator
=
copy
.
deepcopy
(
step
[
"operator"
])
step
[
"operator"
][
"load"
]
=
[
tempOperator
]}
step
[
"operator"
]
=
{}
# find out if there is there is any previous step to merge with
step
[
"operator"
][
"processing"
]
=
[
tempOperator
]
if
technology
==
technologySequence
[
-
1
]:
step
[
"operator"
][
"load"
]
=
[
tempOperator
]
if
len
(
route
[
index
-
1
][
"technology"
].
split
(
"-"
)):
# find out if there is there is any previous step to merge with
if
route
[
index
-
1
][
"technology"
].
split
(
"-"
)[
-
1
]
==
"SET"
:
if
technologySequence
:
idxToMerge
=
index
-
1
if
technology
==
technologySequence
[
-
1
]:
else
:
if
len
(
route
[
index
-
1
][
"technology"
].
split
(
"-"
)):
idxToMerge
=
None
if
route
[
index
-
1
][
"technology"
].
split
(
"-"
)[
-
1
]
==
"SET"
:
# if we must merge two steps
idxToMerge
=
index
-
1
if
idxToMerge
!=
None
:
else
:
# remove the previous step from the updatedRoute and technologySequence
idxToMerge
=
None
updatedRoute
.
pop
(
-
1
)
# if we must merge two steps
technologySequence
.
pop
(
-
1
)
if
idxToMerge
!=
None
:
stepToMerge
=
route
[
idxToMerge
]
# remove the previous step from the updatedRoute and technologySequence
# parts needed
updatedRoute
.
pop
(
-
1
)
step
[
"parts_needed"
]
=
route
[
idxToMerge
][
"parts_needed"
]
technologySequence
.
pop
(
-
1
)
# technology
stepToMerge
=
route
[
idxToMerge
]
step
[
"technology"
]
=
technology
# parts needed
# setupTime
step
[
"parts_needed"
]
=
stepToMerge
[
"parts_needed"
]
if
route
[
idxToMerge
][
"processingTime"
]:
# technology
step
[
"setupTime"
]
=
route
[
idxToMerge
][
"processingTime"
]
step
[
"technology"
]
=
technology
# setupType + operator for setup
# setupTime
if
route
[
idxToMerge
][
"operator"
]
==
"Automatic"
if
stepToMerge
[
"processingTime"
]:
step
[
"operationType"
][
"setup"
]
=
"Automatic"
step
[
"setupTime"
]
=
stepToMerge
[
"processingTime"
]
else
:
# setupType + operator for setup
step
[
"operationType"
][
"setup"
]
=
"Manual"
if
stepToMerge
[
"operator"
]
==
"Automatic"
step
[
"operator"
][
"setup"
]
=
route
[
idxToMerge
][
"operator"
]
step
[
"operationType"
][
"setup"
]
=
"Automatic"
step
[
"operator"
][
"load"
]
=
route
[
idxToMerge
][
"operator"
]
else
:
technologySequence
.
append
(
techonology
)
step
[
"operationType"
][
"setup"
]
=
"Manual"
# append the (updated) step to the temporary route
try
:
updatedRoute
.
append
(
step
)
tempOperator
=
copy
.
deepcopy
(
step
[
"operator"
])
# update the route of the step
except
:
component
[
"route"
]
=
updatedRoute
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
return
data
if
__name__
==
'__main__'
:
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