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
4ef0f3de
Commit
4ef0f3de
authored
Feb 24, 2015
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dueDate and orderDate transformed to simulation time
parent
6cf8ee24
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
8 deletions
+23
-8
dream/plugins/ReadJSOrders.py
dream/plugins/ReadJSOrders.py
+23
-8
No files found.
dream/plugins/ReadJSOrders.py
View file @
4ef0f3de
...
@@ -3,12 +3,13 @@ import json
...
@@ -3,12 +3,13 @@ import json
import
time
import
time
import
random
import
random
import
operator
import
operator
from
datetime
import
datetime
import
datetime
import
copy
import
copy
from
dream.plugins
import
plugin
from
dream.plugins
import
plugin
from
dream.plugins.TimeSupport
import
TimeSupportMixin
class
ReadJSOrders
(
plugin
.
InputPreparationPlugin
):
class
ReadJSOrders
(
plugin
.
InputPreparationPlugin
,
TimeSupportMixin
):
""" Input preparation
""" Input preparation
reads the production orders from the corresponding spreadsheet
reads the production orders from the corresponding spreadsheet
"""
"""
...
@@ -16,12 +17,22 @@ class ReadJSOrders(plugin.InputPreparationPlugin):
...
@@ -16,12 +17,22 @@ class ReadJSOrders(plugin.InputPreparationPlugin):
def
preprocess
(
self
,
data
):
def
preprocess
(
self
,
data
):
""" inserts the retrieved production orders to the BOM echelon
""" inserts the retrieved production orders to the BOM echelon
"""
"""
strptime
=
datetime
.
datetime
.
strptime
# read the current date and define dateFormat from it
try
:
now
=
strptime
(
data
[
'general'
][
'currentDate'
],
'%Y/%m/%d %H:%M'
)
data
[
'general'
][
'dateFormat'
]
=
'%Y/%m/%d %H:%M'
except
ValueError
:
now
=
strptime
(
data
[
'general'
][
'currentDate'
],
'%Y/%m/%d'
)
data
[
'general'
][
'dateFormat'
]
=
'%Y/%m/%d'
self
.
initializeTimeSupport
(
data
)
POdata
=
data
[
"input"
].
get
(
"production_orders_spreadsheet"
,[])
POdata
=
data
[
"input"
].
get
(
"production_orders_spreadsheet"
,[])
productionOrders
=
[]
productionOrders
=
[]
BOM
=
data
[
"input"
].
get
(
"BOM"
,{})
BOM
=
data
[
"input"
].
get
(
"BOM"
,{})
if
not
BOM
:
if
not
BOM
:
BOM
=
data
[
"input"
][
"BOM"
]
=
{}
BOM
=
data
[
"input"
][
"BOM"
]
=
{}
data
[
"input"
][
"BOM"
][
"
o
rders"
]
=
productionOrders
data
[
"input"
][
"BOM"
][
"
productionO
rders"
]
=
productionOrders
if
POdata
:
if
POdata
:
POdata
.
pop
(
0
)
# pop the column names
POdata
.
pop
(
0
)
# pop the column names
for
order
in
POdata
:
for
order
in
POdata
:
...
@@ -30,18 +41,22 @@ class ReadJSOrders(plugin.InputPreparationPlugin):
...
@@ -30,18 +41,22 @@ class ReadJSOrders(plugin.InputPreparationPlugin):
continue
continue
customer
=
order
[
1
]
customer
=
order
[
1
]
project
=
order
[
2
]
project
=
order
[
2
]
orderDate
=
order
[
3
]
# orderDate = order[3]
dueDate
=
order
[
4
]
# XXX hardcoded time
orderDate
=
self
.
convertToSimulationTime
(
strptime
(
"%s %s"
%
(
order
[
3
],
"00:00"
),
'%Y/%m/%d %H:%M'
))
# dueDate = order[4]
# XXX hardcoded time
dueDate
=
self
.
convertToSimulationTime
(
strptime
(
"%s %s"
%
(
order
[
4
],
"00:00"
),
'%Y/%m/%d %H:%M'
))
priority
=
order
[
5
]
priority
=
order
[
5
]
manager
=
order
[
6
]
manager
=
order
[
6
]
productionOrders
.
append
({
productionOrders
.
append
({
"orderID"
:
orderID
,
"_class"
:
"Dream.Order"
,
# hard coded value for the class
"orderName"
:
project
,
"id"
:
orderID
,
"name"
:
project
,
"customer"
:
customer
,
"customer"
:
customer
,
"orderDate"
:
orderDate
,
"orderDate"
:
orderDate
,
"dueDate"
:
dueDate
,
"dueDate"
:
dueDate
,
"priority"
:
priority
,
"priority"
:
priority
,
"manager"
:
manager
"manager"
:
manager
})
})
return
data
return
data
\ No newline at end of file
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