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
37f6db05
Commit
37f6db05
authored
Feb 19, 2015
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new plugin for JopShop instance. Reads WorkPlan from a spreadsheet
parent
71854525
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
0 deletions
+76
-0
dream/plugins/ReadJSWorkPlan.py
dream/plugins/ReadJSWorkPlan.py
+76
-0
No files found.
dream/plugins/ReadJSWorkPlan.py
0 → 100644
View file @
37f6db05
from
copy
import
copy
import
json
import
time
import
random
import
operator
from
datetime
import
datetime
import
copy
import
routeQuery
from
dream.plugins
import
plugin
class
ReadJSWorkPlan
(
plugin
.
InputPreparationPlugin
):
""" Input preparation
reads the work-plan from the corresponding spreadsheet
"""
def
findEntityByID
(
self
,
ID
):
"""search within the BOM and find the entity (order or component)"""
orders
=
self
.
data
[
"input"
][
"BOM"
].
get
(
"orders"
,
{})
for
order
in
orders
:
# check if the id corresponds to an order
if
ID
==
order
[
"orderID"
]:
return
order
components
=
order
.
get
(
"componentsList"
,
[])
for
component
in
components
:
if
ID
==
component
[
"componentID"
]:
return
component
return
{}
def
preprocess
(
self
,
data
):
""" inserts the retrieved order components and the related information (routing) to the BOM echelon
"""
self
.
data
=
data
WPdata
=
data
[
"input"
][
"workplan_spreadsheet"
]
orders
=
data
[
"input"
][
"BOM"
].
get
(
"orders"
,{})
if
WPdata
:
WPdata
.
pop
(
0
)
# pop the column names
for
line
in
WPdata
:
orderID
=
WPdata
[
1
]
order
=
self
.
findEntityByID
(
orderID
)
# if the order is not defined then skip this part
if
not
order
:
continue
partID
=
WPdata
[
0
]
part
=
self
.
findEntityByID
(
partID
)
# if there is no such part in the BOM then create it
if
not
part
:
partName
=
WPdata
[
2
]
components
=
order
.
get
(
"componentsList"
,[])
components
.
append
({
"componentID"
:
partID
,
"componentName"
:
partName
})
order
[
"componentsList"
]
=
components
# update the route of the component
route
=
part
.
get
(
"route"
,
[])
task_id
=
WPdata
[
-
1
]
sequence
=
WPdata
[
4
]
processingTime
=
WPdata
[
-
4
]
operator
=
WPdata
[
5
]
partsneeded
=
WPdata
[
-
2
].
replace
(
" "
,
""
).
split
(
','
)
technology
=
WPdata
[
3
]
quantity
=
WPdata
[
6
]
route
.
append
({
"task_id"
:
task_id
,
"sequence"
:
sequence
,
"processingTime"
:
{
"fixed"
:{
"mean"
:
processingTime
}},
"operator"
:
operator
,
"partsneeded"
:
partsneeded
,
"technology"
:
technology
,
"quantity"
:
quantity
})
part
[
"route"
]
=
route
return
data
\ No newline at end of file
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