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
cdaaaeee
Commit
cdaaaeee
authored
Aug 24, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow the definition of shift in weekends
parent
07cb738f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
18 deletions
+25
-18
dream/plugins/JobShop/ReadJSShifts.py
dream/plugins/JobShop/ReadJSShifts.py
+25
-18
No files found.
dream/plugins/JobShop/ReadJSShifts.py
View file @
cdaaaeee
...
...
@@ -141,7 +141,7 @@ class ReadJSShifts(plugin.InputPreparationPlugin, TimeSupportMixin):
#sorts the list in case the records were not entered in correct ascending order
for
info
in
exceptionShiftPattern
:
exceptionShiftPattern
[
info
].
sort
(
key
=
itemgetter
(
0
))
# ================================================================
#create default pattern for all operators (10 days long)
timeStartList
=
[]
...
...
@@ -188,23 +188,30 @@ class ReadJSShifts(plugin.InputPreparationPlugin, TimeSupportMixin):
# calculate the number of days till the end of the exception
else
:
exceptionDay
=
math
.
floor
((
exception
[
-
1
]
-
hoursToEndFirstDay
.
total_seconds
()
/
3600
)
/
24
)
+
1
for
index2
,
default
in
enumerate
(
defaultShiftPattern
[
node
]):
# check if we still are in the first day
if
hoursToEndFirstDay
.
total_seconds
()
/
3600
>
default
[
-
1
]:
defaultDay
=
0
# calculate the number of days till the end of the default shift
else
:
defaultDay
=
math
.
floor
((
default
[
-
1
]
-
hoursToEndFirstDay
.
total_seconds
()
/
3600
)
/
24
)
+
1
if
exceptionDay
==
defaultDay
:
# update the defaultShiftPattern of the node (operator or machine)
# if the exception day has not been modified then delete the previous entry and use the first exception that occurs
if
not
exceptionDay
in
modifiedDefaultDays
:
defaultShiftPattern
[
node
][
index2
]
=
exception
# otherwise append it at the end
else
:
defaultShiftPattern
[
node
].
append
(
exception
)
modifiedDefaultDays
.
append
(
exceptionDay
)
# the day has been modified, add to the modified days
break
# check the weekday
exceptionDate
=
now
+
datetime
.
timedelta
(
days
=
exceptionDay
)
# if it is weekend create shift entry for that date. The default pattern does not need to be changed
if
exceptionDate
.
weekday
()
in
[
5
,
6
]:
defaultShiftPattern
[
node
].
append
(
exception
)
# for exceptions in weekdays
else
:
for
index2
,
default
in
enumerate
(
defaultShiftPattern
[
node
]):
# check if we still are in the first day
if
hoursToEndFirstDay
.
total_seconds
()
/
3600
>
default
[
-
1
]:
defaultDay
=
0
# calculate the number of days till the end of the default shift
else
:
defaultDay
=
math
.
floor
((
default
[
-
1
]
-
hoursToEndFirstDay
.
total_seconds
()
/
3600
)
/
24
)
+
1
if
exceptionDay
==
defaultDay
:
# update the defaultShiftPattern of the node (operator or machine)
# if the exception day has not been modified then delete the previous entry and use the first exception that occurs
if
not
exceptionDay
in
modifiedDefaultDays
:
defaultShiftPattern
[
node
][
index2
]
=
exception
# otherwise append it at the end
else
:
defaultShiftPattern
[
node
].
append
(
exception
)
modifiedDefaultDays
.
append
(
exceptionDay
)
# the day has been modified, add to the modified days
break
# update the interruptions of the nodes that have a defaultShiftPattern
if
node
in
defaultShiftPattern
:
# sort the shift pattern of every node
...
...
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