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
d9629fc7
Commit
d9629fc7
authored
Jul 09, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
job-shop plugin to change decimal operators for proc times if they are given in commas
parent
cc353e3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
dream/plugins/JobShop/ChangeDecimalOperators.py
dream/plugins/JobShop/ChangeDecimalOperators.py
+38
-0
No files found.
dream/plugins/JobShop/ChangeDecimalOperators.py
0 → 100644
View file @
d9629fc7
from
copy
import
copy
import
json
import
time
import
random
import
operator
from
datetime
import
datetime
from
dream.plugins
import
plugin
class
ChangeDecimalOperators
(
plugin
.
InputPreparationPlugin
):
""" Input preparation
if times are given with ',' as decimal operator this plugin replaces them to '.'
"""
def
preprocess
(
self
,
data
):
""" replace ',' to '.' in the processing times of workplan spreadsheet
"""
self
.
data
=
copy
(
data
)
orders
=
self
.
data
[
"input"
].
get
(
"BOM"
,{}).
get
(
"productionOrders"
,{})
WPdata
=
data
[
"input"
].
get
(
"workplan_spreadsheet"
,[])
# processing time is in column 7. But read it if this changes
i
=
0
procTimeColumn
=
7
for
record
in
WPdata
[
0
]:
if
"Processing"
in
record
:
procTimeColumn
=
i
break
i
+=
1
# replace ',' to '.' for every entry
for
row
in
WPdata
:
if
row
[
procTimeColumn
]:
row
[
procTimeColumn
]
=
str
(
row
[
procTimeColumn
])
row
[
procTimeColumn
]
=
row
[
procTimeColumn
].
replace
(
','
,
'.'
)
return
data
if
__name__
==
'__main__'
:
pass
\ 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