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
c9e0f839
Commit
c9e0f839
authored
Jan 14, 2015
by
Georgios Dagkakis
Committed by
Ioannis Papagiannopoulos
Jan 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plugin for shifts on Batches instance added
parent
31a781d1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
6 deletions
+47
-6
dream/plugins/ReadShiftFromSpreadsheet.py
dream/plugins/ReadShiftFromSpreadsheet.py
+43
-3
dream/simulation/Examples/BatchAllInOneEmpty.json
dream/simulation/Examples/BatchAllInOneEmpty.json
+4
-3
No files found.
dream/plugins/ReadShiftFromSpreadsheet.py
View file @
c9e0f839
...
@@ -3,14 +3,54 @@ import json
...
@@ -3,14 +3,54 @@ import json
import
time
import
time
import
random
import
random
import
operator
import
operator
from
datetime
import
datetime
import
datetime
from
dream.plugins
import
plugin
from
dream.plugins
import
plugin
class
ReadShiftFromSpreadsheet
(
plugin
.
InputPreparationPlugin
):
class
ReadShiftFromSpreadsheet
(
plugin
.
InputPreparationPlugin
):
""" Input prepration
""" Input prepration
read
wip
-srpeadsheet data and update the wip property of the stations.
read
shift
-srpeadsheet data and update the wip property of the stations.
"""
"""
def
preprocess
(
self
,
data
):
def
preprocess
(
self
,
data
):
return
data
strptime
=
datetime
.
datetime
.
strptime
\ No newline at end of file
now
=
strptime
(
data
[
'general'
][
'currentDate'
],
'%Y/%m/%d'
)
shift_by_station
=
{}
for
line
in
data
[
'input'
][
'machine_shift_spreadsheet'
][
1
:]:
if
line
[
1
]:
# Get the dates, and convert them to simulation clock time units.
# In this class, time unit is a minute (XXX it can be an option)
start_date
=
strptime
(
"%s %s"
%
(
line
[
0
],
line
[
2
]),
'%Y/%m/%d %H:%M'
)
start_time
=
(
start_date
-
now
).
total_seconds
()
//
60
stop_date
=
strptime
(
"%s %s"
%
(
line
[
0
],
line
[
3
]),
'%Y/%m/%d %H:%M'
)
stop_time
=
(
stop_date
-
now
).
total_seconds
()
//
60
for
station
in
line
[
1
].
split
(
','
):
station
=
station
.
strip
()
shift_by_station
.
setdefault
(
station
,
[]).
append
(
(
start_time
,
stop_time
)
)
for
line
in
data
[
'input'
][
'operator_shift_spreadsheet'
][
1
:]:
print
line
if
line
[
1
]:
# Get the dates, and convert them to simulation clock time units.
# In this class, time unit is a minute (XXX it can be an option)
start_date
=
strptime
(
"%s %s"
%
(
line
[
0
],
line
[
2
]),
'%Y/%m/%d %H:%M'
)
start_time
=
(
start_date
-
now
).
total_seconds
()
//
60
stop_date
=
strptime
(
"%s %s"
%
(
line
[
0
],
line
[
3
]),
'%Y/%m/%d %H:%M'
)
stop_time
=
(
stop_date
-
now
).
total_seconds
()
//
60
for
station
in
line
[
1
].
split
(
','
):
station
=
station
.
strip
()
shift_by_station
.
setdefault
(
station
,
[]).
append
(
(
start_time
,
stop_time
)
)
for
node
,
node_data
in
data
[
'graph'
][
'node'
].
items
():
if
node
in
shift_by_station
:
interruptions
=
node_data
.
get
(
'interruptions'
,{})
if
not
interruptions
:
node_data
[
'interruptions'
]
=
{}
node_data
[
'interruptions'
][
'shift'
]
=
{
'shiftPattern'
:
shift_by_station
.
pop
(
node
),
'endUnfinished'
:
0
}
# XXX shall we make this
# configurable ?
return
data
\ No newline at end of file
dream/simulation/Examples/BatchAllInOneEmpty.json
View file @
c9e0f839
...
@@ -860,15 +860,16 @@
...
@@ -860,15 +860,16 @@
},
{
},
{
"plugin"
:
"ReadEntryData.ReadEntryData"
,
"plugin"
:
"ReadEntryData.ReadEntryData"
,
"input_id"
:
"EntryData"
"input_id"
:
"EntryData"
},
{
"plugin"
:
"ReadShiftFromSpreadsheet.ReadShiftFromSpreadsheet"
,
"input_id"
:
"ShiftSpreadsheet"
},
{
},
{
"plugin"
:
"BatchesWIPSpreadsheet.BatchesWIPSpreadsheet"
,
"plugin"
:
"BatchesWIPSpreadsheet.BatchesWIPSpreadsheet"
,
"input_id"
:
"WipSpreadsheet"
"input_id"
:
"WipSpreadsheet"
},
{
},
{
"plugin"
:
"ReadSkilledOperators.ReadSkilledOperators"
,
"plugin"
:
"ReadSkilledOperators.ReadSkilledOperators"
,
"input_id"
:
"SkilledOperatorsSpreadsheet"
"input_id"
:
"SkilledOperatorsSpreadsheet"
},
{
"plugin"
:
"ReadShiftFromSpreadsheet.ReadShiftFromSpreadsheet"
,
"input_id"
:
"ShiftSpreadsheet"
}
}
]
]
},
},
...
...
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