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
621ee478
Commit
621ee478
authored
Jan 30, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plugin to read the capacity project info
parent
3ecc0108
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
0 deletions
+74
-0
dream/plugins/CapacityProjectSpreadsheet.py
dream/plugins/CapacityProjectSpreadsheet.py
+65
-0
dream/simulation/Examples/CapacityProjectAllInOneEmpty.json
dream/simulation/Examples/CapacityProjectAllInOneEmpty.json
+9
-0
No files found.
dream/plugins/CapacityProjectSpreadsheet.py
0 → 100644
View file @
621ee478
from
copy
import
copy
import
json
import
time
import
random
import
operator
import
datetime
from
dream.plugins
import
plugin
class
CapacityProjectSpreadsheet
(
plugin
.
InputPreparationPlugin
):
""" Input prepration
read the capacity projects from the spreadsheet
"""
def
preprocess
(
self
,
data
):
strptime
=
datetime
.
datetime
.
strptime
projectData
=
data
[
'input'
].
get
(
'projects_spreadsheet'
,
None
)
data
[
'input'
][
'BOM'
]
=
{}
# Put the projects in BOM. Discuss this!
node
=
data
[
'graph'
][
'node'
]
now
=
strptime
(
data
[
'general'
][
'currentDate'
],
'%Y/%m/%d'
)
if
projectData
:
for
row
in
range
(
1
,
len
(
projectData
)):
if
projectData
[
row
][
0
]:
projectId
=
projectData
[
row
][
0
]
orderDate
=
strptime
(
projectData
[
row
][
1
],
'%Y/%m/%d'
)
orderDate
=
(
orderDate
-
now
).
days
try
:
dueDate
=
strptime
(
projectData
[
row
][
2
],
'%Y/%m/%d'
)
dueDate
=
(
dueDate
-
now
).
days
# if no due date is given set it to 180 (about 6 months)
except
ValueError
:
dueDate
=
180
assemblySpaceRequirement
=
float
(
projectData
[
row
][
3
])
capacityRequirementDict
=
{}
earliestStartDict
=
{}
# get the number of operations of the project
numberOfOperations
=
1
i
=
1
while
not
projectData
[
row
+
i
][
0
]:
# if a completely empty line is found break
if
all
(
v
is
None
for
v
in
projectData
[
row
+
i
]):
break
numberOfOperations
+=
1
i
+=
1
# for every operation get capacityRequirementDict and earliestStartDict
for
stationRecord
in
range
(
numberOfOperations
):
stationId
=
projectData
[
row
+
stationRecord
][
4
]
requiredCapacity
=
projectData
[
row
+
stationRecord
][
5
]
earliestStart
=
projectData
[
row
+
stationRecord
][
6
]
capacityRequirementDict
[
stationId
]
=
float
(
requiredCapacity
)
if
earliestStart
:
earliestStart
=
strptime
(
earliestStart
,
'%Y/%m/%d'
)
earliestStartDict
[
stationId
]
=
(
earliestStart
-
now
).
days
# define the order in BOM
data
[
'input'
][
'BOM'
][
projectId
]
=
{
'orderDate'
:
orderDate
,
'dueDate'
:
dueDate
,
'assemblySpaceRequirement'
:
assemblySpaceRequirement
,
'capacityRequirementDict'
:
capacityRequirementDict
,
'earliestStartDict'
:
earliestStartDict
}
print
data
[
'input'
][
'BOM'
]
return
data
\ No newline at end of file
dream/simulation/Examples/CapacityProjectAllInOneEmpty.json
View file @
621ee478
...
...
@@ -465,6 +465,11 @@
"name"
:
"Project ID"
,
"type"
:
"string"
},
{
"name"
:
"Order Date"
,
"type"
:
"string"
,
"format"
:
"date"
},
{
"name"
:
"Due Date"
,
"type"
:
"string"
,
...
...
@@ -638,6 +643,10 @@
{
"_class"
:
"dream.plugins.AvailableCapacitySpreadsheet.AvailableCapacitySpreadsheet"
,
"input_id"
:
"availableCapacity"
},
{
"_class"
:
"dream.plugins.CapacityProjectSpreadsheet.CapacityProjectSpreadsheet"
,
"input_id"
:
"capacityProject"
}
]
},
...
...
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