개정판 0e455b69
dev issue #627: edit equipment data list
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
1816 | 1816 |
@author humkyung |
1817 | 1817 |
@date 2018.05.03 |
1818 | 1818 |
''' |
1819 |
def getEquipmentItemNo(self): |
|
1820 |
from EquipmentData import EquipmentData |
|
1821 | ||
1822 |
if not self.equipmentDataList: |
|
1823 |
try: |
|
1824 |
# Creates or opens a file called mydb with a SQLite3 DB |
|
1825 |
dbPath = os.path.join(self.getCurrentProject().getDbFilePath(), 'ITI_PID.db') |
|
1826 |
conn = sqlite3.connect(dbPath) |
|
1827 |
# Get a cursor object |
|
1828 |
cursor = conn.cursor() |
|
1829 | ||
1830 |
sql = 'select ITEM_NO from EQUIPMENT_DATA_LIST' |
|
1831 |
cursor.execute(sql) |
|
1832 |
rows = cursor.fetchall() |
|
1833 |
for row in rows: |
|
1834 |
data = EquipmentData(row[0]) |
|
1835 |
self.equipmentDataList.append(data) |
|
1836 |
# Catch the exception |
|
1837 |
except Exception as ex: |
|
1838 |
# Roll back any change if something goes wrong |
|
1839 |
conn.rollback() |
|
1840 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
|
1841 |
finally: |
|
1842 |
# Close the db connection |
|
1843 |
conn.close() |
|
1844 | ||
1845 |
return self.equipmentDataList |
|
1846 | ||
1847 |
''' |
|
1848 |
@brief get equipment data list |
|
1849 |
@author humkyung |
|
1850 |
@date 2018.05.03 |
|
1851 |
''' |
|
1852 | 1819 |
def getEquipmentDataList(self, docName = None): |
1853 | 1820 |
if not self.equipmentDataList: |
1854 | 1821 |
try: |
... | ... | |
1865 | 1832 |
cursor.execute(sql) |
1866 | 1833 |
rows = cursor.fetchall() |
1867 | 1834 |
for row in rows: |
1868 |
self.equipmentDataList.append(row[0]) |
|
1835 |
data = [] |
|
1836 |
for index in range(len(cursor.description)): |
|
1837 |
data.append(row[index]) |
|
1838 |
self.equipmentDataList.append(data) |
|
1869 | 1839 |
# Catch the exception |
1870 | 1840 |
except Exception as ex: |
1871 | 1841 |
# Roll back any change if something goes wrong |
내보내기 Unified diff