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
e3ede773
Commit
e3ede773
authored
Apr 08, 2015
by
panos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Data Extraction script updated -- running version
parent
eb3e6b15
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
20 deletions
+16
-20
dream/KnowledgeExtraction/PilotCases/JobShop/DataExtraction.py
.../KnowledgeExtraction/PilotCases/JobShop/DataExtraction.py
+16
-20
No files found.
dream/KnowledgeExtraction/PilotCases/JobShop/DataExtraction.py
View file @
e3ede773
...
...
@@ -84,11 +84,12 @@ def DataExtraction(DBFilePath):
component
=
{}
# and get the next row
ind1
=
c
.
fetchone
()
nam
e
=
ind1
.
PartName
component
[
'
name'
]
=
nam
e
typ
e
=
ind1
.
PartName
component
[
'
componentType'
]
=
typ
e
code
=
ind1
.
PartCode
WP
=
ind1
.
WP_id
component
[
'id'
]
=
code
component
[
'name'
]
=
code
component
[
'route'
]
=
[]
#SQL query that extracts data from sequence table where PartCode is given
d
=
cursor
[
3
].
execute
(
"""
...
...
@@ -115,11 +116,14 @@ def DataExtraction(DBFilePath):
step
[
'quantity'
]
=
ind2
.
Quantity
step
[
'completed'
]
=
ind2
.
Completed
ind3
=
f
.
fetchone
()
partsNeeded
=
ind3
.
PartsNeeded
.
split
(
';'
)
partsNeeded
=
ind3
.
PartsNeeded
.
replace
(
" "
,
""
).
split
(
';'
)
for
part
in
partsNeeded
:
if
part
==
''
:
partsNeeded
.
remove
(
part
)
step
[
'requiredParts'
]
=
partsNeeded
step
[
'processingTime'
]
=
{}
step
[
'processingTime'
][
'
distribution'
]
=
'Fixed'
step
[
'processingTime'
][
'mean'
]
=
ind2
.
ProcessingTime
step
[
'processingTime'
][
'
Fixed'
]
=
{}
step
[
'processingTime'
][
'
Fixed'
][
'
mean'
]
=
ind2
.
ProcessingTime
component
[
'route'
].
append
(
step
)
#The following checks if the component ids have been inserted to appended
if
not
component
[
'id'
]
in
appended
:
...
...
@@ -137,25 +141,17 @@ def DataExtraction(DBFilePath):
ind3
=
e
.
fetchone
()
for
t
in
appended
:
if
ind3
.
TIMEOUT
:
remTime
=
0
else
:
#calculate the time difference between the TIMEIN and the moment the user wants to run the simulation (e.g. datetime.now())
timeDelta
=
datetime
.
now
()
-
ind3
.
TIMEIN
timeDiff
=
timeDelta
.
total_seconds
()
/
3600
#calculate the remaining time the part needs to be processed
remTime
=
round
((
ind3
.
ProcessingTime
-
timeDiff
),
2
)
data
[
'WIP'
][
code
]
=
{}
data
[
'WIP'
][
code
][
'station'
]
=
ind3
.
MachineName
data
[
'WIP'
][
code
][
'operator'
]
=
ind3
.
PersonnelCode
data
[
'WIP'
][
code
][
'task_id'
]
=
ind3
.
WP_id
data
[
'WIP'
][
code
][
'sequence'
]
=
ind3
.
step
data
[
'WIP'
][
code
][
'remainingProcessingTime'
]
=
remTime
timeIn
=
datetime
.
strptime
(
str
(
ind3
.
TIMEIN
),
'%Y-%m-%d %H:%M:%S'
)
data
[
'WIP'
][
code
][
'timeIn'
]
=
str
(
timeIn
)
timeOut
=
datetime
.
strptime
(
str
(
ind3
.
TIMEOUT
),
'%Y-%m-%d %H:%M:%S'
)
data
[
'WIP'
][
code
][
'timeOut'
]
=
str
(
timeOut
)
#in case the status is 'finished' continue to the next order
elif
status
==
'finished'
:
continue
data
[
'productionOrders'
].
append
(
productionOrders
.
copy
())
# print data
return
data
\ No newline at end of file
DataExtraction
(
"C:
\
Use
r
s
\
P
a
nos
\
Docume
n
ts
\
DB_App
r
oach
\
Jo
b
Shop"
)
\ 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