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
0d0b517a
Commit
0d0b517a
authored
Aug 21, 2015
by
panos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A bug fixed in this script
parent
2db09441
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
dream/KnowledgeExtraction/PilotCases/JobShop/DateTimeConvert.py
...KnowledgeExtraction/PilotCases/JobShop/DateTimeConvert.py
+4
-5
No files found.
dream/KnowledgeExtraction/PilotCases/JobShop/DateTimeConvert.py
View file @
0d0b517a
...
@@ -39,13 +39,13 @@ class DateTimeConvert(plugin.InputPreparationPlugin, TimeSupportMixin):
...
@@ -39,13 +39,13 @@ class DateTimeConvert(plugin.InputPreparationPlugin, TimeSupportMixin):
timeIn
=
entity
.
pop
(
'timeIn'
,
'NA'
)
timeIn
=
entity
.
pop
(
'timeIn'
,
'NA'
)
if
not
timeIn
==
'NA'
:
if
not
timeIn
==
'NA'
:
timeIn
=
strptime
(
timeIn
,
'%Y-%m-%d %H:%M:%S'
)
timeIn
=
strptime
(
timeIn
,
'%Y-%m-%d %H:%M:%S'
)
print
timeIn
if
timeOut
:
if
timeOut
:
entity
[
'remainingProcessingTime'
]
=
0
entity
[
'remainingProcessingTime'
]
=
0
else
:
else
:
#calculate the time difference between the TIMEIN and the moment the user wants to run the simulation (e.g. datetime.now())
#calculate the time difference between the TIMEIN and the moment the user wants to run the simulation (e.g. datetime.now())
print
type
(
now
)
print
type
(
timeIn
)
timeDelta
=
now
-
timeIn
timeDelta
=
now
-
timeIn
print
timeDelta
if
self
.
timeUnit
==
'second'
:
if
self
.
timeUnit
==
'second'
:
timeDiff
=
timeDelta
.
total_seconds
()
#24 * 60 * 60
timeDiff
=
timeDelta
.
total_seconds
()
#24 * 60 * 60
elif
self
.
timeUnit
==
'minute'
:
elif
self
.
timeUnit
==
'minute'
:
...
@@ -62,7 +62,7 @@ class DateTimeConvert(plugin.InputPreparationPlugin, TimeSupportMixin):
...
@@ -62,7 +62,7 @@ class DateTimeConvert(plugin.InputPreparationPlugin, TimeSupportMixin):
timeDiff
=
timeDelta
.
total_seconds
()
/
(
60
*
60
*
24
*
7
*
30
*
360
)
#1 / 360.
timeDiff
=
timeDelta
.
total_seconds
()
/
(
60
*
60
*
24
*
7
*
30
*
360
)
#1 / 360.
else
:
else
:
raise
ValueError
(
"Unsupported time unit %s"
%
self
.
timeUnit
)
raise
ValueError
(
"Unsupported time unit %s"
%
self
.
timeUnit
)
print
timeDiff
for
order
in
orders
:
for
order
in
orders
:
comps
=
order
.
get
(
'componentsList'
,
[])
comps
=
order
.
get
(
'componentsList'
,
[])
for
comp
in
comps
:
for
comp
in
comps
:
...
@@ -70,14 +70,13 @@ class DateTimeConvert(plugin.InputPreparationPlugin, TimeSupportMixin):
...
@@ -70,14 +70,13 @@ class DateTimeConvert(plugin.InputPreparationPlugin, TimeSupportMixin):
for
step
in
comp
.
get
(
'route'
,
[]):
for
step
in
comp
.
get
(
'route'
,
[]):
if
step
.
get
(
'task_id'
,
None
)
==
task_id
:
if
step
.
get
(
'task_id'
,
None
)
==
task_id
:
proc_time
=
step
.
get
(
'processingTime'
,
{}).
get
(
'Fixed'
,{}).
get
(
'mean'
,
0
)
proc_time
=
step
.
get
(
'processingTime'
,
{}).
get
(
'Fixed'
,{}).
get
(
'mean'
,
0
)
print
proc_time
break
break
if
proc_time
:
if
proc_time
:
break
break
if
proc_time
:
if
proc_time
:
break
break
#calculate the remaining time the part needs to be processed
#calculate the remaining time the part needs to be processed
entity
[
'remainingProcessingTime'
]
=
round
((
proc_time
-
timeDiff
),
2
)
entity
[
'remainingProcessingTime'
]
=
max
([
round
((
proc_time
-
timeDiff
),
2
),
0.1
]
)
for
order
in
orders
:
for
order
in
orders
:
orderDate
=
order
.
get
(
'orderDate'
,
None
)
orderDate
=
order
.
get
(
'orderDate'
,
None
)
...
...
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