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
1cf2e6e0
Commit
1cf2e6e0
authored
Feb 22, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plugin for batches shift to be able to define ALL
parent
6d684500
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
dream/plugins/BatchesShift.py
dream/plugins/BatchesShift.py
+46
-0
No files found.
dream/plugins/BatchesShift.py
0 → 100644
View file @
1cf2e6e0
from
copy
import
copy
import
json
import
time
import
random
import
operator
import
datetime
from
dream.plugins
import
plugin
from
dream.plugins.TimeSupport
import
TimeSupportMixin
from
dream.plugins.ReadShiftFromSpreadsheet
import
ReadShiftFromSpreadsheet
class
BatchesShift
(
ReadShiftFromSpreadsheet
):
""" Input prepration
extends standard ReadShiftFromSpreadsheet to accept 'All' to define all stations
sets also the attributes of shifts to objects
XXX to be extended to operators
"""
def
preprocess
(
self
,
data
):
nodes
=
data
[
'graph'
][
'node'
]
machineshiftData
=
data
[
'input'
].
get
(
'machine_shift_spreadsheet'
,
None
)
# create a string with all station ids separated by commas
allString
=
''
for
node_id
,
node
in
nodes
.
iteritems
():
if
node
[
'_class'
].
startswith
(
'Dream.BatchScrapMachine'
)
or
node
[
'_class'
]
==
'Dream.M3'
:
allString
+=
node_id
allString
+=
','
# if in machine shift there is a
for
element
in
machineshiftData
:
if
element
[
1
]
in
[
'ALL'
,
'All'
,
'all'
]:
element
[
1
]
=
allString
# run the standard shift plugin
data
=
ReadShiftFromSpreadsheet
.
preprocess
(
self
,
data
)
# set attributes to shifts
for
node_id
,
node
in
nodes
.
iteritems
():
interruptions
=
node
.
get
(
'interruptions'
,
None
)
if
interruptions
:
shift
=
interruptions
.
get
(
'shift'
,
None
)
if
shift
:
interruptions
[
'shift'
][
'thresholdTimeIsOnShift'
]
=
0
interruptions
[
'shift'
][
'receiveBeforeEndThreshold'
]
=
7
interruptions
[
'shift'
][
'endUnfinished'
]
=
1
return
data
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