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
430193dd
Commit
430193dd
authored
Apr 08, 2015
by
panos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugs fixed in these scripts
parent
aaa22fc4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
17 deletions
+17
-17
dream/KnowledgeExtraction/PilotCases/CapacityStations/CapacityStationsInterface.py
.../PilotCases/CapacityStations/CapacityStationsInterface.py
+4
-4
dream/KnowledgeExtraction/PilotCases/CapacityStations/WorkplanExtraction.py
...raction/PilotCases/CapacityStations/WorkplanExtraction.py
+13
-13
No files found.
dream/KnowledgeExtraction/PilotCases/CapacityStations/CapacityStationsInterface.py
View file @
430193dd
...
...
@@ -24,7 +24,7 @@ Created on 20 March 2015
import
Tkinter
as
tk
from
Tkinter
import
*
import
ImportDatabase
from
dream.KnowledgeExtraction.ImportDatabase
import
ConnectionData
import
tkMessageBox
from
datetime
import
datetime
...
...
@@ -120,7 +120,7 @@ class Demo1(Frame):
return
def
checkInsertedProject
(
self
):
cnxn
=
ImportDatabase
.
ConnectionData
(
seekName
=
'ServerData'
,
file_path
=
'C:
\
Use
r
s
\
P
a
nos
\
Docume
n
ts
\
DB_App
r
oach
\
C
a
pacityStations'
,
implicitExt
=
'txt'
,
number_of_cursors
=
6
)
cnxn
=
ConnectionData
(
seekName
=
'ServerData'
,
file_path
=
'C:
\
Use
r
s
\
P
a
nos
\
Docume
n
ts
\
DB_App
r
oach
\
C
a
pacityStations'
,
implicitExt
=
'txt'
,
number_of_cursors
=
6
)
cursor
=
cnxn
.
getCursors
()
a
=
cursor
[
0
].
execute
(
"""
...
...
@@ -138,7 +138,7 @@ class Demo1(Frame):
return
availableProject
def
alreadyInsertedWP
(
self
):
cnxn
=
ImportDatabase
.
ConnectionData
(
seekName
=
'ServerData'
,
file_path
=
'C:
\
Use
r
s
\
P
a
nos
\
Docume
n
ts
\
DB_App
r
oach
\
C
a
pacityStations'
,
implicitExt
=
'txt'
,
number_of_cursors
=
6
)
cnxn
=
ConnectionData
(
seekName
=
'ServerData'
,
file_path
=
'C:
\
Use
r
s
\
P
a
nos
\
Docume
n
ts
\
DB_App
r
oach
\
C
a
pacityStations'
,
implicitExt
=
'txt'
,
number_of_cursors
=
6
)
cursor
=
cnxn
.
getCursors
()
c
=
cursor
[
0
].
execute
(
"""
...
...
@@ -156,7 +156,7 @@ class Demo1(Frame):
def
updateDatabase
(
self
):
cnxn
=
ImportDatabase
.
ConnectionData
(
seekName
=
'ServerData'
,
file_path
=
'C:
\
Use
r
s
\
P
a
nos
\
Docume
n
ts
\
DB_App
r
oach
\
C
a
pacityStations'
,
implicitExt
=
'txt'
,
number_of_cursors
=
13
)
cnxn
=
ConnectionData
(
seekName
=
'ServerData'
,
file_path
=
'C:
\
Use
r
s
\
P
a
nos
\
Docume
n
ts
\
DB_App
r
oach
\
C
a
pacityStations'
,
implicitExt
=
'txt'
,
number_of_cursors
=
13
)
cursor
=
cnxn
.
getCursors
()
if
self
.
checkBoxVal2
.
get
():
...
...
dream/KnowledgeExtraction/PilotCases/CapacityStations/WorkplanExtraction.py
View file @
430193dd
...
...
@@ -20,7 +20,7 @@
import
xlrd
import
datetime
import
os
import
ImportDatabase
from
dream.KnowledgeExtraction.ImportDatabase
import
ConnectionData
#Static variables that hold the column's number in Workplan (Excel document - template)
WPColumn
=
11
OrderColumn
=
0
...
...
@@ -72,7 +72,7 @@ os.chdir(folder_path)
#create a list that hold the already inserted orders
alreadyInserted
=
[]
#use of the KE tool object to connect to database
cnxn
=
ImportDatabase
.
ConnectionData
(
seekName
=
'ServerData'
,
implicitExt
=
'txt'
,
number_of_cursors
=
6
)
cnxn
=
ConnectionData
(
seekName
=
'ServerData'
,
implicitExt
=
'txt'
,
number_of_cursors
=
6
)
cursor
=
cnxn
.
getCursors
()
#loop that searches the files in the given directory
for
fileName
in
os
.
listdir
(
"."
):
...
...
@@ -118,7 +118,7 @@ for fileName in os.listdir("."):
else
:
#follows the logic of the if part
check_order
=
cursor
[
3
].
execute
(
"""
check_order
=
cursor
[
0
].
execute
(
"""
select Order_id, ProjectName, Customer, Order_date, Due_date,FloorSpaceRequired
from orders
"""
)
...
...
@@ -127,30 +127,30 @@ for fileName in os.listdir("."):
ind1
=
check_order
.
fetchone
()
dataExtraction
(
fileName
)
for
i
in
range
(
4
,
Main
.
nrows
):
orderId
=
Main
.
cell
(
4
,
OrderColumn
).
value
orderId
=
Main
.
cell
(
4
,
OrderColumn
).
value
projectName
=
Main
.
cell
(
4
,
ProjectColumn
).
value
#check the existence of orderId
if
not
orderId
in
ind1
.
Order_id
:
add_order
=
(
"INSERT INTO orders(`id`, `Order_id`, `ProjectName`, `Customer`, `Order_date`, `Due_date`, `FloorSpaceRequired`, `Status`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
)
cursor
[
3
].
execute
(
"SELECT MAX(id)+1 AS ID from orders"
)
cursor
[
2
].
execute
(
"SELECT MAX(id)+1 AS ID from orders"
)
row
=
cursor
[
3
].
fetchone
()
row
=
cursor
[
2
].
fetchone
()
order_ref
=
row
.
ID
status
=
'accepted'
cursor
[
3
].
execute
(
add_order
,
(
order_ref
,
orderId
,
projectName
,
workplan
[
orderId
][
projectName
][
0
],
workplan
[
orderId
][
projectName
][
1
],
workplan
[
orderId
][
projectName
][
2
],
workplan
[
orderId
][
projectName
][
3
],
status
))
cursor
[
3
].
commit
()
cursor
[
2
].
execute
(
add_order
,
(
order_ref
,
orderId
,
projectName
,
workplan
[
orderId
][
projectName
][
0
],
workplan
[
orderId
][
projectName
][
1
],
workplan
[
orderId
][
projectName
][
2
],
workplan
[
orderId
][
projectName
][
3
],
status
))
cursor
[
2
].
commit
()
add_sequence
=
(
"INSERT INTO sequence(`seq_id`, `WP_id`, `Order_id`, `PartCode`, `PartName`, `Operation_Name`, `CapacityRequirement`, `EarliestStart`) VALUES (?, ?, ?, ?, ?, ?, ?, ?) "
)
cursor
[
4
].
execute
(
"SELECT MAX(seq_id)+1 AS ID from sequence"
)
row
=
cursor
[
4
].
fetchone
()
cursor
[
5
].
execute
(
"SELECT MAX(seq_id)+1 AS ID from sequence"
)
row
=
cursor
[
5
].
fetchone
()
seq_ref
=
row
.
ID
for
i
in
range
(
4
,
Main
.
nrows
):
wpId
=
Main
.
cell
(
i
,
WPColumn
).
value
cursor
[
4
].
execute
(
add_sequence
,
(
seq_ref
,
wpId
,
orderId
,
workplan
[
orderId
][
wpId
][
0
],
workplan
[
orderId
][
wpId
][
1
],
workplan
[
orderId
][
wpId
][
2
],
workplan
[
orderId
][
wpId
][
3
],
workplan
[
orderId
][
wpId
][
4
]))
cursor
[
4
].
commit
()
cursor
[
5
].
execute
(
add_sequence
,
(
seq_ref
,
wpId
,
orderId
,
workplan
[
orderId
][
wpId
][
0
],
workplan
[
orderId
][
wpId
][
1
],
workplan
[
orderId
][
wpId
][
2
],
workplan
[
orderId
][
wpId
][
3
],
workplan
[
orderId
][
wpId
][
4
]))
cursor
[
5
].
commit
()
seq_ref
+=
1
else
:
continue
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