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
Hide 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):
...
@@ -84,11 +84,12 @@ def DataExtraction(DBFilePath):
component
=
{}
component
=
{}
# and get the next row
# and get the next row
ind1
=
c
.
fetchone
()
ind1
=
c
.
fetchone
()
nam
e
=
ind1
.
PartName
typ
e
=
ind1
.
PartName
component
[
'
name'
]
=
nam
e
component
[
'
componentType'
]
=
typ
e
code
=
ind1
.
PartCode
code
=
ind1
.
PartCode
WP
=
ind1
.
WP_id
WP
=
ind1
.
WP_id
component
[
'id'
]
=
code
component
[
'id'
]
=
code
component
[
'name'
]
=
code
component
[
'route'
]
=
[]
component
[
'route'
]
=
[]
#SQL query that extracts data from sequence table where PartCode is given
#SQL query that extracts data from sequence table where PartCode is given
d
=
cursor
[
3
].
execute
(
"""
d
=
cursor
[
3
].
execute
(
"""
...
@@ -115,11 +116,14 @@ def DataExtraction(DBFilePath):
...
@@ -115,11 +116,14 @@ def DataExtraction(DBFilePath):
step
[
'quantity'
]
=
ind2
.
Quantity
step
[
'quantity'
]
=
ind2
.
Quantity
step
[
'completed'
]
=
ind2
.
Completed
step
[
'completed'
]
=
ind2
.
Completed
ind3
=
f
.
fetchone
()
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
[
'requiredParts'
]
=
partsNeeded
step
[
'processingTime'
]
=
{}
step
[
'processingTime'
]
=
{}
step
[
'processingTime'
][
'
distribution'
]
=
'Fixed'
step
[
'processingTime'
][
'
Fixed'
]
=
{}
step
[
'processingTime'
][
'mean'
]
=
ind2
.
ProcessingTime
step
[
'processingTime'
][
'
Fixed'
][
'
mean'
]
=
ind2
.
ProcessingTime
component
[
'route'
].
append
(
step
)
component
[
'route'
].
append
(
step
)
#The following checks if the component ids have been inserted to appended
#The following checks if the component ids have been inserted to appended
if
not
component
[
'id'
]
in
appended
:
if
not
component
[
'id'
]
in
appended
:
...
@@ -136,26 +140,18 @@ def DataExtraction(DBFilePath):
...
@@ -136,26 +140,18 @@ def DataExtraction(DBFilePath):
for
x
in
range
(
e
.
rowcount
):
for
x
in
range
(
e
.
rowcount
):
ind3
=
e
.
fetchone
()
ind3
=
e
.
fetchone
()
for
t
in
appended
:
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
]
=
{}
data
[
'WIP'
][
code
][
'station'
]
=
ind3
.
MachineName
data
[
'WIP'
][
code
][
'station'
]
=
ind3
.
MachineName
data
[
'WIP'
][
code
][
'operator'
]
=
ind3
.
PersonnelCode
data
[
'WIP'
][
code
][
'operator'
]
=
ind3
.
PersonnelCode
data
[
'WIP'
][
code
][
'task_id'
]
=
ind3
.
WP_id
data
[
'WIP'
][
code
][
'task_id'
]
=
ind3
.
WP_id
data
[
'WIP'
][
code
][
'sequence'
]
=
ind3
.
step
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
#in case the status is 'finished' continue to the next order
elif
status
==
'finished'
:
elif
status
==
'finished'
:
continue
continue
data
[
'productionOrders'
].
append
(
productionOrders
.
copy
())
data
[
'productionOrders'
].
append
(
productionOrders
.
copy
())
# print data
return
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